summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPW Hu <jlu.hpw@foxmail.com>2021-11-01 15:00:54 +0800
committerPauli <pauli@openssl.org>2021-11-08 08:54:18 +1000
commitd8e830954fdb19ac4cec07c7e902562e290fbe05 (patch)
tree54ca59368edad79f13a15910cbb05da0933bf384 /test
parent0cb66d6bfeb7685f5776e1a93d716024fe678018 (diff)
Fix incorrect return check of BN_bn2binpad
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16942) (cherry picked from commit 098f2627c8d283a518a6e6e60e7893664c7510e0)
Diffstat (limited to 'test')
-rw-r--r--test/acvp_test.c2
-rw-r--r--test/ecdsatest.c2
2 files changed, 2 insertions, 2 deletions
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);