summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-05-14 17:20:27 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-05-14 17:20:27 +0000
commit7ed75e1709657a44b25e0a2a1c978153e0f6b357 (patch)
treef30d49d6e5810708c0ffe368fd5968c7361681d1 /lib
parentbff41515cf059a332a0ae07e5decfbba01c5b6a6 (diff)
Fix X509error() and X509V3error()
When v3err.c was merged into x509_err.c nearly three years ago, it was overlooked that the code needed two distinct pairs of ERR_FUNC/ERR_REASON, one for ERR_LIB_X509 and one for ERR_LIB_X509V3. The result is that the reason strings for the X509_R_* codes would be overwritten by the ones for X509V3_R_* with the same value while the reason strings for all X509V3_R_* would be left undefined. Fix this by an #undef/#define dance for ERR_LIB_X509V3 once we no longer the ERR_FUNC/ERR_REASON pair for ERR_LIB_X509. reported by job ok jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/x509/x509_err.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libcrypto/x509/x509_err.c b/lib/libcrypto/x509/x509_err.c
index bcb04f1fd88..2cbd349350c 100644
--- a/lib/libcrypto/x509/x509_err.c
+++ b/lib/libcrypto/x509/x509_err.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_err.c,v 1.21 2023/04/24 08:39:06 job Exp $ */
+/* $OpenBSD: x509_err.c,v 1.22 2023/05/14 17:20:26 tb Exp $ */
/* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
@@ -71,11 +71,6 @@ static ERR_STRING_DATA X509_str_functs[] = {
{0, NULL}
};
-static ERR_STRING_DATA X509V3_str_functs[] = {
- {ERR_FUNC(0xfff), "CRYPTO_internal"},
- {0, NULL}
-};
-
static ERR_STRING_DATA X509_str_reasons[] = {
{ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"},
{ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"},
@@ -108,6 +103,16 @@ static ERR_STRING_DATA X509_str_reasons[] = {
{0, NULL}
};
+#undef ERR_FUNC
+#undef ERR_REASON
+#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0)
+#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason)
+
+static ERR_STRING_DATA X509V3_str_functs[] = {
+ {ERR_FUNC(0xfff), "CRYPTO_internal"},
+ {0, NULL}
+};
+
static ERR_STRING_DATA X509V3_str_reasons[] = {
{ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"},
{ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"},