OLD | NEW |
1 /* crypto/rc5/rc5_locl.h */ | 1 /* crypto/rc5/rc5_locl.h */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 *((c)++)=(unsigned char)(((l) )&0xff)) | 147 *((c)++)=(unsigned char)(((l) )&0xff)) |
148 | 148 |
149 #if (defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)) || defined(__ICC) | 149 #if (defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)) || defined(__ICC) |
150 #define ROTATE_l32(a,n) _lrotl(a,n) | 150 #define ROTATE_l32(a,n) _lrotl(a,n) |
151 #define ROTATE_r32(a,n) _lrotr(a,n) | 151 #define ROTATE_r32(a,n) _lrotr(a,n) |
152 #elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(
OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) | 152 #elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(
OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) |
153 # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_
64__) | 153 # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_
64__) |
154 # define ROTATE_l32(a,n) ({ register unsigned int ret; \ | 154 # define ROTATE_l32(a,n) ({ register unsigned int ret; \ |
155 asm ("roll %%cl,%0" \ | 155 asm ("roll %%cl,%0" \ |
156 : "=r"(ret) \ | 156 : "=r"(ret) \ |
157 » » » » » » : "c"(n),"0"(a)»\ | 157 » » » » » » : "c"(n),"0"((unsigned int)(a))»
\ |
158 : "cc"); \ | 158 : "cc"); \ |
159 ret; \ | 159 ret; \ |
160 }) | 160 }) |
161 # define ROTATE_r32(a,n) ({ register unsigned int ret; \ | 161 # define ROTATE_r32(a,n) ({ register unsigned int ret; \ |
162 asm ("rorl %%cl,%0" \ | 162 asm ("rorl %%cl,%0" \ |
163 : "=r"(ret) \ | 163 : "=r"(ret) \ |
164 » » » » » » : "c"(n),"0"(a)»\ | 164 » » » » » » : "c"(n),"0"((unsigned int)(a))»
\ |
165 : "cc"); \ | 165 : "cc"); \ |
166 ret; \ | 166 ret; \ |
167 }) | 167 }) |
168 # endif | 168 # endif |
169 #endif | 169 #endif |
170 #ifndef ROTATE_l32 | 170 #ifndef ROTATE_l32 |
171 #define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) | 171 #define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) |
172 #endif | 172 #endif |
173 #ifndef ROTATE_r32 | 173 #ifndef ROTATE_r32 |
174 #define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) | 174 #define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) |
(...skipping 23 matching lines...) Expand all Loading... |
198 b&=RC5_32_MASK; \ | 198 b&=RC5_32_MASK; \ |
199 b=ROTATE_r32(b,a); \ | 199 b=ROTATE_r32(b,a); \ |
200 b^=a; \ | 200 b^=a; \ |
201 a-=s[n]; \ | 201 a-=s[n]; \ |
202 a&=RC5_32_MASK; \ | 202 a&=RC5_32_MASK; \ |
203 a=ROTATE_r32(a,b); \ | 203 a=ROTATE_r32(a,b); \ |
204 a^=b; | 204 a^=b; |
205 | 205 |
206 | 206 |
207 | 207 |
OLD | NEW |