From: Richard Levitte Date: Tue, 15 Oct 2019 14:45:12 +0000 (+0200) Subject: For provided ciphers, EVP_CIPHER_CTX_ctrl() with EVP_CTRL_INIT always returns 1 X-Git-Tag: openssl-3.0.0-alpha1~1133 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d6d74cf4a44f08ed63d942b103198a1e3294295a;p=oweals%2Fopenssl.git For provided ciphers, EVP_CIPHER_CTX_ctrl() with EVP_CTRL_INIT always returns 1 This control command should never be used with provided methods, but since this is publically available, someone might still make the mistake. We make sure it returns 1 so as not to be overly disruptive. Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/10163) --- diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 3f0e5a7e4a..86506d3a4c 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1089,8 +1089,16 @@ int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) ptr, sz); break; + case EVP_CTRL_INIT: + /* + * TODO(3.0) EVP_CTRL_INIT is purely legacy, no provider counterpart + * As a matter of fact, this should be dead code, but some caller + * might still do a direct control call with this command, so... + * Legacy methods return 1 except for exceptional circumstances, so + * we do the same here to not be disruptive. + */ + return 1; case EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS: /* Used by DASYNC */ - case EVP_CTRL_INIT: /* TODO(3.0) Purely legacy, no provider counterpart */ default: goto end; case EVP_CTRL_GET_IV: