summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2017-11-24 11:37:59 +0100
committerMatt Caswell <matt@openssl.org>2017-12-06 16:36:20 +0100
commit77d75993651b63e872244a3256e37967bb3c3e9e (patch)
tree8047115e83b00e26c5def19e0c337a98b9bd9552 /test
parentbn/asm/rsaz-avx2.pl: fix digit correction bug in rsaz_1024_mul_avx2. (diff)
downloadopenssl-77d75993651b63e872244a3256e37967bb3c3e9e.tar.xz
openssl-77d75993651b63e872244a3256e37967bb3c3e9e.zip
test/bntest.c: add rsaz_1024_mul_avx2 regression test.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test')
-rw-r--r--test/bntest.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/bntest.c b/test/bntest.c
index 9eda5bd825..fc3d0756f0 100644
--- a/test/bntest.c
+++ b/test/bntest.c
@@ -425,6 +425,28 @@ static int test_modexp_mont5(void)
if (!TEST_BN_eq(c, d))
goto err;
+ /* Regression test for bug in rsaz_1024_mul_avx2 */
+ BN_hex2bn(&a,
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2020202020DF");
+ BN_hex2bn(&b,
+ "2020202020202020202020202020202020202020202020202020202020202020"
+ "2020202020202020202020202020202020202020202020202020202020202020"
+ "20202020202020FF202020202020202020202020202020202020202020202020"
+ "2020202020202020202020202020202020202020202020202020202020202020");
+ BN_hex2bn(&n,
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2020202020FF");
+ BN_MONT_CTX_set(mont, n, ctx);
+ BN_mod_exp_mont_consttime(c, a, b, n, ctx, mont);
+ BN_mod_exp_mont(d, a, b, n, ctx, mont);
+ if (!TEST_BN_eq(c, d))
+ goto err;
+
/* Zero input */
BN_bntest_rand(p, 1024, 0, 0);
BN_zero(a);