diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec2_oct.c')
| -rw-r--r-- | src/lib/libcrypto/ec/ec2_oct.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/lib/libcrypto/ec/ec2_oct.c b/src/lib/libcrypto/ec/ec2_oct.c index c45d9c2219..72690b1bc7 100644 --- a/src/lib/libcrypto/ec/ec2_oct.c +++ b/src/lib/libcrypto/ec/ec2_oct.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec2_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ | 1 | /* $OpenBSD: ec2_oct.c,v 1.7 2015/02/09 15:49:22 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -109,11 +109,13 @@ ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point | |||
| 109 | y_bit = (y_bit != 0) ? 1 : 0; | 109 | y_bit = (y_bit != 0) ? 1 : 0; |
| 110 | 110 | ||
| 111 | BN_CTX_start(ctx); | 111 | BN_CTX_start(ctx); |
| 112 | tmp = BN_CTX_get(ctx); | 112 | if ((tmp = BN_CTX_get(ctx)) == NULL) |
| 113 | x = BN_CTX_get(ctx); | 113 | goto err; |
| 114 | y = BN_CTX_get(ctx); | 114 | if ((x = BN_CTX_get(ctx)) == NULL) |
| 115 | z = BN_CTX_get(ctx); | 115 | goto err; |
| 116 | if (z == NULL) | 116 | if ((y = BN_CTX_get(ctx)) == NULL) |
| 117 | goto err; | ||
| 118 | if ((z = BN_CTX_get(ctx)) == NULL) | ||
| 117 | goto err; | 119 | goto err; |
| 118 | 120 | ||
| 119 | if (!BN_GF2m_mod_arr(x, x_, group->poly)) | 121 | if (!BN_GF2m_mod_arr(x, x_, group->poly)) |
| @@ -212,10 +214,11 @@ ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
| 212 | } | 214 | } |
| 213 | BN_CTX_start(ctx); | 215 | BN_CTX_start(ctx); |
| 214 | used_ctx = 1; | 216 | used_ctx = 1; |
| 215 | x = BN_CTX_get(ctx); | 217 | if ((x = BN_CTX_get(ctx)) == NULL) |
| 216 | y = BN_CTX_get(ctx); | 218 | goto err; |
| 217 | yxi = BN_CTX_get(ctx); | 219 | if ((y = BN_CTX_get(ctx)) == NULL) |
| 218 | if (yxi == NULL) | 220 | goto err; |
| 221 | if ((yxi = BN_CTX_get(ctx)) == NULL) | ||
| 219 | goto err; | 222 | goto err; |
| 220 | 223 | ||
| 221 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) | 224 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) |
| @@ -329,10 +332,11 @@ ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
| 329 | return 0; | 332 | return 0; |
| 330 | } | 333 | } |
| 331 | BN_CTX_start(ctx); | 334 | BN_CTX_start(ctx); |
| 332 | x = BN_CTX_get(ctx); | 335 | if ((x = BN_CTX_get(ctx)) == NULL) |
| 333 | y = BN_CTX_get(ctx); | 336 | goto err; |
| 334 | yxi = BN_CTX_get(ctx); | 337 | if ((y = BN_CTX_get(ctx)) == NULL) |
| 335 | if (yxi == NULL) | 338 | goto err; |
| 339 | if ((yxi = BN_CTX_get(ctx)) == NULL) | ||
| 336 | goto err; | 340 | goto err; |
| 337 | 341 | ||
| 338 | if (!BN_bin2bn(buf + 1, field_len, x)) | 342 | if (!BN_bin2bn(buf + 1, field_len, x)) |
