Properly check return type of DH_compute_key()
authorPascal Cuoq <cuoq@trust-in-soft.com>
Wed, 6 May 2015 07:55:28 +0000 (09:55 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Wed, 7 Oct 2015 16:54:12 +0000 (18:54 +0200)
It returns -1 on error, not 0.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
MR #1231

test/dhtest.c

index 9ce92ee392832b8f9b09c908fe69c4b5dbc66c49..896af851ce234cfae6bbd118573c1bc3b22af12a 100644 (file)
@@ -515,9 +515,9 @@ static int run_rfc5114_tests(void)
          * Work out shared secrets using both sides and compare with expected
          * values.
          */
-        if (!DH_compute_key(Z1, dhB->pub_key, dhA))
+        if (DH_compute_key(Z1, dhB->pub_key, dhA) == -1)
             goto bad_err;
-        if (!DH_compute_key(Z2, dhA->pub_key, dhB))
+        if (DH_compute_key(Z2, dhA->pub_key, dhB) == -1)
             goto bad_err;
 
         if (memcmp(Z1, td->Z, td->Z_len))