diff options
26 files changed, 321 insertions, 139 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index 564dc01169..7b926db11c 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.195 2024/05/24 19:16:53 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.196 2024/06/24 06:43:22 tb Exp $ |
2 | 2 | ||
3 | LIB= crypto | 3 | LIB= crypto |
4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
@@ -36,6 +36,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/dh | |||
36 | CFLAGS+= -I${LCRYPTO_SRC}/dsa | 36 | CFLAGS+= -I${LCRYPTO_SRC}/dsa |
37 | CFLAGS+= -I${LCRYPTO_SRC}/ec | 37 | CFLAGS+= -I${LCRYPTO_SRC}/ec |
38 | CFLAGS+= -I${LCRYPTO_SRC}/ecdsa | 38 | CFLAGS+= -I${LCRYPTO_SRC}/ecdsa |
39 | CFLAGS+= -I${LCRYPTO_SRC}/err | ||
39 | CFLAGS+= -I${LCRYPTO_SRC}/evp | 40 | CFLAGS+= -I${LCRYPTO_SRC}/evp |
40 | CFLAGS+= -I${LCRYPTO_SRC}/hidden | 41 | CFLAGS+= -I${LCRYPTO_SRC}/hidden |
41 | CFLAGS+= -I${LCRYPTO_SRC}/hmac | 42 | CFLAGS+= -I${LCRYPTO_SRC}/hmac |
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index 28570386f6..44809c76b1 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1_err.c,v 1.26 2023/07/05 21:23:36 beck Exp $ */ | 1 | /* $OpenBSD: asn1_err.c,v 1.27 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA ASN1_str_functs[] = { | 70 | static const ERR_STRING_DATA ASN1_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA ASN1_str_reasons[] = { | 75 | static const ERR_STRING_DATA ASN1_str_reasons[] = { |
74 | {ERR_REASON(ASN1_R_ADDING_OBJECT) , "adding object"}, | 76 | {ERR_REASON(ASN1_R_ADDING_OBJECT) , "adding object"}, |
75 | {ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) , "asn1 parse error"}, | 77 | {ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) , "asn1 parse error"}, |
76 | {ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) , "asn1 sig parse error"}, | 78 | {ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) , "asn1 sig parse error"}, |
@@ -206,8 +208,8 @@ ERR_load_ASN1_strings(void) | |||
206 | { | 208 | { |
207 | #ifndef OPENSSL_NO_ERR | 209 | #ifndef OPENSSL_NO_ERR |
208 | if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) { | 210 | if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) { |
209 | ERR_load_strings(0, ASN1_str_functs); | 211 | ERR_load_const_strings(ASN1_str_functs); |
210 | ERR_load_strings(0, ASN1_str_reasons); | 212 | ERR_load_const_strings(ASN1_str_reasons); |
211 | } | 213 | } |
212 | #endif | 214 | #endif |
213 | } | 215 | } |
diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c index 36fabca21c..4541adb240 100644 --- a/src/lib/libcrypto/bio/bio_err.c +++ b/src/lib/libcrypto/bio/bio_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_err.c,v 1.20 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bio_err.c,v 1.21 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/bio.h> | 61 | #include <openssl/bio.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA BIO_str_functs[] = { | 70 | static const ERR_STRING_DATA BIO_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA BIO_str_reasons[] = { | 75 | static const ERR_STRING_DATA BIO_str_reasons[] = { |
74 | {ERR_REASON(BIO_R_ACCEPT_ERROR) , "accept error"}, | 76 | {ERR_REASON(BIO_R_ACCEPT_ERROR) , "accept error"}, |
75 | {ERR_REASON(BIO_R_BAD_FOPEN_MODE) , "bad fopen mode"}, | 77 | {ERR_REASON(BIO_R_BAD_FOPEN_MODE) , "bad fopen mode"}, |
76 | {ERR_REASON(BIO_R_BAD_HOSTNAME_LOOKUP) , "bad hostname lookup"}, | 78 | {ERR_REASON(BIO_R_BAD_HOSTNAME_LOOKUP) , "bad hostname lookup"}, |
@@ -112,8 +114,8 @@ ERR_load_BIO_strings(void) | |||
112 | { | 114 | { |
113 | #ifndef OPENSSL_NO_ERR | 115 | #ifndef OPENSSL_NO_ERR |
114 | if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) { | 116 | if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) { |
115 | ERR_load_strings(0, BIO_str_functs); | 117 | ERR_load_const_strings(BIO_str_functs); |
116 | ERR_load_strings(0, BIO_str_reasons); | 118 | ERR_load_const_strings(BIO_str_reasons); |
117 | } | 119 | } |
118 | #endif | 120 | #endif |
119 | } | 121 | } |
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c index 6fd6030a0c..3ee6b4311f 100644 --- a/src/lib/libcrypto/bn/bn_err.c +++ b/src/lib/libcrypto/bn/bn_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_err.c,v 1.17 2023/07/08 12:21:58 beck Exp $ */ | 1 | /* $OpenBSD: bn_err.c,v 1.18 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA BN_str_functs[]= { | 70 | static const ERR_STRING_DATA BN_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA BN_str_reasons[]= { | 75 | static const ERR_STRING_DATA BN_str_reasons[] = { |
74 | {ERR_REASON(BN_R_ARG2_LT_ARG3) , "arg2 lt arg3"}, | 76 | {ERR_REASON(BN_R_ARG2_LT_ARG3) , "arg2 lt arg3"}, |
75 | {ERR_REASON(BN_R_BAD_RECIPROCAL) , "bad reciprocal"}, | 77 | {ERR_REASON(BN_R_BAD_RECIPROCAL) , "bad reciprocal"}, |
76 | {ERR_REASON(BN_R_BIGNUM_TOO_LONG) , "bignum too long"}, | 78 | {ERR_REASON(BN_R_BIGNUM_TOO_LONG) , "bignum too long"}, |
@@ -100,8 +102,8 @@ ERR_load_BN_strings(void) | |||
100 | { | 102 | { |
101 | #ifndef OPENSSL_NO_ERR | 103 | #ifndef OPENSSL_NO_ERR |
102 | if (ERR_func_error_string(BN_str_functs[0].error) == NULL) { | 104 | if (ERR_func_error_string(BN_str_functs[0].error) == NULL) { |
103 | ERR_load_strings(0, BN_str_functs); | 105 | ERR_load_const_strings(BN_str_functs); |
104 | ERR_load_strings(0, BN_str_reasons); | 106 | ERR_load_const_strings(BN_str_reasons); |
105 | } | 107 | } |
106 | #endif | 108 | #endif |
107 | } | 109 | } |
diff --git a/src/lib/libcrypto/buffer/buf_err.c b/src/lib/libcrypto/buffer/buf_err.c index 3b045cf589..8637a06a76 100644 --- a/src/lib/libcrypto/buffer/buf_err.c +++ b/src/lib/libcrypto/buffer/buf_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: buf_err.c,v 1.13 2023/07/08 08:26:26 beck Exp $ */ | 1 | /* $OpenBSD: buf_err.c,v 1.14 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/buffer.h> | 61 | #include <openssl/buffer.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA BUF_str_functs[] = { | 70 | static const ERR_STRING_DATA BUF_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA BUF_str_reasons[] = { | 75 | static const ERR_STRING_DATA BUF_str_reasons[] = { |
74 | {0, NULL} | 76 | {0, NULL} |
75 | }; | 77 | }; |
76 | 78 | ||
@@ -81,8 +83,8 @@ ERR_load_BUF_strings(void) | |||
81 | { | 83 | { |
82 | #ifndef OPENSSL_NO_ERR | 84 | #ifndef OPENSSL_NO_ERR |
83 | if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) { | 85 | if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) { |
84 | ERR_load_strings(0, BUF_str_functs); | 86 | ERR_load_const_strings(BUF_str_functs); |
85 | ERR_load_strings(0, BUF_str_reasons); | 87 | ERR_load_const_strings(BUF_str_reasons); |
86 | } | 88 | } |
87 | #endif | 89 | #endif |
88 | } | 90 | } |
diff --git a/src/lib/libcrypto/cms/cms_err.c b/src/lib/libcrypto/cms/cms_err.c index 5758a26db5..5431ab4bb8 100644 --- a/src/lib/libcrypto/cms/cms_err.c +++ b/src/lib/libcrypto/cms/cms_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_err.c,v 1.14 2023/07/08 08:26:26 beck Exp $ */ | 1 | /* $OpenBSD: cms_err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. | 3 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. |
4 | * | 4 | * |
@@ -11,17 +11,19 @@ | |||
11 | #include <openssl/cms.h> | 11 | #include <openssl/cms.h> |
12 | #include <openssl/err.h> | 12 | #include <openssl/err.h> |
13 | 13 | ||
14 | #include "err_local.h" | ||
15 | |||
14 | #ifndef OPENSSL_NO_ERR | 16 | #ifndef OPENSSL_NO_ERR |
15 | 17 | ||
16 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CMS,func,0) | 18 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CMS,func,0) |
17 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CMS,0,reason) | 19 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CMS,0,reason) |
18 | 20 | ||
19 | static ERR_STRING_DATA CMS_str_functs[] = { | 21 | static const ERR_STRING_DATA CMS_str_functs[] = { |
20 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 22 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
21 | {0, NULL} | 23 | {0, NULL} |
22 | }; | 24 | }; |
23 | 25 | ||
24 | static ERR_STRING_DATA CMS_str_reasons[] = { | 26 | static const ERR_STRING_DATA CMS_str_reasons[] = { |
25 | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ADD_SIGNER_ERROR), "add signer error"}, | 27 | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ADD_SIGNER_ERROR), "add signer error"}, |
26 | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_ALREADY_PRESENT), | 28 | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_ALREADY_PRESENT), |
27 | "certificate already present"}, | 29 | "certificate already present"}, |
@@ -155,8 +157,8 @@ ERR_load_CMS_strings(void) | |||
155 | { | 157 | { |
156 | #ifndef OPENSSL_NO_ERR | 158 | #ifndef OPENSSL_NO_ERR |
157 | if (ERR_func_error_string(CMS_str_functs[0].error) == NULL) { | 159 | if (ERR_func_error_string(CMS_str_functs[0].error) == NULL) { |
158 | ERR_load_strings(ERR_LIB_CMS, CMS_str_functs); | 160 | ERR_load_const_strings(CMS_str_functs); |
159 | ERR_load_strings(ERR_LIB_CMS, CMS_str_reasons); | 161 | ERR_load_const_strings(CMS_str_reasons); |
160 | } | 162 | } |
161 | #endif | 163 | #endif |
162 | return 1; | 164 | return 1; |
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c index 9a44f22fa2..5100847d89 100644 --- a/src/lib/libcrypto/conf/conf_err.c +++ b/src/lib/libcrypto/conf/conf_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: conf_err.c,v 1.16 2024/04/09 13:56:30 beck Exp $ */ | 1 | /* $OpenBSD: conf_err.c,v 1.17 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/conf.h> | 60 | #include <openssl/conf.h> |
61 | #include <openssl/err.h> | 61 | #include <openssl/err.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA CONF_str_functs[]= { | 70 | static const ERR_STRING_DATA CONF_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA CONF_str_reasons[]= { | 75 | static const ERR_STRING_DATA CONF_str_reasons[] = { |
74 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"}, | 76 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"}, |
75 | {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"}, | 77 | {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"}, |
76 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"}, | 78 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"}, |
@@ -98,8 +100,8 @@ ERR_load_CONF_strings(void) | |||
98 | { | 100 | { |
99 | #ifndef OPENSSL_NO_ERR | 101 | #ifndef OPENSSL_NO_ERR |
100 | if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) { | 102 | if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) { |
101 | ERR_load_strings(0, CONF_str_functs); | 103 | ERR_load_const_strings(CONF_str_functs); |
102 | ERR_load_strings(0, CONF_str_reasons); | 104 | ERR_load_const_strings(CONF_str_reasons); |
103 | } | 105 | } |
104 | #endif | 106 | #endif |
105 | } | 107 | } |
diff --git a/src/lib/libcrypto/cpt_err.c b/src/lib/libcrypto/cpt_err.c index ff4e5c4bc5..459b99d433 100644 --- a/src/lib/libcrypto/cpt_err.c +++ b/src/lib/libcrypto/cpt_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cpt_err.c,v 1.15 2023/07/08 08:28:23 beck Exp $ */ | 1 | /* $OpenBSD: cpt_err.c,v 1.16 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,12 +60,14 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/crypto.h> | 61 | #include <openssl/crypto.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA CRYPTO_str_functs[] = { | 70 | static const ERR_STRING_DATA CRYPTO_str_functs[] = { |
69 | {ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX), "CRYPTO_get_ex_new_index"}, | 71 | {ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX), "CRYPTO_get_ex_new_index"}, |
70 | {ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID), "CRYPTO_get_new_dynlockid"}, | 72 | {ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID), "CRYPTO_get_new_dynlockid"}, |
71 | {ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_LOCKID), "CRYPTO_get_new_lockid"}, | 73 | {ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_LOCKID), "CRYPTO_get_new_lockid"}, |
@@ -79,7 +81,7 @@ static ERR_STRING_DATA CRYPTO_str_functs[] = { | |||
79 | {0, NULL} | 81 | {0, NULL} |
80 | }; | 82 | }; |
81 | 83 | ||
82 | static ERR_STRING_DATA CRYPTO_str_reasons[] = { | 84 | static const ERR_STRING_DATA CRYPTO_str_reasons[] = { |
83 | {ERR_REASON(CRYPTO_R_FIPS_MODE_NOT_SUPPORTED), "fips mode not supported"}, | 85 | {ERR_REASON(CRYPTO_R_FIPS_MODE_NOT_SUPPORTED), "fips mode not supported"}, |
84 | {ERR_REASON(CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK), "no dynlock create callback"}, | 86 | {ERR_REASON(CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK), "no dynlock create callback"}, |
85 | {0, NULL} | 87 | {0, NULL} |
@@ -92,8 +94,8 @@ ERR_load_CRYPTO_strings(void) | |||
92 | { | 94 | { |
93 | #ifndef OPENSSL_NO_ERR | 95 | #ifndef OPENSSL_NO_ERR |
94 | if (ERR_func_error_string(CRYPTO_str_functs[0].error) == NULL) { | 96 | if (ERR_func_error_string(CRYPTO_str_functs[0].error) == NULL) { |
95 | ERR_load_strings(0, CRYPTO_str_functs); | 97 | ERR_load_const_strings(CRYPTO_str_functs); |
96 | ERR_load_strings(0, CRYPTO_str_reasons); | 98 | ERR_load_const_strings(CRYPTO_str_reasons); |
97 | } | 99 | } |
98 | #endif | 100 | #endif |
99 | } | 101 | } |
diff --git a/src/lib/libcrypto/ct/ct_err.c b/src/lib/libcrypto/ct/ct_err.c index 2597874bd3..494f88b898 100644 --- a/src/lib/libcrypto/ct/ct_err.c +++ b/src/lib/libcrypto/ct/ct_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ct_err.c,v 1.7 2022/07/12 14:42:48 kn Exp $ */ | 1 | /* $OpenBSD: ct_err.c,v 1.8 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -56,9 +56,11 @@ | |||
56 | #include <openssl/ct.h> | 56 | #include <openssl/ct.h> |
57 | #include <openssl/err.h> | 57 | #include <openssl/err.h> |
58 | 58 | ||
59 | #include "err_local.h" | ||
60 | |||
59 | #ifndef OPENSSL_NO_ERR | 61 | #ifndef OPENSSL_NO_ERR |
60 | 62 | ||
61 | static ERR_STRING_DATA CT_str_functs[] = { | 63 | static const ERR_STRING_DATA CT_str_functs[] = { |
62 | {ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW, 0), "CTLOG_new"}, | 64 | {ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW, 0), "CTLOG_new"}, |
63 | {ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW_FROM_BASE64, 0), | 65 | {ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW_FROM_BASE64, 0), |
64 | "CTLOG_new_from_base64"}, | 66 | "CTLOG_new_from_base64"}, |
@@ -101,7 +103,7 @@ static ERR_STRING_DATA CT_str_functs[] = { | |||
101 | {0, NULL} | 103 | {0, NULL} |
102 | }; | 104 | }; |
103 | 105 | ||
104 | static ERR_STRING_DATA CT_str_reasons[] = { | 106 | static const ERR_STRING_DATA CT_str_reasons[] = { |
105 | {ERR_PACK(ERR_LIB_CT, 0, CT_R_BASE64_DECODE_ERROR), | 107 | {ERR_PACK(ERR_LIB_CT, 0, CT_R_BASE64_DECODE_ERROR), |
106 | "base64 decode error"}, | 108 | "base64 decode error"}, |
107 | {ERR_PACK(ERR_LIB_CT, 0, CT_R_INVALID_LOG_ID_LENGTH), | 109 | {ERR_PACK(ERR_LIB_CT, 0, CT_R_INVALID_LOG_ID_LENGTH), |
@@ -140,8 +142,8 @@ int | |||
140 | ERR_load_CT_strings(void) | 142 | ERR_load_CT_strings(void) |
141 | { | 143 | { |
142 | if (ERR_func_error_string(CT_str_functs[0].error) == NULL) { | 144 | if (ERR_func_error_string(CT_str_functs[0].error) == NULL) { |
143 | ERR_load_strings(0, CT_str_functs); | 145 | ERR_load_const_strings(CT_str_functs); |
144 | ERR_load_strings(0, CT_str_reasons); | 146 | ERR_load_const_strings(CT_str_reasons); |
145 | } | 147 | } |
146 | return 1; | 148 | return 1; |
147 | } | 149 | } |
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index 52fec7848b..568eff5752 100644 --- a/src/lib/libcrypto/dh/dh_err.c +++ b/src/lib/libcrypto/dh/dh_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh_err.c,v 1.21 2024/05/19 08:22:40 tb Exp $ */ | 1 | /* $OpenBSD: dh_err.c,v 1.22 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -57,20 +57,22 @@ | |||
57 | 57 | ||
58 | #include <openssl/opensslconf.h> | 58 | #include <openssl/opensslconf.h> |
59 | 59 | ||
60 | #include <openssl/err.h> | ||
61 | #include <openssl/dh.h> | 60 | #include <openssl/dh.h> |
61 | #include <openssl/err.h> | ||
62 | |||
63 | #include "err_local.h" | ||
62 | 64 | ||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA DH_str_functs[] = { | 70 | static const ERR_STRING_DATA DH_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA DH_str_reasons[] = { | 75 | static const ERR_STRING_DATA DH_str_reasons[] = { |
74 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, | 76 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, |
75 | {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, | 77 | {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, |
76 | {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, | 78 | {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, |
@@ -104,8 +106,8 @@ ERR_load_DH_strings(void) | |||
104 | { | 106 | { |
105 | #ifndef OPENSSL_NO_ERR | 107 | #ifndef OPENSSL_NO_ERR |
106 | if (ERR_func_error_string(DH_str_functs[0].error) == NULL) { | 108 | if (ERR_func_error_string(DH_str_functs[0].error) == NULL) { |
107 | ERR_load_strings(0, DH_str_functs); | 109 | ERR_load_const_strings(DH_str_functs); |
108 | ERR_load_strings(0, DH_str_reasons); | 110 | ERR_load_const_strings(DH_str_reasons); |
109 | } | 111 | } |
110 | #endif | 112 | #endif |
111 | } | 113 | } |
diff --git a/src/lib/libcrypto/dsa/dsa_err.c b/src/lib/libcrypto/dsa/dsa_err.c index 048fa8df4b..b7670f895b 100644 --- a/src/lib/libcrypto/dsa/dsa_err.c +++ b/src/lib/libcrypto/dsa/dsa_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_err.c,v 1.21 2024/05/19 08:22:40 tb Exp $ */ | 1 | /* $OpenBSD: dsa_err.c,v 1.22 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/dsa.h> | 61 | #include <openssl/dsa.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA DSA_str_functs[] = { | 70 | static const ERR_STRING_DATA DSA_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA DSA_str_reasons[] = { | 75 | static const ERR_STRING_DATA DSA_str_reasons[] = { |
74 | {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, | 76 | {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, |
75 | {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, | 77 | {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, |
76 | {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, | 78 | {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, |
@@ -94,8 +96,8 @@ ERR_load_DSA_strings(void) | |||
94 | { | 96 | { |
95 | #ifndef OPENSSL_NO_ERR | 97 | #ifndef OPENSSL_NO_ERR |
96 | if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) { | 98 | if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) { |
97 | ERR_load_strings(0, DSA_str_functs); | 99 | ERR_load_const_strings(DSA_str_functs); |
98 | ERR_load_strings(0, DSA_str_reasons); | 100 | ERR_load_const_strings(DSA_str_reasons); |
99 | } | 101 | } |
100 | #endif | 102 | #endif |
101 | } | 103 | } |
diff --git a/src/lib/libcrypto/ec/ec_err.c b/src/lib/libcrypto/ec/ec_err.c index 7ecbb66569..2a6c419b57 100644 --- a/src/lib/libcrypto/ec/ec_err.c +++ b/src/lib/libcrypto/ec/ec_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_err.c,v 1.19 2024/05/19 08:26:03 tb Exp $ */ | 1 | /* $OpenBSD: ec_err.c,v 1.20 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/ec.h> | 61 | #include <openssl/ec.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA EC_str_functs[] = { | 70 | static const ERR_STRING_DATA EC_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA EC_str_reasons[] = { | 75 | static const ERR_STRING_DATA EC_str_reasons[] = { |
74 | {ERR_REASON(EC_R_ASN1_ERROR), "asn1 error"}, | 76 | {ERR_REASON(EC_R_ASN1_ERROR), "asn1 error"}, |
75 | {ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD), "asn1 unknown field"}, | 77 | {ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD), "asn1 unknown field"}, |
76 | {ERR_REASON(EC_R_BAD_SIGNATURE), "bad signature"}, | 78 | {ERR_REASON(EC_R_BAD_SIGNATURE), "bad signature"}, |
@@ -140,10 +142,9 @@ void | |||
140 | ERR_load_EC_strings(void) | 142 | ERR_load_EC_strings(void) |
141 | { | 143 | { |
142 | #ifndef OPENSSL_NO_ERR | 144 | #ifndef OPENSSL_NO_ERR |
143 | |||
144 | if (ERR_func_error_string(EC_str_functs[0].error) == NULL) { | 145 | if (ERR_func_error_string(EC_str_functs[0].error) == NULL) { |
145 | ERR_load_strings(0, EC_str_functs); | 146 | ERR_load_const_strings(EC_str_functs); |
146 | ERR_load_strings(0, EC_str_reasons); | 147 | ERR_load_const_strings(EC_str_reasons); |
147 | } | 148 | } |
148 | #endif | 149 | #endif |
149 | } | 150 | } |
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index a7b13a5404..583293e793 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.60 2024/03/02 11:37:13 tb Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.61 2024/06/24 06:43:22 tb 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 | * |
@@ -244,9 +244,9 @@ struct st_ERR_FNS { | |||
244 | /* Works on the "error_hash" string table */ | 244 | /* Works on the "error_hash" string table */ |
245 | LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create); | 245 | LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create); |
246 | void (*cb_err_del)(void); | 246 | void (*cb_err_del)(void); |
247 | ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *); | 247 | const ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *); |
248 | ERR_STRING_DATA *(*cb_err_set_item)(ERR_STRING_DATA *); | 248 | const ERR_STRING_DATA *(*cb_err_set_item)(const ERR_STRING_DATA *); |
249 | ERR_STRING_DATA *(*cb_err_del_item)(ERR_STRING_DATA *); | 249 | const ERR_STRING_DATA *(*cb_err_del_item)(const ERR_STRING_DATA *); |
250 | /* Works on the "thread_hash" error-state table */ | 250 | /* Works on the "thread_hash" error-state table */ |
251 | LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create); | 251 | LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create); |
252 | void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash); | 252 | void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash); |
@@ -260,9 +260,9 @@ struct st_ERR_FNS { | |||
260 | /* Predeclarations of the "err_defaults" functions */ | 260 | /* Predeclarations of the "err_defaults" functions */ |
261 | static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create); | 261 | static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create); |
262 | static void int_err_del(void); | 262 | static void int_err_del(void); |
263 | static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *); | 263 | static const ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *); |
264 | static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *); | 264 | static const ERR_STRING_DATA *int_err_set_item(const ERR_STRING_DATA *); |
265 | static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *); | 265 | static const ERR_STRING_DATA *int_err_del_item(const ERR_STRING_DATA *); |
266 | static LHASH_OF(ERR_STATE) *int_thread_get(int create); | 266 | static LHASH_OF(ERR_STATE) *int_thread_get(int create); |
267 | static void int_thread_release(LHASH_OF(ERR_STATE) **hash); | 267 | static void int_thread_release(LHASH_OF(ERR_STATE) **hash); |
268 | static ERR_STATE *int_thread_get_item(const ERR_STATE *); | 268 | static ERR_STATE *int_thread_get_item(const ERR_STATE *); |
@@ -369,7 +369,7 @@ int_err_del(void) | |||
369 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | 369 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); |
370 | } | 370 | } |
371 | 371 | ||
372 | static ERR_STRING_DATA * | 372 | static const ERR_STRING_DATA * |
373 | int_err_get_item(const ERR_STRING_DATA *d) | 373 | int_err_get_item(const ERR_STRING_DATA *d) |
374 | { | 374 | { |
375 | ERR_STRING_DATA *p; | 375 | ERR_STRING_DATA *p; |
@@ -387,10 +387,10 @@ int_err_get_item(const ERR_STRING_DATA *d) | |||
387 | return p; | 387 | return p; |
388 | } | 388 | } |
389 | 389 | ||
390 | static ERR_STRING_DATA * | 390 | static const ERR_STRING_DATA * |
391 | int_err_set_item(ERR_STRING_DATA *d) | 391 | int_err_set_item(const ERR_STRING_DATA *d) |
392 | { | 392 | { |
393 | ERR_STRING_DATA *p; | 393 | const ERR_STRING_DATA *p; |
394 | LHASH_OF(ERR_STRING_DATA) *hash; | 394 | LHASH_OF(ERR_STRING_DATA) *hash; |
395 | 395 | ||
396 | err_fns_check(); | 396 | err_fns_check(); |
@@ -399,14 +399,14 @@ int_err_set_item(ERR_STRING_DATA *d) | |||
399 | return NULL; | 399 | return NULL; |
400 | 400 | ||
401 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | 401 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); |
402 | p = lh_ERR_STRING_DATA_insert(hash, d); | 402 | p = lh_ERR_STRING_DATA_insert(hash, (void *)d); |
403 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | 403 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); |
404 | 404 | ||
405 | return p; | 405 | return p; |
406 | } | 406 | } |
407 | 407 | ||
408 | static ERR_STRING_DATA * | 408 | static const ERR_STRING_DATA * |
409 | int_err_del_item(ERR_STRING_DATA *d) | 409 | int_err_del_item(const ERR_STRING_DATA *d) |
410 | { | 410 | { |
411 | ERR_STRING_DATA *p; | 411 | ERR_STRING_DATA *p; |
412 | LHASH_OF(ERR_STRING_DATA) *hash; | 412 | LHASH_OF(ERR_STRING_DATA) *hash; |
@@ -693,6 +693,16 @@ ERR_load_strings(int lib, ERR_STRING_DATA *str) | |||
693 | LCRYPTO_ALIAS(ERR_load_strings); | 693 | LCRYPTO_ALIAS(ERR_load_strings); |
694 | 694 | ||
695 | void | 695 | void |
696 | ERR_load_const_strings(const ERR_STRING_DATA *str) | ||
697 | { | ||
698 | ERR_load_ERR_strings(); | ||
699 | while (str->error) { | ||
700 | ERRFN(err_set_item)(str); | ||
701 | str++; | ||
702 | } | ||
703 | } | ||
704 | |||
705 | void | ||
696 | ERR_unload_strings(int lib, ERR_STRING_DATA *str) | 706 | ERR_unload_strings(int lib, ERR_STRING_DATA *str) |
697 | { | 707 | { |
698 | /* Prayer and clean living lets you ignore errors, OpenSSL style */ | 708 | /* Prayer and clean living lets you ignore errors, OpenSSL style */ |
@@ -964,7 +974,8 @@ LCRYPTO_ALIAS(ERR_error_string); | |||
964 | const char * | 974 | const char * |
965 | ERR_lib_error_string(unsigned long e) | 975 | ERR_lib_error_string(unsigned long e) |
966 | { | 976 | { |
967 | ERR_STRING_DATA d, *p; | 977 | const ERR_STRING_DATA *p; |
978 | ERR_STRING_DATA d; | ||
968 | unsigned long l; | 979 | unsigned long l; |
969 | 980 | ||
970 | if (!OPENSSL_init_crypto(0, NULL)) | 981 | if (!OPENSSL_init_crypto(0, NULL)) |
@@ -981,7 +992,8 @@ LCRYPTO_ALIAS(ERR_lib_error_string); | |||
981 | const char * | 992 | const char * |
982 | ERR_func_error_string(unsigned long e) | 993 | ERR_func_error_string(unsigned long e) |
983 | { | 994 | { |
984 | ERR_STRING_DATA d, *p; | 995 | const ERR_STRING_DATA *p; |
996 | ERR_STRING_DATA d; | ||
985 | unsigned long l, f; | 997 | unsigned long l, f; |
986 | 998 | ||
987 | err_fns_check(); | 999 | err_fns_check(); |
@@ -996,7 +1008,8 @@ LCRYPTO_ALIAS(ERR_func_error_string); | |||
996 | const char * | 1008 | const char * |
997 | ERR_reason_error_string(unsigned long e) | 1009 | ERR_reason_error_string(unsigned long e) |
998 | { | 1010 | { |
999 | ERR_STRING_DATA d, *p = NULL; | 1011 | const ERR_STRING_DATA *p = NULL; |
1012 | ERR_STRING_DATA d; | ||
1000 | unsigned long l, r; | 1013 | unsigned long l, r; |
1001 | 1014 | ||
1002 | err_fns_check(); | 1015 | err_fns_check(); |
diff --git a/src/lib/libcrypto/err/err_local.h b/src/lib/libcrypto/err/err_local.h new file mode 100644 index 0000000000..d091b979cc --- /dev/null +++ b/src/lib/libcrypto/err/err_local.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* $OpenBSD: err_local.h,v 1.1 2024/06/24 06:43:22 tb Exp $ */ | ||
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 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | /* ==================================================================== | ||
59 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | ||
60 | * | ||
61 | * Redistribution and use in source and binary forms, with or without | ||
62 | * modification, are permitted provided that the following conditions | ||
63 | * are met: | ||
64 | * | ||
65 | * 1. Redistributions of source code must retain the above copyright | ||
66 | * notice, this list of conditions and the following disclaimer. | ||
67 | * | ||
68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
69 | * notice, this list of conditions and the following disclaimer in | ||
70 | * the documentation and/or other materials provided with the | ||
71 | * distribution. | ||
72 | * | ||
73 | * 3. All advertising materials mentioning features or use of this | ||
74 | * software must display the following acknowledgment: | ||
75 | * "This product includes software developed by the OpenSSL Project | ||
76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
77 | * | ||
78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
79 | * endorse or promote products derived from this software without | ||
80 | * prior written permission. For written permission, please contact | ||
81 | * openssl-core@openssl.org. | ||
82 | * | ||
83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
84 | * nor may "OpenSSL" appear in their names without prior written | ||
85 | * permission of the OpenSSL Project. | ||
86 | * | ||
87 | * 6. Redistributions of any form whatsoever must retain the following | ||
88 | * acknowledgment: | ||
89 | * "This product includes software developed by the OpenSSL Project | ||
90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
91 | * | ||
92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
104 | * ==================================================================== | ||
105 | * | ||
106 | * This product includes cryptographic software written by Eric Young | ||
107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
108 | * Hudson (tjh@cryptsoft.com). | ||
109 | * | ||
110 | */ | ||
111 | |||
112 | #include <openssl/err.h> | ||
113 | |||
114 | #ifndef HEADER_ERR_LOCAL_H | ||
115 | #define HEADER_ERR_LOCAL_H | ||
116 | |||
117 | __BEGIN_HIDDEN_DECLS | ||
118 | |||
119 | void ERR_load_const_strings(const ERR_STRING_DATA *str); | ||
120 | |||
121 | __END_HIDDEN_DECLS | ||
122 | |||
123 | #endif /* HEADER_ERR_LOCAL_H */ | ||
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index 07515f4d99..a41339c775 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_err.c,v 1.33 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: evp_err.c,v 1.34 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA EVP_str_functs[] = { | 70 | static const ERR_STRING_DATA EVP_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA EVP_str_reasons[] = { | 75 | static const ERR_STRING_DATA EVP_str_reasons[] = { |
74 | {ERR_REASON(EVP_R_AES_IV_SETUP_FAILED) , "aes iv setup failed"}, | 76 | {ERR_REASON(EVP_R_AES_IV_SETUP_FAILED) , "aes iv setup failed"}, |
75 | {ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) , "aes key setup failed"}, | 77 | {ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) , "aes key setup failed"}, |
76 | {ERR_REASON(EVP_R_ASN1_LIB) , "asn1 lib"}, | 78 | {ERR_REASON(EVP_R_ASN1_LIB) , "asn1 lib"}, |
@@ -159,8 +161,8 @@ ERR_load_EVP_strings(void) | |||
159 | { | 161 | { |
160 | #ifndef OPENSSL_NO_ERR | 162 | #ifndef OPENSSL_NO_ERR |
161 | if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) { | 163 | if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) { |
162 | ERR_load_strings(0, EVP_str_functs); | 164 | ERR_load_const_strings(EVP_str_functs); |
163 | ERR_load_strings(0, EVP_str_reasons); | 165 | ERR_load_const_strings(EVP_str_reasons); |
164 | } | 166 | } |
165 | #endif | 167 | #endif |
166 | } | 168 | } |
diff --git a/src/lib/libcrypto/kdf/kdf_err.c b/src/lib/libcrypto/kdf/kdf_err.c index 4dd323701a..fc38e08136 100644 --- a/src/lib/libcrypto/kdf/kdf_err.c +++ b/src/lib/libcrypto/kdf/kdf_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kdf_err.c,v 1.9 2022/07/12 14:42:49 kn Exp $ */ | 1 | /* $OpenBSD: kdf_err.c,v 1.10 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2018 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2018 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -56,16 +56,18 @@ | |||
56 | #include <openssl/err.h> | 56 | #include <openssl/err.h> |
57 | #include <openssl/kdf.h> | 57 | #include <openssl/kdf.h> |
58 | 58 | ||
59 | #include "err_local.h" | ||
60 | |||
59 | #ifndef OPENSSL_NO_ERR | 61 | #ifndef OPENSSL_NO_ERR |
60 | 62 | ||
61 | static ERR_STRING_DATA KDF_str_functs[] = { | 63 | static const ERR_STRING_DATA KDF_str_functs[] = { |
62 | {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_CTRL_STR, 0), "pkey_hkdf_ctrl_str"}, | 64 | {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_CTRL_STR, 0), "pkey_hkdf_ctrl_str"}, |
63 | {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_DERIVE, 0), "pkey_hkdf_derive"}, | 65 | {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_DERIVE, 0), "pkey_hkdf_derive"}, |
64 | {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_INIT, 0), "pkey_hkdf_init"}, | 66 | {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_INIT, 0), "pkey_hkdf_init"}, |
65 | {0, NULL}, | 67 | {0, NULL}, |
66 | }; | 68 | }; |
67 | 69 | ||
68 | static ERR_STRING_DATA KDF_str_reasons[] = { | 70 | static const ERR_STRING_DATA KDF_str_reasons[] = { |
69 | {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_KEY), "missing key"}, | 71 | {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_KEY), "missing key"}, |
70 | {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_MESSAGE_DIGEST), | 72 | {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_MESSAGE_DIGEST), |
71 | "missing message digest"}, | 73 | "missing message digest"}, |
@@ -81,8 +83,8 @@ ERR_load_KDF_strings(void) | |||
81 | { | 83 | { |
82 | #ifndef OPENSSL_NO_ERR | 84 | #ifndef OPENSSL_NO_ERR |
83 | if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) { | 85 | if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) { |
84 | ERR_load_strings(0, KDF_str_functs); | 86 | ERR_load_const_strings(KDF_str_functs); |
85 | ERR_load_strings(0, KDF_str_reasons); | 87 | ERR_load_const_strings(KDF_str_reasons); |
86 | } | 88 | } |
87 | #endif | 89 | #endif |
88 | return 1; | 90 | return 1; |
diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c index 04cb4218c2..514fb0d4f0 100644 --- a/src/lib/libcrypto/objects/obj_err.c +++ b/src/lib/libcrypto/objects/obj_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: obj_err.c,v 1.14 2023/07/08 12:27:51 beck Exp $ */ | 1 | /* $OpenBSD: obj_err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA OBJ_str_functs[] = { | 70 | static const ERR_STRING_DATA OBJ_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA OBJ_str_reasons[] = { | 75 | static const ERR_STRING_DATA OBJ_str_reasons[] = { |
74 | {ERR_REASON(OBJ_R_MALLOC_FAILURE) , "malloc failure"}, | 76 | {ERR_REASON(OBJ_R_MALLOC_FAILURE) , "malloc failure"}, |
75 | {ERR_REASON(OBJ_R_UNKNOWN_NID) , "unknown nid"}, | 77 | {ERR_REASON(OBJ_R_UNKNOWN_NID) , "unknown nid"}, |
76 | {0, NULL} | 78 | {0, NULL} |
@@ -83,8 +85,8 @@ ERR_load_OBJ_strings(void) | |||
83 | { | 85 | { |
84 | #ifndef OPENSSL_NO_ERR | 86 | #ifndef OPENSSL_NO_ERR |
85 | if (ERR_func_error_string(OBJ_str_functs[0].error) == NULL) { | 87 | if (ERR_func_error_string(OBJ_str_functs[0].error) == NULL) { |
86 | ERR_load_strings(0, OBJ_str_functs); | 88 | ERR_load_const_strings(OBJ_str_functs); |
87 | ERR_load_strings(0, OBJ_str_reasons); | 89 | ERR_load_const_strings(OBJ_str_reasons); |
88 | } | 90 | } |
89 | #endif | 91 | #endif |
90 | } | 92 | } |
diff --git a/src/lib/libcrypto/ocsp/ocsp_err.c b/src/lib/libcrypto/ocsp/ocsp_err.c index 865091f542..ca8f8f22b2 100644 --- a/src/lib/libcrypto/ocsp/ocsp_err.c +++ b/src/lib/libcrypto/ocsp/ocsp_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ocsp_err.c,v 1.10 2023/07/08 10:44:00 beck Exp $ */ | 1 | /* $OpenBSD: ocsp_err.c,v 1.11 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/ocsp.h> | 61 | #include <openssl/ocsp.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA OCSP_str_functs[]= { | 70 | static const ERR_STRING_DATA OCSP_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA OCSP_str_reasons[]= { | 75 | static const ERR_STRING_DATA OCSP_str_reasons[] = { |
74 | {ERR_REASON(OCSP_R_BAD_DATA) , "bad data"}, | 76 | {ERR_REASON(OCSP_R_BAD_DATA) , "bad data"}, |
75 | {ERR_REASON(OCSP_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, | 77 | {ERR_REASON(OCSP_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, |
76 | {ERR_REASON(OCSP_R_DIGEST_ERR) , "digest err"}, | 78 | {ERR_REASON(OCSP_R_DIGEST_ERR) , "digest err"}, |
@@ -111,8 +113,8 @@ ERR_load_OCSP_strings(void) | |||
111 | { | 113 | { |
112 | #ifndef OPENSSL_NO_ERR | 114 | #ifndef OPENSSL_NO_ERR |
113 | if (ERR_func_error_string(OCSP_str_functs[0].error) == NULL) { | 115 | if (ERR_func_error_string(OCSP_str_functs[0].error) == NULL) { |
114 | ERR_load_strings(0, OCSP_str_functs); | 116 | ERR_load_const_strings(OCSP_str_functs); |
115 | ERR_load_strings(0, OCSP_str_reasons); | 117 | ERR_load_const_strings(OCSP_str_reasons); |
116 | } | 118 | } |
117 | #endif | 119 | #endif |
118 | } | 120 | } |
diff --git a/src/lib/libcrypto/pem/pem_err.c b/src/lib/libcrypto/pem/pem_err.c index a94e2d5ebb..05025c8ee0 100644 --- a/src/lib/libcrypto/pem/pem_err.c +++ b/src/lib/libcrypto/pem/pem_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pem_err.c,v 1.14 2023/07/07 13:40:44 beck Exp $ */ | 1 | /* $OpenBSD: pem_err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/pem.h> | 61 | #include <openssl/pem.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA PEM_str_functs[] = { | 70 | static const ERR_STRING_DATA PEM_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA PEM_str_reasons[] = { | 75 | static const ERR_STRING_DATA PEM_str_reasons[] = { |
74 | {ERR_REASON(PEM_R_BAD_BASE64_DECODE) , "bad base64 decode"}, | 76 | {ERR_REASON(PEM_R_BAD_BASE64_DECODE) , "bad base64 decode"}, |
75 | {ERR_REASON(PEM_R_BAD_DECRYPT) , "bad decrypt"}, | 77 | {ERR_REASON(PEM_R_BAD_DECRYPT) , "bad decrypt"}, |
76 | {ERR_REASON(PEM_R_BAD_END_LINE) , "bad end line"}, | 78 | {ERR_REASON(PEM_R_BAD_END_LINE) , "bad end line"}, |
@@ -109,8 +111,8 @@ ERR_load_PEM_strings(void) | |||
109 | { | 111 | { |
110 | #ifndef OPENSSL_NO_ERR | 112 | #ifndef OPENSSL_NO_ERR |
111 | if (ERR_func_error_string(PEM_str_functs[0].error) == NULL) { | 113 | if (ERR_func_error_string(PEM_str_functs[0].error) == NULL) { |
112 | ERR_load_strings(0, PEM_str_functs); | 114 | ERR_load_const_strings(PEM_str_functs); |
113 | ERR_load_strings(0, PEM_str_reasons); | 115 | ERR_load_const_strings(PEM_str_reasons); |
114 | } | 116 | } |
115 | #endif | 117 | #endif |
116 | } | 118 | } |
diff --git a/src/lib/libcrypto/pkcs12/pk12err.c b/src/lib/libcrypto/pkcs12/pk12err.c index 3af03528a2..c04c83c4f1 100644 --- a/src/lib/libcrypto/pkcs12/pk12err.c +++ b/src/lib/libcrypto/pkcs12/pk12err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pk12err.c,v 1.14 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: pk12err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA PKCS12_str_functs[]= { | 70 | static const ERR_STRING_DATA PKCS12_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA PKCS12_str_reasons[]= { | 75 | static const ERR_STRING_DATA PKCS12_str_reasons[] = { |
74 | {ERR_REASON(PKCS12_R_CANT_PACK_STRUCTURE), "cant pack structure"}, | 76 | {ERR_REASON(PKCS12_R_CANT_PACK_STRUCTURE), "cant pack structure"}, |
75 | {ERR_REASON(PKCS12_R_CONTENT_TYPE_NOT_DATA), "content type not data"}, | 77 | {ERR_REASON(PKCS12_R_CONTENT_TYPE_NOT_DATA), "content type not data"}, |
76 | {ERR_REASON(PKCS12_R_DECODE_ERROR) , "decode error"}, | 78 | {ERR_REASON(PKCS12_R_DECODE_ERROR) , "decode error"}, |
@@ -103,8 +105,8 @@ ERR_load_PKCS12_strings(void) | |||
103 | { | 105 | { |
104 | #ifndef OPENSSL_NO_ERR | 106 | #ifndef OPENSSL_NO_ERR |
105 | if (ERR_func_error_string(PKCS12_str_functs[0].error) == NULL) { | 107 | if (ERR_func_error_string(PKCS12_str_functs[0].error) == NULL) { |
106 | ERR_load_strings(0, PKCS12_str_functs); | 108 | ERR_load_const_strings(PKCS12_str_functs); |
107 | ERR_load_strings(0, PKCS12_str_reasons); | 109 | ERR_load_const_strings(PKCS12_str_reasons); |
108 | } | 110 | } |
109 | #endif | 111 | #endif |
110 | } | 112 | } |
diff --git a/src/lib/libcrypto/pkcs7/pkcs7err.c b/src/lib/libcrypto/pkcs7/pkcs7err.c index d3ca0ec6df..d4e6d7cf77 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7err.c +++ b/src/lib/libcrypto/pkcs7/pkcs7err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs7err.c,v 1.15 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: pkcs7err.c,v 1.16 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/pkcs7.h> | 61 | #include <openssl/pkcs7.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA PKCS7_str_functs[]= { | 70 | static const ERR_STRING_DATA PKCS7_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA PKCS7_str_reasons[]= { | 75 | static const ERR_STRING_DATA PKCS7_str_reasons[] = { |
74 | {ERR_REASON(PKCS7_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, | 76 | {ERR_REASON(PKCS7_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, |
75 | {ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER), "cipher has no object identifier"}, | 77 | {ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER), "cipher has no object identifier"}, |
76 | {ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED), "cipher not initialized"}, | 78 | {ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED), "cipher not initialized"}, |
@@ -135,8 +137,8 @@ ERR_load_PKCS7_strings(void) | |||
135 | { | 137 | { |
136 | #ifndef OPENSSL_NO_ERR | 138 | #ifndef OPENSSL_NO_ERR |
137 | if (ERR_func_error_string(PKCS7_str_functs[0].error) == NULL) { | 139 | if (ERR_func_error_string(PKCS7_str_functs[0].error) == NULL) { |
138 | ERR_load_strings(0, PKCS7_str_functs); | 140 | ERR_load_const_strings(PKCS7_str_functs); |
139 | ERR_load_strings(0, PKCS7_str_reasons); | 141 | ERR_load_const_strings(PKCS7_str_reasons); |
140 | } | 142 | } |
141 | #endif | 143 | #endif |
142 | } | 144 | } |
diff --git a/src/lib/libcrypto/rand/rand_err.c b/src/lib/libcrypto/rand/rand_err.c index b156c0c87c..1f0e251207 100644 --- a/src/lib/libcrypto/rand/rand_err.c +++ b/src/lib/libcrypto/rand/rand_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rand_err.c,v 1.17 2023/07/07 12:01:32 beck Exp $ */ | 1 | /* $OpenBSD: rand_err.c,v 1.18 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/rand.h> | 61 | #include <openssl/rand.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA RAND_str_functs[] = { | 70 | static const ERR_STRING_DATA RAND_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA RAND_str_reasons[] = { | 75 | static const ERR_STRING_DATA RAND_str_reasons[] = { |
74 | {ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED), "dual ec drbg disabled"}, | 76 | {ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED), "dual ec drbg disabled"}, |
75 | {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG), "error initialising drbg"}, | 77 | {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG), "error initialising drbg"}, |
76 | {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG), "error instantiating drbg"}, | 78 | {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG), "error instantiating drbg"}, |
@@ -86,8 +88,8 @@ ERR_load_RAND_strings(void) | |||
86 | { | 88 | { |
87 | #ifndef OPENSSL_NO_ERR | 89 | #ifndef OPENSSL_NO_ERR |
88 | if (ERR_func_error_string(RAND_str_functs[0].error) == NULL) { | 90 | if (ERR_func_error_string(RAND_str_functs[0].error) == NULL) { |
89 | ERR_load_strings(0, RAND_str_functs); | 91 | ERR_load_const_strings(RAND_str_functs); |
90 | ERR_load_strings(0, RAND_str_reasons); | 92 | ERR_load_const_strings(RAND_str_reasons); |
91 | } | 93 | } |
92 | #endif | 94 | #endif |
93 | } | 95 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_err.c b/src/lib/libcrypto/rsa/rsa_err.c index 8b54168900..934a59f663 100644 --- a/src/lib/libcrypto/rsa/rsa_err.c +++ b/src/lib/libcrypto/rsa/rsa_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_err.c,v 1.22 2023/07/08 12:26:45 beck Exp $ */ | 1 | /* $OpenBSD: rsa_err.c,v 1.23 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/rsa.h> | 61 | #include <openssl/rsa.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA RSA_str_functs[] = { | 70 | static const ERR_STRING_DATA RSA_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA RSA_str_reasons[] = { | 75 | static const ERR_STRING_DATA RSA_str_reasons[] = { |
74 | {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) , "algorithm mismatch"}, | 76 | {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) , "algorithm mismatch"}, |
75 | {ERR_REASON(RSA_R_BAD_E_VALUE) , "bad e value"}, | 77 | {ERR_REASON(RSA_R_BAD_E_VALUE) , "bad e value"}, |
76 | {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT), "bad fixed header decrypt"}, | 78 | {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT), "bad fixed header decrypt"}, |
@@ -150,8 +152,8 @@ ERR_load_RSA_strings(void) | |||
150 | { | 152 | { |
151 | #ifndef OPENSSL_NO_ERR | 153 | #ifndef OPENSSL_NO_ERR |
152 | if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) { | 154 | if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) { |
153 | ERR_load_strings(0, RSA_str_functs); | 155 | ERR_load_const_strings(RSA_str_functs); |
154 | ERR_load_strings(0, RSA_str_reasons); | 156 | ERR_load_const_strings(RSA_str_reasons); |
155 | } | 157 | } |
156 | #endif | 158 | #endif |
157 | } | 159 | } |
diff --git a/src/lib/libcrypto/ts/ts_err.c b/src/lib/libcrypto/ts/ts_err.c index bb8209a85c..c0dcc73099 100644 --- a/src/lib/libcrypto/ts/ts_err.c +++ b/src/lib/libcrypto/ts/ts_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ts_err.c,v 1.7 2023/07/07 07:25:21 beck Exp $ */ | 1 | /* $OpenBSD: ts_err.c,v 1.8 2024/06/24 06:43:22 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/ts.h> | 61 | #include <openssl/ts.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA TS_str_functs[] = { | 70 | static const ERR_STRING_DATA TS_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA TS_str_reasons[]= { | 75 | static const ERR_STRING_DATA TS_str_reasons[] = { |
74 | {ERR_REASON(TS_R_BAD_PKCS7_TYPE) , "bad pkcs7 type"}, | 76 | {ERR_REASON(TS_R_BAD_PKCS7_TYPE) , "bad pkcs7 type"}, |
75 | {ERR_REASON(TS_R_BAD_TYPE) , "bad type"}, | 77 | {ERR_REASON(TS_R_BAD_TYPE) , "bad type"}, |
76 | {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, | 78 | {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, |
@@ -116,8 +118,8 @@ ERR_load_TS_strings(void) | |||
116 | { | 118 | { |
117 | #ifndef OPENSSL_NO_ERR | 119 | #ifndef OPENSSL_NO_ERR |
118 | if (ERR_func_error_string(TS_str_functs[0].error) == NULL) { | 120 | if (ERR_func_error_string(TS_str_functs[0].error) == NULL) { |
119 | ERR_load_strings(0, TS_str_functs); | 121 | ERR_load_const_strings(TS_str_functs); |
120 | ERR_load_strings(0, TS_str_reasons); | 122 | ERR_load_const_strings(TS_str_reasons); |
121 | } | 123 | } |
122 | #endif | 124 | #endif |
123 | } | 125 | } |
diff --git a/src/lib/libcrypto/ui/ui_err.c b/src/lib/libcrypto/ui/ui_err.c index 3f875da776..656fa42887 100644 --- a/src/lib/libcrypto/ui/ui_err.c +++ b/src/lib/libcrypto/ui/ui_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ui_err.c,v 1.12 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: ui_err.c,v 1.13 2024/06/24 06:43:23 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -60,17 +60,19 @@ | |||
60 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
61 | #include <openssl/ui.h> | 61 | #include <openssl/ui.h> |
62 | 62 | ||
63 | #include "err_local.h" | ||
64 | |||
63 | #ifndef OPENSSL_NO_ERR | 65 | #ifndef OPENSSL_NO_ERR |
64 | 66 | ||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0) | 67 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason) | 68 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason) |
67 | 69 | ||
68 | static ERR_STRING_DATA UI_str_functs[] = { | 70 | static const ERR_STRING_DATA UI_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 71 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 72 | {0, NULL} |
71 | }; | 73 | }; |
72 | 74 | ||
73 | static ERR_STRING_DATA UI_str_reasons[] = { | 75 | static const ERR_STRING_DATA UI_str_reasons[] = { |
74 | {ERR_REASON(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS), "common ok and cancel characters"}, | 76 | {ERR_REASON(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS), "common ok and cancel characters"}, |
75 | {ERR_REASON(UI_R_INDEX_TOO_LARGE), "index too large"}, | 77 | {ERR_REASON(UI_R_INDEX_TOO_LARGE), "index too large"}, |
76 | {ERR_REASON(UI_R_INDEX_TOO_SMALL), "index too small"}, | 78 | {ERR_REASON(UI_R_INDEX_TOO_SMALL), "index too small"}, |
@@ -88,8 +90,8 @@ ERR_load_UI_strings(void) | |||
88 | { | 90 | { |
89 | #ifndef OPENSSL_NO_ERR | 91 | #ifndef OPENSSL_NO_ERR |
90 | if (ERR_func_error_string(UI_str_functs[0].error) == NULL) { | 92 | if (ERR_func_error_string(UI_str_functs[0].error) == NULL) { |
91 | ERR_load_strings(0, UI_str_functs); | 93 | ERR_load_const_strings(UI_str_functs); |
92 | ERR_load_strings(0, UI_str_reasons); | 94 | ERR_load_const_strings(UI_str_reasons); |
93 | } | 95 | } |
94 | #endif | 96 | #endif |
95 | } | 97 | } |
diff --git a/src/lib/libcrypto/x509/x509_err.c b/src/lib/libcrypto/x509/x509_err.c index 2cbd349350..cff045b105 100644 --- a/src/lib/libcrypto/x509/x509_err.c +++ b/src/lib/libcrypto/x509/x509_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_err.c,v 1.22 2023/05/14 17:20:26 tb Exp $ */ | 1 | /* $OpenBSD: x509_err.c,v 1.23 2024/06/24 06:43:23 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -61,17 +61,19 @@ | |||
61 | #include <openssl/x509.h> | 61 | #include <openssl/x509.h> |
62 | #include <openssl/x509v3.h> | 62 | #include <openssl/x509v3.h> |
63 | 63 | ||
64 | #include "err_local.h" | ||
65 | |||
64 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
65 | 67 | ||
66 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0) |
67 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason) |
68 | 70 | ||
69 | static ERR_STRING_DATA X509_str_functs[] = { | 71 | static const ERR_STRING_DATA X509_str_functs[] = { |
70 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 72 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
71 | {0, NULL} | 73 | {0, NULL} |
72 | }; | 74 | }; |
73 | 75 | ||
74 | static ERR_STRING_DATA X509_str_reasons[] = { | 76 | static const ERR_STRING_DATA X509_str_reasons[] = { |
75 | {ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"}, | 77 | {ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"}, |
76 | {ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"}, | 78 | {ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"}, |
77 | {ERR_REASON(X509_R_CANT_CHECK_DH_KEY) , "cant check dh key"}, | 79 | {ERR_REASON(X509_R_CANT_CHECK_DH_KEY) , "cant check dh key"}, |
@@ -108,12 +110,12 @@ static ERR_STRING_DATA X509_str_reasons[] = { | |||
108 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0) | 110 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0) |
109 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason) | 111 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason) |
110 | 112 | ||
111 | static ERR_STRING_DATA X509V3_str_functs[] = { | 113 | static const ERR_STRING_DATA X509V3_str_functs[] = { |
112 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 114 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
113 | {0, NULL} | 115 | {0, NULL} |
114 | }; | 116 | }; |
115 | 117 | ||
116 | static ERR_STRING_DATA X509V3_str_reasons[] = { | 118 | static const ERR_STRING_DATA X509V3_str_reasons[] = { |
117 | {ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"}, | 119 | {ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"}, |
118 | {ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"}, | 120 | {ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"}, |
119 | {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) , "bn dec2bn error"}, | 121 | {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) , "bn dec2bn error"}, |
@@ -192,8 +194,8 @@ ERR_load_X509_strings(void) | |||
192 | { | 194 | { |
193 | #ifndef OPENSSL_NO_ERR | 195 | #ifndef OPENSSL_NO_ERR |
194 | if (ERR_func_error_string(X509_str_functs[0].error) == NULL) { | 196 | if (ERR_func_error_string(X509_str_functs[0].error) == NULL) { |
195 | ERR_load_strings(0, X509_str_functs); | 197 | ERR_load_const_strings(X509_str_functs); |
196 | ERR_load_strings(0, X509_str_reasons); | 198 | ERR_load_const_strings(X509_str_reasons); |
197 | } | 199 | } |
198 | #endif | 200 | #endif |
199 | } | 201 | } |
@@ -205,8 +207,8 @@ ERR_load_X509V3_strings(void) | |||
205 | { | 207 | { |
206 | #ifndef OPENSSL_NO_ERR | 208 | #ifndef OPENSSL_NO_ERR |
207 | if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) { | 209 | if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) { |
208 | ERR_load_strings(0, X509V3_str_functs); | 210 | ERR_load_const_strings(X509V3_str_functs); |
209 | ERR_load_strings(0, X509V3_str_reasons); | 211 | ERR_load_const_strings(X509V3_str_reasons); |
210 | } | 212 | } |
211 | #endif | 213 | #endif |
212 | } | 214 | } |