diff options
author | Matt Caswell <matt@openssl.org> | 2019-07-03 17:30:03 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-08-06 11:19:07 +0100 |
commit | a9612d6c034f47c4788c67d85651d0cd58c3faf7 (patch) | |
tree | b3af6481b8c7a2a50b8834c3cec70841ae739f95 /test | |
parent | c1a3f16f735057b45df1803d58f40e4e17b233e5 (diff) |
Make the EC code available from inside the FIPS provider
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/9380)
Diffstat (limited to 'test')
-rw-r--r-- | test/curve448_internal_test.c | 24 | ||||
-rw-r--r-- | test/ectest.c | 38 |
2 files changed, 31 insertions, 31 deletions
diff --git a/test/curve448_internal_test.c b/test/curve448_internal_test.c index 85c0b0e880..d3e3abab83 100644 --- a/test/curve448_internal_test.c +++ b/test/curve448_internal_test.c @@ -600,38 +600,38 @@ static int test_ed448(void) EVP_MD_CTX *hashctx = EVP_MD_CTX_new(); if (!TEST_ptr(hashctx) - || !TEST_true(ED448_sign(outsig, NULL, 0, pubkey1, privkey1, NULL, - 0)) + || !TEST_true(ED448_sign(NULL, outsig, NULL, 0, pubkey1, privkey1, + NULL, 0)) || !TEST_int_eq(memcmp(sig1, outsig, sizeof(sig1)), 0) - || !TEST_true(ED448_sign(outsig, msg2, sizeof(msg2), pubkey2, + || !TEST_true(ED448_sign(NULL, outsig, msg2, sizeof(msg2), pubkey2, privkey2, NULL, 0)) || !TEST_int_eq(memcmp(sig2, outsig, sizeof(sig2)), 0) - || !TEST_true(ED448_sign(outsig, msg3, sizeof(msg3), pubkey3, + || !TEST_true(ED448_sign(NULL, outsig, msg3, sizeof(msg3), pubkey3, privkey3, context3, sizeof(context3))) || !TEST_int_eq(memcmp(sig3, outsig, sizeof(sig3)), 0) - || !TEST_true(ED448_sign(outsig, msg4, sizeof(msg4), pubkey4, + || !TEST_true(ED448_sign(NULL, outsig, msg4, sizeof(msg4), pubkey4, privkey4, NULL, 0)) || !TEST_int_eq(memcmp(sig4, outsig, sizeof(sig4)), 0) - || !TEST_true(ED448_sign(outsig, msg5, sizeof(msg5), pubkey5, + || !TEST_true(ED448_sign(NULL, outsig, msg5, sizeof(msg5), pubkey5, privkey5, NULL, 0)) || !TEST_int_eq(memcmp(sig5, outsig, sizeof(sig5)), 0) - || !TEST_true(ED448_sign(outsig, msg6, sizeof(msg6), pubkey6, + || !TEST_true(ED448_sign(NULL, outsig, msg6, sizeof(msg6), pubkey6, privkey6, NULL, 0)) || !TEST_int_eq(memcmp(sig6, outsig, sizeof(sig6)), 0) - || !TEST_true(ED448_sign(outsig, msg7, sizeof(msg7), pubkey7, + || !TEST_true(ED448_sign(NULL, outsig, msg7, sizeof(msg7), pubkey7, privkey7, NULL, 0)) || !TEST_int_eq(memcmp(sig7, outsig, sizeof(sig7)), 0) - || !TEST_true(ED448_sign(outsig, msg8, sizeof(msg8), pubkey8, + || !TEST_true(ED448_sign(NULL, outsig, msg8, sizeof(msg8), pubkey8, privkey8, NULL, 0)) || !TEST_int_eq(memcmp(sig8, outsig, sizeof(sig8)), 0) - || !TEST_true(ED448_sign(outsig, msg9, sizeof(msg9), pubkey9, + || !TEST_true(ED448_sign(NULL, outsig, msg9, sizeof(msg9), pubkey9, privkey9, NULL, 0)) || !TEST_int_eq(memcmp(sig9, outsig, sizeof(sig9)), 0) - || !TEST_true(ED448ph_sign(outsig, dohash(hashctx, phmsg1, + || !TEST_true(ED448ph_sign(NULL, outsig, dohash(hashctx, phmsg1, sizeof(phmsg1)), phpubkey1, phprivkey1, NULL, 0)) || !TEST_int_eq(memcmp(phsig1, outsig, sizeof(phsig1)), 0) - || !TEST_true(ED448ph_sign(outsig, dohash(hashctx, phmsg2, + || !TEST_true(ED448ph_sign(NULL, outsig, dohash(hashctx, phmsg2, sizeof(phmsg2)), phpubkey2, phprivkey2, phcontext2, sizeof(phcontext2))) || !TEST_int_eq(memcmp(phsig2, outsig, sizeof(phsig2)), 0)) { diff --git a/test/ectest.c b/test/ectest.c index 43ac905a64..cfe6d869eb 100644 --- a/test/ectest.c +++ b/test/ectest.c @@ -1625,22 +1625,22 @@ static int check_named_curve_test(int id) } /* Passes because this is a valid curve */ - if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0), nid) + if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid) /* Only NIST curves pass */ - || !TEST_int_eq(EC_GROUP_check_named_curve(group, 1), + || !TEST_int_eq(EC_GROUP_check_named_curve(group, 1, NULL), EC_curve_nid2nist(nid) != NULL ? nid : NID_undef)) goto err; /* Fail if the curve name doesn't match the parameters */ EC_GROUP_set_curve_name(group, nid + 1); ERR_set_mark(); - if (!TEST_int_le(EC_GROUP_check_named_curve(group, 0), 0)) + if (!TEST_int_le(EC_GROUP_check_named_curve(group, 0, NULL), 0)) goto err; ERR_pop_to_mark(); /* Restore curve name and ensure it's passing */ EC_GROUP_set_curve_name(group, nid); - if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0), nid)) + if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid)) goto err; if (!TEST_int_eq(EC_GROUP_set_seed(group, invalid_seed, invalid_seed_len), @@ -1652,47 +1652,47 @@ static int check_named_curve_test(int id) * If the built-in curve has a seed and we set the seed to another value * then it will fail the check. */ - if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0), 0)) + if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), 0)) goto err; } else { /* * If the built-in curve does not have a seed then setting the seed will * pass the check (as the seed is optional). */ - if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0), nid)) + if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid)) goto err; } /* Pass if the seed is unknown (as it is optional) */ if (!TEST_int_eq(EC_GROUP_set_seed(group, NULL, 0), 1) - || !TEST_int_eq(EC_GROUP_check_named_curve(group, 0), nid)) + || !TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid)) goto err; /* Check that a duped group passes */ - if (!TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), nid)) + if (!TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), nid)) goto err; /* check that changing any generator parameter fails */ if (!TEST_true(EC_GROUP_set_generator(gtest, other_gen, group_order, group_cofactor)) - || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), 0) + || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), 0) || !TEST_true(EC_GROUP_set_generator(gtest, group_gen, other_order, group_cofactor)) - || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), 0) + || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), 0) /* The order is not an optional field, so this should fail */ || !TEST_true(EC_GROUP_set_generator(gtest, group_gen, NULL, group_cofactor)) - || !TEST_int_le(EC_GROUP_check_named_curve(gtest, 0), 0) + || !TEST_int_le(EC_GROUP_check_named_curve(gtest, 0, NULL), 0) || !TEST_true(EC_GROUP_set_generator(gtest, group_gen, group_order, other_cofactor)) - || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), 0) + || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), 0) /* Check that if the cofactor is not set then it still passes */ || !TEST_true(EC_GROUP_set_generator(gtest, group_gen, group_order, NULL)) - || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), nid) + || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), nid) /* check that restoring the generator passes */ || !TEST_true(EC_GROUP_set_generator(gtest, group_gen, group_order, group_cofactor)) - || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), nid)) + || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), nid)) goto err; /* @@ -1704,7 +1704,7 @@ static int check_named_curve_test(int id) */ ERR_set_mark(); if (EC_GROUP_set_curve(gtest, other_p, group_a, group_b, NULL)) { - if (!TEST_int_le(EC_GROUP_check_named_curve(gtest, 0), 0)) + if (!TEST_int_le(EC_GROUP_check_named_curve(gtest, 0, NULL), 0)) goto err; } else { /* clear the error stack if EC_GROUP_set_curve() failed */ @@ -1712,7 +1712,7 @@ static int check_named_curve_test(int id) ERR_set_mark(); } if (EC_GROUP_set_curve(gtest, group_p, other_a, group_b, NULL)) { - if (!TEST_int_le(EC_GROUP_check_named_curve(gtest, 0), 0)) + if (!TEST_int_le(EC_GROUP_check_named_curve(gtest, 0, NULL), 0)) goto err; } else { /* clear the error stack if EC_GROUP_set_curve() failed */ @@ -1720,7 +1720,7 @@ static int check_named_curve_test(int id) ERR_set_mark(); } if (EC_GROUP_set_curve(gtest, group_p, group_a, other_b, NULL)) { - if (!TEST_int_le(EC_GROUP_check_named_curve(gtest, 0), 0)) + if (!TEST_int_le(EC_GROUP_check_named_curve(gtest, 0, NULL), 0)) goto err; } else { /* clear the error stack if EC_GROUP_set_curve() failed */ @@ -1731,7 +1731,7 @@ static int check_named_curve_test(int id) /* Check that restoring the curve parameters passes */ if (!TEST_true(EC_GROUP_set_curve(gtest, group_p, group_a, group_b, NULL)) - || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0), nid)) + || !TEST_int_eq(EC_GROUP_check_named_curve(gtest, 0, NULL), nid)) goto err; ret = 1; @@ -1778,7 +1778,7 @@ static int check_named_curve_lookup_test(int id) if (!TEST_ptr(g = EC_GROUP_new_from_ecparameters(p))) goto err; - if (!TEST_int_gt(rv = EC_GROUP_check_named_curve(g, 0), 0)) + if (!TEST_int_gt(rv = EC_GROUP_check_named_curve(g, 0, NULL), 0)) goto err; if (rv != nid) { /* |