From 4742bc0f6fdebbb5a15cc049001941fcf3a5a154 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Tue, 14 Aug 2007 16:00:52 +0000 Subject: [PATCH] Fix remaining error code discrepancies. --- crypto/err/err_str.c | 2 +- crypto/evp/dig_eng.c | 6 +++--- crypto/evp/digest.c | 8 ++++---- crypto/evp/enc_min.c | 6 +++--- crypto/evp/evp.h | 6 +++++- crypto/evp/evp_enc.c | 4 ++-- crypto/evp/evp_err.c | 5 +++++ crypto/rand/rand.h | 2 ++ crypto/rand/rand_eng.c | 2 +- crypto/rand/rand_err.c | 2 ++ crypto/rand/rand_lib.c | 2 +- crypto/rsa/rsa.h | 1 + crypto/rsa/rsa_eng.c | 4 ++-- crypto/rsa/rsa_err.c | 1 + 14 files changed, 33 insertions(+), 18 deletions(-) diff --git a/crypto/err/err_str.c b/crypto/err/err_str.c index bc448e647f..4c7807398f 100644 --- a/crypto/err/err_str.c +++ b/crypto/err/err_str.c @@ -223,7 +223,7 @@ static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1]; * others will be displayed numerically by ERR_error_string. * It is crucial that we have something for each reason code * that occurs in ERR_str_reasons, or bogus reason strings - * will be returned for SYSerr(), which always gets an errno + * will be returned for SYSerr, which always gets an errno * value and never one of those 'standard' reason codes. */ static void build_SYS_str_reasons(void) diff --git a/crypto/evp/dig_eng.c b/crypto/evp/dig_eng.c index 159b2f7c3c..64cdf9366c 100644 --- a/crypto/evp/dig_eng.c +++ b/crypto/evp/dig_eng.c @@ -135,7 +135,7 @@ static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE * { if (!ENGINE_init(impl)) { - EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_INITIALIZATION_ERROR); return 0; } } @@ -149,7 +149,7 @@ static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE * if(!d) { /* Same comment from evp_enc.c */ - EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_INITIALIZATION_ERROR); return 0; } /* We'll use the ENGINE's private digest definition */ @@ -165,7 +165,7 @@ static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE * else if(!ctx->digest) { - EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_NO_DIGEST_SET); + EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_NO_DIGEST_SET); return 0; } return 1; diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 89eda8fd10..19a558bdad 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -222,7 +222,7 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) { if (!ENGINE_init(impl)) { - EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_INITIALIZATION_ERROR); return 0; } } @@ -236,7 +236,7 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) if(!d) { /* Same comment from evp_enc.c */ - EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_INITIALIZATION_ERROR); return 0; } /* We'll use the ENGINE's private digest definition */ @@ -252,7 +252,7 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) else if(!ctx->digest) { - EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_NO_DIGEST_SET); + EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_NO_DIGEST_SET); return 0; } return 1; @@ -284,7 +284,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) if (!(type->flags & EVP_MD_FLAG_FIPS) && !(ctx->flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)) { - EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_DISABLED_FOR_FIPS); + EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_DISABLED_FOR_FIPS); ctx->digest = &bad_md; return 0; } diff --git a/crypto/evp/enc_min.c b/crypto/evp/enc_min.c index d1b14fafc5..b7b4d1cd48 100644 --- a/crypto/evp/enc_min.c +++ b/crypto/evp/enc_min.c @@ -152,7 +152,7 @@ static int do_evp_enc_engine(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pcipher, EN { if (!ENGINE_init(impl)) { - EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR); return 0; } } @@ -169,7 +169,7 @@ static int do_evp_enc_engine(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pcipher, EN * control history, is that we should at least * be able to avoid using US mispellings of * "initialisation"? */ - EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR); return 0; } /* We'll use the ENGINE's private cipher definition */ @@ -295,7 +295,7 @@ skip_to_init: if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS) & !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW)) { - EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_DISABLED_FOR_FIPS); + EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_DISABLED_FOR_FIPS); #if 0 ERR_add_error_data(2, "cipher=", EVP_CIPHER_name(ctx->cipher)); diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index b8efccae23..054902865b 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -956,6 +956,10 @@ void ERR_load_EVP_strings(void); #define EVP_F_ALG_MODULE_INIT 138 #define EVP_F_CAMELLIA_INIT_KEY 159 #define EVP_F_D2I_PKEY 100 +#define EVP_F_DO_EVP_ENC_ENGINE 140 +#define EVP_F_DO_EVP_ENC_ENGINE_FULL 141 +#define EVP_F_DO_EVP_MD_ENGINE 139 +#define EVP_F_DO_EVP_MD_ENGINE_FULL 142 #define EVP_F_DSAPKEY2PKCS8 134 #define EVP_F_DSA_PKEY2PKCS8 135 #define EVP_F_ECDSA_PKEY2PKCS8 129 @@ -1032,6 +1036,7 @@ void ERR_load_EVP_strings(void); #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 #define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_SEED_KEY_SETUP_FAILED 162 #define EVP_R_UNKNOWN_OPTION 149 #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 @@ -1044,7 +1049,6 @@ void ERR_load_EVP_strings(void); #define EVP_R_UNSUPPORTED_SALT_TYPE 126 #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 -#define EVP_R_SEED_KEY_SETUP_FAILED 162 #ifdef __cplusplus } diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index b685a5e99e..be63d605c4 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -384,7 +384,7 @@ static int do_evp_enc_engine_full(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciphe { if (!ENGINE_init(impl)) { - EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_ENC_ENGINE_FULL, EVP_R_INITIALIZATION_ERROR); return 0; } } @@ -401,7 +401,7 @@ static int do_evp_enc_engine_full(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciphe * control history, is that we should at least * be able to avoid using US mispellings of * "initialisation"? */ - EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); + EVPerr(EVP_F_DO_EVP_ENC_ENGINE_FULL, EVP_R_INITIALIZATION_ERROR); return 0; } /* We'll use the ENGINE's private cipher definition */ diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c index 69112804a9..b5b900d4fe 100644 --- a/crypto/evp/evp_err.c +++ b/crypto/evp/evp_err.c @@ -74,6 +74,10 @@ static ERR_STRING_DATA EVP_str_functs[]= {ERR_FUNC(EVP_F_ALG_MODULE_INIT), "ALG_MODULE_INIT"}, {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, +{ERR_FUNC(EVP_F_DO_EVP_ENC_ENGINE), "DO_EVP_ENC_ENGINE"}, +{ERR_FUNC(EVP_F_DO_EVP_ENC_ENGINE_FULL), "DO_EVP_ENC_ENGINE_FULL"}, +{ERR_FUNC(EVP_F_DO_EVP_MD_ENGINE), "DO_EVP_MD_ENGINE"}, +{ERR_FUNC(EVP_F_DO_EVP_MD_ENGINE_FULL), "DO_EVP_MD_ENGINE_FULL"}, {ERR_FUNC(EVP_F_DSAPKEY2PKCS8), "DSAPKEY2PKCS8"}, {ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"}, {ERR_FUNC(EVP_F_ECDSA_PKEY2PKCS8), "ECDSA_PKEY2PKCS8"}, @@ -153,6 +157,7 @@ static ERR_STRING_DATA EVP_str_reasons[]= {ERR_REASON(EVP_R_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function configured"}, {ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"}, {ERR_REASON(EVP_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"}, +{ERR_REASON(EVP_R_SEED_KEY_SETUP_FAILED) ,"seed key setup failed"}, {ERR_REASON(EVP_R_UNKNOWN_OPTION) ,"unknown option"}, {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, diff --git a/crypto/rand/rand.h b/crypto/rand/rand.h index cbf1b297b1..ea89153cba 100644 --- a/crypto/rand/rand.h +++ b/crypto/rand/rand.h @@ -137,8 +137,10 @@ void ERR_load_RAND_strings(void); /* Error codes for the RAND functions. */ /* Function codes. */ +#define RAND_F_ENG_RAND_GET_RAND_METHOD 108 #define RAND_F_FIPS_RAND 103 #define RAND_F_FIPS_RAND_BYTES 102 +#define RAND_F_FIPS_RAND_GET_RAND_METHOD 109 #define RAND_F_FIPS_RAND_SET_DT 106 #define RAND_F_FIPS_SET_DT 104 #define RAND_F_FIPS_SET_PRNG_SEED 107 diff --git a/crypto/rand/rand_eng.c b/crypto/rand/rand_eng.c index 222430e72a..1897d6db70 100644 --- a/crypto/rand/rand_eng.c +++ b/crypto/rand/rand_eng.c @@ -109,7 +109,7 @@ const RAND_METHOD *eng_RAND_get_rand_method(const RAND_METHOD **pmeth) if(FIPS_mode() && *pmeth != FIPS_rand_check()) { - RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); + RANDerr(RAND_F_ENG_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); return 0; } diff --git a/crypto/rand/rand_err.c b/crypto/rand/rand_err.c index 7fa27a5d43..829fb44d77 100644 --- a/crypto/rand/rand_err.c +++ b/crypto/rand/rand_err.c @@ -70,8 +70,10 @@ static ERR_STRING_DATA RAND_str_functs[]= { +{ERR_FUNC(RAND_F_ENG_RAND_GET_RAND_METHOD), "ENG_RAND_GET_RAND_METHOD"}, {ERR_FUNC(RAND_F_FIPS_RAND), "FIPS_RAND"}, {ERR_FUNC(RAND_F_FIPS_RAND_BYTES), "FIPS_RAND_BYTES"}, +{ERR_FUNC(RAND_F_FIPS_RAND_GET_RAND_METHOD), "FIPS_RAND_GET_RAND_METHOD"}, {ERR_FUNC(RAND_F_FIPS_RAND_SET_DT), "FIPS_RAND_SET_DT"}, {ERR_FUNC(RAND_F_FIPS_SET_DT), "FIPS_SET_DT"}, {ERR_FUNC(RAND_F_FIPS_SET_PRNG_SEED), "FIPS_SET_PRNG_SEED"}, diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index d4bb5765f7..105e4e07ad 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -91,7 +91,7 @@ static const RAND_METHOD *fips_RAND_get_rand_method(const RAND_METHOD **pmeth) if(FIPS_mode() && *pmeth != FIPS_rand_check()) { - RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); + RANDerr(RAND_F_FIPS_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); return 0; } diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h index e7a6a92c41..64d9d719b6 100644 --- a/crypto/rsa/rsa.h +++ b/crypto/rsa/rsa.h @@ -443,6 +443,7 @@ void ERR_load_RSA_strings(void); #define RSA_F_RSA_PUBLIC_DECRYPT 138 #define RSA_F_RSA_SETUP_BLINDING 136 #define RSA_F_RSA_SET_DEFAULT_METHOD 139 +#define RSA_F_RSA_SET_METHOD 142 #define RSA_F_RSA_SIGN 117 #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 #define RSA_F_RSA_VERIFY 119 diff --git a/crypto/rsa/rsa_eng.c b/crypto/rsa/rsa_eng.c index 03410423ff..383a7045b2 100644 --- a/crypto/rsa/rsa_eng.c +++ b/crypto/rsa/rsa_eng.c @@ -121,7 +121,7 @@ int RSA_set_method(RSA *rsa, const RSA_METHOD *meth) #ifdef OPENSSL_FIPS if (FIPS_mode() && !(meth->flags & RSA_FLAG_FIPS_METHOD)) { - RSAerr(RSA_F_RSA_SET_DEFAULT_METHOD, RSA_R_NON_FIPS_METHOD); + RSAerr(RSA_F_RSA_SET_METHOD, RSA_R_NON_FIPS_METHOD); return 0; } #endif @@ -180,7 +180,7 @@ RSA *RSA_new_method(ENGINE *engine) #ifdef OPENSSL_FIPS if (FIPS_mode() && !(ret->meth->flags & RSA_FLAG_FIPS_METHOD)) { - RSAerr(RSA_F_RSA_SET_DEFAULT_METHOD, RSA_R_NON_FIPS_METHOD); + RSAerr(RSA_F_RSA_NEW_METHOD, RSA_R_NON_FIPS_METHOD); #ifndef OPENSSL_NO_ENGINE if (ret->engine) ENGINE_finish(ret->engine); diff --git a/crypto/rsa/rsa_err.c b/crypto/rsa/rsa_err.c index 2b4dacb979..501f5ea389 100644 --- a/crypto/rsa/rsa_err.c +++ b/crypto/rsa/rsa_err.c @@ -107,6 +107,7 @@ static ERR_STRING_DATA RSA_str_functs[]= {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"}, {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, {ERR_FUNC(RSA_F_RSA_SET_DEFAULT_METHOD), "RSA_set_default_method"}, +{ERR_FUNC(RSA_F_RSA_SET_METHOD), "RSA_set_method"}, {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, -- 2.25.1