From bf23b9a163658496c3cabb1d0a00a88b94aede0a Mon Sep 17 00:00:00 2001 From: Pedro Monreal Date: Thu, 4 Mar 2021 17:01:50 +0100 Subject: Fix reason code: EVP_R_OPERATON_NOT_INITIALIZED Reviewed-by: Tomas Mraz Reviewed-by: Shane Lontis Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14429) --- crypto/err/openssl.txt | 2 +- crypto/evp/asymcipher.c | 4 ++-- crypto/evp/evp_err.c | 2 +- crypto/evp/exchange.c | 4 ++-- crypto/evp/kem.c | 4 ++-- crypto/evp/pmeth_gn.c | 6 +++--- crypto/evp/signature.c | 6 +++--- include/openssl/cryptoerr_legacy.h | 5 +++++ include/openssl/evperr.h | 2 +- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt index e9a179c362..53e8c4cd39 100644 --- a/crypto/err/openssl.txt +++ b/crypto/err/openssl.txt @@ -708,7 +708,7 @@ EVP_R_NULL_MAC_PKEY_CTX:208:null mac pkey ctx EVP_R_ONLY_ONESHOT_SUPPORTED:177:only oneshot supported EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE:150:\ operation not supported for this keytype -EVP_R_OPERATON_NOT_INITIALIZED:151:operation not initialized +EVP_R_OPERATION_NOT_INITIALIZED:151:operation not initialized EVP_R_OUTPUT_WOULD_OVERFLOW:202:output would overflow EVP_R_PARAMETER_TOO_LARGE:187:parameter too large EVP_R_PARTIALLY_OVERLAPPING:162:partially overlapping buffers diff --git a/crypto/evp/asymcipher.c b/crypto/evp/asymcipher.c index ee8e8662b0..221ceb038d 100644 --- a/crypto/evp/asymcipher.c +++ b/crypto/evp/asymcipher.c @@ -183,7 +183,7 @@ int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, } if (ctx->operation != EVP_PKEY_OP_ENCRYPT) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } @@ -220,7 +220,7 @@ int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, } if (ctx->operation != EVP_PKEY_OP_DECRYPT) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c index 5d9b82c289..850de00ca9 100644 --- a/crypto/evp/evp_err.c +++ b/crypto/evp/evp_err.c @@ -135,7 +135,7 @@ static const ERR_STRING_DATA EVP_str_reasons[] = { "only oneshot supported"}, {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE), "operation not supported for this keytype"}, - {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATON_NOT_INITIALIZED), + {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATION_NOT_INITIALIZED), "operation not initialized"}, {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OUTPUT_WOULD_OVERFLOW), "output would overflow"}, diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c index e0f15026c8..1a512c4283 100644 --- a/crypto/evp/exchange.c +++ b/crypto/evp/exchange.c @@ -359,7 +359,7 @@ int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer) if (ctx->operation != EVP_PKEY_OP_DERIVE && ctx->operation != EVP_PKEY_OP_ENCRYPT && ctx->operation != EVP_PKEY_OP_DECRYPT) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } @@ -419,7 +419,7 @@ int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *pkeylen) } if (!EVP_PKEY_CTX_IS_DERIVE_OP(ctx)) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } diff --git a/crypto/evp/kem.c b/crypto/evp/kem.c index e26c3502db..b784d28d1c 100644 --- a/crypto/evp/kem.c +++ b/crypto/evp/kem.c @@ -117,7 +117,7 @@ int EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx, return 0; if (ctx->operation != EVP_PKEY_OP_ENCAPSULATE) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } @@ -148,7 +148,7 @@ int EVP_PKEY_decapsulate(EVP_PKEY_CTX *ctx, return 0; if (ctx->operation != EVP_PKEY_OP_DECAPSULATE) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c index 1953e0f958..091d387795 100644 --- a/crypto/evp/pmeth_gn.c +++ b/crypto/evp/pmeth_gn.c @@ -244,7 +244,7 @@ int EVP_PKEY_gen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) ret = -2; goto end; not_initialized: - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); ret = -1; goto end; #ifndef FIPS_MODULE @@ -258,7 +258,7 @@ int EVP_PKEY_gen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) { if (ctx->operation != EVP_PKEY_OP_PARAMGEN) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } return EVP_PKEY_gen(ctx, ppkey); @@ -267,7 +267,7 @@ int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey) { if (ctx->operation != EVP_PKEY_OP_KEYGEN) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } return EVP_PKEY_gen(ctx, ppkey); diff --git a/crypto/evp/signature.c b/crypto/evp/signature.c index 277e972414..d6d96908ab 100644 --- a/crypto/evp/signature.c +++ b/crypto/evp/signature.c @@ -555,7 +555,7 @@ int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, } if (ctx->operation != EVP_PKEY_OP_SIGN) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } @@ -594,7 +594,7 @@ int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, } if (ctx->operation != EVP_PKEY_OP_VERIFY) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } @@ -631,7 +631,7 @@ int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, } if (ctx->operation != EVP_PKEY_OP_VERIFYRECOVER) { - ERR_raise(ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED); + ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_INITIALIZED); return -1; } diff --git a/include/openssl/cryptoerr_legacy.h b/include/openssl/cryptoerr_legacy.h index 34bb3dfd1e..6b78c5624c 100644 --- a/include/openssl/cryptoerr_legacy.h +++ b/include/openssl/cryptoerr_legacy.h @@ -1454,6 +1454,11 @@ OSSL_DEPRECATEDIN_3_0 int ERR_load_X509V3_strings(void); # define X509V3_F_X509_PURPOSE_ADD 0 # define X509V3_F_X509_PURPOSE_SET 0 +/* + * Compatibility defines. + */ +# define EVP_R_OPERATON_NOT_INITIALIZED EVP_R_OPERATION_NOT_INITIALIZED + # endif # ifdef __cplusplus diff --git a/include/openssl/evperr.h b/include/openssl/evperr.h index a96c684f1f..b2e08b14b6 100644 --- a/include/openssl/evperr.h +++ b/include/openssl/evperr.h @@ -96,7 +96,7 @@ # define EVP_R_NULL_MAC_PKEY_CTX 208 # define EVP_R_ONLY_ONESHOT_SUPPORTED 177 # define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 -# define EVP_R_OPERATON_NOT_INITIALIZED 151 +# define EVP_R_OPERATION_NOT_INITIALIZED 151 # define EVP_R_OUTPUT_WOULD_OVERFLOW 202 # define EVP_R_PARAMETER_TOO_LARGE 187 # define EVP_R_PARTIALLY_OVERLAPPING 162 -- cgit v1.2.3