diff options
author | Matt Caswell <matt@openssl.org> | 2023-12-06 11:19:24 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2023-12-12 16:11:52 +0000 |
commit | 601be4b60eb3d525b77306ce54ba30e88aadf7e5 (patch) | |
tree | c104e8e566358053fe084190718700e45ae5b50d /test | |
parent | bde822724fa50dfd636414b2830710c16dbfe037 (diff) |
Extend the test of BN_GF2m_mod_inv
Test that input value of 1 for p is treated as an error
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22960)
(cherry picked from commit b83c719ecb884f609ade7ad7f52bd5e09737585b)
Diffstat (limited to 'test')
-rw-r--r-- | test/bntest.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/bntest.c b/test/bntest.c index e8c8ca4f8d..f9bde5ef4d 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -907,6 +907,14 @@ static int test_gf2m_modinv(void) || !TEST_ptr(d = BN_new())) goto err; + /* Test that a non-sensical, too small value causes a failure */ + if (!TEST_true(BN_one(b[0]))) + goto err; + if (!TEST_true(BN_bntest_rand(a, 512, 0, 0))) + goto err; + if (!TEST_false(BN_GF2m_mod_inv(c, a, b[0], ctx))) + goto err; + if (!(TEST_true(BN_GF2m_arr2poly(p0, b[0])) && TEST_true(BN_GF2m_arr2poly(p1, b[1])))) goto err; |