[openssl] master update

Dr. Paul Dale pauli at openssl.org
Sun Nov 7 22:53:22 UTC 2021


The branch master has been updated
       via  098f2627c8d283a518a6e6e60e7893664c7510e0 (commit)
      from  ab547fc005307ecf48451638e947cdabca147159 (commit)


- Log -----------------------------------------------------------------
commit 098f2627c8d283a518a6e6e60e7893664c7510e0
Author: PW Hu <jlu.hpw at foxmail.com>
Date:   Mon Nov 1 15:00:54 2021 +0800

    Fix incorrect return check of BN_bn2binpad
    
    Reviewed-by: Kurt Roeckx <kurt at roeckx.be>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16942)

-----------------------------------------------------------------------

Summary of changes:
 crypto/ec/ec_deprecated.c | 2 +-
 test/acvp_test.c          | 2 +-
 test/ecdsatest.c          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/ec/ec_deprecated.c b/crypto/ec/ec_deprecated.c
index cd2eec80b7..22ddb3660c 100644
--- a/crypto/ec/ec_deprecated.c
+++ b/crypto/ec/ec_deprecated.c
@@ -52,7 +52,7 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group,
         return NULL;
     }
 
-    if (!BN_bn2binpad(bn, buf, buf_len)) {
+    if (BN_bn2binpad(bn, buf, buf_len) < 0) {
         OPENSSL_free(buf);
         return NULL;
     }
diff --git a/test/acvp_test.c b/test/acvp_test.c
index 6512a6ec35..4b6632e689 100644
--- a/test/acvp_test.c
+++ b/test/acvp_test.c
@@ -71,7 +71,7 @@ static int pkey_get_bn_bytes(EVP_PKEY *pkey, const char *name,
     buf = OPENSSL_zalloc(sz);
     if (buf == NULL)
         goto err;
-    if (!BN_bn2binpad(bn, buf, sz))
+    if (BN_bn2binpad(bn, buf, sz) <= 0)
         goto err;
 
     *out_len = sz;
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index c94d7d8dab..282b9660d3 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -46,7 +46,7 @@ static int fbytes(unsigned char *buf, size_t num, ossl_unused const char *name,
         || !TEST_true(BN_hex2bn(&tmp, numbers[fbytes_counter]))
         /* tmp might need leading zeros so pad it out */
         || !TEST_int_le(BN_num_bytes(tmp), num)
-        || !TEST_true(BN_bn2binpad(tmp, buf, num)))
+        || !TEST_int_gt(BN_bn2binpad(tmp, buf, num), 0))
         goto err;
 
     fbytes_counter = (fbytes_counter + 1) % OSSL_NELEM(numbers);


More information about the openssl-commits mailing list