x509_err.c (583d8095) x509_err.c (3dca7526)
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/* ====================================================================
3 * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright

--- 46 unchanged lines hidden (view full) ---

56#include <stdio.h>
57
58#include <openssl/opensslconf.h>
59
60#include <openssl/err.h>
61#include <openssl/x509.h>
62#include <openssl/x509v3.h>
63
2/* ====================================================================
3 * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright

--- 46 unchanged lines hidden (view full) ---

56#include <stdio.h>
57
58#include <openssl/opensslconf.h>
59
60#include <openssl/err.h>
61#include <openssl/x509.h>
62#include <openssl/x509v3.h>
63
64#include "err_local.h"
65
64#ifndef OPENSSL_NO_ERR
65
66#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0)
67#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason)
68
66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason)
70
69static ERR_STRING_DATA X509_str_functs[] = {
71static const ERR_STRING_DATA X509_str_functs[] = {
70 {ERR_FUNC(0xfff), "CRYPTO_internal"},
71 {0, NULL}
72};
73
72 {ERR_FUNC(0xfff), "CRYPTO_internal"},
73 {0, NULL}
74};
75
74static ERR_STRING_DATA X509_str_reasons[] = {
76static const ERR_STRING_DATA X509_str_reasons[] = {
75 {ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"},
76 {ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"},
77 {ERR_REASON(X509_R_CANT_CHECK_DH_KEY) , "cant check dh key"},
78 {ERR_REASON(X509_R_CERT_ALREADY_IN_HASH_TABLE), "cert already in hash table"},
79 {ERR_REASON(X509_R_ERR_ASN1_LIB) , "err asn1 lib"},
80 {ERR_REASON(X509_R_INVALID_DIRECTORY) , "invalid directory"},
81 {ERR_REASON(X509_R_INVALID_FIELD_NAME) , "invalid field name"},
82 {ERR_REASON(X509_R_INVALID_TRUST) , "invalid trust"},

--- 20 unchanged lines hidden (view full) ---

103 {0, NULL}
104};
105
106#undef ERR_FUNC
107#undef ERR_REASON
108#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0)
109#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason)
110
77 {ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"},
78 {ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"},
79 {ERR_REASON(X509_R_CANT_CHECK_DH_KEY) , "cant check dh key"},
80 {ERR_REASON(X509_R_CERT_ALREADY_IN_HASH_TABLE), "cert already in hash table"},
81 {ERR_REASON(X509_R_ERR_ASN1_LIB) , "err asn1 lib"},
82 {ERR_REASON(X509_R_INVALID_DIRECTORY) , "invalid directory"},
83 {ERR_REASON(X509_R_INVALID_FIELD_NAME) , "invalid field name"},
84 {ERR_REASON(X509_R_INVALID_TRUST) , "invalid trust"},

--- 20 unchanged lines hidden (view full) ---

105 {0, NULL}
106};
107
108#undef ERR_FUNC
109#undef ERR_REASON
110#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0)
111#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason)
112
111static ERR_STRING_DATA X509V3_str_functs[] = {
113static const ERR_STRING_DATA X509V3_str_functs[] = {
112 {ERR_FUNC(0xfff), "CRYPTO_internal"},
113 {0, NULL}
114};
115
114 {ERR_FUNC(0xfff), "CRYPTO_internal"},
115 {0, NULL}
116};
117
116static ERR_STRING_DATA X509V3_str_reasons[] = {
118static const ERR_STRING_DATA X509V3_str_reasons[] = {
117 {ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"},
118 {ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"},
119 {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) , "bn dec2bn error"},
120 {ERR_REASON(X509V3_R_BN_TO_ASN1_INTEGER_ERROR), "bn to asn1 integer error"},
121 {ERR_REASON(X509V3_R_DIRNAME_ERROR) , "dirname error"},
122 {ERR_REASON(X509V3_R_DISTPOINT_ALREADY_SET), "distpoint already set"},
123 {ERR_REASON(X509V3_R_DUPLICATE_ZONE_ID) , "duplicate zone id"},
124 {ERR_REASON(X509V3_R_ERROR_CONVERTING_ZONE), "error converting zone"},

--- 62 unchanged lines hidden (view full) ---

187
188#endif
189
190void
191ERR_load_X509_strings(void)
192{
193#ifndef OPENSSL_NO_ERR
194 if (ERR_func_error_string(X509_str_functs[0].error) == NULL) {
119 {ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"},
120 {ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"},
121 {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) , "bn dec2bn error"},
122 {ERR_REASON(X509V3_R_BN_TO_ASN1_INTEGER_ERROR), "bn to asn1 integer error"},
123 {ERR_REASON(X509V3_R_DIRNAME_ERROR) , "dirname error"},
124 {ERR_REASON(X509V3_R_DISTPOINT_ALREADY_SET), "distpoint already set"},
125 {ERR_REASON(X509V3_R_DUPLICATE_ZONE_ID) , "duplicate zone id"},
126 {ERR_REASON(X509V3_R_ERROR_CONVERTING_ZONE), "error converting zone"},

--- 62 unchanged lines hidden (view full) ---

189
190#endif
191
192void
193ERR_load_X509_strings(void)
194{
195#ifndef OPENSSL_NO_ERR
196 if (ERR_func_error_string(X509_str_functs[0].error) == NULL) {
195 ERR_load_strings(0, X509_str_functs);
196 ERR_load_strings(0, X509_str_reasons);
197 ERR_load_const_strings(X509_str_functs);
198 ERR_load_const_strings(X509_str_reasons);
197 }
198#endif
199}
200LCRYPTO_ALIAS(ERR_load_X509_strings);
201
202
203void
204ERR_load_X509V3_strings(void)
205{
206#ifndef OPENSSL_NO_ERR
207 if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) {
199 }
200#endif
201}
202LCRYPTO_ALIAS(ERR_load_X509_strings);
203
204
205void
206ERR_load_X509V3_strings(void)
207{
208#ifndef OPENSSL_NO_ERR
209 if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) {
208 ERR_load_strings(0, X509V3_str_functs);
209 ERR_load_strings(0, X509V3_str_reasons);
210 ERR_load_const_strings(X509V3_str_functs);
211 ERR_load_const_strings(X509V3_str_reasons);
210 }
211#endif
212}
213LCRYPTO_ALIAS(ERR_load_X509V3_strings);
212 }
213#endif
214}
215LCRYPTO_ALIAS(ERR_load_X509V3_strings);