diff options
Diffstat (limited to 'src/lib/libcrypto/cryptlib.c')
| -rw-r--r-- | src/lib/libcrypto/cryptlib.c | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 2924def2bb..612b3b93b4 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
| @@ -89,7 +89,6 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] = | |||
| 89 | "ssl_session", | 89 | "ssl_session", |
| 90 | "ssl_sess_cert", | 90 | "ssl_sess_cert", |
| 91 | "ssl", | 91 | "ssl", |
| 92 | "ssl_method", | ||
| 93 | "rand", | 92 | "rand", |
| 94 | "rand2", | 93 | "rand2", |
| 95 | "debug_malloc", | 94 | "debug_malloc", |
| @@ -104,8 +103,7 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] = | |||
| 104 | "dynlock", | 103 | "dynlock", |
| 105 | "engine", | 104 | "engine", |
| 106 | "ui", | 105 | "ui", |
| 107 | "hwcrhk", /* This is a HACK which will disappear in 0.9.8 */ | 106 | #if CRYPTO_NUM_LOCKS != 31 |
| 108 | #if CRYPTO_NUM_LOCKS != 33 | ||
| 109 | # error "Inconsistency between crypto.h and cryptlib.c" | 107 | # error "Inconsistency between crypto.h and cryptlib.c" |
| 110 | #endif | 108 | #endif |
| 111 | }; | 109 | }; |
| @@ -208,18 +206,10 @@ int CRYPTO_get_new_dynlockid(void) | |||
| 208 | i=sk_CRYPTO_dynlock_find(dyn_locks,NULL); | 206 | i=sk_CRYPTO_dynlock_find(dyn_locks,NULL); |
| 209 | /* If there was none, push, thereby creating a new one */ | 207 | /* If there was none, push, thereby creating a new one */ |
| 210 | if (i == -1) | 208 | if (i == -1) |
| 211 | /* Since sk_push() returns the number of items on the | 209 | i=sk_CRYPTO_dynlock_push(dyn_locks,pointer); |
| 212 | stack, not the location of the pushed item, we need | ||
| 213 | to transform the returned number into a position, | ||
| 214 | by decreasing it. */ | ||
| 215 | i=sk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1; | ||
| 216 | else | ||
| 217 | /* If we found a place with a NULL pointer, put our pointer | ||
| 218 | in it. */ | ||
| 219 | sk_CRYPTO_dynlock_set(dyn_locks,i,pointer); | ||
| 220 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | 210 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); |
| 221 | 211 | ||
| 222 | if (i == -1) | 212 | if (!i) |
| 223 | { | 213 | { |
| 224 | dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); | 214 | dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); |
| 225 | OPENSSL_free(pointer); | 215 | OPENSSL_free(pointer); |
| @@ -411,17 +401,15 @@ void CRYPTO_lock(int mode, int type, const char *file, int line) | |||
| 411 | #endif | 401 | #endif |
| 412 | if (type < 0) | 402 | if (type < 0) |
| 413 | { | 403 | { |
| 414 | if (dynlock_lock_callback != NULL) | 404 | struct CRYPTO_dynlock_value *pointer |
| 415 | { | 405 | = CRYPTO_get_dynlock_value(type); |
| 416 | struct CRYPTO_dynlock_value *pointer | ||
| 417 | = CRYPTO_get_dynlock_value(type); | ||
| 418 | |||
| 419 | OPENSSL_assert(pointer != NULL); | ||
| 420 | 406 | ||
| 407 | if (pointer && dynlock_lock_callback) | ||
| 408 | { | ||
| 421 | dynlock_lock_callback(mode, pointer, file, line); | 409 | dynlock_lock_callback(mode, pointer, file, line); |
| 422 | |||
| 423 | CRYPTO_destroy_dynlockid(type); | ||
| 424 | } | 410 | } |
| 411 | |||
| 412 | CRYPTO_destroy_dynlockid(type); | ||
| 425 | } | 413 | } |
| 426 | else | 414 | else |
| 427 | if (locking_callback != NULL) | 415 | if (locking_callback != NULL) |
| @@ -472,7 +460,7 @@ const char *CRYPTO_get_lock_name(int type) | |||
| 472 | return("dynamic"); | 460 | return("dynamic"); |
| 473 | else if (type < CRYPTO_NUM_LOCKS) | 461 | else if (type < CRYPTO_NUM_LOCKS) |
| 474 | return(lock_names[type]); | 462 | return(lock_names[type]); |
| 475 | else if (type-CRYPTO_NUM_LOCKS > sk_num(app_locks)) | 463 | else if (type-CRYPTO_NUM_LOCKS >= sk_num(app_locks)) |
| 476 | return("ERROR"); | 464 | return("ERROR"); |
| 477 | else | 465 | else |
| 478 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); | 466 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); |
| @@ -504,11 +492,3 @@ BOOL WINAPI DLLEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, | |||
| 504 | #endif | 492 | #endif |
| 505 | 493 | ||
| 506 | #endif | 494 | #endif |
| 507 | |||
| 508 | void OpenSSLDie(const char *file,int line,const char *assertion) | ||
| 509 | { | ||
| 510 | fprintf(stderr, | ||
| 511 | "%s(%d): OpenSSL internal error, assertion failed: %s\n", | ||
| 512 | file,line,assertion); | ||
| 513 | abort(); | ||
| 514 | } | ||
