From 4c35a22e0aa22fc7904e65b389538eb96a82e37a Mon Sep 17 00:00:00 2001 From: jordan Date: Sat, 14 Jan 2023 23:04:29 -0600 Subject: [PATCH] Cleanup input checks. --- wolfcrypt/src/evp.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/wolfcrypt/src/evp.c b/wolfcrypt/src/evp.c index 334037915..5c4d2c09f 100644 --- a/wolfcrypt/src/evp.c +++ b/wolfcrypt/src/evp.c @@ -739,19 +739,23 @@ int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx, int fill; WOLFSSL_ENTER("wolfSSL_EVP_CipherUpdate"); - if (inl == 0 && in == NULL ) { - /* Nothing to do in this case. Just set outl to zero and return. */ - if (outl != NULL) { *outl = 0; } - return WOLFSSL_SUCCESS; - } - - if ((ctx == NULL) || (inl < 0) || (outl == NULL) || (in == NULL)) { + if ((ctx == NULL) || (outl == NULL)) { WOLFSSL_MSG("Bad argument"); return WOLFSSL_FAILURE; } *outl = 0; + if ((inl == 0) && (in == NULL)) { + /* Nothing to do in this case. Just return. */ + return WOLFSSL_SUCCESS; + } + + if ((inl < 0) || (in == NULL)) { + WOLFSSL_MSG("Bad argument"); + return WOLFSSL_FAILURE; + } + switch (ctx->cipherType) { #if !defined(NO_AES) && defined(HAVE_AESGCM) case AES_128_GCM_TYPE: