Return 0 on a non-matching kdf_type
authorMatt Caswell <matt@openssl.org>
Wed, 18 Apr 2018 11:03:41 +0000 (12:03 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 19 Apr 2018 07:49:40 +0000 (08:49 +0100)
If we have a non-matching kdf_type then pkey_dh_derive silently succeeds.
It should fail. This is a "should not happen" condition anyway so the
impact is negligible.

Fixes #2440

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

crypto/dh/dh_pmeth.c

index 6452482c87d2f954371f32657465363fdad2685e..926be98e7f37d90f6dc2f19877535983ac1801ab 100644 (file)
@@ -486,7 +486,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
         return ret;
     }
 #endif
-    return 1;
+    return 0;
 }
 
 const EVP_PKEY_METHOD dh_pkey_meth = {