0002-don-t-redefine-ALIGN.patch 1.73 KB
From 381a12925143ba4f6910c15ccb1fabb2a7c8c614 Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Sat, 28 Nov 2015 15:54:24 +0100
Subject: don't redefine ALIGN

---
 include/relic_types.h |  9 +++++++--
 src/md/blake2.h       | 10 +++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/relic_types.h b/include/relic_types.h
index afc4870..d9ef4f5 100644
--- a/include/relic_types.h
+++ b/include/relic_types.h
@@ -129,9 +129,14 @@ typedef unsigned long long ull_t;
  * Specification for aligned variables.
  */
 #if ALIGN > 1
-#define align 			__attribute__ ((aligned (ALIGN)))
+#  if defined(_MSC_VER)
+#    define ALIGNME(x) __declspec(align(x))
+#  else
+#    define ALIGNME(x) __attribute__((aligned(x)))
+#  endif
 #else
-#define align 			/* empty*/
+#  define align 			/* empty*/
+#  define ALIGNME(x)          /* empty*/
 #endif
 
 /**
diff --git a/src/md/blake2.h b/src/md/blake2.h
index f8aba83..48e314f 100644
--- a/src/md/blake2.h
+++ b/src/md/blake2.h
@@ -17,11 +17,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#if defined(_MSC_VER)
-#define ALIGN(x) __declspec(align(x))
-#else
-#define ALIGN(x) __attribute__((aligned(x)))
-#endif
+#include "relic_types.h"
 
 #if defined(__cplusplus)
 extern "C" {
@@ -61,7 +57,7 @@ extern "C" {
     uint8_t  personal[BLAKE2S_PERSONALBYTES];  // 32
   } blake2s_param;
 
-  ALIGN( 64 ) typedef struct __blake2s_state
+  ALIGNME( 64 ) typedef struct __blake2s_state
   {
     uint32_t h[8];
     uint32_t t[2];
@@ -86,7 +82,7 @@ extern "C" {
     uint8_t  personal[BLAKE2B_PERSONALBYTES];  // 64
   } blake2b_param;
 
-  ALIGN( 64 ) typedef struct __blake2b_state
+  ALIGNME( 64 ) typedef struct __blake2b_state
   {
     uint64_t h[8];
     uint64_t t[2];
-- 
2.6.2