diff options
author | jsing <> | 2022-11-24 01:24:37 +0000 |
---|---|---|
committer | jsing <> | 2022-11-24 01:24:37 +0000 |
commit | 095ccaedd0631462c52a1a2d9aa19b35c3e45b12 (patch) | |
tree | 26f9d49b7ade19e4dcd3d166f1a0a641de5d7740 /src/lib | |
parent | 33e3061fb8eb23998047c28cdac665b3bbd09531 (diff) | |
download | openbsd-095ccaedd0631462c52a1a2d9aa19b35c3e45b12.tar.gz openbsd-095ccaedd0631462c52a1a2d9aa19b35c3e45b12.tar.bz2 openbsd-095ccaedd0631462c52a1a2d9aa19b35c3e45b12.zip |
Call bn_expand() rather than handrolling an equivalent.
The current code manually calculates words from bits and then calls
bn_wexpand() - call bn_expand() with bits instead.
ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index b3030edeee..b6c06a45a2 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_smpl.c,v 1.25 2022/11/19 07:29:29 tb Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.26 2022/11/24 01:24:37 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -186,9 +186,9 @@ ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
186 | dest->poly[3] = src->poly[3]; | 186 | dest->poly[3] = src->poly[3]; |
187 | dest->poly[4] = src->poly[4]; | 187 | dest->poly[4] = src->poly[4]; |
188 | dest->poly[5] = src->poly[5]; | 188 | dest->poly[5] = src->poly[5]; |
189 | if (bn_wexpand(&dest->a, (int) (dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) | 189 | if (bn_expand(&dest->a, dest->poly[0]) == NULL) |
190 | return 0; | 190 | return 0; |
191 | if (bn_wexpand(&dest->b, (int) (dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) | 191 | if (bn_expand(&dest->b, dest->poly[0]) == NULL) |
192 | return 0; | 192 | return 0; |
193 | for (i = dest->a.top; i < dest->a.dmax; i++) | 193 | for (i = dest->a.top; i < dest->a.dmax; i++) |
194 | dest->a.d[i] = 0; | 194 | dest->a.d[i] = 0; |
@@ -216,7 +216,7 @@ ec_GF2m_simple_group_set_curve(EC_GROUP *group, | |||
216 | /* group->a */ | 216 | /* group->a */ |
217 | if (!BN_GF2m_mod_arr(&group->a, a, group->poly)) | 217 | if (!BN_GF2m_mod_arr(&group->a, a, group->poly)) |
218 | goto err; | 218 | goto err; |
219 | if (bn_wexpand(&group->a, (int) (group->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) | 219 | if (bn_expand(&group->a, group->poly[0]) == NULL) |
220 | goto err; | 220 | goto err; |
221 | for (i = group->a.top; i < group->a.dmax; i++) | 221 | for (i = group->a.top; i < group->a.dmax; i++) |
222 | group->a.d[i] = 0; | 222 | group->a.d[i] = 0; |
@@ -224,7 +224,7 @@ ec_GF2m_simple_group_set_curve(EC_GROUP *group, | |||
224 | /* group->b */ | 224 | /* group->b */ |
225 | if (!BN_GF2m_mod_arr(&group->b, b, group->poly)) | 225 | if (!BN_GF2m_mod_arr(&group->b, b, group->poly)) |
226 | goto err; | 226 | goto err; |
227 | if (bn_wexpand(&group->b, (int) (group->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) | 227 | if (bn_expand(&group->b, group->poly[0]) == NULL) |
228 | goto err; | 228 | goto err; |
229 | for (i = group->b.top; i < group->b.dmax; i++) | 229 | for (i = group->b.top; i < group->b.dmax; i++) |
230 | group->b.d[i] = 0; | 230 | group->b.d[i] = 0; |