diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/err/err.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 4342efbdab..d3900a75f4 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.66 2024/10/11 11:58:53 jsing Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.67 2024/10/11 12:10:12 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 | * |
| @@ -141,7 +141,7 @@ typedef struct err_state_st { | |||
| 141 | } ERR_STATE; | 141 | } ERR_STATE; |
| 142 | 142 | ||
| 143 | #ifndef OPENSSL_NO_ERR | 143 | #ifndef OPENSSL_NO_ERR |
| 144 | static ERR_STRING_DATA ERR_str_libraries[] = { | 144 | static const ERR_STRING_DATA ERR_str_libraries[] = { |
| 145 | {ERR_PACK(ERR_LIB_NONE,0,0), "unknown library"}, | 145 | {ERR_PACK(ERR_LIB_NONE,0,0), "unknown library"}, |
| 146 | {ERR_PACK(ERR_LIB_SYS,0,0), "system library"}, | 146 | {ERR_PACK(ERR_LIB_SYS,0,0), "system library"}, |
| 147 | {ERR_PACK(ERR_LIB_BN,0,0), "bignum routines"}, | 147 | {ERR_PACK(ERR_LIB_BN,0,0), "bignum routines"}, |
| @@ -174,7 +174,7 @@ static ERR_STRING_DATA ERR_str_libraries[] = { | |||
| 174 | {0, NULL}, | 174 | {0, NULL}, |
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | static ERR_STRING_DATA ERR_str_functs[] = { | 177 | static const ERR_STRING_DATA ERR_str_functs[] = { |
| 178 | {ERR_PACK(ERR_LIB_SYS,SYS_F_FOPEN, 0), "fopen"}, | 178 | {ERR_PACK(ERR_LIB_SYS,SYS_F_FOPEN, 0), "fopen"}, |
| 179 | {ERR_PACK(ERR_LIB_SYS,SYS_F_CONNECT, 0), "connect"}, | 179 | {ERR_PACK(ERR_LIB_SYS,SYS_F_CONNECT, 0), "connect"}, |
| 180 | {ERR_PACK(ERR_LIB_SYS,SYS_F_GETSERVBYNAME, 0), "getservbyname"}, | 180 | {ERR_PACK(ERR_LIB_SYS,SYS_F_GETSERVBYNAME, 0), "getservbyname"}, |
| @@ -188,7 +188,7 @@ static ERR_STRING_DATA ERR_str_functs[] = { | |||
| 188 | {0, NULL}, | 188 | {0, NULL}, |
| 189 | }; | 189 | }; |
| 190 | 190 | ||
| 191 | static ERR_STRING_DATA ERR_str_reasons[] = { | 191 | static const ERR_STRING_DATA ERR_str_reasons[] = { |
| 192 | {ERR_R_SYS_LIB, "system lib"}, | 192 | {ERR_R_SYS_LIB, "system lib"}, |
| 193 | {ERR_R_BN_LIB, "BN lib"}, | 193 | {ERR_R_BN_LIB, "BN lib"}, |
| 194 | {ERR_R_RSA_LIB, "RSA lib"}, | 194 | {ERR_R_RSA_LIB, "RSA lib"}, |
| @@ -609,7 +609,7 @@ ERR_get_state(void) | |||
| 609 | static void | 609 | static void |
| 610 | err_load_strings(int lib, ERR_STRING_DATA *str) | 610 | err_load_strings(int lib, ERR_STRING_DATA *str) |
| 611 | { | 611 | { |
| 612 | while (str->error) { | 612 | while (str->error != 0) { |
| 613 | if (lib) | 613 | if (lib) |
| 614 | str->error |= ERR_PACK(lib, 0, 0); | 614 | str->error |= ERR_PACK(lib, 0, 0); |
| 615 | err_set_item(str); | 615 | err_set_item(str); |
| @@ -617,6 +617,15 @@ err_load_strings(int lib, ERR_STRING_DATA *str) | |||
| 617 | } | 617 | } |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | static void | ||
| 621 | err_load_const_strings(const ERR_STRING_DATA *str) | ||
| 622 | { | ||
| 623 | while (str->error != 0) { | ||
| 624 | err_set_item(str); | ||
| 625 | str++; | ||
| 626 | } | ||
| 627 | } | ||
| 628 | |||
| 620 | static unsigned long | 629 | static unsigned long |
| 621 | get_error_values(int inc, int top, const char **file, int *line, | 630 | get_error_values(int inc, int top, const char **file, int *line, |
| 622 | const char **data, int *flags) | 631 | const char **data, int *flags) |
| @@ -688,9 +697,9 @@ ERR_load_ERR_strings_internal(void) | |||
| 688 | { | 697 | { |
| 689 | err_init_thread = pthread_self(); | 698 | err_init_thread = pthread_self(); |
| 690 | #ifndef OPENSSL_NO_ERR | 699 | #ifndef OPENSSL_NO_ERR |
| 691 | err_load_strings(0, ERR_str_libraries); | 700 | err_load_const_strings(ERR_str_libraries); |
| 692 | err_load_strings(0, ERR_str_reasons); | 701 | err_load_const_strings(ERR_str_reasons); |
| 693 | err_load_strings(0, ERR_str_functs); | 702 | err_load_const_strings(ERR_str_functs); |
| 694 | build_SYS_str_reasons(); | 703 | build_SYS_str_reasons(); |
| 695 | err_load_strings(ERR_LIB_SYS, SYS_str_reasons); | 704 | err_load_strings(ERR_LIB_SYS, SYS_str_reasons); |
| 696 | #endif | 705 | #endif |
| @@ -723,10 +732,7 @@ void | |||
| 723 | ERR_load_const_strings(const ERR_STRING_DATA *str) | 732 | ERR_load_const_strings(const ERR_STRING_DATA *str) |
| 724 | { | 733 | { |
| 725 | ERR_load_ERR_strings(); | 734 | ERR_load_ERR_strings(); |
| 726 | while (str->error) { | 735 | err_load_const_strings(str); |
| 727 | err_set_item(str); | ||
| 728 | str++; | ||
| 729 | } | ||
| 730 | } | 736 | } |
| 731 | 737 | ||
| 732 | void | 738 | void |
