diff options
author | jsing <> | 2018-05-13 13:48:08 +0000 |
---|---|---|
committer | jsing <> | 2018-05-13 13:48:08 +0000 |
commit | 294ab72401fb4b21de1eb8cfc698fba7c7f676f9 (patch) | |
tree | 96ffa806e6015ca7656a37095f52d0238b382a31 /src/lib/libcrypto/asn1 | |
parent | 5c4fd695e4ce135d2abc9d0272d5dcc6c5ca68be (diff) | |
download | openbsd-294ab72401fb4b21de1eb8cfc698fba7c7f676f9.tar.gz openbsd-294ab72401fb4b21de1eb8cfc698fba7c7f676f9.tar.bz2 openbsd-294ab72401fb4b21de1eb8cfc698fba7c7f676f9.zip |
Use recallocarray() instead of OPENSSL_realloc_clean().
Also place all of the OPENSSL_* memory related prototypes under #ifndef
LIBRESSL_INTERNAL.
ok beck@ tb@
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/f_int.c | 5 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 7fa5af9bbb..11771bdd02 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_bitstr.c,v 1.27 2018/05/12 17:44:31 jsing Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.28 2018/05/13 13:48:08 jsing 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 | * |
@@ -190,8 +190,6 @@ c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len) | |||
190 | return (NULL); | 190 | return (NULL); |
191 | } | 191 | } |
192 | 192 | ||
193 | /* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de> | ||
194 | */ | ||
195 | int | 193 | int |
196 | ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) | 194 | ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) |
197 | { | 195 | { |
@@ -212,8 +210,7 @@ ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) | |||
212 | if ((a->length < (w + 1)) || (a->data == NULL)) { | 210 | if ((a->length < (w + 1)) || (a->data == NULL)) { |
213 | if (!value) | 211 | if (!value) |
214 | return(1); /* Don't need to set */ | 212 | return(1); /* Don't need to set */ |
215 | c = OPENSSL_realloc_clean(a->data, a->length, w + 1); | 213 | if ((c = recallocarray(a->data, a->length, w + 1, 1)) == NULL) { |
216 | if (c == NULL) { | ||
217 | ASN1error(ERR_R_MALLOC_FAILURE); | 214 | ASN1error(ERR_R_MALLOC_FAILURE); |
218 | return 0; | 215 | return 0; |
219 | } | 216 | } |
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c index 9849a7c8fc..d03fafe87d 100644 --- a/src/lib/libcrypto/asn1/f_int.c +++ b/src/lib/libcrypto/asn1/f_int.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: f_int.c,v 1.19 2018/04/25 11:48:21 tb Exp $ */ | 1 | /* $OpenBSD: f_int.c,v 1.20 2018/05/13 13:48:08 jsing 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 | * |
@@ -158,8 +158,7 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) | |||
158 | } | 158 | } |
159 | i /= 2; | 159 | i /= 2; |
160 | if (num + i > slen) { | 160 | if (num + i > slen) { |
161 | sp = OPENSSL_realloc_clean(s, slen, num + i); | 161 | if ((sp = recallocarray(s, slen, num + i, 1)) == NULL) { |
162 | if (sp == NULL) { | ||
163 | ASN1error(ERR_R_MALLOC_FAILURE); | 162 | ASN1error(ERR_R_MALLOC_FAILURE); |
164 | goto err; | 163 | goto err; |
165 | } | 164 | } |