Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2335)
BIGNUM *rshift = getBN(s, "RShift");
BIGNUM *ret = BN_new();
int n = 0;
BIGNUM *rshift = getBN(s, "RShift");
BIGNUM *ret = BN_new();
int n = 0;
if (a == NULL || rshift == NULL || ret == NULL || !getint(s, &n, "N"))
goto err;
if (a == NULL || rshift == NULL || ret == NULL || !getint(s, &n, "N"))
goto err;
if (!BN_rshift(ret, a, n)
|| !equalBN("A >> N", rshift, ret))
if (!BN_rshift(ret, a, n)
|| !equalBN("A >> N", rshift, ret))
+ errcnt++;
+
+ /* If N == 1, try with rshift1 as well */
+ if (n == 1) {
+ if (!BN_rshift1(ret, a)
+ || !equalBN("A >> 1 (rshift1)", rshift, ret))
+ errcnt++;
+ }
err:
BN_free(a);
BN_free(rshift);
BN_free(ret);
err:
BN_free(a);
BN_free(rshift);
BN_free(ret);
}
static int file_square(STANZA *s)
}
static int file_square(STANZA *s)