summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-11-28 07:53:35 +0000
committerBodo Möller <bodo@openssl.org>2000-11-28 07:53:35 +0000
commitd79cab27a583a3557a8f45a41326ad2953fde538 (patch)
treed4e9b247ab4879a477478f452108b8cec1e4bc13
parent24b44446e20b3e80999b18fd4f76316f7220b5cd (diff)
Correct a bug in BN_kronecker.
Sketch the test for BN_kronecker.
-rw-r--r--crypto/bn/bn_kron.c2
-rw-r--r--crypto/bn/bntest.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/crypto/bn/bn_kron.c b/crypto/bn/bn_kron.c
index aba48dda4a..20b593e679 100644
--- a/crypto/bn/bn_kron.c
+++ b/crypto/bn/bn_kron.c
@@ -146,7 +146,7 @@ int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
if (BN_is_zero(A))
{
- ret = BN_is_one(B);
+ ret = BN_is_one(B) ? ret : 0;
goto end;
}
diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c
index 37631e439b..866ac1d0a0 100644
--- a/crypto/bn/bntest.c
+++ b/crypto/bn/bntest.c
@@ -902,7 +902,17 @@ int test_exp(BIO *bp, BN_CTX *ctx)
int test_kron(BIO *bp, BN_CTX *ctx)
{
+ /* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol).
+ * In this case we know that if b is prime, then BN_kronecker(a, b, ctx)
+ * is congruent to $a^{(b-1)/2}$, modulo $b$ (Legendre symbol).
+ * So we generate a random prime b and compare these values
+ * for a number of random a's. (That is, we run the Solovay-Strassen
+ * primality test to confirm that b is prime, except that we
+ * don't want to test whether b is prime but whether BN_kronecker
+ * works.) */
+
/* XXX */
+
return(1);
}