Blame view

RIOT/pkg/relic/patches/0002-don-t-redefine-ALIGN.patch 1.73 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  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