diff options
Diffstat (limited to 'src/lib/libcrypto/rc5')
-rw-r--r-- | src/lib/libcrypto/rc5/rc5_locl.h | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/src/lib/libcrypto/rc5/rc5_locl.h b/src/lib/libcrypto/rc5/rc5_locl.h index 07671decaa..d4e0d30eca 100644 --- a/src/lib/libcrypto/rc5/rc5_locl.h +++ b/src/lib/libcrypto/rc5/rc5_locl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rc5_locl.h,v 1.5 2014/07/10 22:45:57 jsing Exp $ */ | 1 | /* $OpenBSD: rc5_locl.h,v 1.6 2014/08/18 19:15:34 bcook Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -56,6 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <stdint.h> | ||
59 | #include <stdlib.h> | 60 | #include <stdlib.h> |
60 | 61 | ||
61 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
@@ -148,30 +149,17 @@ | |||
148 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | 149 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ |
149 | *((c)++)=(unsigned char)(((l) )&0xff)) | 150 | *((c)++)=(unsigned char)(((l) )&0xff)) |
150 | 151 | ||
151 | #if defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | 152 | static inline uint32_t ROTATE_l32(uint32_t a, uint32_t n) |
152 | # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) | 153 | { |
153 | # define ROTATE_l32(a,n) ({ register unsigned int ret; \ | 154 | uint32_t amt = n & 0x1f; |
154 | asm ("roll %%cl,%0" \ | 155 | return (a << amt) | (a >> (32 - amt)); |
155 | : "=r"(ret) \ | 156 | } |
156 | : "c"(n),"0"((unsigned int)(a)) \ | 157 | |
157 | : "cc"); \ | 158 | static inline uint32_t ROTATE_r32(uint32_t a, uint32_t n) |
158 | ret; \ | 159 | { |
159 | }) | 160 | uint32_t amt = n & 0x1f; |
160 | # define ROTATE_r32(a,n) ({ register unsigned int ret; \ | 161 | return (a << (32 - amt)) | (a >> amt); |
161 | asm ("rorl %%cl,%0" \ | 162 | } |
162 | : "=r"(ret) \ | ||
163 | : "c"(n),"0"((unsigned int)(a)) \ | ||
164 | : "cc"); \ | ||
165 | ret; \ | ||
166 | }) | ||
167 | # endif | ||
168 | #endif | ||
169 | #ifndef ROTATE_l32 | ||
170 | #define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) | ||
171 | #endif | ||
172 | #ifndef ROTATE_r32 | ||
173 | #define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) | ||
174 | #endif | ||
175 | 163 | ||
176 | #define RC5_32_MASK 0xffffffffL | 164 | #define RC5_32_MASK 0xffffffffL |
177 | 165 | ||