aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2019-06-25 01:37:07 +1000
committerPauli <paul.dale@oracle.com>2019-06-26 16:33:41 +1000
commitedc62356485257a37eb8775f25c5a19345b83a50 (patch)
tree5fe9d21c901fb2d1ad9851237a4776f42d190003
parent10c25644e362381844e0089504f0db42f029d855 (diff)
downloadopenssl-edc62356485257a37eb8775f25c5a19345b83a50.zip
openssl-edc62356485257a37eb8775f25c5a19345b83a50.tar.gz
openssl-edc62356485257a37eb8775f25c5a19345b83a50.tar.bz2
The params_test uses wrong size for BN check.
Before the return size was included in the OSSL_PARAM structure, the size global was updated via a pointer. The size global variable has been removed and the in structure return size used instead. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9248)
-rw-r--r--test/params_test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/params_test.c b/test/params_test.c
index 64fd4b8..50beb17 100644
--- a/test/params_test.c
+++ b/test/params_test.c
@@ -304,7 +304,6 @@ static int app_p1; /* "p1" */
static double app_p2; /* "p2" is ignored */
static BIGNUM *app_p3 = NULL; /* "p3" */
static unsigned char bignumbin[4096]; /* "p3" */
-static size_t bignumbin_l; /* "p3" */
static char app_p4[256]; /* "p4" */
static char app_p5[256]; /* "p5" */
static const char *app_p6 = NULL; /* "p6" */
@@ -336,7 +335,6 @@ static int init_app_variables(void)
if (!BN_hex2bn(&app_p3, app_p3_init)
|| (l = BN_bn2nativepad(app_p3, bignumbin, sizeof(bignumbin))) < 0)
return 0;
- bignumbin_l = (size_t)l;
strcpy(app_p4, app_p4_init);
strcpy(app_p5, app_p5_init);
app_p6 = app_p6_init;
@@ -458,7 +456,8 @@ static int test_case_variant(OSSL_PARAM *params, const struct provider_dispatch_
if (!TEST_true(prov->get_params(obj, params))
|| !TEST_int_eq(app_p1, p1_init) /* "provider" value */
|| !TEST_double_eq(app_p2, app_p2_init) /* Should remain untouched */
- || !TEST_ptr(BN_native2bn(bignumbin, bignumbin_l, app_p3))
+ || !TEST_ptr(p = OSSL_PARAM_locate(params, "p3"))
+ || !TEST_ptr(BN_native2bn(bignumbin, p->return_size, app_p3))
|| !TEST_BN_eq(app_p3, verify_p3) /* "provider" value */
|| !TEST_str_eq(app_p4, p4_init) /* "provider" value */
|| !TEST_ptr(p = OSSL_PARAM_locate(params, "p5"))
@@ -507,7 +506,8 @@ static int test_case_variant(OSSL_PARAM *params, const struct provider_dispatch_
if (!TEST_true(prov->get_params(obj, params))
|| !TEST_int_eq(app_p1, app_p1_init) /* app value */
|| !TEST_double_eq(app_p2, app_p2_init) /* Should remain untouched */
- || !TEST_ptr(BN_native2bn(bignumbin, bignumbin_l, app_p3))
+ || !TEST_ptr(p = OSSL_PARAM_locate(params, "p3"))
+ || !TEST_ptr(BN_native2bn(bignumbin, p->return_size, app_p3))
|| !TEST_BN_eq(app_p3, verify_p3) /* app value */
|| !TEST_str_eq(app_p4, app_p4_init) /* app value */
|| !TEST_ptr(p = OSSL_PARAM_locate(params, "p5"))