diff options
author | Richard Levitte <levitte@openssl.org> | 2017-02-01 00:46:58 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-02-01 02:03:29 +0100 |
commit | ceac1975357f9a716e4c7f0fee61511bd1bf7034 (patch) | |
tree | 01bc807f8ebfe9699f9a3b638e49d5654711f21a /test | |
parent | 26141babcfad85469383c3919dcff5713fecad16 (diff) |
bntest: make sure file_rshift tests BN_rshift1 as well when appropriate
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2335)
Diffstat (limited to 'test')
-rw-r--r-- | test/bntest.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/bntest.c b/test/bntest.c index 77c7af62c2..76e91e67c0 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -1155,21 +1155,28 @@ static int file_rshift(STANZA *s) BIGNUM *rshift = getBN(s, "RShift"); BIGNUM *ret = BN_new(); int n = 0; - int st = 0; + int errcnt = 1; if (a == NULL || rshift == NULL || ret == NULL || !getint(s, &n, "N")) goto err; + errcnt = 0; if (!BN_rshift(ret, a, n) || !equalBN("A >> N", rshift, ret)) - goto err; + errcnt++; + + /* If N == 1, try with rshift1 as well */ + if (n == 1) { + if (!BN_rshift1(ret, a) + || !equalBN("A >> 1 (rshift1)", rshift, ret)) + errcnt++; + } - st = 1; err: BN_free(a); BN_free(rshift); BN_free(ret); - return st; + return errcnt == 0; } static int file_square(STANZA *s) |