diff options
author | Bodo Möller <bodo@openssl.org> | 2006-06-18 22:00:57 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2006-06-18 22:00:57 +0000 |
commit | c4e7870ac1af6f629e021391b16d9671742db95f (patch) | |
tree | 94b6b80bd8f96eb2f3ee022691c733ac8556ecde /crypto/ec/ec2_smpl.c | |
parent | 4584eccea00d6910770a7ce1a9719b051c01ae8f (diff) |
Change array representation of binary polynomials to make GF2m part of
the BN library more generally useful.
Submitted by: Douglas Stebila
Diffstat (limited to 'crypto/ec/ec2_smpl.c')
-rw-r--r-- | crypto/ec/ec2_smpl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c index 527e6d8147..01d8483c3a 100644 --- a/crypto/ec/ec2_smpl.c +++ b/crypto/ec/ec2_smpl.c @@ -157,6 +157,7 @@ void ec_GF2m_simple_group_clear_finish(EC_GROUP *group) group->poly[2] = 0; group->poly[3] = 0; group->poly[4] = 0; + group->poly[5] = -1; } @@ -174,6 +175,7 @@ int ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) dest->poly[2] = src->poly[2]; dest->poly[3] = src->poly[3]; dest->poly[4] = src->poly[4]; + dest->poly[5] = src->poly[5]; bn_wexpand(&dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2); bn_wexpand(&dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2); for (i = dest->a.top; i < dest->a.dmax; i++) dest->a.d[i] = 0; @@ -190,7 +192,7 @@ int ec_GF2m_simple_group_set_curve(EC_GROUP *group, /* group->field */ if (!BN_copy(&group->field, p)) goto err; - i = BN_GF2m_poly2arr(&group->field, group->poly, 5); + i = BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1; if ((i != 5) && (i != 3)) { ECerr(EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE, EC_R_UNSUPPORTED_FIELD); |