View | Details | Raw Unified | Return to bug 198190
Collapse All | Expand All

(-)security/p5-CryptX/files/patch-src__ltc__headerss__tomcrypt_macros.h (+107 lines)
Line 0 Link Here
1
--- src/ltc/headers/tomcrypt_macros.h.orig	2014-01-23 16:45:59.000000000 +0100
2
+++ src/ltc/headers/tomcrypt_macros.h	2015-03-02 20:23:48.396007000 +0100
3
@@ -281,21 +281,19 @@
4
 
5
 #ifndef LTC_NO_ROLC
6
 
7
-static inline ulong32 ROLc(ulong32 word, const int i)
8
-{
9
-   asm ("roll %2,%0"
10
-      :"=r" (word)
11
-      :"0" (word),"I" (i));
12
-   return word;
13
-}
14
-
15
-static inline ulong32 RORc(ulong32 word, const int i)
16
-{
17
-   asm ("rorl %2,%0"
18
-      :"=r" (word)
19
-      :"0" (word),"I" (i));
20
-   return word;
21
-}
22
+#define ROLc(word, i) ({     \
23
+   ulong32 _word = word;     \
24
+   asm ("roll %2,%0"         \
25
+      :"=r" (_word)          \
26
+      :"0" (_word),"I" (i)); \
27
+   _word; })
28
+
29
+#define RORc(word, i) ({     \
30
+   ulong32 _word = word;     \
31
+   asm ("rorl %2,%0"         \
32
+      :"=r" (_word)          \
33
+      :"0" (_word),"I" (i)); \
34
+   _word; })
35
 
36
 #else
37
 
38
@@ -324,21 +322,19 @@
39
 
40
 #ifndef LTC_NO_ROLC
41
 
42
-static inline ulong32 ROLc(ulong32 word, const int i)
43
-{
44
-   asm ("rotlwi %0,%0,%2"
45
-      :"=r" (word)
46
-      :"0" (word),"I" (i));
47
-   return word;
48
-}
49
-
50
-static inline ulong32 RORc(ulong32 word, const int i)
51
-{
52
-   asm ("rotrwi %0,%0,%2"
53
-      :"=r" (word)
54
-      :"0" (word),"I" (i));
55
-   return word;
56
-}
57
+#define ROLc(word, i) ({     \
58
+   ulong32 _word = word;     \
59
+   asm ("rotlwi %0,%0,%2"    \
60
+      :"=r" (_word)          \
61
+      :"0" (_word),"I" (i)); \
62
+   _word; })
63
+
64
+#define RORc(word, i) ({     \
65
+   ulong32 _word = word;     \
66
+   asm ("rotrwi %0,%0,%2"    \
67
+      :"=r" (_word)          \
68
+      :"0" (_word),"I" (i)); \
69
+   _word; })
70
 
71
 #else
72
 
73
@@ -380,21 +376,19 @@
74
 
75
 #ifndef LTC_NO_ROLC
76
 
77
-static inline ulong64 ROL64c(ulong64 word, const int i)
78
-{
79
-   asm("rolq %2,%0"
80
-      :"=r" (word)
81
-      :"0" (word),"J" (i));
82
-   return word;
83
-}
84
-
85
-static inline ulong64 ROR64c(ulong64 word, const int i)
86
-{
87
-   asm("rorq %2,%0"
88
-      :"=r" (word)
89
-      :"0" (word),"J" (i));
90
-   return word;
91
-}
92
+#define ROL64c(word, i) ({     \
93
+   ulong64 _word = word;       \
94
+   asm ("rolq %2,%0"           \
95
+      :"=r" (_word)            \
96
+      :"0" (_word),"J" (i));   \
97
+   _word; })
98
+
99
+#define ROR64c(word, i) ({     \
100
+   ulong64 _word = word;       \
101
+   asm ("rorq %2,%0"           \
102
+      :"=r" (_word)            \
103
+      :"0" (_word),"J" (i));   \
104
+   _word; })
105
 
106
 #else /* LTC_NO_ROLC */
107
 

Return to bug 198190