diff options
author | Bodo Möller <bodo@openssl.org> | 2000-11-26 18:31:32 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-11-26 18:31:32 +0000 |
commit | 5acaa49504153ecdd9734ac80aeb9153fde94e48 (patch) | |
tree | 3be1e2178b83713e43bdd6f4d0ea55d9f48c0478 /crypto/bn/bntest.c | |
parent | 535b9b5724e08f27c722982bbf775a862134a22d (diff) |
More BN_mod_... functions.
Diffstat (limited to 'crypto/bn/bntest.c')
-rw-r--r-- | crypto/bn/bntest.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c index 11e58f994a..0ade0c0012 100644 --- a/crypto/bn/bntest.c +++ b/crypto/bn/bntest.c @@ -761,6 +761,16 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx) BN_print(bp,b); BIO_puts(bp," % "); BN_print(bp,c); + if ((a->neg ^ b->neg) && !BN_is_zero(e)) + { + /* If (a*b) % c is negative, c must be added + * in order to obtain the normalized remainder + * (new with OpenSSL 0.9.7, previous versions of + * BN_mod_mul could generate negative results) + */ + BIO_puts(bp," + "); + BN_print(bp,c); + } BIO_puts(bp," - "); } BN_print(bp,e); |