Fix remaining error code discrepancies.

This commit is contained in:
Dr. Stephen Henson
2007-08-14 16:00:52 +00:00
parent 02e483d236
commit 4742bc0f6f
14 changed files with 33 additions and 18 deletions

View File

@@ -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. * others will be displayed numerically by ERR_error_string.
* It is crucial that we have something for each reason code * It is crucial that we have something for each reason code
* that occurs in ERR_str_reasons, or bogus reason strings * 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. */ * value and never one of those 'standard' reason codes. */
static void build_SYS_str_reasons(void) static void build_SYS_str_reasons(void)

View File

@@ -135,7 +135,7 @@ static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *
{ {
if (!ENGINE_init(impl)) 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; return 0;
} }
} }
@@ -149,7 +149,7 @@ static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *
if(!d) if(!d)
{ {
/* Same comment from evp_enc.c */ /* 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; return 0;
} }
/* We'll use the ENGINE's private digest definition */ /* 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 else
if(!ctx->digest) 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 0;
} }
return 1; return 1;

View File

@@ -222,7 +222,7 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl)
{ {
if (!ENGINE_init(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; return 0;
} }
} }
@@ -236,7 +236,7 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl)
if(!d) if(!d)
{ {
/* Same comment from evp_enc.c */ /* 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; return 0;
} }
/* We'll use the ENGINE's private digest definition */ /* 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 else
if(!ctx->digest) 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 0;
} }
return 1; 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) if (!(type->flags & EVP_MD_FLAG_FIPS)
&& !(ctx->flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)) && !(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; ctx->digest = &bad_md;
return 0; return 0;
} }

View File

@@ -152,7 +152,7 @@ static int do_evp_enc_engine(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pcipher, EN
{ {
if (!ENGINE_init(impl)) 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; 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 * control history, is that we should at least
* be able to avoid using US mispellings of * be able to avoid using US mispellings of
* "initialisation"? */ * "initialisation"? */
EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR);
return 0; return 0;
} }
/* We'll use the ENGINE's private cipher definition */ /* We'll use the ENGINE's private cipher definition */
@@ -295,7 +295,7 @@ skip_to_init:
if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS) if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS)
& !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW)) & !(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 #if 0
ERR_add_error_data(2, "cipher=", ERR_add_error_data(2, "cipher=",
EVP_CIPHER_name(ctx->cipher)); EVP_CIPHER_name(ctx->cipher));

View File

@@ -956,6 +956,10 @@ void ERR_load_EVP_strings(void);
#define EVP_F_ALG_MODULE_INIT 138 #define EVP_F_ALG_MODULE_INIT 138
#define EVP_F_CAMELLIA_INIT_KEY 159 #define EVP_F_CAMELLIA_INIT_KEY 159
#define EVP_F_D2I_PKEY 100 #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_DSAPKEY2PKCS8 134
#define EVP_F_DSA_PKEY2PKCS8 135 #define EVP_F_DSA_PKEY2PKCS8 135
#define EVP_F_ECDSA_PKEY2PKCS8 129 #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_NO_VERIFY_FUNCTION_CONFIGURED 105
#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117
#define EVP_R_PUBLIC_KEY_NOT_RSA 106 #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_OPTION 149
#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 #define EVP_R_UNKNOWN_PBE_ALGORITHM 121
#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 #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_UNSUPPORTED_SALT_TYPE 126
#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
#define EVP_R_SEED_KEY_SETUP_FAILED 162
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -384,7 +384,7 @@ static int do_evp_enc_engine_full(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciphe
{ {
if (!ENGINE_init(impl)) 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; 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 * control history, is that we should at least
* be able to avoid using US mispellings of * be able to avoid using US mispellings of
* "initialisation"? */ * "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; return 0;
} }
/* We'll use the ENGINE's private cipher definition */ /* We'll use the ENGINE's private cipher definition */

View File

@@ -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_ALG_MODULE_INIT), "ALG_MODULE_INIT"},
{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"},
{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, {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_DSAPKEY2PKCS8), "DSAPKEY2PKCS8"},
{ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"}, {ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"},
{ERR_FUNC(EVP_F_ECDSA_PKEY2PKCS8), "ECDSA_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_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function configured"},
{ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"}, {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_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_OPTION) ,"unknown option"},
{ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"},
{ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"},

View File

@@ -137,8 +137,10 @@ void ERR_load_RAND_strings(void);
/* Error codes for the RAND functions. */ /* Error codes for the RAND functions. */
/* Function codes. */ /* Function codes. */
#define RAND_F_ENG_RAND_GET_RAND_METHOD 108
#define RAND_F_FIPS_RAND 103 #define RAND_F_FIPS_RAND 103
#define RAND_F_FIPS_RAND_BYTES 102 #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_RAND_SET_DT 106
#define RAND_F_FIPS_SET_DT 104 #define RAND_F_FIPS_SET_DT 104
#define RAND_F_FIPS_SET_PRNG_SEED 107 #define RAND_F_FIPS_SET_PRNG_SEED 107

View File

@@ -109,7 +109,7 @@ const RAND_METHOD *eng_RAND_get_rand_method(const RAND_METHOD **pmeth)
if(FIPS_mode() if(FIPS_mode()
&& *pmeth != FIPS_rand_check()) && *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; return 0;
} }

View File

@@ -70,8 +70,10 @@
static ERR_STRING_DATA RAND_str_functs[]= 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), "FIPS_RAND"},
{ERR_FUNC(RAND_F_FIPS_RAND_BYTES), "FIPS_RAND_BYTES"}, {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_RAND_SET_DT), "FIPS_RAND_SET_DT"},
{ERR_FUNC(RAND_F_FIPS_SET_DT), "FIPS_SET_DT"}, {ERR_FUNC(RAND_F_FIPS_SET_DT), "FIPS_SET_DT"},
{ERR_FUNC(RAND_F_FIPS_SET_PRNG_SEED), "FIPS_SET_PRNG_SEED"}, {ERR_FUNC(RAND_F_FIPS_SET_PRNG_SEED), "FIPS_SET_PRNG_SEED"},

View File

@@ -91,7 +91,7 @@ static const RAND_METHOD *fips_RAND_get_rand_method(const RAND_METHOD **pmeth)
if(FIPS_mode() if(FIPS_mode()
&& *pmeth != FIPS_rand_check()) && *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; return 0;
} }

View File

@@ -443,6 +443,7 @@ void ERR_load_RSA_strings(void);
#define RSA_F_RSA_PUBLIC_DECRYPT 138 #define RSA_F_RSA_PUBLIC_DECRYPT 138
#define RSA_F_RSA_SETUP_BLINDING 136 #define RSA_F_RSA_SETUP_BLINDING 136
#define RSA_F_RSA_SET_DEFAULT_METHOD 139 #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 117
#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
#define RSA_F_RSA_VERIFY 119 #define RSA_F_RSA_VERIFY 119

View File

@@ -121,7 +121,7 @@ int RSA_set_method(RSA *rsa, const RSA_METHOD *meth)
#ifdef OPENSSL_FIPS #ifdef OPENSSL_FIPS
if (FIPS_mode() && !(meth->flags & RSA_FLAG_FIPS_METHOD)) 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; return 0;
} }
#endif #endif
@@ -180,7 +180,7 @@ RSA *RSA_new_method(ENGINE *engine)
#ifdef OPENSSL_FIPS #ifdef OPENSSL_FIPS
if (FIPS_mode() && !(ret->meth->flags & RSA_FLAG_FIPS_METHOD)) 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 #ifndef OPENSSL_NO_ENGINE
if (ret->engine) if (ret->engine)
ENGINE_finish(ret->engine); ENGINE_finish(ret->engine);

View File

@@ -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_PUBLIC_DECRYPT), "RSA_public_decrypt"},
{ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, {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_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), "RSA_sign"},
{ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"},
{ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"},