summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r--src/lib/libcrypto/bn/bn_blind.c17
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c5
-rw-r--r--src/lib/libcrypto/bn/bn_mod.c5
-rw-r--r--src/lib/libcrypto/bn/bn_prime.c5
-rw-r--r--src/lib/libcrypto/bn/bn_print.c5
5 files changed, 14 insertions, 23 deletions
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c
index 5f559da067..c842f76c6f 100644
--- a/src/lib/libcrypto/bn/bn_blind.c
+++ b/src/lib/libcrypto/bn/bn_blind.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_blind.c,v 1.13 2014/07/11 08:44:47 jsing Exp $ */ 1/* $OpenBSD: bn_blind.c,v 1.14 2014/07/12 16:03:36 miod Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -181,14 +181,10 @@ BN_BLINDING_free(BN_BLINDING *r)
181 if (r == NULL) 181 if (r == NULL)
182 return; 182 return;
183 183
184 if (r->A != NULL) 184 BN_clear_free(r->A);
185 BN_clear_free(r->A ); 185 BN_clear_free(r->Ai);
186 if (r->Ai != NULL) 186 BN_clear_free(r->e);
187 BN_clear_free(r->Ai); 187 BN_clear_free(r->mod);
188 if (r->e != NULL)
189 BN_clear_free(r->e );
190 if (r->mod != NULL)
191 BN_clear_free(r->mod);
192 free(r); 188 free(r);
193} 189}
194 190
@@ -341,8 +337,7 @@ BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m,
341 goto err; 337 goto err;
342 338
343 if (e != NULL) { 339 if (e != NULL) {
344 if (ret->e != NULL) 340 BN_free(ret->e);
345 BN_free(ret->e);
346 ret->e = BN_dup(e); 341 ret->e = BN_dup(e);
347 } 342 }
348 if (ret->e == NULL) 343 if (ret->e == NULL)
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 4ee9b2bbde..d0cb49cd1e 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_lib.c,v 1.32 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: bn_lib.c,v 1.33 2014/07/12 16:03:36 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -585,8 +585,7 @@ BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
585 i = ((n - 1) / BN_BYTES) + 1; 585 i = ((n - 1) / BN_BYTES) + 1;
586 m = ((n - 1) % (BN_BYTES)); 586 m = ((n - 1) % (BN_BYTES));
587 if (bn_wexpand(ret, (int)i) == NULL) { 587 if (bn_wexpand(ret, (int)i) == NULL) {
588 if (bn) 588 BN_free(bn);
589 BN_free(bn);
590 return NULL; 589 return NULL;
591 } 590 }
592 ret->top = i; 591 ret->top = i;
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c
index a503ff3b1b..67bd3541b0 100644
--- a/src/lib/libcrypto/bn/bn_mod.c
+++ b/src/lib/libcrypto/bn/bn_mod.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mod.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: bn_mod.c,v 1.9 2014/07/12 16:03:36 miod 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/* ==================================================================== 4/* ====================================================================
@@ -253,8 +253,7 @@ BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx)
253 ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m)); 253 ret = BN_mod_lshift_quick(r, r, n, (abs_m ? abs_m : m));
254 bn_check_top(r); 254 bn_check_top(r);
255 255
256 if (abs_m) 256 BN_free(abs_m);
257 BN_free(abs_m);
258 return ret; 257 return ret;
259} 258}
260 259
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c
index db786a63ef..27468ceb93 100644
--- a/src/lib/libcrypto/bn/bn_prime.c
+++ b/src/lib/libcrypto/bn/bn_prime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_prime.c,v 1.10 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: bn_prime.c,v 1.11 2014/07/12 16:03:36 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -344,8 +344,7 @@ err:
344 if (ctx_passed == NULL) 344 if (ctx_passed == NULL)
345 BN_CTX_free(ctx); 345 BN_CTX_free(ctx);
346 } 346 }
347 if (mont != NULL) 347 BN_MONT_CTX_free(mont);
348 BN_MONT_CTX_free(mont);
349 348
350 return (ret); 349 return (ret);
351} 350}
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c
index ccdae5ae09..4920705a5b 100644
--- a/src/lib/libcrypto/bn/bn_print.c
+++ b/src/lib/libcrypto/bn/bn_print.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_print.c,v 1.22 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: bn_print.c,v 1.23 2014/07/12 16:03:36 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -163,8 +163,7 @@ BN_bn2dec(const BIGNUM *a)
163 163
164err: 164err:
165 free(bn_data); 165 free(bn_data);
166 if (t != NULL) 166 BN_free(t);
167 BN_free(t);
168 if (!ok && buf) { 167 if (!ok && buf) {
169 free(buf); 168 free(buf);
170 buf = NULL; 169 buf = NULL;