diff options
author | jsing <> | 2024-10-11 12:27:24 +0000 |
---|---|---|
committer | jsing <> | 2024-10-11 12:27:24 +0000 |
commit | 61723d7ef03ea0d6dfb9984e183d118cac3846fa (patch) | |
tree | fdfefd7b20ef3506bce61e7860388deeb2565fef /src | |
parent | a3e6b4d34f7e835c63146d64ba9d8da2d87ea72c (diff) | |
download | openbsd-61723d7ef03ea0d6dfb9984e183d118cac3846fa.tar.gz openbsd-61723d7ef03ea0d6dfb9984e183d118cac3846fa.tar.bz2 openbsd-61723d7ef03ea0d6dfb9984e183d118cac3846fa.zip |
Remove pointless locking from err_build_SYS_str_reasons().
err_build_SYS_str_reasons() is only called during initialisation, under
pthread_once(). As such, there is no need to grab CRYPTO_LOCK_ERR or
check for reentrant calls.
ok tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/err/err.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 5f03c4cdb5..d7b1728bac 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err.c,v 1.70 2024/10/11 12:25:05 jsing Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.71 2024/10/11 12:27:24 jsing Exp $ */ |
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 | * |
@@ -487,22 +487,8 @@ err_build_SYS_str_reasons(void) | |||
487 | { | 487 | { |
488 | /* malloc cannot be used here, use static storage instead */ | 488 | /* malloc cannot be used here, use static storage instead */ |
489 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; | 489 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; |
490 | int i; | ||
491 | static int init = 1; | ||
492 | int save_errno; | 490 | int save_errno; |
493 | 491 | int i; | |
494 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
495 | if (!init) { | ||
496 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
497 | return; | ||
498 | } | ||
499 | |||
500 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
501 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
502 | if (!init) { | ||
503 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
504 | return; | ||
505 | } | ||
506 | 492 | ||
507 | /* strerror(3) will set errno to EINVAL when i is an unknown errno. */ | 493 | /* strerror(3) will set errno to EINVAL when i is an unknown errno. */ |
508 | save_errno = errno; | 494 | save_errno = errno; |
@@ -526,10 +512,6 @@ err_build_SYS_str_reasons(void) | |||
526 | 512 | ||
527 | /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, | 513 | /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, |
528 | * as required by ERR_load_strings. */ | 514 | * as required by ERR_load_strings. */ |
529 | |||
530 | init = 0; | ||
531 | |||
532 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
533 | } | 515 | } |
534 | #endif | 516 | #endif |
535 | 517 | ||