Go to the documentation of this file.
112 #if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN)
113 #error "DATA_ORDER must be defined!"
117 #error "HASH_CBLOCK must be defined!"
120 #error "HASH_LONG must be defined!"
123 #error "HASH_CTX must be defined!"
127 #error "HASH_UPDATE must be defined!"
129 #ifndef HASH_TRANSFORM
130 #error "HASH_TRANSFORM must be defined!"
133 #error "HASH_FINAL must be defined!"
136 #ifndef HASH_BLOCK_DATA_ORDER
137 #error "HASH_BLOCK_DATA_ORDER must be defined!"
145 # if defined(_MSC_VER) || defined(__ICC)
146 # define ROTATE(a,n) _lrotl(a,n)
147 # elif defined(__MWERKS__)
148 # if defined(__POWERPC__)
149 # define ROTATE(a,n) __rlwinm(a,n,0,31)
150 # elif defined(__MC68K__)
152 # define ROTATE(a,n) ( n<24 ? __rol(a,n) : __ror(a,32-n) )
154 # define ROTATE(a,n) __rol(a,n)
156 # elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
163 # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
164 # define ROTATE(a,n) ({ register unsigned int ret; \
168 : "I"(n), "0"((unsigned int)(a)) \
172 # elif defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
173 defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__)
174 # define ROTATE(a,n) ({ register unsigned int ret; \
176 "rlwinm %0,%1,%2,0,31" \
181 # elif defined(__s390x__)
182 # define ROTATE(a,n) ({ register unsigned int ret; \
183 asm ("rll %0,%1,%2" \
193 #define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
196 #if defined(DATA_ORDER_IS_BIG_ENDIAN)
199 # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
200 # if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \
201 (defined(__x86_64) || defined(__x86_64__))
202 # if !defined(B_ENDIAN)
209 # define HOST_c2l(c,l) ({ unsigned int r=*((const unsigned int *)(c)); \
210 asm ("bswapl %0":"=r"(r):"0"(r)); \
212 # define HOST_l2c(l,c) ({ unsigned int r=(l); \
213 asm ("bswapl %0":"=r"(r):"0"(r)); \
214 *((unsigned int *)(c))=r; (c)+=4; r; })
219 #if defined(__s390__) || defined(__s390x__)
220 # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l))
221 # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l))
225 #define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
226 l|=(((unsigned long)(*((c)++)))<<16), \
227 l|=(((unsigned long)(*((c)++)))<< 8), \
228 l|=(((unsigned long)(*((c)++))) ), \
232 #define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \
233 *((c)++)=(unsigned char)(((l)>>16)&0xff), \
234 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
235 *((c)++)=(unsigned char)(((l) )&0xff), \
239 #elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
242 # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
243 # if defined(__s390x__)
244 # define HOST_c2l(c,l) ({ asm ("lrv %0,%1" \
245 :"=d"(l) :"m"(*(const unsigned int *)(c)));\
247 # define HOST_l2c(l,c) ({ asm ("strv %1,%0" \
248 :"=m"(*(unsigned int *)(c)) :"d"(l));\
253 #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
256 # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l)
257 # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l)
262 #define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \
263 l|=(((unsigned long)(*((c)++)))<< 8), \
264 l|=(((unsigned long)(*((c)++)))<<16), \
265 l|=(((unsigned long)(*((c)++)))<<24), \
269 #define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
270 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
271 *((c)++)=(unsigned char)(((l)>>16)&0xff), \
272 *((c)++)=(unsigned char)(((l)>>24)&0xff), \
284 const unsigned char *
data=data_;
289 if (len==0)
return 1;
291 l=(c->Nl+(((
HASH_LONG)len)<<3))&0xffffffffUL;
302 p=(
unsigned char *)c->data;
316 memcpy (p+n,data,len);
317 c->num += (
unsigned int)len;
333 p = (
unsigned char *)c->data;
334 c->num = (
unsigned int)
len;
349 unsigned char *
p = (
unsigned char *)c->data;
364 #if defined(DATA_ORDER_IS_BIG_ENDIAN)
365 (
void)HOST_l2c(c->Nh,p);
366 (
void)HOST_l2c(c->Nl,p);
367 #elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
368 (
void)HOST_l2c(c->Nl,p);
369 (
void)HOST_l2c(c->Nh,p);
376 #ifndef HASH_MAKE_STRING
377 #error "HASH_MAKE_STRING must be defined!"
386 #if defined(__alpha) || defined(__sparcv9) || defined(__mips)
387 #define MD32_REG_T long
413 #define MD32_REG_T int