OLD | NEW |
1 /* crypto/x509/by_dir.c */ | 1 /* crypto/x509/by_dir.c */ |
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 X509_CINF st_x509_cinf; | 280 X509_CINF st_x509_cinf; |
281 } x509; | 281 } x509; |
282 struct { | 282 struct { |
283 X509_CRL st_crl; | 283 X509_CRL st_crl; |
284 X509_CRL_INFO st_crl_info; | 284 X509_CRL_INFO st_crl_info; |
285 } crl; | 285 } crl; |
286 } data; | 286 } data; |
287 int ok=0; | 287 int ok=0; |
288 int i,j,k; | 288 int i,j,k; |
289 unsigned long h; | 289 unsigned long h; |
| 290 unsigned long hash_array[2]; |
| 291 int hash_index; |
290 BUF_MEM *b=NULL; | 292 BUF_MEM *b=NULL; |
291 X509_OBJECT stmp,*tmp; | 293 X509_OBJECT stmp,*tmp; |
292 const char *postfix=""; | 294 const char *postfix=""; |
293 | 295 |
294 if (name == NULL) return(0); | 296 if (name == NULL) return(0); |
295 | 297 |
296 stmp.type=type; | 298 stmp.type=type; |
297 if (type == X509_LU_X509) | 299 if (type == X509_LU_X509) |
298 { | 300 { |
299 data.x509.st_x509.cert_info= &data.x509.st_x509_cinf; | 301 data.x509.st_x509.cert_info= &data.x509.st_x509_cinf; |
(...skipping 15 matching lines...) Expand all Loading... |
315 } | 317 } |
316 | 318 |
317 if ((b=BUF_MEM_new()) == NULL) | 319 if ((b=BUF_MEM_new()) == NULL) |
318 { | 320 { |
319 X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_BUF_LIB); | 321 X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_BUF_LIB); |
320 goto finish; | 322 goto finish; |
321 } | 323 } |
322 | 324 |
323 ctx=(BY_DIR *)xl->method_data; | 325 ctx=(BY_DIR *)xl->method_data; |
324 | 326 |
325 » h=X509_NAME_hash(name); | 327 » hash_array[0]=X509_NAME_hash(name); |
| 328 » hash_array[1]=X509_NAME_hash_old(name); |
| 329 » for (hash_index=0; hash_index < 2; ++hash_index) |
| 330 » » { |
| 331 » » h=hash_array[hash_index]; |
326 for (i=0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) | 332 for (i=0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) |
327 { | 333 { |
328 BY_DIR_ENTRY *ent; | 334 BY_DIR_ENTRY *ent; |
329 int idx; | 335 int idx; |
330 BY_DIR_HASH htmp, *hent; | 336 BY_DIR_HASH htmp, *hent; |
331 ent = sk_BY_DIR_ENTRY_value(ctx->dirs, i); | 337 ent = sk_BY_DIR_ENTRY_value(ctx->dirs, i); |
332 j=strlen(ent->dir)+1+8+6+1+1; | 338 j=strlen(ent->dir)+1+8+6+1+1; |
333 if (!BUF_MEM_grow(b,j)) | 339 if (!BUF_MEM_grow(b,j)) |
334 { | 340 { |
335 X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_MALLOC_FAILURE)
; | 341 X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_MALLOC_FAILURE)
; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 ret->type=tmp->type; | 475 ret->type=tmp->type; |
470 memcpy(&ret->data,&tmp->data,sizeof(ret->data)); | 476 memcpy(&ret->data,&tmp->data,sizeof(ret->data)); |
471 /* If we were going to up the reference count, | 477 /* If we were going to up the reference count, |
472 * we would need to do it on a perl 'type' | 478 * we would need to do it on a perl 'type' |
473 * basis */ | 479 * basis */ |
474 /* CRYPTO_add(&tmp->data.x509->references,1, | 480 /* CRYPTO_add(&tmp->data.x509->references,1, |
475 CRYPTO_LOCK_X509);*/ | 481 CRYPTO_LOCK_X509);*/ |
476 goto finish; | 482 goto finish; |
477 } | 483 } |
478 } | 484 } |
| 485 } |
479 finish: | 486 finish: |
480 if (b != NULL) BUF_MEM_free(b); | 487 if (b != NULL) BUF_MEM_free(b); |
481 return(ok); | 488 return(ok); |
482 } | 489 } |
OLD | NEW |