Remove an unneccessary check of cipher
authorMatt Caswell <matt@openssl.org>
Mon, 16 May 2016 13:56:53 +0000 (14:56 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 16 May 2016 19:28:03 +0000 (20:28 +0100)
Due to short-circuiting we only need to check "cipher" for NULL once.

PR#699

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/evp/evp_enc.c

index e02e801949c0eb883ad8def26f63875ec6dda2ed..ad64a74bb415165adf7b6466c58df03fba80dde1 100644 (file)
@@ -120,7 +120,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
      * reinitialisation, when it may all be unnecessary.
      */
     if (ctx->engine && ctx->cipher
-        && (!cipher || (cipher && (cipher->nid == ctx->cipher->nid))))
+        && (cipher == NULL || cipher->nid == ctx->cipher->nid))
         goto skip_to_init;
 #endif
     if (cipher) {