Remove some logically dead code
authorMatt Caswell <matt@openssl.org>
Tue, 29 May 2018 13:33:12 +0000 (14:33 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 31 May 2018 09:38:51 +0000 (10:38 +0100)
Issues found by Coverity

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)

crypto/ec/ec_pmeth.c

index 2fde4f7a5b9a952415ee417194cde65ef9a2a4dc..b4105c20f2c901579e00e00663cbbd29922285c5 100644 (file)
@@ -219,10 +219,8 @@ static int pkey_ecies_encrypt(EVP_PKEY_CTX *ctx,
 
         if (dctx->md)
             md_type = EVP_MD_type(dctx->md);
-        else if (ec_nid == NID_sm2)
-            md_type = NID_sm3;
         else
-            md_type = NID_sha256;
+            md_type = NID_sm3;
 
         if (out == NULL) {
             *outlen = SM2_ciphertext_size(ec, EVP_get_digestbynid(md_type),
@@ -259,13 +257,12 @@ static int pkey_ecies_decrypt(EVP_PKEY_CTX *ctx,
 
         if (dctx->md)
             md_type = EVP_MD_type(dctx->md);
-        else if (ec_nid == NID_sm2)
-            md_type = NID_sm3;
         else
-            md_type = NID_sha256;
+            md_type = NID_sm3;
 
         if (out == NULL) {
-            *outlen = SM2_plaintext_size(ec, EVP_get_digestbynid(md_type), inlen);
+            *outlen = SM2_plaintext_size(ec, EVP_get_digestbynid(md_type),
+                                         inlen);
             ret = 1;
         }
         else {