diff options
author | tb <> | 2024-05-19 08:21:13 +0000 |
---|---|---|
committer | tb <> | 2024-05-19 08:21:13 +0000 |
commit | 5d8b063a65cec87945b14d627948eb5a62d57529 (patch) | |
tree | 679ac206baac91399db8c157674af3c8a4d90f2b /src | |
parent | 05e553f5567082e370f1d32138837e1813d2256d (diff) | |
download | openbsd-5d8b063a65cec87945b14d627948eb5a62d57529.tar.gz openbsd-5d8b063a65cec87945b14d627948eb5a62d57529.tar.bz2 openbsd-5d8b063a65cec87945b14d627948eb5a62d57529.zip |
KNF for dh_err and dsa_err
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/dh/dh_err.c | 72 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_err.c | 50 |
2 files changed, 59 insertions, 63 deletions
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index f5dda2898d..df15a85b40 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.19 2023/07/08 15:29:03 beck Exp $ */ | 1 | /* $OpenBSD: dh_err.c,v 1.20 2024/05/19 08:21:13 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 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -65,50 +65,48 @@ | |||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0) | 65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason) | 66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason) |
67 | 67 | ||
68 | static ERR_STRING_DATA DH_str_functs[]= { | 68 | static ERR_STRING_DATA DH_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 70 | {0, NULL} |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static ERR_STRING_DATA DH_str_reasons[]= | 73 | static ERR_STRING_DATA DH_str_reasons[] = { |
74 | { | 74 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, |
75 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, | 75 | {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, |
76 | {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, | 76 | {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, |
77 | {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, | 77 | {ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"}, |
78 | {ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"}, | 78 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, |
79 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, | 79 | {ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"}, |
80 | {ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"}, | 80 | {ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, |
81 | {ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 81 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
82 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 82 | {ERR_REASON(DH_R_NON_FIPS_METHOD) ,"non fips method"}, |
83 | {ERR_REASON(DH_R_NON_FIPS_METHOD) ,"non fips method"}, | 83 | {ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"}, |
84 | {ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"}, | 84 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, |
85 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, | 85 | {ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, |
86 | {ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, | 86 | {ERR_REASON(DH_R_CHECK_INVALID_J_VALUE) ,"check invalid j value"}, |
87 | {ERR_REASON(DH_R_CHECK_INVALID_J_VALUE) ,"check invalid j value"}, | 87 | {ERR_REASON(DH_R_CHECK_INVALID_Q_VALUE) ,"check invalid q value"}, |
88 | {ERR_REASON(DH_R_CHECK_INVALID_Q_VALUE) ,"check invalid q value"}, | 88 | {ERR_REASON(DH_R_CHECK_PUBKEY_INVALID) ,"check pubkey invalid"}, |
89 | {ERR_REASON(DH_R_CHECK_PUBKEY_INVALID) ,"check pubkey invalid"}, | 89 | {ERR_REASON(DH_R_CHECK_PUBKEY_TOO_LARGE) ,"check pubkey too large"}, |
90 | {ERR_REASON(DH_R_CHECK_PUBKEY_TOO_LARGE) ,"check pubkey too large"}, | 90 | {ERR_REASON(DH_R_CHECK_PUBKEY_TOO_SMALL) ,"check pubkey too small"}, |
91 | {ERR_REASON(DH_R_CHECK_PUBKEY_TOO_SMALL) ,"check pubkey too small"}, | 91 | {ERR_REASON(DH_R_CHECK_P_NOT_PRIME) ,"check p not prime"}, |
92 | {ERR_REASON(DH_R_CHECK_P_NOT_PRIME) ,"check p not prime"}, | 92 | {ERR_REASON(DH_R_CHECK_P_NOT_SAFE_PRIME) ,"check p not safe prime"}, |
93 | {ERR_REASON(DH_R_CHECK_P_NOT_SAFE_PRIME) ,"check p not safe prime"}, | 93 | {ERR_REASON(DH_R_CHECK_Q_NOT_PRIME) ,"check q not prime"}, |
94 | {ERR_REASON(DH_R_CHECK_Q_NOT_PRIME) ,"check q not prime"}, | 94 | {ERR_REASON(DH_R_MISSING_PUBKEY) ,"missing pubkey"}, |
95 | {ERR_REASON(DH_R_MISSING_PUBKEY) ,"missing pubkey"}, | 95 | {ERR_REASON(DH_R_NOT_SUITABLE_GENERATOR) ,"not suitable generator"}, |
96 | {ERR_REASON(DH_R_NOT_SUITABLE_GENERATOR) ,"not suitable generator"}, | 96 | {ERR_REASON(DH_R_UNABLE_TO_CHECK_GENERATOR),"unable to check generator"}, |
97 | {ERR_REASON(DH_R_UNABLE_TO_CHECK_GENERATOR),"unable to check generator"}, | 97 | {0,NULL} |
98 | {0,NULL} | 98 | }; |
99 | }; | ||
100 | 99 | ||
101 | #endif | 100 | #endif |
102 | 101 | ||
103 | void ERR_load_DH_strings(void) | 102 | void |
104 | { | 103 | ERR_load_DH_strings(void) |
104 | { | ||
105 | #ifndef OPENSSL_NO_ERR | 105 | #ifndef OPENSSL_NO_ERR |
106 | 106 | if (ERR_func_error_string(DH_str_functs[0].error) == NULL) { | |
107 | if (ERR_func_error_string(DH_str_functs[0].error) == NULL) | ||
108 | { | ||
109 | ERR_load_strings(0,DH_str_functs); | 107 | ERR_load_strings(0,DH_str_functs); |
110 | ERR_load_strings(0,DH_str_reasons); | 108 | ERR_load_strings(0,DH_str_reasons); |
111 | } | ||
112 | #endif | ||
113 | } | 109 | } |
110 | #endif | ||
111 | } | ||
114 | LCRYPTO_ALIAS(ERR_load_DH_strings); | 112 | LCRYPTO_ALIAS(ERR_load_DH_strings); |
diff --git a/src/lib/libcrypto/dsa/dsa_err.c b/src/lib/libcrypto/dsa/dsa_err.c index 6934fe14f0..8effa58a48 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.19 2023/07/08 14:28:15 beck Exp $ */ | 1 | /* $OpenBSD: dsa_err.c,v 1.20 2024/05/19 08:21:13 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 | * |
@@ -65,40 +65,38 @@ | |||
65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) | 65 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) |
66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) | 66 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) |
67 | 67 | ||
68 | static ERR_STRING_DATA DSA_str_functs[]= { | 68 | static ERR_STRING_DATA DSA_str_functs[] = { |
69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, | 69 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
70 | {0, NULL} | 70 | {0, NULL} |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static ERR_STRING_DATA DSA_str_reasons[]= | 73 | static ERR_STRING_DATA DSA_str_reasons[] = { |
74 | { | 74 | {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, |
75 | {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, | 75 | {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, |
76 | {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, | 76 | {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, |
77 | {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, | 77 | {ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, |
78 | {ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, | 78 | {ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"}, |
79 | {ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"}, | 79 | {ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"}, |
80 | {ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"}, | 80 | {ERR_REASON(DSA_R_INVALID_PARAMETERS) ,"invalid parameters"}, |
81 | {ERR_REASON(DSA_R_INVALID_PARAMETERS) ,"invalid parameters"}, | 81 | {ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, |
82 | {ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, | 82 | {ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
83 | {ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 83 | {ERR_REASON(DSA_R_NEED_NEW_SETUP_VALUES) ,"need new setup values"}, |
84 | {ERR_REASON(DSA_R_NEED_NEW_SETUP_VALUES) ,"need new setup values"}, | 84 | {ERR_REASON(DSA_R_NON_FIPS_DSA_METHOD) ,"non fips dsa method"}, |
85 | {ERR_REASON(DSA_R_NON_FIPS_DSA_METHOD) ,"non fips dsa method"}, | 85 | {ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"}, |
86 | {ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"}, | 86 | {ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, |
87 | {ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, | 87 | {0,NULL} |
88 | {0,NULL} | 88 | }; |
89 | }; | ||
90 | 89 | ||
91 | #endif | 90 | #endif |
92 | 91 | ||
93 | void ERR_load_DSA_strings(void) | 92 | void |
94 | { | 93 | ERR_load_DSA_strings(void) |
94 | { | ||
95 | #ifndef OPENSSL_NO_ERR | 95 | #ifndef OPENSSL_NO_ERR |
96 | 96 | if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) { | |
97 | if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) | ||
98 | { | ||
99 | ERR_load_strings(0,DSA_str_functs); | 97 | ERR_load_strings(0,DSA_str_functs); |
100 | ERR_load_strings(0,DSA_str_reasons); | 98 | ERR_load_strings(0,DSA_str_reasons); |
101 | } | ||
102 | #endif | ||
103 | } | 99 | } |
100 | #endif | ||
101 | } | ||
104 | LCRYPTO_ALIAS(ERR_load_DSA_strings); | 102 | LCRYPTO_ALIAS(ERR_load_DSA_strings); |