summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/crypto/ec/ecp_oct.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/crypto/ec/ecp_oct.c')
-rw-r--r--src/lib/libssl/src/crypto/ec/ecp_oct.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/lib/libssl/src/crypto/ec/ecp_oct.c b/src/lib/libssl/src/crypto/ec/ecp_oct.c
index abc31e6382..994f0b08b1 100644
--- a/src/lib/libssl/src/crypto/ec/ecp_oct.c
+++ b/src/lib/libssl/src/crypto/ec/ecp_oct.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ 1/* $OpenBSD: ecp_oct.c,v 1.7 2015/02/09 15:49:22 jsing Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. 3 * for the OpenSSL project.
4 * Includes code written by Bodo Moeller for the OpenSSL project. 4 * Includes code written by Bodo Moeller for the OpenSSL project.
@@ -67,8 +67,8 @@
67#include "ec_lcl.h" 67#include "ec_lcl.h"
68 68
69int 69int
70ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, EC_POINT * point, 70ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group,
71 const BIGNUM * x_, int y_bit, BN_CTX * ctx) 71 EC_POINT * point, const BIGNUM * x_, int y_bit, BN_CTX * ctx)
72{ 72{
73 BN_CTX *new_ctx = NULL; 73 BN_CTX *new_ctx = NULL;
74 BIGNUM *tmp1, *tmp2, *x, *y; 74 BIGNUM *tmp1, *tmp2, *x, *y;
@@ -85,11 +85,13 @@ ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, EC_POINT * poin
85 y_bit = (y_bit != 0); 85 y_bit = (y_bit != 0);
86 86
87 BN_CTX_start(ctx); 87 BN_CTX_start(ctx);
88 tmp1 = BN_CTX_get(ctx); 88 if ((tmp1 = BN_CTX_get(ctx)) == NULL)
89 tmp2 = BN_CTX_get(ctx); 89 goto err;
90 x = BN_CTX_get(ctx); 90 if ((tmp2 = BN_CTX_get(ctx)) == NULL)
91 y = BN_CTX_get(ctx); 91 goto err;
92 if (y == NULL) 92 if ((x = BN_CTX_get(ctx)) == NULL)
93 goto err;
94 if ((y = BN_CTX_get(ctx)) == NULL)
93 goto err; 95 goto err;
94 96
95 /* 97 /*
@@ -239,9 +241,9 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co
239 } 241 }
240 BN_CTX_start(ctx); 242 BN_CTX_start(ctx);
241 used_ctx = 1; 243 used_ctx = 1;
242 x = BN_CTX_get(ctx); 244 if ((x = BN_CTX_get(ctx)) == NULL)
243 y = BN_CTX_get(ctx); 245 goto err;
244 if (y == NULL) 246 if ((y = BN_CTX_get(ctx)) == NULL)
245 goto err; 247 goto err;
246 248
247 if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)) 249 if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx))
@@ -348,9 +350,9 @@ ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point,
348 return 0; 350 return 0;
349 } 351 }
350 BN_CTX_start(ctx); 352 BN_CTX_start(ctx);
351 x = BN_CTX_get(ctx); 353 if ((x = BN_CTX_get(ctx)) == NULL)
352 y = BN_CTX_get(ctx); 354 goto err;
353 if (y == NULL) 355 if ((y = BN_CTX_get(ctx)) == NULL)
354 goto err; 356 goto err;
355 357
356 if (!BN_bin2bn(buf + 1, field_len, x)) 358 if (!BN_bin2bn(buf + 1, field_len, x))