x509_cmp.c (68651) | x509_cmp.c (76866) |
---|---|
1/* crypto/x509/x509_cmp.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 185 unchanged lines hidden (view full) --- 194 195#ifndef NO_MD5 196/* I now DER encode the name and hash it. Since I cache the DER encoding, 197 * this is reasonably efficient. */ 198unsigned long X509_NAME_hash(X509_NAME *x) 199 { 200 unsigned long ret=0; 201 unsigned char md[16]; | 1/* crypto/x509/x509_cmp.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 185 unchanged lines hidden (view full) --- 194 195#ifndef NO_MD5 196/* I now DER encode the name and hash it. Since I cache the DER encoding, 197 * this is reasonably efficient. */ 198unsigned long X509_NAME_hash(X509_NAME *x) 199 { 200 unsigned long ret=0; 201 unsigned char md[16]; |
202 unsigned char str[256],*p,*pp; 203 int i; | |
204 | 202 |
205 i=i2d_X509_NAME(x,NULL); 206 if (i > sizeof(str)) 207 p=OPENSSL_malloc(i); 208 else 209 p=str; | 203 /* Ensure cached version is up to date */ 204 i2d_X509_NAME(x,NULL); 205 /* Use cached encoding directly rather than copying: this should 206 * keep libsafe happy. 207 */ 208 MD5((unsigned char *)x->bytes->data,x->bytes->length,&(md[0])); |
210 | 209 |
211 pp=p; 212 i2d_X509_NAME(x,&pp); 213 MD5((unsigned char *)p,i,&(md[0])); 214 if (p != str) OPENSSL_free(p); 215 | |
216 ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| 217 ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) 218 )&0xffffffffL; 219 return(ret); 220 } 221#endif 222 223/* Search a stack of X509 for a match */ --- 91 unchanged lines hidden --- | 210 ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| 211 ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) 212 )&0xffffffffL; 213 return(ret); 214 } 215#endif 216 217/* Search a stack of X509 for a match */ --- 91 unchanged lines hidden --- |