aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-03-08 22:52:49 +0000
committerBodo Möller <bodo@openssl.org>2001-03-08 22:52:49 +0000
commit42909e39681bcbaaada696c901bbff472d71dbe2 (patch)
tree88d31a20bf60369f33a11df7a653f8124e0b91de /crypto
parentc10810802836755d417e122e086067b509331327 (diff)
downloadopenssl-42909e39681bcbaaada696c901bbff472d71dbe2.tar.gz
Fix ec_GFp_simple_cmp.
Use example group from Annex I of X9.62 in ectest.c.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ec/ecp_smpl.c7
-rw-r--r--crypto/ec/ectest.c8
2 files changed, 10 insertions, 5 deletions
diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c
index 204dafab2a..4c23b71020 100644
--- a/crypto/ec/ecp_smpl.c
+++ b/crypto/ec/ecp_smpl.c
@@ -1409,13 +1409,18 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *
{
if (!field_mul(group, Zb23, Zb23, &b->Z, ctx)) goto end;
if (!field_mul(group, tmp1, &a->Y, Zb23, ctx)) goto end;
+ /* tmp1_ = tmp1 */
}
+ else
+ tmp1_ = &a->Y;
if (!a->Z_is_one)
{
if (!field_mul(group, Za23, Za23, &a->Z, ctx)) goto end;
if (!field_mul(group, tmp2, &b->Y, Za23, ctx)) goto end;
+ /* tmp2_ = tmp2 */
}
- /* tmp1_ and tmp2_ are still ok */
+ else
+ tmp2_ = &b->Y;
/* compare Y_a*Z_b^3 with Y_b*Z_a^3 */
if (BN_cmp(tmp1_, tmp2_) != 0)
diff --git a/crypto/ec/ectest.c b/crypto/ec/ectest.c
index 28e331b608..53f88c6517 100644
--- a/crypto/ec/ectest.c
+++ b/crypto/ec/ectest.c
@@ -94,9 +94,9 @@ int main(int argc, char *argv[])
b = BN_new();
if (!p || !a || !b) ABORT;
- if (!BN_hex2bn(&p, "D")) ABORT;
- if (!BN_hex2bn(&a, "7")) ABORT;
- if (!BN_hex2bn(&b, "C")) ABORT;
+ if (!BN_hex2bn(&p, "17")) ABORT;
+ if (!BN_hex2bn(&a, "1")) ABORT;
+ if (!BN_hex2bn(&b, "1")) ABORT;
group = EC_GROUP_new(EC_GFp_mont_method());
if (!group) ABORT;
@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
z = BN_new();
if (!x || !y || !z) ABORT;
- if (!BN_hex2bn(&x, "C")) ABORT;
+ if (!BN_hex2bn(&x, "D")) ABORT;
if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT;
if (!EC_POINT_is_on_curve(group, Q, ctx))
{