diff options
author | beck <> | 2014-04-17 13:37:50 +0000 |
---|---|---|
committer | beck <> | 2014-04-17 13:37:50 +0000 |
commit | bddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch) | |
tree | 7595a93a27385c367802aa17ecf20f96551cf14d | |
parent | ecec66222d758996a4ff2671ca5026d9ede5ef76 (diff) | |
download | openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.gz openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.bz2 openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.zip |
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free
477 files changed, 2618 insertions, 2618 deletions
diff --git a/src/lib/libcrypto/aes/aes_wrap.c b/src/lib/libcrypto/aes/aes_wrap.c index 198b0be333..668978425a 100644 --- a/src/lib/libcrypto/aes/aes_wrap.c +++ b/src/lib/libcrypto/aes/aes_wrap.c | |||
@@ -141,8 +141,8 @@ AES_wrap_unwrap_test(const unsigned char *kek, int keybits, | |||
141 | unsigned char *otmp = NULL, *ptmp = NULL; | 141 | unsigned char *otmp = NULL, *ptmp = NULL; |
142 | int r, ret = 0; | 142 | int r, ret = 0; |
143 | AES_KEY wctx; | 143 | AES_KEY wctx; |
144 | otmp = OPENSSL_malloc(keylen + 8); | 144 | otmp = malloc(keylen + 8); |
145 | ptmp = OPENSSL_malloc(keylen); | 145 | ptmp = malloc(keylen); |
146 | if (!otmp || !ptmp) | 146 | if (!otmp || !ptmp) |
147 | return 0; | 147 | return 0; |
148 | if (AES_set_encrypt_key(kek, keybits, &wctx)) | 148 | if (AES_set_encrypt_key(kek, keybits, &wctx)) |
@@ -165,9 +165,9 @@ AES_wrap_unwrap_test(const unsigned char *kek, int keybits, | |||
165 | 165 | ||
166 | err: | 166 | err: |
167 | if (otmp) | 167 | if (otmp) |
168 | OPENSSL_free(otmp); | 168 | free(otmp); |
169 | if (ptmp) | 169 | if (ptmp) |
170 | OPENSSL_free(ptmp); | 170 | free(ptmp); |
171 | 171 | ||
172 | return ret; | 172 | return ret; |
173 | } | 173 | } |
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 34179960b8..e2b65bf2ac 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -144,7 +144,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, | |||
144 | 144 | ||
145 | if (len-- > 1) /* using one because of the bits left byte */ | 145 | if (len-- > 1) /* using one because of the bits left byte */ |
146 | { | 146 | { |
147 | s=(unsigned char *)OPENSSL_malloc((int)len); | 147 | s=(unsigned char *)malloc((int)len); |
148 | if (s == NULL) | 148 | if (s == NULL) |
149 | { | 149 | { |
150 | i=ERR_R_MALLOC_FAILURE; | 150 | i=ERR_R_MALLOC_FAILURE; |
@@ -158,7 +158,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, | |||
158 | s=NULL; | 158 | s=NULL; |
159 | 159 | ||
160 | ret->length=(int)len; | 160 | ret->length=(int)len; |
161 | if (ret->data != NULL) OPENSSL_free(ret->data); | 161 | if (ret->data != NULL) free(ret->data); |
162 | ret->data=s; | 162 | ret->data=s; |
163 | ret->type=V_ASN1_BIT_STRING; | 163 | ret->type=V_ASN1_BIT_STRING; |
164 | if (a != NULL) (*a)=ret; | 164 | if (a != NULL) (*a)=ret; |
@@ -192,7 +192,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) | |||
192 | { | 192 | { |
193 | if (!value) return(1); /* Don't need to set */ | 193 | if (!value) return(1); /* Don't need to set */ |
194 | if (a->data == NULL) | 194 | if (a->data == NULL) |
195 | c=(unsigned char *)OPENSSL_malloc(w+1); | 195 | c=(unsigned char *)malloc(w+1); |
196 | else | 196 | else |
197 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, | 197 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, |
198 | a->length, | 198 | a->length, |
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c index 92d630cdba..8431d89edf 100644 --- a/src/lib/libcrypto/asn1/a_bytes.c +++ b/src/lib/libcrypto/asn1/a_bytes.c | |||
@@ -101,7 +101,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
101 | 101 | ||
102 | if (len != 0) | 102 | if (len != 0) |
103 | { | 103 | { |
104 | s=(unsigned char *)OPENSSL_malloc((int)len+1); | 104 | s=(unsigned char *)malloc((int)len+1); |
105 | if (s == NULL) | 105 | if (s == NULL) |
106 | { | 106 | { |
107 | i=ERR_R_MALLOC_FAILURE; | 107 | i=ERR_R_MALLOC_FAILURE; |
@@ -114,7 +114,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
114 | else | 114 | else |
115 | s=NULL; | 115 | s=NULL; |
116 | 116 | ||
117 | if (ret->data != NULL) OPENSSL_free(ret->data); | 117 | if (ret->data != NULL) free(ret->data); |
118 | ret->length=(int)len; | 118 | ret->length=(int)len; |
119 | ret->data=s; | 119 | ret->data=s; |
120 | ret->type=tag; | 120 | ret->type=tag; |
@@ -209,8 +209,8 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
209 | { | 209 | { |
210 | if ((ret->length < len) || (ret->data == NULL)) | 210 | if ((ret->length < len) || (ret->data == NULL)) |
211 | { | 211 | { |
212 | if (ret->data != NULL) OPENSSL_free(ret->data); | 212 | if (ret->data != NULL) free(ret->data); |
213 | s=(unsigned char *)OPENSSL_malloc((int)len + 1); | 213 | s=(unsigned char *)malloc((int)len + 1); |
214 | if (s == NULL) | 214 | if (s == NULL) |
215 | { | 215 | { |
216 | i=ERR_R_MALLOC_FAILURE; | 216 | i=ERR_R_MALLOC_FAILURE; |
@@ -226,7 +226,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
226 | else | 226 | else |
227 | { | 227 | { |
228 | s=NULL; | 228 | s=NULL; |
229 | if (ret->data != NULL) OPENSSL_free(ret->data); | 229 | if (ret->data != NULL) free(ret->data); |
230 | } | 230 | } |
231 | 231 | ||
232 | ret->length=(int)len; | 232 | ret->length=(int)len; |
@@ -301,14 +301,14 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) | |||
301 | if (!asn1_const_Finish(c)) goto err; | 301 | if (!asn1_const_Finish(c)) goto err; |
302 | 302 | ||
303 | a->length=num; | 303 | a->length=num; |
304 | if (a->data != NULL) OPENSSL_free(a->data); | 304 | if (a->data != NULL) free(a->data); |
305 | a->data=(unsigned char *)b.data; | 305 | a->data=(unsigned char *)b.data; |
306 | if (os != NULL) ASN1_STRING_free(os); | 306 | if (os != NULL) ASN1_STRING_free(os); |
307 | return(1); | 307 | return(1); |
308 | err: | 308 | err: |
309 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error); | 309 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error); |
310 | if (os != NULL) ASN1_STRING_free(os); | 310 | if (os != NULL) ASN1_STRING_free(os); |
311 | if (b.data != NULL) OPENSSL_free(b.data); | 311 | if (b.data != NULL) free(b.data); |
312 | return(0); | 312 | return(0); |
313 | } | 313 | } |
314 | 314 | ||
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c index 8a4b24a06b..0d463d409b 100644 --- a/src/lib/libcrypto/asn1/a_digest.c +++ b/src/lib/libcrypto/asn1/a_digest.c | |||
@@ -81,6 +81,6 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, | |||
81 | 81 | ||
82 | if (!EVP_Digest(str, i, md, len, type, NULL)) | 82 | if (!EVP_Digest(str, i, md, len, type, NULL)) |
83 | return 0; | 83 | return 0; |
84 | OPENSSL_free(str); | 84 | free(str); |
85 | return(1); | 85 | return(1); |
86 | } | 86 | } |
diff --git a/src/lib/libcrypto/asn1/a_dup.c b/src/lib/libcrypto/asn1/a_dup.c index d98992548a..e825b9c2d4 100644 --- a/src/lib/libcrypto/asn1/a_dup.c +++ b/src/lib/libcrypto/asn1/a_dup.c | |||
@@ -72,14 +72,14 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x) | |||
72 | if (x == NULL) return(NULL); | 72 | if (x == NULL) return(NULL); |
73 | 73 | ||
74 | i=i2d(x,NULL); | 74 | i=i2d(x,NULL); |
75 | b=OPENSSL_malloc(i+10); | 75 | b=malloc(i+10); |
76 | if (b == NULL) | 76 | if (b == NULL) |
77 | { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } | 77 | { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } |
78 | p= b; | 78 | p= b; |
79 | i=i2d(x,&p); | 79 | i=i2d(x,&p); |
80 | p2= b; | 80 | p2= b; |
81 | ret=d2i(NULL,&p2,i); | 81 | ret=d2i(NULL,&p2,i); |
82 | OPENSSL_free(b); | 82 | free(b); |
83 | return(ret); | 83 | return(ret); |
84 | } | 84 | } |
85 | 85 | ||
@@ -104,6 +104,6 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x) | |||
104 | { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } | 104 | { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } |
105 | p= b; | 105 | p= b; |
106 | ret=ASN1_item_d2i(NULL,&p,i, it); | 106 | ret=ASN1_item_d2i(NULL,&p,i, it); |
107 | OPENSSL_free(b); | 107 | free(b); |
108 | return(ret); | 108 | return(ret); |
109 | } | 109 | } |
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c index fe9aa13b9c..c1154dde0a 100644 --- a/src/lib/libcrypto/asn1/a_enum.c +++ b/src/lib/libcrypto/asn1/a_enum.c | |||
@@ -77,8 +77,8 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) | |||
77 | if (a->length < (int)(sizeof(long)+1)) | 77 | if (a->length < (int)(sizeof(long)+1)) |
78 | { | 78 | { |
79 | if (a->data != NULL) | 79 | if (a->data != NULL) |
80 | OPENSSL_free(a->data); | 80 | free(a->data); |
81 | if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL) | 81 | if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL) |
82 | memset((char *)a->data,0,sizeof(long)+1); | 82 | memset((char *)a->data,0,sizeof(long)+1); |
83 | } | 83 | } |
84 | if (a->data == NULL) | 84 | if (a->data == NULL) |
@@ -155,7 +155,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) | |||
155 | len=((j == 0)?0:((j/8)+1)); | 155 | len=((j == 0)?0:((j/8)+1)); |
156 | if (ret->length < len+4) | 156 | if (ret->length < len+4) |
157 | { | 157 | { |
158 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); | 158 | unsigned char *new_data=realloc(ret->data, len+4); |
159 | if (!new_data) | 159 | if (!new_data) |
160 | { | 160 | { |
161 | ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); | 161 | ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c index 4f312ee6c9..86666e7a20 100644 --- a/src/lib/libcrypto/asn1/a_gentm.c +++ b/src/lib/libcrypto/asn1/a_gentm.c | |||
@@ -225,7 +225,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | |||
225 | p=(char *)s->data; | 225 | p=(char *)s->data; |
226 | if ((p == NULL) || ((size_t)s->length < len)) | 226 | if ((p == NULL) || ((size_t)s->length < len)) |
227 | { | 227 | { |
228 | p=OPENSSL_malloc(len); | 228 | p=malloc(len); |
229 | if (p == NULL) | 229 | if (p == NULL) |
230 | { | 230 | { |
231 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, | 231 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, |
@@ -233,7 +233,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | |||
233 | return(NULL); | 233 | return(NULL); |
234 | } | 234 | } |
235 | if (s->data != NULL) | 235 | if (s->data != NULL) |
236 | OPENSSL_free(s->data); | 236 | free(s->data); |
237 | s->data=(unsigned char *)p; | 237 | s->data=(unsigned char *)p; |
238 | } | 238 | } |
239 | 239 | ||
diff --git a/src/lib/libcrypto/asn1/a_i2d_fp.c b/src/lib/libcrypto/asn1/a_i2d_fp.c index a3ad76d356..484bcd66eb 100644 --- a/src/lib/libcrypto/asn1/a_i2d_fp.c +++ b/src/lib/libcrypto/asn1/a_i2d_fp.c | |||
@@ -88,7 +88,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) | |||
88 | int i,j=0,n,ret=1; | 88 | int i,j=0,n,ret=1; |
89 | 89 | ||
90 | n=i2d(x,NULL); | 90 | n=i2d(x,NULL); |
91 | b=(char *)OPENSSL_malloc(n); | 91 | b=(char *)malloc(n); |
92 | if (b == NULL) | 92 | if (b == NULL) |
93 | { | 93 | { |
94 | ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); | 94 | ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); |
@@ -110,7 +110,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) | |||
110 | j+=i; | 110 | j+=i; |
111 | n-=i; | 111 | n-=i; |
112 | } | 112 | } |
113 | OPENSSL_free(b); | 113 | free(b); |
114 | return(ret); | 114 | return(ret); |
115 | } | 115 | } |
116 | 116 | ||
@@ -158,6 +158,6 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x) | |||
158 | j+=i; | 158 | j+=i; |
159 | n-=i; | 159 | n-=i; |
160 | } | 160 | } |
161 | OPENSSL_free(b); | 161 | free(b); |
162 | return(ret); | 162 | return(ret); |
163 | } | 163 | } |
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index 297c45a9ff..6c38ace8f9 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
@@ -194,9 +194,9 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
194 | p= *pp; | 194 | p= *pp; |
195 | pend = p + len; | 195 | pend = p + len; |
196 | 196 | ||
197 | /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it | 197 | /* We must malloc stuff, even for 0 bytes otherwise it |
198 | * signifies a missing NULL parameter. */ | 198 | * signifies a missing NULL parameter. */ |
199 | s=(unsigned char *)OPENSSL_malloc((int)len+1); | 199 | s=(unsigned char *)malloc((int)len+1); |
200 | if (s == NULL) | 200 | if (s == NULL) |
201 | { | 201 | { |
202 | i=ERR_R_MALLOC_FAILURE; | 202 | i=ERR_R_MALLOC_FAILURE; |
@@ -249,7 +249,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
249 | memcpy(s,p,(int)len); | 249 | memcpy(s,p,(int)len); |
250 | } | 250 | } |
251 | 251 | ||
252 | if (ret->data != NULL) OPENSSL_free(ret->data); | 252 | if (ret->data != NULL) free(ret->data); |
253 | ret->data=s; | 253 | ret->data=s; |
254 | ret->length=(int)len; | 254 | ret->length=(int)len; |
255 | if (a != NULL) (*a)=ret; | 255 | if (a != NULL) (*a)=ret; |
@@ -300,9 +300,9 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
300 | goto err; | 300 | goto err; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it | 303 | /* We must malloc stuff, even for 0 bytes otherwise it |
304 | * signifies a missing NULL parameter. */ | 304 | * signifies a missing NULL parameter. */ |
305 | s=(unsigned char *)OPENSSL_malloc((int)len+1); | 305 | s=(unsigned char *)malloc((int)len+1); |
306 | if (s == NULL) | 306 | if (s == NULL) |
307 | { | 307 | { |
308 | i=ERR_R_MALLOC_FAILURE; | 308 | i=ERR_R_MALLOC_FAILURE; |
@@ -319,7 +319,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
319 | p+=len; | 319 | p+=len; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (ret->data != NULL) OPENSSL_free(ret->data); | 322 | if (ret->data != NULL) free(ret->data); |
323 | ret->data=s; | 323 | ret->data=s; |
324 | ret->length=(int)len; | 324 | ret->length=(int)len; |
325 | if (a != NULL) (*a)=ret; | 325 | if (a != NULL) (*a)=ret; |
@@ -343,8 +343,8 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) | |||
343 | if (a->length < (int)(sizeof(long)+1)) | 343 | if (a->length < (int)(sizeof(long)+1)) |
344 | { | 344 | { |
345 | if (a->data != NULL) | 345 | if (a->data != NULL) |
346 | OPENSSL_free(a->data); | 346 | free(a->data); |
347 | if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL) | 347 | if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL) |
348 | memset((char *)a->data,0,sizeof(long)+1); | 348 | memset((char *)a->data,0,sizeof(long)+1); |
349 | } | 349 | } |
350 | if (a->data == NULL) | 350 | if (a->data == NULL) |
@@ -422,7 +422,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) | |||
422 | len=((j == 0)?0:((j/8)+1)); | 422 | len=((j == 0)?0:((j/8)+1)); |
423 | if (ret->length < len+4) | 423 | if (ret->length < len+4) |
424 | { | 424 | { |
425 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); | 425 | unsigned char *new_data=realloc(ret->data, len+4); |
426 | if (!new_data) | 426 | if (!new_data) |
427 | { | 427 | { |
428 | ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); | 428 | ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c index dc953c8325..f6d8da8b3c 100644 --- a/src/lib/libcrypto/asn1/a_mbstr.c +++ b/src/lib/libcrypto/asn1/a_mbstr.c | |||
@@ -185,7 +185,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
185 | dest = *out; | 185 | dest = *out; |
186 | if(dest->data) { | 186 | if(dest->data) { |
187 | dest->length = 0; | 187 | dest->length = 0; |
188 | OPENSSL_free(dest->data); | 188 | free(dest->data); |
189 | dest->data = NULL; | 189 | dest->data = NULL; |
190 | } | 190 | } |
191 | dest->type = str_type; | 191 | dest->type = str_type; |
@@ -231,7 +231,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
231 | cpyfunc = cpy_utf8; | 231 | cpyfunc = cpy_utf8; |
232 | break; | 232 | break; |
233 | } | 233 | } |
234 | if(!(p = OPENSSL_malloc(outlen + 1))) { | 234 | if(!(p = malloc(outlen + 1))) { |
235 | if(free_out) ASN1_STRING_free(dest); | 235 | if(free_out) ASN1_STRING_free(dest); |
236 | ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE); | 236 | ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE); |
237 | return -1; | 237 | return -1; |
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index 3978c9150d..c30f32442d 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
@@ -180,9 +180,9 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) | |||
180 | if (blsize > tmpsize) | 180 | if (blsize > tmpsize) |
181 | { | 181 | { |
182 | if (tmp != ftmp) | 182 | if (tmp != ftmp) |
183 | OPENSSL_free(tmp); | 183 | free(tmp); |
184 | tmpsize = blsize + 32; | 184 | tmpsize = blsize + 32; |
185 | tmp = OPENSSL_malloc(tmpsize); | 185 | tmp = malloc(tmpsize); |
186 | if (!tmp) | 186 | if (!tmp) |
187 | goto err; | 187 | goto err; |
188 | } | 188 | } |
@@ -215,13 +215,13 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) | |||
215 | len+=i; | 215 | len+=i; |
216 | } | 216 | } |
217 | if (tmp != ftmp) | 217 | if (tmp != ftmp) |
218 | OPENSSL_free(tmp); | 218 | free(tmp); |
219 | if (bl) | 219 | if (bl) |
220 | BN_free(bl); | 220 | BN_free(bl); |
221 | return(len); | 221 | return(len); |
222 | err: | 222 | err: |
223 | if (tmp != ftmp) | 223 | if (tmp != ftmp) |
224 | OPENSSL_free(tmp); | 224 | free(tmp); |
225 | if (bl) | 225 | if (bl) |
226 | BN_free(bl); | 226 | BN_free(bl); |
227 | return(0); | 227 | return(0); |
@@ -242,7 +242,7 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) | |||
242 | i=i2t_ASN1_OBJECT(buf,sizeof buf,a); | 242 | i=i2t_ASN1_OBJECT(buf,sizeof buf,a); |
243 | if (i > (int)(sizeof(buf) - 1)) | 243 | if (i > (int)(sizeof(buf) - 1)) |
244 | { | 244 | { |
245 | p = OPENSSL_malloc(i + 1); | 245 | p = malloc(i + 1); |
246 | if (!p) | 246 | if (!p) |
247 | return -1; | 247 | return -1; |
248 | i2t_ASN1_OBJECT(p,i + 1,a); | 248 | i2t_ASN1_OBJECT(p,i + 1,a); |
@@ -251,7 +251,7 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) | |||
251 | return BIO_write(bp, "<INVALID>", 9); | 251 | return BIO_write(bp, "<INVALID>", 9); |
252 | BIO_write(bp,p,i); | 252 | BIO_write(bp,p,i); |
253 | if (p != buf) | 253 | if (p != buf) |
254 | OPENSSL_free(p); | 254 | free(p); |
255 | return(i); | 255 | return(i); |
256 | } | 256 | } |
257 | 257 | ||
@@ -319,8 +319,8 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | |||
319 | if ((data == NULL) || (ret->length < len)) | 319 | if ((data == NULL) || (ret->length < len)) |
320 | { | 320 | { |
321 | ret->length=0; | 321 | ret->length=0; |
322 | if (data != NULL) OPENSSL_free(data); | 322 | if (data != NULL) free(data); |
323 | data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); | 323 | data=(unsigned char *)malloc(len ? (int)len : 1); |
324 | if (data == NULL) | 324 | if (data == NULL) |
325 | { i=ERR_R_MALLOC_FAILURE; goto err; } | 325 | { i=ERR_R_MALLOC_FAILURE; goto err; } |
326 | ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; | 326 | ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; |
@@ -348,7 +348,7 @@ ASN1_OBJECT *ASN1_OBJECT_new(void) | |||
348 | { | 348 | { |
349 | ASN1_OBJECT *ret; | 349 | ASN1_OBJECT *ret; |
350 | 350 | ||
351 | ret=(ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT)); | 351 | ret=(ASN1_OBJECT *)malloc(sizeof(ASN1_OBJECT)); |
352 | if (ret == NULL) | 352 | if (ret == NULL) |
353 | { | 353 | { |
354 | ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE); | 354 | ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE); |
@@ -369,19 +369,19 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a) | |||
369 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) | 369 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) |
370 | { | 370 | { |
371 | #ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */ | 371 | #ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */ |
372 | if (a->sn != NULL) OPENSSL_free((void *)a->sn); | 372 | if (a->sn != NULL) free((void *)a->sn); |
373 | if (a->ln != NULL) OPENSSL_free((void *)a->ln); | 373 | if (a->ln != NULL) free((void *)a->ln); |
374 | #endif | 374 | #endif |
375 | a->sn=a->ln=NULL; | 375 | a->sn=a->ln=NULL; |
376 | } | 376 | } |
377 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) | 377 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) |
378 | { | 378 | { |
379 | if (a->data != NULL) OPENSSL_free((void *)a->data); | 379 | if (a->data != NULL) free((void *)a->data); |
380 | a->data=NULL; | 380 | a->data=NULL; |
381 | a->length=0; | 381 | a->length=0; |
382 | } | 382 | } |
383 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) | 383 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) |
384 | OPENSSL_free(a); | 384 | free(a); |
385 | } | 385 | } |
386 | 386 | ||
387 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, | 387 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, |
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c index 01b6292b65..0433b49a64 100644 --- a/src/lib/libcrypto/asn1/a_sign.c +++ b/src/lib/libcrypto/asn1/a_sign.c | |||
@@ -211,7 +211,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, | |||
211 | 211 | ||
212 | inl=ASN1_item_i2d(asn,&buf_in, it); | 212 | inl=ASN1_item_i2d(asn,&buf_in, it); |
213 | outll=outl=EVP_PKEY_size(pkey); | 213 | outll=outl=EVP_PKEY_size(pkey); |
214 | buf_out=OPENSSL_malloc((unsigned int)outl); | 214 | buf_out=malloc((unsigned int)outl); |
215 | if ((buf_in == NULL) || (buf_out == NULL)) | 215 | if ((buf_in == NULL) || (buf_out == NULL)) |
216 | { | 216 | { |
217 | outl=0; | 217 | outl=0; |
@@ -226,7 +226,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, | |||
226 | ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB); | 226 | ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB); |
227 | goto err; | 227 | goto err; |
228 | } | 228 | } |
229 | if (signature->data != NULL) OPENSSL_free(signature->data); | 229 | if (signature->data != NULL) free(signature->data); |
230 | signature->data=buf_out; | 230 | signature->data=buf_out; |
231 | buf_out=NULL; | 231 | buf_out=NULL; |
232 | signature->length=outl; | 232 | signature->length=outl; |
@@ -238,8 +238,8 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, | |||
238 | err: | 238 | err: |
239 | EVP_MD_CTX_cleanup(ctx); | 239 | EVP_MD_CTX_cleanup(ctx); |
240 | if (buf_in != NULL) | 240 | if (buf_in != NULL) |
241 | { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); } | 241 | { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); free(buf_in); } |
242 | if (buf_out != NULL) | 242 | if (buf_out != NULL) |
243 | { OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); } | 243 | { OPENSSL_cleanse((char *)buf_out,outll); free(buf_out); } |
244 | return(outl); | 244 | return(outl); |
245 | } | 245 | } |
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index d1a587ccc1..713b3cb028 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
@@ -278,12 +278,12 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING | |||
278 | t.type = str->type; | 278 | t.type = str->type; |
279 | t.value.ptr = (char *)str; | 279 | t.value.ptr = (char *)str; |
280 | der_len = i2d_ASN1_TYPE(&t, NULL); | 280 | der_len = i2d_ASN1_TYPE(&t, NULL); |
281 | der_buf = OPENSSL_malloc(der_len); | 281 | der_buf = malloc(der_len); |
282 | if(!der_buf) return -1; | 282 | if(!der_buf) return -1; |
283 | p = der_buf; | 283 | p = der_buf; |
284 | i2d_ASN1_TYPE(&t, &p); | 284 | i2d_ASN1_TYPE(&t, &p); |
285 | outlen = do_hex_dump(io_ch, arg, der_buf, der_len); | 285 | outlen = do_hex_dump(io_ch, arg, der_buf, der_len); |
286 | OPENSSL_free(der_buf); | 286 | free(der_buf); |
287 | if(outlen < 0) return -1; | 287 | if(outlen < 0) return -1; |
288 | return outlen + 1; | 288 | return outlen + 1; |
289 | } | 289 | } |
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 2fc48c1551..74bc7b316c 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
@@ -222,7 +222,7 @@ int ASN1_STRING_TABLE_add(int nid, | |||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | if(!(tmp = ASN1_STRING_TABLE_get(nid))) { | 224 | if(!(tmp = ASN1_STRING_TABLE_get(nid))) { |
225 | tmp = OPENSSL_malloc(sizeof(ASN1_STRING_TABLE)); | 225 | tmp = malloc(sizeof(ASN1_STRING_TABLE)); |
226 | if(!tmp) { | 226 | if(!tmp) { |
227 | ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, | 227 | ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, |
228 | ERR_R_MALLOC_FAILURE); | 228 | ERR_R_MALLOC_FAILURE); |
@@ -250,7 +250,7 @@ void ASN1_STRING_TABLE_cleanup(void) | |||
250 | 250 | ||
251 | static void st_free(ASN1_STRING_TABLE *tbl) | 251 | static void st_free(ASN1_STRING_TABLE *tbl) |
252 | { | 252 | { |
253 | if(tbl->flags & STABLE_FLAGS_MALLOC) OPENSSL_free(tbl); | 253 | if(tbl->flags & STABLE_FLAGS_MALLOC) free(tbl); |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c index f2e7de16af..0e7aca90a7 100644 --- a/src/lib/libcrypto/asn1/a_utctm.c +++ b/src/lib/libcrypto/asn1/a_utctm.c | |||
@@ -203,14 +203,14 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, | |||
203 | p=(char *)s->data; | 203 | p=(char *)s->data; |
204 | if ((p == NULL) || ((size_t)s->length < len)) | 204 | if ((p == NULL) || ((size_t)s->length < len)) |
205 | { | 205 | { |
206 | p=OPENSSL_malloc(len); | 206 | p=malloc(len); |
207 | if (p == NULL) | 207 | if (p == NULL) |
208 | { | 208 | { |
209 | ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE); | 209 | ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE); |
210 | return(NULL); | 210 | return(NULL); |
211 | } | 211 | } |
212 | if (s->data != NULL) | 212 | if (s->data != NULL) |
213 | OPENSSL_free(s->data); | 213 | free(s->data); |
214 | s->data=(unsigned char *)p; | 214 | s->data=(unsigned char *)p; |
215 | } | 215 | } |
216 | 216 | ||
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c index 5eb47d768c..8eca970be3 100644 --- a/src/lib/libcrypto/asn1/a_verify.c +++ b/src/lib/libcrypto/asn1/a_verify.c | |||
@@ -154,7 +154,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, | |||
154 | } | 154 | } |
155 | 155 | ||
156 | OPENSSL_cleanse(buf_in,(unsigned int)inl); | 156 | OPENSSL_cleanse(buf_in,(unsigned int)inl); |
157 | OPENSSL_free(buf_in); | 157 | free(buf_in); |
158 | 158 | ||
159 | if (EVP_DigestVerifyFinal(&ctx,signature->data, | 159 | if (EVP_DigestVerifyFinal(&ctx,signature->data, |
160 | (size_t)signature->length) <= 0) | 160 | (size_t)signature->length) <= 0) |
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c index a19e058fca..228392f1e6 100644 --- a/src/lib/libcrypto/asn1/ameth_lib.c +++ b/src/lib/libcrypto/asn1/ameth_lib.c | |||
@@ -289,7 +289,7 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | |||
289 | const char *pem_str, const char *info) | 289 | const char *pem_str, const char *info) |
290 | { | 290 | { |
291 | EVP_PKEY_ASN1_METHOD *ameth; | 291 | EVP_PKEY_ASN1_METHOD *ameth; |
292 | ameth = OPENSSL_malloc(sizeof(EVP_PKEY_ASN1_METHOD)); | 292 | ameth = malloc(sizeof(EVP_PKEY_ASN1_METHOD)); |
293 | if (!ameth) | 293 | if (!ameth) |
294 | return NULL; | 294 | return NULL; |
295 | 295 | ||
@@ -393,10 +393,10 @@ void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | |||
393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) | 393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) |
394 | { | 394 | { |
395 | if (ameth->pem_str) | 395 | if (ameth->pem_str) |
396 | OPENSSL_free(ameth->pem_str); | 396 | free(ameth->pem_str); |
397 | if (ameth->info) | 397 | if (ameth->info) |
398 | OPENSSL_free(ameth->info); | 398 | free(ameth->info); |
399 | OPENSSL_free(ameth); | 399 | free(ameth); |
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c index 81a7a38895..8194beeb30 100644 --- a/src/lib/libcrypto/asn1/asn1_gen.c +++ b/src/lib/libcrypto/asn1/asn1_gen.c | |||
@@ -226,7 +226,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
226 | 226 | ||
227 | /* Allocate buffer for new encoding */ | 227 | /* Allocate buffer for new encoding */ |
228 | 228 | ||
229 | new_der = OPENSSL_malloc(len); | 229 | new_der = malloc(len); |
230 | if (!new_der) | 230 | if (!new_der) |
231 | goto err; | 231 | goto err; |
232 | 232 | ||
@@ -266,9 +266,9 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
266 | 266 | ||
267 | err: | 267 | err: |
268 | if (orig_der) | 268 | if (orig_der) |
269 | OPENSSL_free(orig_der); | 269 | free(orig_der); |
270 | if (new_der) | 270 | if (new_der) |
271 | OPENSSL_free(new_der); | 271 | free(new_der); |
272 | 272 | ||
273 | return ret; | 273 | return ret; |
274 | 274 | ||
@@ -499,7 +499,7 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | |||
499 | bad: | 499 | bad: |
500 | 500 | ||
501 | if (der) | 501 | if (der) |
502 | OPENSSL_free(der); | 502 | free(der); |
503 | 503 | ||
504 | if (sk) | 504 | if (sk) |
505 | sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); | 505 | sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 4d1d6af18d..7b06b6fdc8 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -383,9 +383,9 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
383 | { | 383 | { |
384 | c=str->data; | 384 | c=str->data; |
385 | if (c == NULL) | 385 | if (c == NULL) |
386 | str->data=OPENSSL_malloc(len+1); | 386 | str->data=malloc(len+1); |
387 | else | 387 | else |
388 | str->data=OPENSSL_realloc(c,len+1); | 388 | str->data=realloc(c,len+1); |
389 | 389 | ||
390 | if (str->data == NULL) | 390 | if (str->data == NULL) |
391 | { | 391 | { |
@@ -407,7 +407,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
407 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | 407 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) |
408 | { | 408 | { |
409 | if (str->data) | 409 | if (str->data) |
410 | OPENSSL_free(str->data); | 410 | free(str->data); |
411 | str->data = data; | 411 | str->data = data; |
412 | str->length = len; | 412 | str->length = len; |
413 | } | 413 | } |
@@ -422,7 +422,7 @@ ASN1_STRING *ASN1_STRING_type_new(int type) | |||
422 | { | 422 | { |
423 | ASN1_STRING *ret; | 423 | ASN1_STRING *ret; |
424 | 424 | ||
425 | ret=(ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING)); | 425 | ret=(ASN1_STRING *)malloc(sizeof(ASN1_STRING)); |
426 | if (ret == NULL) | 426 | if (ret == NULL) |
427 | { | 427 | { |
428 | ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE); | 428 | ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE); |
@@ -439,8 +439,8 @@ void ASN1_STRING_free(ASN1_STRING *a) | |||
439 | { | 439 | { |
440 | if (a == NULL) return; | 440 | if (a == NULL) return; |
441 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) | 441 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) |
442 | OPENSSL_free(a->data); | 442 | free(a->data); |
443 | OPENSSL_free(a); | 443 | free(a); |
444 | } | 444 | } |
445 | 445 | ||
446 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | 446 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) |
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h index c60b197552..ecc2c77228 100644 --- a/src/lib/libcrypto/asn1/asn1_mac.h +++ b/src/lib/libcrypto/asn1/asn1_mac.h | |||
@@ -289,7 +289,7 @@ err:\ | |||
289 | 289 | ||
290 | /* New macros */ | 290 | /* New macros */ |
291 | #define M_ASN1_New_Malloc(ret,type) \ | 291 | #define M_ASN1_New_Malloc(ret,type) \ |
292 | if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ | 292 | if ((ret=(type *)malloc(sizeof(type))) == NULL) \ |
293 | { c.line=__LINE__; goto err2; } | 293 | { c.line=__LINE__; goto err2; } |
294 | 294 | ||
295 | #define M_ASN1_New(arg,func) \ | 295 | #define M_ASN1_New(arg,func) \ |
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c index 54a704a969..d94b3cd6f8 100644 --- a/src/lib/libcrypto/asn1/asn_mime.c +++ b/src/lib/libcrypto/asn1/asn_mime.c | |||
@@ -220,7 +220,7 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) | |||
220 | if (rv > 0) | 220 | if (rv > 0) |
221 | { | 221 | { |
222 | BIO_puts(out, micstr); | 222 | BIO_puts(out, micstr); |
223 | OPENSSL_free(micstr); | 223 | free(micstr); |
224 | continue; | 224 | continue; |
225 | } | 225 | } |
226 | if (rv != -2) | 226 | if (rv != -2) |
@@ -822,7 +822,7 @@ static MIME_HEADER *mime_hdr_new(char *name, char *value) | |||
822 | } | 822 | } |
823 | } | 823 | } |
824 | } else tmpval = NULL; | 824 | } else tmpval = NULL; |
825 | mhdr = (MIME_HEADER *) OPENSSL_malloc(sizeof(MIME_HEADER)); | 825 | mhdr = (MIME_HEADER *) malloc(sizeof(MIME_HEADER)); |
826 | if(!mhdr) return NULL; | 826 | if(!mhdr) return NULL; |
827 | mhdr->name = tmpname; | 827 | mhdr->name = tmpname; |
828 | mhdr->value = tmpval; | 828 | mhdr->value = tmpval; |
@@ -851,7 +851,7 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value) | |||
851 | if(!tmpval) return 0; | 851 | if(!tmpval) return 0; |
852 | } else tmpval = NULL; | 852 | } else tmpval = NULL; |
853 | /* Parameter values are case sensitive so leave as is */ | 853 | /* Parameter values are case sensitive so leave as is */ |
854 | mparam = (MIME_PARAM *) OPENSSL_malloc(sizeof(MIME_PARAM)); | 854 | mparam = (MIME_PARAM *) malloc(sizeof(MIME_PARAM)); |
855 | if(!mparam) return 0; | 855 | if(!mparam) return 0; |
856 | mparam->param_name = tmpname; | 856 | mparam->param_name = tmpname; |
857 | mparam->param_value = tmpval; | 857 | mparam->param_value = tmpval; |
@@ -900,17 +900,17 @@ static MIME_PARAM *mime_param_find(MIME_HEADER *hdr, char *name) | |||
900 | 900 | ||
901 | static void mime_hdr_free(MIME_HEADER *hdr) | 901 | static void mime_hdr_free(MIME_HEADER *hdr) |
902 | { | 902 | { |
903 | if(hdr->name) OPENSSL_free(hdr->name); | 903 | if(hdr->name) free(hdr->name); |
904 | if(hdr->value) OPENSSL_free(hdr->value); | 904 | if(hdr->value) free(hdr->value); |
905 | if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); | 905 | if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); |
906 | OPENSSL_free(hdr); | 906 | free(hdr); |
907 | } | 907 | } |
908 | 908 | ||
909 | static void mime_param_free(MIME_PARAM *param) | 909 | static void mime_param_free(MIME_PARAM *param) |
910 | { | 910 | { |
911 | if(param->param_name) OPENSSL_free(param->param_name); | 911 | if(param->param_name) free(param->param_name); |
912 | if(param->param_value) OPENSSL_free(param->param_value); | 912 | if(param->param_value) free(param->param_value); |
913 | OPENSSL_free(param); | 913 | free(param); |
914 | } | 914 | } |
915 | 915 | ||
916 | /* Check for a multipart boundary. Returns: | 916 | /* Check for a multipart boundary. Returns: |
diff --git a/src/lib/libcrypto/asn1/asn_moid.c b/src/lib/libcrypto/asn1/asn_moid.c index 1ea6a59248..fd04d11459 100644 --- a/src/lib/libcrypto/asn1/asn_moid.c +++ b/src/lib/libcrypto/asn1/asn_moid.c | |||
@@ -145,7 +145,7 @@ static int do_create(char *value, char *name) | |||
145 | p--; | 145 | p--; |
146 | } | 146 | } |
147 | p++; | 147 | p++; |
148 | lntmp = OPENSSL_malloc((p - ln) + 1); | 148 | lntmp = malloc((p - ln) + 1); |
149 | if (lntmp == NULL) | 149 | if (lntmp == NULL) |
150 | return 0; | 150 | return 0; |
151 | memcpy(lntmp, ln, p - ln); | 151 | memcpy(lntmp, ln, p - ln); |
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c index 1886508654..13dc5d4665 100644 --- a/src/lib/libcrypto/asn1/asn_pack.c +++ b/src/lib/libcrypto/asn1/asn_pack.c | |||
@@ -75,7 +75,7 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct) | |||
75 | } else octmp = *oct; | 75 | } else octmp = *oct; |
76 | 76 | ||
77 | if(octmp->data) { | 77 | if(octmp->data) { |
78 | OPENSSL_free(octmp->data); | 78 | free(octmp->data); |
79 | octmp->data = NULL; | 79 | octmp->data = NULL; |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/src/lib/libcrypto/asn1/bio_asn1.c b/src/lib/libcrypto/asn1/bio_asn1.c index dc7efd551c..fa98dba728 100644 --- a/src/lib/libcrypto/asn1/bio_asn1.c +++ b/src/lib/libcrypto/asn1/bio_asn1.c | |||
@@ -150,7 +150,7 @@ BIO_METHOD *BIO_f_asn1(void) | |||
150 | static int asn1_bio_new(BIO *b) | 150 | static int asn1_bio_new(BIO *b) |
151 | { | 151 | { |
152 | BIO_ASN1_BUF_CTX *ctx; | 152 | BIO_ASN1_BUF_CTX *ctx; |
153 | ctx = OPENSSL_malloc(sizeof(BIO_ASN1_BUF_CTX)); | 153 | ctx = malloc(sizeof(BIO_ASN1_BUF_CTX)); |
154 | if (!ctx) | 154 | if (!ctx) |
155 | return 0; | 155 | return 0; |
156 | if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) | 156 | if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) |
@@ -163,7 +163,7 @@ static int asn1_bio_new(BIO *b) | |||
163 | 163 | ||
164 | static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size) | 164 | static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size) |
165 | { | 165 | { |
166 | ctx->buf = OPENSSL_malloc(size); | 166 | ctx->buf = malloc(size); |
167 | if (!ctx->buf) | 167 | if (!ctx->buf) |
168 | return 0; | 168 | return 0; |
169 | ctx->bufsize = size; | 169 | ctx->bufsize = size; |
@@ -186,8 +186,8 @@ static int asn1_bio_free(BIO *b) | |||
186 | if (ctx == NULL) | 186 | if (ctx == NULL) |
187 | return 0; | 187 | return 0; |
188 | if (ctx->buf) | 188 | if (ctx->buf) |
189 | OPENSSL_free(ctx->buf); | 189 | free(ctx->buf); |
190 | OPENSSL_free(ctx); | 190 | free(ctx); |
191 | b->init = 0; | 191 | b->init = 0; |
192 | b->ptr = NULL; | 192 | b->ptr = NULL; |
193 | b->flags = 0; | 193 | b->flags = 0; |
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index b91f97a1b1..60f324bdae 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
@@ -110,7 +110,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
110 | ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED); | 110 | ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED); |
111 | return NULL; | 111 | return NULL; |
112 | } | 112 | } |
113 | ndef_aux = OPENSSL_malloc(sizeof(NDEF_SUPPORT)); | 113 | ndef_aux = malloc(sizeof(NDEF_SUPPORT)); |
114 | asn_bio = BIO_new(BIO_f_asn1()); | 114 | asn_bio = BIO_new(BIO_f_asn1()); |
115 | 115 | ||
116 | /* ASN1 bio needs to be next to output BIO */ | 116 | /* ASN1 bio needs to be next to output BIO */ |
@@ -148,7 +148,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
148 | if (asn_bio) | 148 | if (asn_bio) |
149 | BIO_free(asn_bio); | 149 | BIO_free(asn_bio); |
150 | if (ndef_aux) | 150 | if (ndef_aux) |
151 | OPENSSL_free(ndef_aux); | 151 | free(ndef_aux); |
152 | return NULL; | 152 | return NULL; |
153 | } | 153 | } |
154 | 154 | ||
@@ -164,7 +164,7 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
164 | ndef_aux = *(NDEF_SUPPORT **)parg; | 164 | ndef_aux = *(NDEF_SUPPORT **)parg; |
165 | 165 | ||
166 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); | 166 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); |
167 | p = OPENSSL_malloc(derlen); | 167 | p = malloc(derlen); |
168 | ndef_aux->derbuf = p; | 168 | ndef_aux->derbuf = p; |
169 | *pbuf = p; | 169 | *pbuf = p; |
170 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); | 170 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); |
@@ -187,7 +187,7 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
187 | ndef_aux = *(NDEF_SUPPORT **)parg; | 187 | ndef_aux = *(NDEF_SUPPORT **)parg; |
188 | 188 | ||
189 | if (ndef_aux->derbuf) | 189 | if (ndef_aux->derbuf) |
190 | OPENSSL_free(ndef_aux->derbuf); | 190 | free(ndef_aux->derbuf); |
191 | 191 | ||
192 | ndef_aux->derbuf = NULL; | 192 | ndef_aux->derbuf = NULL; |
193 | *pbuf = NULL; | 193 | *pbuf = NULL; |
@@ -200,7 +200,7 @@ static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
200 | NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; | 200 | NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; |
201 | if (!ndef_prefix_free(b, pbuf, plen, parg)) | 201 | if (!ndef_prefix_free(b, pbuf, plen, parg)) |
202 | return 0; | 202 | return 0; |
203 | OPENSSL_free(*pndef_aux); | 203 | free(*pndef_aux); |
204 | *pndef_aux = NULL; | 204 | *pndef_aux = NULL; |
205 | return 1; | 205 | return 1; |
206 | } | 206 | } |
@@ -229,7 +229,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
229 | return 0; | 229 | return 0; |
230 | 230 | ||
231 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); | 231 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); |
232 | p = OPENSSL_malloc(derlen); | 232 | p = malloc(derlen); |
233 | ndef_aux->derbuf = p; | 233 | ndef_aux->derbuf = p; |
234 | *pbuf = p; | 234 | *pbuf = p; |
235 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); | 235 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); |
diff --git a/src/lib/libcrypto/asn1/f_enum.c b/src/lib/libcrypto/asn1/f_enum.c index 56e3cc8df2..caf34ee97e 100644 --- a/src/lib/libcrypto/asn1/f_enum.c +++ b/src/lib/libcrypto/asn1/f_enum.c | |||
@@ -153,15 +153,15 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
153 | if (num+i > slen) | 153 | if (num+i > slen) |
154 | { | 154 | { |
155 | if (s == NULL) | 155 | if (s == NULL) |
156 | sp=(unsigned char *)OPENSSL_malloc( | 156 | sp=(unsigned char *)malloc( |
157 | (unsigned int)num+i*2); | 157 | (unsigned int)num+i*2); |
158 | else | 158 | else |
159 | sp=(unsigned char *)OPENSSL_realloc(s, | 159 | sp=(unsigned char *)realloc(s, |
160 | (unsigned int)num+i*2); | 160 | (unsigned int)num+i*2); |
161 | if (sp == NULL) | 161 | if (sp == NULL) |
162 | { | 162 | { |
163 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); | 163 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); |
164 | if (s != NULL) OPENSSL_free(s); | 164 | if (s != NULL) free(s); |
165 | goto err; | 165 | goto err; |
166 | } | 166 | } |
167 | s=sp; | 167 | s=sp; |
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c index 8b92fad9df..977e3d01b7 100644 --- a/src/lib/libcrypto/asn1/f_int.c +++ b/src/lib/libcrypto/asn1/f_int.c | |||
@@ -157,14 +157,14 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) | |||
157 | if (num+i > slen) | 157 | if (num+i > slen) |
158 | { | 158 | { |
159 | if (s == NULL) | 159 | if (s == NULL) |
160 | sp=(unsigned char *)OPENSSL_malloc( | 160 | sp=(unsigned char *)malloc( |
161 | (unsigned int)num+i*2); | 161 | (unsigned int)num+i*2); |
162 | else | 162 | else |
163 | sp=OPENSSL_realloc_clean(s,slen,num+i*2); | 163 | sp=OPENSSL_realloc_clean(s,slen,num+i*2); |
164 | if (sp == NULL) | 164 | if (sp == NULL) |
165 | { | 165 | { |
166 | ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); | 166 | ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); |
167 | if (s != NULL) OPENSSL_free(s); | 167 | if (s != NULL) free(s); |
168 | goto err; | 168 | goto err; |
169 | } | 169 | } |
170 | s=sp; | 170 | s=sp; |
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c index f7d36adac7..f4bee15335 100644 --- a/src/lib/libcrypto/asn1/f_string.c +++ b/src/lib/libcrypto/asn1/f_string.c | |||
@@ -149,15 +149,15 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
149 | if (num+i > slen) | 149 | if (num+i > slen) |
150 | { | 150 | { |
151 | if (s == NULL) | 151 | if (s == NULL) |
152 | sp=(unsigned char *)OPENSSL_malloc( | 152 | sp=(unsigned char *)malloc( |
153 | (unsigned int)num+i*2); | 153 | (unsigned int)num+i*2); |
154 | else | 154 | else |
155 | sp=(unsigned char *)OPENSSL_realloc(s, | 155 | sp=(unsigned char *)realloc(s, |
156 | (unsigned int)num+i*2); | 156 | (unsigned int)num+i*2); |
157 | if (sp == NULL) | 157 | if (sp == NULL) |
158 | { | 158 | { |
159 | ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE); | 159 | ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE); |
160 | if (s != NULL) OPENSSL_free(s); | 160 | if (s != NULL) free(s); |
161 | goto err; | 161 | goto err; |
162 | } | 162 | } |
163 | s=sp; | 163 | s=sp; |
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c index e251739933..97647d17e1 100644 --- a/src/lib/libcrypto/asn1/n_pkey.c +++ b/src/lib/libcrypto/asn1/n_pkey.c | |||
@@ -169,7 +169,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, | |||
169 | 169 | ||
170 | 170 | ||
171 | /* Since its RC4 encrypted length is actual length */ | 171 | /* Since its RC4 encrypted length is actual length */ |
172 | if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL) | 172 | if ((zz=(unsigned char *)malloc(rsalen)) == NULL) |
173 | { | 173 | { |
174 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); | 174 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); |
175 | goto err; | 175 | goto err; |
@@ -179,7 +179,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, | |||
179 | /* Write out private key encoding */ | 179 | /* Write out private key encoding */ |
180 | i2d_RSAPrivateKey(a,&zz); | 180 | i2d_RSAPrivateKey(a,&zz); |
181 | 181 | ||
182 | if ((zz=OPENSSL_malloc(pkeylen)) == NULL) | 182 | if ((zz=malloc(pkeylen)) == NULL) |
183 | { | 183 | { |
184 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); | 184 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); |
185 | goto err; | 185 | goto err; |
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 4ea683036b..2d80334e01 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
@@ -214,7 +214,7 @@ X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, | |||
214 | 214 | ||
215 | if (!saltlen) | 215 | if (!saltlen) |
216 | saltlen = PKCS5_SALT_LEN; | 216 | saltlen = PKCS5_SALT_LEN; |
217 | if (!(osalt->data = OPENSSL_malloc (saltlen))) | 217 | if (!(osalt->data = malloc (saltlen))) |
218 | goto merr; | 218 | goto merr; |
219 | 219 | ||
220 | osalt->length = saltlen; | 220 | osalt->length = saltlen; |
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c index c61169208a..f6550b2b04 100644 --- a/src/lib/libcrypto/asn1/t_crl.c +++ b/src/lib/libcrypto/asn1/t_crl.c | |||
@@ -97,7 +97,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x) | |||
97 | X509_signature_print(out, x->sig_alg, NULL); | 97 | X509_signature_print(out, x->sig_alg, NULL); |
98 | p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); | 98 | p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); |
99 | BIO_printf(out,"%8sIssuer: %s\n","",p); | 99 | BIO_printf(out,"%8sIssuer: %s\n","",p); |
100 | OPENSSL_free(p); | 100 | free(p); |
101 | BIO_printf(out,"%8sLast Update: ",""); | 101 | BIO_printf(out,"%8sLast Update: ",""); |
102 | ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); | 102 | ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); |
103 | BIO_printf(out,"\n%8sNext Update: ",""); | 103 | BIO_printf(out,"\n%8sNext Update: ",""); |
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index bbf00c7a29..8dfda07b92 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
@@ -239,7 +239,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
239 | } | 239 | } |
240 | ret=1; | 240 | ret=1; |
241 | err: | 241 | err: |
242 | if (m != NULL) OPENSSL_free(m); | 242 | if (m != NULL) free(m); |
243 | return(ret); | 243 | return(ret); |
244 | } | 244 | } |
245 | 245 | ||
@@ -256,7 +256,7 @@ int X509_ocspid_print (BIO *bp, X509 *x) | |||
256 | if (BIO_printf(bp," Subject OCSP hash: ") <= 0) | 256 | if (BIO_printf(bp," Subject OCSP hash: ") <= 0) |
257 | goto err; | 257 | goto err; |
258 | derlen = i2d_X509_NAME(x->cert_info->subject, NULL); | 258 | derlen = i2d_X509_NAME(x->cert_info->subject, NULL); |
259 | if ((der = dertmp = (unsigned char *)OPENSSL_malloc (derlen)) == NULL) | 259 | if ((der = dertmp = (unsigned char *)malloc (derlen)) == NULL) |
260 | goto err; | 260 | goto err; |
261 | i2d_X509_NAME(x->cert_info->subject, &dertmp); | 261 | i2d_X509_NAME(x->cert_info->subject, &dertmp); |
262 | 262 | ||
@@ -266,7 +266,7 @@ int X509_ocspid_print (BIO *bp, X509 *x) | |||
266 | { | 266 | { |
267 | if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err; | 267 | if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err; |
268 | } | 268 | } |
269 | OPENSSL_free (der); | 269 | free (der); |
270 | der=NULL; | 270 | der=NULL; |
271 | 271 | ||
272 | /* display the hash of the public key as it would appear | 272 | /* display the hash of the public key as it would appear |
@@ -287,7 +287,7 @@ int X509_ocspid_print (BIO *bp, X509 *x) | |||
287 | 287 | ||
288 | return (1); | 288 | return (1); |
289 | err: | 289 | err: |
290 | if (der != NULL) OPENSSL_free(der); | 290 | if (der != NULL) free(der); |
291 | return(0); | 291 | return(0); |
292 | } | 292 | } |
293 | 293 | ||
@@ -477,7 +477,7 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) | |||
477 | b=X509_NAME_oneline(name,NULL,0); | 477 | b=X509_NAME_oneline(name,NULL,0); |
478 | if (!*b) | 478 | if (!*b) |
479 | { | 479 | { |
480 | OPENSSL_free(b); | 480 | free(b); |
481 | return 1; | 481 | return 1; |
482 | } | 482 | } |
483 | s=b+1; /* skip the first slash */ | 483 | s=b+1; /* skip the first slash */ |
@@ -513,6 +513,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) | |||
513 | err: | 513 | err: |
514 | X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB); | 514 | X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB); |
515 | } | 515 | } |
516 | OPENSSL_free(b); | 516 | free(b); |
517 | return(ret); | 517 | return(ret); |
518 | } | 518 | } |
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 87d7dfdf5c..c594db9140 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
@@ -910,7 +910,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, | |||
910 | *in = p; | 910 | *in = p; |
911 | ret = 1; | 911 | ret = 1; |
912 | err: | 912 | err: |
913 | if (free_cont && buf.data) OPENSSL_free(buf.data); | 913 | if (free_cont && buf.data) free(buf.data); |
914 | return ret; | 914 | return ret; |
915 | } | 915 | } |
916 | 916 | ||
@@ -1046,7 +1046,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | |||
1046 | if (*free_cont) | 1046 | if (*free_cont) |
1047 | { | 1047 | { |
1048 | if (stmp->data) | 1048 | if (stmp->data) |
1049 | OPENSSL_free(stmp->data); | 1049 | free(stmp->data); |
1050 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ | 1050 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ |
1051 | stmp->length = len; | 1051 | stmp->length = len; |
1052 | *free_cont = 0; | 1052 | *free_cont = 0; |
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c index 936ad1f767..9ab0473d73 100644 --- a/src/lib/libcrypto/asn1/tasn_enc.c +++ b/src/lib/libcrypto/asn1/tasn_enc.c | |||
@@ -110,7 +110,7 @@ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, | |||
110 | len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); | 110 | len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); |
111 | if (len <= 0) | 111 | if (len <= 0) |
112 | return len; | 112 | return len; |
113 | buf = OPENSSL_malloc(len); | 113 | buf = malloc(len); |
114 | if (!buf) | 114 | if (!buf) |
115 | return -1; | 115 | return -1; |
116 | p = buf; | 116 | p = buf; |
@@ -451,9 +451,9 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, | |||
451 | do_sort = 0; | 451 | do_sort = 0; |
452 | else | 452 | else |
453 | { | 453 | { |
454 | derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk) | 454 | derlst = malloc(sk_ASN1_VALUE_num(sk) |
455 | * sizeof(*derlst)); | 455 | * sizeof(*derlst)); |
456 | tmpdat = OPENSSL_malloc(skcontlen); | 456 | tmpdat = malloc(skcontlen); |
457 | if (!derlst || !tmpdat) | 457 | if (!derlst || !tmpdat) |
458 | return 0; | 458 | return 0; |
459 | } | 459 | } |
@@ -496,8 +496,8 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, | |||
496 | i++, tder++) | 496 | i++, tder++) |
497 | (void)sk_ASN1_VALUE_set(sk, i, tder->field); | 497 | (void)sk_ASN1_VALUE_set(sk, i, tder->field); |
498 | } | 498 | } |
499 | OPENSSL_free(derlst); | 499 | free(derlst); |
500 | OPENSSL_free(tmpdat); | 500 | free(tmpdat); |
501 | return 1; | 501 | return 1; |
502 | } | 502 | } |
503 | 503 | ||
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c index 77d3092d31..b04034ba4c 100644 --- a/src/lib/libcrypto/asn1/tasn_fre.c +++ b/src/lib/libcrypto/asn1/tasn_fre.c | |||
@@ -126,7 +126,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
126 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); | 126 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); |
127 | if (!combine) | 127 | if (!combine) |
128 | { | 128 | { |
129 | OPENSSL_free(*pval); | 129 | free(*pval); |
130 | *pval = NULL; | 130 | *pval = NULL; |
131 | } | 131 | } |
132 | break; | 132 | break; |
@@ -173,7 +173,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
173 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); | 173 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); |
174 | if (!combine) | 174 | if (!combine) |
175 | { | 175 | { |
176 | OPENSSL_free(*pval); | 176 | free(*pval); |
177 | *pval = NULL; | 177 | *pval = NULL; |
178 | } | 178 | } |
179 | break; | 179 | break; |
@@ -254,7 +254,7 @@ void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
254 | 254 | ||
255 | case V_ASN1_ANY: | 255 | case V_ASN1_ANY: |
256 | ASN1_primitive_free(pval, NULL); | 256 | ASN1_primitive_free(pval, NULL); |
257 | OPENSSL_free(*pval); | 257 | free(*pval); |
258 | break; | 258 | break; |
259 | 259 | ||
260 | default: | 260 | default: |
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c index 0d9e78cc7c..aab9ef08c4 100644 --- a/src/lib/libcrypto/asn1/tasn_new.c +++ b/src/lib/libcrypto/asn1/tasn_new.c | |||
@@ -160,7 +160,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
160 | } | 160 | } |
161 | if (!combine) | 161 | if (!combine) |
162 | { | 162 | { |
163 | *pval = OPENSSL_malloc(it->size); | 163 | *pval = malloc(it->size); |
164 | if (!*pval) | 164 | if (!*pval) |
165 | goto memerr; | 165 | goto memerr; |
166 | memset(*pval, 0, it->size); | 166 | memset(*pval, 0, it->size); |
@@ -188,7 +188,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
188 | } | 188 | } |
189 | if (!combine) | 189 | if (!combine) |
190 | { | 190 | { |
191 | *pval = OPENSSL_malloc(it->size); | 191 | *pval = malloc(it->size); |
192 | if (!*pval) | 192 | if (!*pval) |
193 | goto memerr; | 193 | goto memerr; |
194 | memset(*pval, 0, it->size); | 194 | memset(*pval, 0, it->size); |
@@ -354,7 +354,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
354 | return 1; | 354 | return 1; |
355 | 355 | ||
356 | case V_ASN1_ANY: | 356 | case V_ASN1_ANY: |
357 | typ = OPENSSL_malloc(sizeof(ASN1_TYPE)); | 357 | typ = malloc(sizeof(ASN1_TYPE)); |
358 | if (!typ) | 358 | if (!typ) |
359 | return 0; | 359 | return 0; |
360 | typ->value.ptr = NULL; | 360 | typ->value.ptr = NULL; |
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c index 542a091a66..ec524edac8 100644 --- a/src/lib/libcrypto/asn1/tasn_prn.c +++ b/src/lib/libcrypto/asn1/tasn_prn.c | |||
@@ -85,7 +85,7 @@ ASN1_PCTX default_pctx = | |||
85 | ASN1_PCTX *ASN1_PCTX_new(void) | 85 | ASN1_PCTX *ASN1_PCTX_new(void) |
86 | { | 86 | { |
87 | ASN1_PCTX *ret; | 87 | ASN1_PCTX *ret; |
88 | ret = OPENSSL_malloc(sizeof(ASN1_PCTX)); | 88 | ret = malloc(sizeof(ASN1_PCTX)); |
89 | if (ret == NULL) | 89 | if (ret == NULL) |
90 | { | 90 | { |
91 | ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE); | 91 | ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE); |
@@ -101,7 +101,7 @@ ASN1_PCTX *ASN1_PCTX_new(void) | |||
101 | 101 | ||
102 | void ASN1_PCTX_free(ASN1_PCTX *p) | 102 | void ASN1_PCTX_free(ASN1_PCTX *p) |
103 | { | 103 | { |
104 | OPENSSL_free(p); | 104 | free(p); |
105 | } | 105 | } |
106 | 106 | ||
107 | unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p) | 107 | unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p) |
@@ -480,7 +480,7 @@ static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, | |||
480 | s = i2s_ASN1_INTEGER(NULL, str); | 480 | s = i2s_ASN1_INTEGER(NULL, str); |
481 | if (BIO_puts(out, s) <= 0) | 481 | if (BIO_puts(out, s) <= 0) |
482 | ret = 0; | 482 | ret = 0; |
483 | OPENSSL_free(s); | 483 | free(s); |
484 | return ret; | 484 | return ret; |
485 | } | 485 | } |
486 | 486 | ||
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c index ca9ec7a32f..dfa63fb2bc 100644 --- a/src/lib/libcrypto/asn1/tasn_utl.c +++ b/src/lib/libcrypto/asn1/tasn_utl.c | |||
@@ -155,7 +155,7 @@ void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
155 | if (enc) | 155 | if (enc) |
156 | { | 156 | { |
157 | if (enc->enc) | 157 | if (enc->enc) |
158 | OPENSSL_free(enc->enc); | 158 | free(enc->enc); |
159 | enc->enc = NULL; | 159 | enc->enc = NULL; |
160 | enc->len = 0; | 160 | enc->len = 0; |
161 | enc->modified = 1; | 161 | enc->modified = 1; |
@@ -171,8 +171,8 @@ int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, | |||
171 | return 1; | 171 | return 1; |
172 | 172 | ||
173 | if (enc->enc) | 173 | if (enc->enc) |
174 | OPENSSL_free(enc->enc); | 174 | free(enc->enc); |
175 | enc->enc = OPENSSL_malloc(inlen); | 175 | enc->enc = malloc(inlen); |
176 | if (!enc->enc) | 176 | if (!enc->enc) |
177 | return 0; | 177 | return 0; |
178 | memcpy(enc->enc, in, inlen); | 178 | memcpy(enc->enc, in, inlen); |
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index c51c690ba9..cf7e69aaaf 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c | |||
@@ -493,7 +493,7 @@ X509_CRL_METHOD *X509_CRL_METHOD_new( | |||
493 | int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)) | 493 | int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)) |
494 | { | 494 | { |
495 | X509_CRL_METHOD *m; | 495 | X509_CRL_METHOD *m; |
496 | m = OPENSSL_malloc(sizeof(X509_CRL_METHOD)); | 496 | m = malloc(sizeof(X509_CRL_METHOD)); |
497 | if (!m) | 497 | if (!m) |
498 | return NULL; | 498 | return NULL; |
499 | m->crl_init = crl_init; | 499 | m->crl_init = crl_init; |
@@ -508,7 +508,7 @@ void X509_CRL_METHOD_free(X509_CRL_METHOD *m) | |||
508 | { | 508 | { |
509 | if (!(m->flags & X509_CRL_METHOD_DYNAMIC)) | 509 | if (!(m->flags & X509_CRL_METHOD_DYNAMIC)) |
510 | return; | 510 | return; |
511 | OPENSSL_free(m); | 511 | free(m); |
512 | } | 512 | } |
513 | 513 | ||
514 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) | 514 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) |
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c index d44f6cdb01..c13fad056f 100644 --- a/src/lib/libcrypto/asn1/x_info.c +++ b/src/lib/libcrypto/asn1/x_info.c | |||
@@ -66,7 +66,7 @@ X509_INFO *X509_INFO_new(void) | |||
66 | { | 66 | { |
67 | X509_INFO *ret=NULL; | 67 | X509_INFO *ret=NULL; |
68 | 68 | ||
69 | ret=(X509_INFO *)OPENSSL_malloc(sizeof(X509_INFO)); | 69 | ret=(X509_INFO *)malloc(sizeof(X509_INFO)); |
70 | if (ret == NULL) | 70 | if (ret == NULL) |
71 | { | 71 | { |
72 | ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE); | 72 | ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE); |
@@ -106,8 +106,8 @@ void X509_INFO_free(X509_INFO *x) | |||
106 | if (x->x509 != NULL) X509_free(x->x509); | 106 | if (x->x509 != NULL) X509_free(x->x509); |
107 | if (x->crl != NULL) X509_CRL_free(x->crl); | 107 | if (x->crl != NULL) X509_CRL_free(x->crl); |
108 | if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey); | 108 | if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey); |
109 | if (x->enc_data != NULL) OPENSSL_free(x->enc_data); | 109 | if (x->enc_data != NULL) free(x->enc_data); |
110 | OPENSSL_free(x); | 110 | free(x); |
111 | } | 111 | } |
112 | 112 | ||
113 | IMPLEMENT_STACK_OF(X509_INFO) | 113 | IMPLEMENT_STACK_OF(X509_INFO) |
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index d7c2318693..e14d329639 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
@@ -132,7 +132,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME) | |||
132 | static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) | 132 | static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) |
133 | { | 133 | { |
134 | X509_NAME *ret = NULL; | 134 | X509_NAME *ret = NULL; |
135 | ret = OPENSSL_malloc(sizeof(X509_NAME)); | 135 | ret = malloc(sizeof(X509_NAME)); |
136 | if(!ret) goto memerr; | 136 | if(!ret) goto memerr; |
137 | if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) | 137 | if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) |
138 | goto memerr; | 138 | goto memerr; |
@@ -149,7 +149,7 @@ static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) | |||
149 | { | 149 | { |
150 | if (ret->entries) | 150 | if (ret->entries) |
151 | sk_X509_NAME_ENTRY_free(ret->entries); | 151 | sk_X509_NAME_ENTRY_free(ret->entries); |
152 | OPENSSL_free(ret); | 152 | free(ret); |
153 | } | 153 | } |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
@@ -164,8 +164,8 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
164 | BUF_MEM_free(a->bytes); | 164 | BUF_MEM_free(a->bytes); |
165 | sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); | 165 | sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); |
166 | if (a->canon_enc) | 166 | if (a->canon_enc) |
167 | OPENSSL_free(a->canon_enc); | 167 | free(a->canon_enc); |
168 | OPENSSL_free(a); | 168 | free(a); |
169 | *pval = NULL; | 169 | *pval = NULL; |
170 | } | 170 | } |
171 | 171 | ||
@@ -325,7 +325,7 @@ static int x509_name_canon(X509_NAME *a) | |||
325 | 325 | ||
326 | if (a->canon_enc) | 326 | if (a->canon_enc) |
327 | { | 327 | { |
328 | OPENSSL_free(a->canon_enc); | 328 | free(a->canon_enc); |
329 | a->canon_enc = NULL; | 329 | a->canon_enc = NULL; |
330 | } | 330 | } |
331 | /* Special case: empty X509_NAME => null encoding */ | 331 | /* Special case: empty X509_NAME => null encoding */ |
@@ -362,7 +362,7 @@ static int x509_name_canon(X509_NAME *a) | |||
362 | 362 | ||
363 | a->canon_enclen = i2d_name_canon(intname, NULL); | 363 | a->canon_enclen = i2d_name_canon(intname, NULL); |
364 | 364 | ||
365 | p = OPENSSL_malloc(a->canon_enclen); | 365 | p = malloc(a->canon_enclen); |
366 | 366 | ||
367 | if (!p) | 367 | if (!p) |
368 | goto err; | 368 | goto err; |
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c index 8453618426..3bf2f5e915 100644 --- a/src/lib/libcrypto/asn1/x_pkey.c +++ b/src/lib/libcrypto/asn1/x_pkey.c | |||
@@ -146,6 +146,6 @@ void X509_PKEY_free(X509_PKEY *x) | |||
146 | if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); | 146 | if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); |
147 | if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey); | 147 | if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey); |
148 | if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey); | 148 | if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey); |
149 | if ((x->key_data != NULL) && (x->key_free)) OPENSSL_free(x->key_data); | 149 | if ((x->key_data != NULL) && (x->key_free)) free(x->key_data); |
150 | OPENSSL_free(x); | 150 | free(x); |
151 | } | 151 | } |
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index b649e1fcf9..684f40899f 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
@@ -357,7 +357,7 @@ int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, | |||
357 | if (penc) | 357 | if (penc) |
358 | { | 358 | { |
359 | if (pub->public_key->data) | 359 | if (pub->public_key->data) |
360 | OPENSSL_free(pub->public_key->data); | 360 | free(pub->public_key->data); |
361 | pub->public_key->data = penc; | 361 | pub->public_key->data = penc; |
362 | pub->public_key->length = penclen; | 362 | pub->public_key->length = penclen; |
363 | /* Set number of unused bits to zero */ | 363 | /* Set number of unused bits to zero */ |
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c index de3df9eb51..5734f2b069 100644 --- a/src/lib/libcrypto/asn1/x_x509.c +++ b/src/lib/libcrypto/asn1/x_x509.c | |||
@@ -105,7 +105,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
105 | break; | 105 | break; |
106 | 106 | ||
107 | case ASN1_OP_D2I_POST: | 107 | case ASN1_OP_D2I_POST: |
108 | if (ret->name != NULL) OPENSSL_free(ret->name); | 108 | if (ret->name != NULL) free(ret->name); |
109 | ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); | 109 | ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); |
110 | break; | 110 | break; |
111 | 111 | ||
@@ -123,7 +123,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
123 | ASIdentifiers_free(ret->rfc3779_asid); | 123 | ASIdentifiers_free(ret->rfc3779_asid); |
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | if (ret->name != NULL) OPENSSL_free(ret->name); | 126 | if (ret->name != NULL) free(ret->name); |
127 | break; | 127 | break; |
128 | 128 | ||
129 | } | 129 | } |
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 55a5ca1a32..ff0089e82e 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
@@ -706,7 +706,7 @@ doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, | |||
706 | if (*buffer == NULL) { | 706 | if (*buffer == NULL) { |
707 | if (*maxlen == 0) | 707 | if (*maxlen == 0) |
708 | *maxlen = 1024; | 708 | *maxlen = 1024; |
709 | *buffer = OPENSSL_malloc(*maxlen); | 709 | *buffer = malloc(*maxlen); |
710 | if (*currlen > 0) { | 710 | if (*currlen > 0) { |
711 | assert(*sbuffer != NULL); | 711 | assert(*sbuffer != NULL); |
712 | memcpy(*buffer, *sbuffer, *currlen); | 712 | memcpy(*buffer, *sbuffer, *currlen); |
@@ -714,7 +714,7 @@ doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, | |||
714 | *sbuffer = NULL; | 714 | *sbuffer = NULL; |
715 | } else { | 715 | } else { |
716 | *maxlen += 1024; | 716 | *maxlen += 1024; |
717 | *buffer = OPENSSL_realloc(*buffer, *maxlen); | 717 | *buffer = realloc(*buffer, *maxlen); |
718 | } | 718 | } |
719 | } | 719 | } |
720 | /* What to do if *buffer is NULL? */ | 720 | /* What to do if *buffer is NULL? */ |
@@ -764,7 +764,7 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
764 | format, args); | 764 | format, args); |
765 | if (dynbuf) { | 765 | if (dynbuf) { |
766 | ret = BIO_write(bio, dynbuf, (int)retlen); | 766 | ret = BIO_write(bio, dynbuf, (int)retlen); |
767 | OPENSSL_free(dynbuf); | 767 | free(dynbuf); |
768 | } else { | 768 | } else { |
769 | ret = BIO_write(bio, hugebuf, (int)retlen); | 769 | ret = BIO_write(bio, hugebuf, (int)retlen); |
770 | } | 770 | } |
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index b08226d52b..1ae9d96577 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -490,7 +490,7 @@ again: | |||
490 | ret = 1; | 490 | ret = 1; |
491 | err: | 491 | err: |
492 | if (str != NULL) | 492 | if (str != NULL) |
493 | OPENSSL_free(str); | 493 | free(str); |
494 | if ((ret == 0) && (s != -1)) { | 494 | if ((ret == 0) && (s != -1)) { |
495 | close(s); | 495 | close(s); |
496 | s = -1; | 496 | s = -1; |
@@ -591,9 +591,9 @@ BIO_accept(int sock, char **addr) | |||
591 | p = *addr; | 591 | p = *addr; |
592 | if (p) { | 592 | if (p) { |
593 | *p = '\0'; | 593 | *p = '\0'; |
594 | p = OPENSSL_realloc(p, nl); | 594 | p = realloc(p, nl); |
595 | } else { | 595 | } else { |
596 | p = OPENSSL_malloc(nl); | 596 | p = malloc(nl); |
597 | } | 597 | } |
598 | if (p == NULL) { | 598 | if (p == NULL) { |
599 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 599 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); |
@@ -609,7 +609,7 @@ BIO_accept(int sock, char **addr) | |||
609 | l = ntohl(sa.from.sa_in.sin_addr.s_addr); | 609 | l = ntohl(sa.from.sa_in.sin_addr.s_addr); |
610 | port = ntohs(sa.from.sa_in.sin_port); | 610 | port = ntohs(sa.from.sa_in.sin_port); |
611 | if (*addr == NULL) { | 611 | if (*addr == NULL) { |
612 | if ((p = OPENSSL_malloc(24)) == NULL) { | 612 | if ((p = malloc(24)) == NULL) { |
613 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 613 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); |
614 | goto end; | 614 | goto end; |
615 | } | 615 | } |
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 937a1c58d5..be2ebab148 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
@@ -95,18 +95,18 @@ buffer_new(BIO *bi) | |||
95 | { | 95 | { |
96 | BIO_F_BUFFER_CTX *ctx; | 96 | BIO_F_BUFFER_CTX *ctx; |
97 | 97 | ||
98 | ctx = (BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX)); | 98 | ctx = (BIO_F_BUFFER_CTX *)malloc(sizeof(BIO_F_BUFFER_CTX)); |
99 | if (ctx == NULL) | 99 | if (ctx == NULL) |
100 | return (0); | 100 | return (0); |
101 | ctx->ibuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); | 101 | ctx->ibuf = (char *)malloc(DEFAULT_BUFFER_SIZE); |
102 | if (ctx->ibuf == NULL) { | 102 | if (ctx->ibuf == NULL) { |
103 | OPENSSL_free(ctx); | 103 | free(ctx); |
104 | return (0); | 104 | return (0); |
105 | } | 105 | } |
106 | ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); | 106 | ctx->obuf = (char *)malloc(DEFAULT_BUFFER_SIZE); |
107 | if (ctx->obuf == NULL) { | 107 | if (ctx->obuf == NULL) { |
108 | OPENSSL_free(ctx->ibuf); | 108 | free(ctx->ibuf); |
109 | OPENSSL_free(ctx); | 109 | free(ctx); |
110 | return (0); | 110 | return (0); |
111 | } | 111 | } |
112 | ctx->ibuf_size = DEFAULT_BUFFER_SIZE; | 112 | ctx->ibuf_size = DEFAULT_BUFFER_SIZE; |
@@ -131,10 +131,10 @@ buffer_free(BIO *a) | |||
131 | return (0); | 131 | return (0); |
132 | b = (BIO_F_BUFFER_CTX *)a->ptr; | 132 | b = (BIO_F_BUFFER_CTX *)a->ptr; |
133 | if (b->ibuf != NULL) | 133 | if (b->ibuf != NULL) |
134 | OPENSSL_free(b->ibuf); | 134 | free(b->ibuf); |
135 | if (b->obuf != NULL) | 135 | if (b->obuf != NULL) |
136 | OPENSSL_free(b->obuf); | 136 | free(b->obuf); |
137 | OPENSSL_free(a->ptr); | 137 | free(a->ptr); |
138 | a->ptr = NULL; | 138 | a->ptr = NULL; |
139 | a->init = 0; | 139 | a->init = 0; |
140 | a->flags = 0; | 140 | a->flags = 0; |
@@ -339,11 +339,11 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
339 | break; | 339 | break; |
340 | case BIO_C_SET_BUFF_READ_DATA: | 340 | case BIO_C_SET_BUFF_READ_DATA: |
341 | if (num > ctx->ibuf_size) { | 341 | if (num > ctx->ibuf_size) { |
342 | p1 = OPENSSL_malloc((int)num); | 342 | p1 = malloc((int)num); |
343 | if (p1 == NULL) | 343 | if (p1 == NULL) |
344 | goto malloc_error; | 344 | goto malloc_error; |
345 | if (ctx->ibuf != NULL) | 345 | if (ctx->ibuf != NULL) |
346 | OPENSSL_free(ctx->ibuf); | 346 | free(ctx->ibuf); |
347 | ctx->ibuf = p1; | 347 | ctx->ibuf = p1; |
348 | } | 348 | } |
349 | ctx->ibuf_off = 0; | 349 | ctx->ibuf_off = 0; |
@@ -370,27 +370,27 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
370 | p1 = ctx->ibuf; | 370 | p1 = ctx->ibuf; |
371 | p2 = ctx->obuf; | 371 | p2 = ctx->obuf; |
372 | if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) { | 372 | if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) { |
373 | p1 = (char *)OPENSSL_malloc((int)num); | 373 | p1 = (char *)malloc((int)num); |
374 | if (p1 == NULL) | 374 | if (p1 == NULL) |
375 | goto malloc_error; | 375 | goto malloc_error; |
376 | } | 376 | } |
377 | if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) { | 377 | if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) { |
378 | p2 = (char *)OPENSSL_malloc((int)num); | 378 | p2 = (char *)malloc((int)num); |
379 | if (p2 == NULL) { | 379 | if (p2 == NULL) { |
380 | if (p1 != ctx->ibuf) | 380 | if (p1 != ctx->ibuf) |
381 | OPENSSL_free(p1); | 381 | free(p1); |
382 | goto malloc_error; | 382 | goto malloc_error; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | if (ctx->ibuf != p1) { | 385 | if (ctx->ibuf != p1) { |
386 | OPENSSL_free(ctx->ibuf); | 386 | free(ctx->ibuf); |
387 | ctx->ibuf = p1; | 387 | ctx->ibuf = p1; |
388 | ctx->ibuf_off = 0; | 388 | ctx->ibuf_off = 0; |
389 | ctx->ibuf_len = 0; | 389 | ctx->ibuf_len = 0; |
390 | ctx->ibuf_size = ibs; | 390 | ctx->ibuf_size = ibs; |
391 | } | 391 | } |
392 | if (ctx->obuf != p2) { | 392 | if (ctx->obuf != p2) { |
393 | OPENSSL_free(ctx->obuf); | 393 | free(ctx->obuf); |
394 | ctx->obuf = p2; | 394 | ctx->obuf = p2; |
395 | ctx->obuf_off = 0; | 395 | ctx->obuf_off = 0; |
396 | ctx->obuf_len = 0; | 396 | ctx->obuf_len = 0; |
diff --git a/src/lib/libcrypto/bio/bf_lbuf.c b/src/lib/libcrypto/bio/bf_lbuf.c index 006ed9d91c..5020795ded 100644 --- a/src/lib/libcrypto/bio/bf_lbuf.c +++ b/src/lib/libcrypto/bio/bf_lbuf.c | |||
@@ -106,12 +106,12 @@ linebuffer_new(BIO *bi) | |||
106 | { | 106 | { |
107 | BIO_LINEBUFFER_CTX *ctx; | 107 | BIO_LINEBUFFER_CTX *ctx; |
108 | 108 | ||
109 | ctx = (BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX)); | 109 | ctx = (BIO_LINEBUFFER_CTX *)malloc(sizeof(BIO_LINEBUFFER_CTX)); |
110 | if (ctx == NULL) | 110 | if (ctx == NULL) |
111 | return (0); | 111 | return (0); |
112 | ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE); | 112 | ctx->obuf = (char *)malloc(DEFAULT_LINEBUFFER_SIZE); |
113 | if (ctx->obuf == NULL) { | 113 | if (ctx->obuf == NULL) { |
114 | OPENSSL_free(ctx); | 114 | free(ctx); |
115 | return (0); | 115 | return (0); |
116 | } | 116 | } |
117 | ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE; | 117 | ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE; |
@@ -132,8 +132,8 @@ linebuffer_free(BIO *a) | |||
132 | return (0); | 132 | return (0); |
133 | b = (BIO_LINEBUFFER_CTX *)a->ptr; | 133 | b = (BIO_LINEBUFFER_CTX *)a->ptr; |
134 | if (b->obuf != NULL) | 134 | if (b->obuf != NULL) |
135 | OPENSSL_free(b->obuf); | 135 | free(b->obuf); |
136 | OPENSSL_free(a->ptr); | 136 | free(a->ptr); |
137 | a->ptr = NULL; | 137 | a->ptr = NULL; |
138 | a->init = 0; | 138 | a->init = 0; |
139 | a->flags = 0; | 139 | a->flags = 0; |
@@ -299,7 +299,7 @@ linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
299 | obs = (int)num; | 299 | obs = (int)num; |
300 | p = ctx->obuf; | 300 | p = ctx->obuf; |
301 | if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) { | 301 | if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) { |
302 | p = (char *)OPENSSL_malloc((int)num); | 302 | p = (char *)malloc((int)num); |
303 | if (p == NULL) | 303 | if (p == NULL) |
304 | goto malloc_error; | 304 | goto malloc_error; |
305 | } | 305 | } |
@@ -308,7 +308,7 @@ linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
308 | ctx->obuf_len = obs; | 308 | ctx->obuf_len = obs; |
309 | } | 309 | } |
310 | memcpy(p, ctx->obuf, ctx->obuf_len); | 310 | memcpy(p, ctx->obuf, ctx->obuf_len); |
311 | OPENSSL_free(ctx->obuf); | 311 | free(ctx->obuf); |
312 | ctx->obuf = p; | 312 | ctx->obuf = p; |
313 | ctx->obuf_size = obs; | 313 | ctx->obuf_size = obs; |
314 | } | 314 | } |
diff --git a/src/lib/libcrypto/bio/bf_nbio.c b/src/lib/libcrypto/bio/bf_nbio.c index d181f518ec..200ca706ff 100644 --- a/src/lib/libcrypto/bio/bf_nbio.c +++ b/src/lib/libcrypto/bio/bf_nbio.c | |||
@@ -104,7 +104,7 @@ nbiof_new(BIO *bi) | |||
104 | { | 104 | { |
105 | NBIO_TEST *nt; | 105 | NBIO_TEST *nt; |
106 | 106 | ||
107 | if (!(nt = (NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)))) | 107 | if (!(nt = (NBIO_TEST *)malloc(sizeof(NBIO_TEST)))) |
108 | return (0); | 108 | return (0); |
109 | nt->lrn = -1; | 109 | nt->lrn = -1; |
110 | nt->lwn = -1; | 110 | nt->lwn = -1; |
@@ -120,7 +120,7 @@ nbiof_free(BIO *a) | |||
120 | if (a == NULL) | 120 | if (a == NULL) |
121 | return (0); | 121 | return (0); |
122 | if (a->ptr != NULL) | 122 | if (a->ptr != NULL) |
123 | OPENSSL_free(a->ptr); | 123 | free(a->ptr); |
124 | a->ptr = NULL; | 124 | a->ptr = NULL; |
125 | a->init = 0; | 125 | a->init = 0; |
126 | a->flags = 0; | 126 | a->flags = 0; |
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 90f1b1c1ef..c226d943af 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -68,13 +68,13 @@ BIO | |||
68 | { | 68 | { |
69 | BIO *ret = NULL; | 69 | BIO *ret = NULL; |
70 | 70 | ||
71 | ret = (BIO *)OPENSSL_malloc(sizeof(BIO)); | 71 | ret = (BIO *)malloc(sizeof(BIO)); |
72 | if (ret == NULL) { | 72 | if (ret == NULL) { |
73 | BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); | 73 | BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); |
74 | return (NULL); | 74 | return (NULL); |
75 | } | 75 | } |
76 | if (!BIO_set(ret, method)) { | 76 | if (!BIO_set(ret, method)) { |
77 | OPENSSL_free(ret); | 77 | free(ret); |
78 | ret = NULL; | 78 | ret = NULL; |
79 | } | 79 | } |
80 | return (ret); | 80 | return (ret); |
@@ -136,7 +136,7 @@ BIO_free(BIO *a) | |||
136 | if ((a->method == NULL) || (a->method->destroy == NULL)) | 136 | if ((a->method == NULL) || (a->method->destroy == NULL)) |
137 | return (1); | 137 | return (1); |
138 | a->method->destroy(a); | 138 | a->method->destroy(a); |
139 | OPENSSL_free(a); | 139 | free(a); |
140 | return (1); | 140 | return (1); |
141 | } | 141 | } |
142 | 142 | ||
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index d7c151eaaa..161b5d01f8 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
@@ -137,7 +137,7 @@ static BIO_ACCEPT | |||
137 | { | 137 | { |
138 | BIO_ACCEPT *ret; | 138 | BIO_ACCEPT *ret; |
139 | 139 | ||
140 | if ((ret = (BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL) | 140 | if ((ret = (BIO_ACCEPT *)malloc(sizeof(BIO_ACCEPT))) == NULL) |
141 | return (NULL); | 141 | return (NULL); |
142 | 142 | ||
143 | memset(ret, 0, sizeof(BIO_ACCEPT)); | 143 | memset(ret, 0, sizeof(BIO_ACCEPT)); |
@@ -153,12 +153,12 @@ BIO_ACCEPT_free(BIO_ACCEPT *a) | |||
153 | return; | 153 | return; |
154 | 154 | ||
155 | if (a->param_addr != NULL) | 155 | if (a->param_addr != NULL) |
156 | OPENSSL_free(a->param_addr); | 156 | free(a->param_addr); |
157 | if (a->addr != NULL) | 157 | if (a->addr != NULL) |
158 | OPENSSL_free(a->addr); | 158 | free(a->addr); |
159 | if (a->bio_chain != NULL) | 159 | if (a->bio_chain != NULL) |
160 | BIO_free(a->bio_chain); | 160 | BIO_free(a->bio_chain); |
161 | OPENSSL_free(a); | 161 | free(a); |
162 | } | 162 | } |
163 | 163 | ||
164 | static void | 164 | static void |
@@ -357,7 +357,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
357 | if (num == 0) { | 357 | if (num == 0) { |
358 | b->init = 1; | 358 | b->init = 1; |
359 | if (data->param_addr != NULL) | 359 | if (data->param_addr != NULL) |
360 | OPENSSL_free(data->param_addr); | 360 | free(data->param_addr); |
361 | data->param_addr = BUF_strdup(ptr); | 361 | data->param_addr = BUF_strdup(ptr); |
362 | } else if (num == 1) { | 362 | } else if (num == 1) { |
363 | data->accept_nbio = (ptr != NULL); | 363 | data->accept_nbio = (ptr != NULL); |
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index a74fcfdabc..4d93aba0a4 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c | |||
@@ -146,7 +146,7 @@ bio_new(BIO *bio) | |||
146 | { | 146 | { |
147 | struct bio_bio_st *b; | 147 | struct bio_bio_st *b; |
148 | 148 | ||
149 | b = OPENSSL_malloc(sizeof *b); | 149 | b = malloc(sizeof *b); |
150 | if (b == NULL) | 150 | if (b == NULL) |
151 | return 0; | 151 | return 0; |
152 | 152 | ||
@@ -173,10 +173,10 @@ bio_free(BIO *bio) | |||
173 | bio_destroy_pair(bio); | 173 | bio_destroy_pair(bio); |
174 | 174 | ||
175 | if (b->buf != NULL) { | 175 | if (b->buf != NULL) { |
176 | OPENSSL_free(b->buf); | 176 | free(b->buf); |
177 | } | 177 | } |
178 | 178 | ||
179 | OPENSSL_free(b); | 179 | free(b); |
180 | 180 | ||
181 | return 1; | 181 | return 1; |
182 | } | 182 | } |
@@ -516,7 +516,7 @@ bio_ctrl(BIO *bio, int cmd, long num, void *ptr) | |||
516 | 516 | ||
517 | if (b->size != new_size) { | 517 | if (b->size != new_size) { |
518 | if (b->buf) { | 518 | if (b->buf) { |
519 | OPENSSL_free(b->buf); | 519 | free(b->buf); |
520 | b->buf = NULL; | 520 | b->buf = NULL; |
521 | } | 521 | } |
522 | b->size = new_size; | 522 | b->size = new_size; |
@@ -701,7 +701,7 @@ bio_make_pair(BIO *bio1, BIO *bio2) | |||
701 | } | 701 | } |
702 | 702 | ||
703 | if (b1->buf == NULL) { | 703 | if (b1->buf == NULL) { |
704 | b1->buf = OPENSSL_malloc(b1->size); | 704 | b1->buf = malloc(b1->size); |
705 | if (b1->buf == NULL) { | 705 | if (b1->buf == NULL) { |
706 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); | 706 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); |
707 | return 0; | 707 | return 0; |
@@ -711,7 +711,7 @@ bio_make_pair(BIO *bio1, BIO *bio2) | |||
711 | } | 711 | } |
712 | 712 | ||
713 | if (b2->buf == NULL) { | 713 | if (b2->buf == NULL) { |
714 | b2->buf = OPENSSL_malloc(b2->size); | 714 | b2->buf = malloc(b2->size); |
715 | if (b2->buf == NULL) { | 715 | if (b2->buf == NULL) { |
716 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); | 716 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); |
717 | return 0; | 717 | return 0; |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index db877b140b..78ce240648 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -147,7 +147,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
147 | break; | 147 | break; |
148 | } | 148 | } |
149 | if (c->param_port != NULL) | 149 | if (c->param_port != NULL) |
150 | OPENSSL_free(c->param_port); | 150 | free(c->param_port); |
151 | c->param_port = BUF_strdup(p); | 151 | c->param_port = BUF_strdup(p); |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -293,7 +293,7 @@ BIO_CONNECT | |||
293 | { | 293 | { |
294 | BIO_CONNECT *ret; | 294 | BIO_CONNECT *ret; |
295 | 295 | ||
296 | if ((ret = (BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL) | 296 | if ((ret = (BIO_CONNECT *)malloc(sizeof(BIO_CONNECT))) == NULL) |
297 | return (NULL); | 297 | return (NULL); |
298 | ret->state = BIO_CONN_S_BEFORE; | 298 | ret->state = BIO_CONN_S_BEFORE; |
299 | ret->param_hostname = NULL; | 299 | ret->param_hostname = NULL; |
@@ -316,10 +316,10 @@ BIO_CONNECT_free(BIO_CONNECT *a) | |||
316 | return; | 316 | return; |
317 | 317 | ||
318 | if (a->param_hostname != NULL) | 318 | if (a->param_hostname != NULL) |
319 | OPENSSL_free(a->param_hostname); | 319 | free(a->param_hostname); |
320 | if (a->param_port != NULL) | 320 | if (a->param_port != NULL) |
321 | OPENSSL_free(a->param_port); | 321 | free(a->param_port); |
322 | OPENSSL_free(a); | 322 | free(a); |
323 | } | 323 | } |
324 | 324 | ||
325 | BIO_METHOD | 325 | BIO_METHOD |
@@ -470,11 +470,11 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
470 | b->init = 1; | 470 | b->init = 1; |
471 | if (num == 0) { | 471 | if (num == 0) { |
472 | if (data->param_hostname != NULL) | 472 | if (data->param_hostname != NULL) |
473 | OPENSSL_free(data->param_hostname); | 473 | free(data->param_hostname); |
474 | data->param_hostname = BUF_strdup(ptr); | 474 | data->param_hostname = BUF_strdup(ptr); |
475 | } else if (num == 1) { | 475 | } else if (num == 1) { |
476 | if (data->param_port != NULL) | 476 | if (data->param_port != NULL) |
477 | OPENSSL_free(data->param_port); | 477 | free(data->param_port); |
478 | data->param_port = BUF_strdup(ptr); | 478 | data->param_port = BUF_strdup(ptr); |
479 | } else if (num == 2) { | 479 | } else if (num == 2) { |
480 | char buf[16]; | 480 | char buf[16]; |
@@ -483,7 +483,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
483 | (void) snprintf(buf, sizeof buf, "%d.%d.%d.%d", | 483 | (void) snprintf(buf, sizeof buf, "%d.%d.%d.%d", |
484 | p[0], p[1], p[2], p[3]); | 484 | p[0], p[1], p[2], p[3]); |
485 | if (data->param_hostname != NULL) | 485 | if (data->param_hostname != NULL) |
486 | OPENSSL_free(data->param_hostname); | 486 | free(data->param_hostname); |
487 | data->param_hostname = BUF_strdup(buf); | 487 | data->param_hostname = BUF_strdup(buf); |
488 | memcpy(&(data->ip[0]), ptr, 4); | 488 | memcpy(&(data->ip[0]), ptr, 4); |
489 | } else if (num == 3) { | 489 | } else if (num == 3) { |
@@ -492,7 +492,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
492 | (void) snprintf(buf, sizeof buf, "%d", | 492 | (void) snprintf(buf, sizeof buf, "%d", |
493 | *(int *)ptr); | 493 | *(int *)ptr); |
494 | if (data->param_port != NULL) | 494 | if (data->param_port != NULL) |
495 | OPENSSL_free(data->param_port); | 495 | free(data->param_port); |
496 | data->param_port = BUF_strdup(buf); | 496 | data->param_port = BUF_strdup(buf); |
497 | data->port= *(int *)ptr; | 497 | data->port= *(int *)ptr; |
498 | } | 498 | } |
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c index 478c765399..e0445fc97e 100644 --- a/src/lib/libcrypto/bio/bss_dgram.c +++ b/src/lib/libcrypto/bio/bss_dgram.c | |||
@@ -212,7 +212,7 @@ dgram_new(BIO *bi) | |||
212 | 212 | ||
213 | bi->init = 0; | 213 | bi->init = 0; |
214 | bi->num = 0; | 214 | bi->num = 0; |
215 | data = OPENSSL_malloc(sizeof(bio_dgram_data)); | 215 | data = malloc(sizeof(bio_dgram_data)); |
216 | if (data == NULL) | 216 | if (data == NULL) |
217 | return 0; | 217 | return 0; |
218 | memset(data, 0x00, sizeof(bio_dgram_data)); | 218 | memset(data, 0x00, sizeof(bio_dgram_data)); |
@@ -234,7 +234,7 @@ dgram_free(BIO *a) | |||
234 | 234 | ||
235 | data = (bio_dgram_data *)a->ptr; | 235 | data = (bio_dgram_data *)a->ptr; |
236 | if (data != NULL) | 236 | if (data != NULL) |
237 | OPENSSL_free(data); | 237 | free(data); |
238 | 238 | ||
239 | return (1); | 239 | return (1); |
240 | } | 240 | } |
@@ -805,7 +805,7 @@ BIO | |||
805 | * SCTP-AUTH has to be activated for the listening socket | 805 | * SCTP-AUTH has to be activated for the listening socket |
806 | * already, otherwise the connected socket won't use it. */ | 806 | * already, otherwise the connected socket won't use it. */ |
807 | sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); | 807 | sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); |
808 | authchunks = OPENSSL_malloc(sockopt_len); | 808 | authchunks = malloc(sockopt_len); |
809 | memset(authchunks, 0, sizeof(sockopt_len)); | 809 | memset(authchunks, 0, sizeof(sockopt_len)); |
810 | ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); | 810 | ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); |
811 | OPENSSL_assert(ret >= 0); | 811 | OPENSSL_assert(ret >= 0); |
@@ -819,7 +819,7 @@ BIO | |||
819 | auth_forward = 1; | 819 | auth_forward = 1; |
820 | } | 820 | } |
821 | 821 | ||
822 | OPENSSL_free(authchunks); | 822 | free(authchunks); |
823 | 823 | ||
824 | OPENSSL_assert(auth_data); | 824 | OPENSSL_assert(auth_data); |
825 | OPENSSL_assert(auth_forward); | 825 | OPENSSL_assert(auth_forward); |
@@ -866,7 +866,7 @@ dgram_sctp_new(BIO *bi) | |||
866 | 866 | ||
867 | bi->init = 0; | 867 | bi->init = 0; |
868 | bi->num = 0; | 868 | bi->num = 0; |
869 | data = OPENSSL_malloc(sizeof(bio_dgram_sctp_data)); | 869 | data = malloc(sizeof(bio_dgram_sctp_data)); |
870 | if (data == NULL) | 870 | if (data == NULL) |
871 | return 0; | 871 | return 0; |
872 | memset(data, 0x00, sizeof(bio_dgram_sctp_data)); | 872 | memset(data, 0x00, sizeof(bio_dgram_sctp_data)); |
@@ -891,7 +891,7 @@ dgram_sctp_free(BIO *a) | |||
891 | 891 | ||
892 | data = (bio_dgram_sctp_data *)a->ptr; | 892 | data = (bio_dgram_sctp_data *)a->ptr; |
893 | if (data != NULL) | 893 | if (data != NULL) |
894 | OPENSSL_free(data); | 894 | free(data); |
895 | 895 | ||
896 | return (1); | 896 | return (1); |
897 | } | 897 | } |
@@ -998,7 +998,7 @@ dgram_sctp_read(BIO *b, char *out, int outl) | |||
998 | if (data->saved_message.length > 0) { | 998 | if (data->saved_message.length > 0) { |
999 | dgram_sctp_write(data->saved_message.bio, data->saved_message.data, | 999 | dgram_sctp_write(data->saved_message.bio, data->saved_message.data, |
1000 | data->saved_message.length); | 1000 | data->saved_message.length); |
1001 | OPENSSL_free(data->saved_message.data); | 1001 | free(data->saved_message.data); |
1002 | data->saved_message.length = 0; | 1002 | data->saved_message.length = 0; |
1003 | } | 1003 | } |
1004 | 1004 | ||
@@ -1087,7 +1087,7 @@ dgram_sctp_read(BIO *b, char *out, int outl) | |||
1087 | struct sctp_authchunks *authchunks; | 1087 | struct sctp_authchunks *authchunks; |
1088 | 1088 | ||
1089 | optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); | 1089 | optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); |
1090 | authchunks = OPENSSL_malloc(optlen); | 1090 | authchunks = malloc(optlen); |
1091 | memset(authchunks, 0, sizeof(optlen)); | 1091 | memset(authchunks, 0, sizeof(optlen)); |
1092 | ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); | 1092 | ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); |
1093 | OPENSSL_assert(ii >= 0); | 1093 | OPENSSL_assert(ii >= 0); |
@@ -1101,7 +1101,7 @@ dgram_sctp_read(BIO *b, char *out, int outl) | |||
1101 | auth_forward = 1; | 1101 | auth_forward = 1; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | OPENSSL_free(authchunks); | 1104 | free(authchunks); |
1105 | 1105 | ||
1106 | if (!auth_data || !auth_forward) { | 1106 | if (!auth_data || !auth_forward) { |
1107 | BIOerr(BIO_F_DGRAM_SCTP_READ, BIO_R_CONNECT_ERROR); | 1107 | BIOerr(BIO_F_DGRAM_SCTP_READ, BIO_R_CONNECT_ERROR); |
@@ -1154,7 +1154,7 @@ dgram_sctp_write(BIO *b, const char *in, int inl) | |||
1154 | if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) { | 1154 | if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) { |
1155 | data->saved_message.bio = b; | 1155 | data->saved_message.bio = b; |
1156 | data->saved_message.length = inl; | 1156 | data->saved_message.length = inl; |
1157 | data->saved_message.data = OPENSSL_malloc(inl); | 1157 | data->saved_message.data = malloc(inl); |
1158 | memcpy(data->saved_message.data, in, inl); | 1158 | memcpy(data->saved_message.data, in, inl); |
1159 | return inl; | 1159 | return inl; |
1160 | } | 1160 | } |
@@ -1282,7 +1282,7 @@ dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
1282 | 1282 | ||
1283 | /* Add new key */ | 1283 | /* Add new key */ |
1284 | sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t); | 1284 | sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t); |
1285 | authkey = OPENSSL_malloc(sockopt_len); | 1285 | authkey = malloc(sockopt_len); |
1286 | memset(authkey, 0x00, sockopt_len); | 1286 | memset(authkey, 0x00, sockopt_len); |
1287 | authkey->sca_keynumber = authkeyid.scact_keynumber + 1; | 1287 | authkey->sca_keynumber = authkeyid.scact_keynumber + 1; |
1288 | #ifndef __FreeBSD__ | 1288 | #ifndef __FreeBSD__ |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 2d38837f9e..cde3c858f1 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
@@ -157,7 +157,7 @@ slg_write(BIO *b, const char *in, int inl) | |||
157 | { 0, "", LOG_ERR } /* The default */ | 157 | { 0, "", LOG_ERR } /* The default */ |
158 | }; | 158 | }; |
159 | 159 | ||
160 | if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) { | 160 | if ((buf = (char *)malloc(inl + 1)) == NULL) { |
161 | return (0); | 161 | return (0); |
162 | } | 162 | } |
163 | strlcpy(buf, in, inl + 1); | 163 | strlcpy(buf, in, inl + 1); |
@@ -169,7 +169,7 @@ slg_write(BIO *b, const char *in, int inl) | |||
169 | 169 | ||
170 | xsyslog(b, priority, pp); | 170 | xsyslog(b, priority, pp); |
171 | 171 | ||
172 | OPENSSL_free(buf); | 172 | free(buf); |
173 | return (ret); | 173 | return (ret); |
174 | } | 174 | } |
175 | 175 | ||
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c index 9ed8bc2b40..264531013e 100644 --- a/src/lib/libcrypto/bn/bn_blind.c +++ b/src/lib/libcrypto/bn/bn_blind.c | |||
@@ -140,7 +140,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) | |||
140 | 140 | ||
141 | bn_check_top(mod); | 141 | bn_check_top(mod); |
142 | 142 | ||
143 | if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL) | 143 | if ((ret=(BN_BLINDING *)malloc(sizeof(BN_BLINDING))) == NULL) |
144 | { | 144 | { |
145 | BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE); | 145 | BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE); |
146 | return(NULL); | 146 | return(NULL); |
@@ -180,7 +180,7 @@ void BN_BLINDING_free(BN_BLINDING *r) | |||
180 | if (r->Ai != NULL) BN_free(r->Ai); | 180 | if (r->Ai != NULL) BN_free(r->Ai); |
181 | if (r->e != NULL) BN_free(r->e ); | 181 | if (r->e != NULL) BN_free(r->e ); |
182 | if (r->mod != NULL) BN_free(r->mod); | 182 | if (r->mod != NULL) BN_free(r->mod); |
183 | OPENSSL_free(r); | 183 | free(r); |
184 | } | 184 | } |
185 | 185 | ||
186 | int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | 186 | int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) |
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index 3f2256f675..ef67f4781c 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c | |||
@@ -213,7 +213,7 @@ void BN_CTX_init(BN_CTX *ctx) | |||
213 | 213 | ||
214 | BN_CTX *BN_CTX_new(void) | 214 | BN_CTX *BN_CTX_new(void) |
215 | { | 215 | { |
216 | BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX)); | 216 | BN_CTX *ret = malloc(sizeof(BN_CTX)); |
217 | if(!ret) | 217 | if(!ret) |
218 | { | 218 | { |
219 | BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE); | 219 | BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE); |
@@ -249,7 +249,7 @@ void BN_CTX_free(BN_CTX *ctx) | |||
249 | #endif | 249 | #endif |
250 | BN_STACK_finish(&ctx->stack); | 250 | BN_STACK_finish(&ctx->stack); |
251 | BN_POOL_finish(&ctx->pool); | 251 | BN_POOL_finish(&ctx->pool); |
252 | OPENSSL_free(ctx); | 252 | free(ctx); |
253 | } | 253 | } |
254 | 254 | ||
255 | void BN_CTX_start(BN_CTX *ctx) | 255 | void BN_CTX_start(BN_CTX *ctx) |
@@ -317,7 +317,7 @@ static void BN_STACK_init(BN_STACK *st) | |||
317 | 317 | ||
318 | static void BN_STACK_finish(BN_STACK *st) | 318 | static void BN_STACK_finish(BN_STACK *st) |
319 | { | 319 | { |
320 | if(st->size) OPENSSL_free(st->indexes); | 320 | if(st->size) free(st->indexes); |
321 | } | 321 | } |
322 | 322 | ||
323 | #ifndef OPENSSL_NO_DEPRECATED | 323 | #ifndef OPENSSL_NO_DEPRECATED |
@@ -334,13 +334,13 @@ static int BN_STACK_push(BN_STACK *st, unsigned int idx) | |||
334 | { | 334 | { |
335 | unsigned int newsize = (st->size ? | 335 | unsigned int newsize = (st->size ? |
336 | (st->size * 3 / 2) : BN_CTX_START_FRAMES); | 336 | (st->size * 3 / 2) : BN_CTX_START_FRAMES); |
337 | unsigned int *newitems = OPENSSL_malloc(newsize * | 337 | unsigned int *newitems = malloc(newsize * |
338 | sizeof(unsigned int)); | 338 | sizeof(unsigned int)); |
339 | if(!newitems) return 0; | 339 | if(!newitems) return 0; |
340 | if(st->depth) | 340 | if(st->depth) |
341 | memcpy(newitems, st->indexes, st->depth * | 341 | memcpy(newitems, st->indexes, st->depth * |
342 | sizeof(unsigned int)); | 342 | sizeof(unsigned int)); |
343 | if(st->size) OPENSSL_free(st->indexes); | 343 | if(st->size) free(st->indexes); |
344 | st->indexes = newitems; | 344 | st->indexes = newitems; |
345 | st->size = newsize; | 345 | st->size = newsize; |
346 | } | 346 | } |
@@ -375,7 +375,7 @@ static void BN_POOL_finish(BN_POOL *p) | |||
375 | bn++; | 375 | bn++; |
376 | } | 376 | } |
377 | p->current = p->head->next; | 377 | p->current = p->head->next; |
378 | OPENSSL_free(p->head); | 378 | free(p->head); |
379 | p->head = p->current; | 379 | p->head = p->current; |
380 | } | 380 | } |
381 | } | 381 | } |
@@ -406,7 +406,7 @@ static BIGNUM *BN_POOL_get(BN_POOL *p) | |||
406 | { | 406 | { |
407 | BIGNUM *bn; | 407 | BIGNUM *bn; |
408 | unsigned int loop = 0; | 408 | unsigned int loop = 0; |
409 | BN_POOL_ITEM *item = OPENSSL_malloc(sizeof(BN_POOL_ITEM)); | 409 | BN_POOL_ITEM *item = malloc(sizeof(BN_POOL_ITEM)); |
410 | if(!item) return NULL; | 410 | if(!item) return NULL; |
411 | /* Initialise the structure */ | 411 | /* Initialise the structure */ |
412 | bn = item->vals; | 412 | bn = item->vals; |
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index 2abf6fd678..2047e1cc3f 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c | |||
@@ -636,7 +636,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, | |||
636 | powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH); | 636 | powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH); |
637 | else | 637 | else |
638 | #endif | 638 | #endif |
639 | if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL) | 639 | if ((powerbufFree=(unsigned char*)malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL) |
640 | goto err; | 640 | goto err; |
641 | 641 | ||
642 | powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree); | 642 | powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree); |
@@ -823,7 +823,7 @@ err: | |||
823 | if (powerbuf!=NULL) | 823 | if (powerbuf!=NULL) |
824 | { | 824 | { |
825 | OPENSSL_cleanse(powerbuf,powerbufLen); | 825 | OPENSSL_cleanse(powerbuf,powerbufLen); |
826 | if (powerbufFree) OPENSSL_free(powerbufFree); | 826 | if (powerbufFree) free(powerbufFree); |
827 | } | 827 | } |
828 | BN_CTX_end(ctx); | 828 | BN_CTX_end(ctx); |
829 | return(ret); | 829 | return(ret); |
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 8a4dc20ad9..68a5faa52d 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
@@ -444,7 +444,7 @@ int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
444 | bn_check_top(a); | 444 | bn_check_top(a); |
445 | bn_check_top(b); | 445 | bn_check_top(b); |
446 | bn_check_top(p); | 446 | bn_check_top(p); |
447 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 447 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
448 | ret = BN_GF2m_poly2arr(p, arr, max); | 448 | ret = BN_GF2m_poly2arr(p, arr, max); |
449 | if (!ret || ret > max) | 449 | if (!ret || ret > max) |
450 | { | 450 | { |
@@ -454,7 +454,7 @@ int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
454 | ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); | 454 | ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); |
455 | bn_check_top(r); | 455 | bn_check_top(r); |
456 | err: | 456 | err: |
457 | if (arr) OPENSSL_free(arr); | 457 | if (arr) free(arr); |
458 | return ret; | 458 | return ret; |
459 | } | 459 | } |
460 | 460 | ||
@@ -500,7 +500,7 @@ int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
500 | 500 | ||
501 | bn_check_top(a); | 501 | bn_check_top(a); |
502 | bn_check_top(p); | 502 | bn_check_top(p); |
503 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 503 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
504 | ret = BN_GF2m_poly2arr(p, arr, max); | 504 | ret = BN_GF2m_poly2arr(p, arr, max); |
505 | if (!ret || ret > max) | 505 | if (!ret || ret > max) |
506 | { | 506 | { |
@@ -510,7 +510,7 @@ int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
510 | ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); | 510 | ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); |
511 | bn_check_top(r); | 511 | bn_check_top(r); |
512 | err: | 512 | err: |
513 | if (arr) OPENSSL_free(arr); | 513 | if (arr) free(arr); |
514 | return ret; | 514 | return ret; |
515 | } | 515 | } |
516 | 516 | ||
@@ -861,7 +861,7 @@ int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
861 | bn_check_top(a); | 861 | bn_check_top(a); |
862 | bn_check_top(b); | 862 | bn_check_top(b); |
863 | bn_check_top(p); | 863 | bn_check_top(p); |
864 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 864 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
865 | ret = BN_GF2m_poly2arr(p, arr, max); | 865 | ret = BN_GF2m_poly2arr(p, arr, max); |
866 | if (!ret || ret > max) | 866 | if (!ret || ret > max) |
867 | { | 867 | { |
@@ -871,7 +871,7 @@ int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
871 | ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx); | 871 | ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx); |
872 | bn_check_top(r); | 872 | bn_check_top(r); |
873 | err: | 873 | err: |
874 | if (arr) OPENSSL_free(arr); | 874 | if (arr) free(arr); |
875 | return ret; | 875 | return ret; |
876 | } | 876 | } |
877 | 877 | ||
@@ -919,7 +919,7 @@ int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
919 | int *arr=NULL; | 919 | int *arr=NULL; |
920 | bn_check_top(a); | 920 | bn_check_top(a); |
921 | bn_check_top(p); | 921 | bn_check_top(p); |
922 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 922 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
923 | ret = BN_GF2m_poly2arr(p, arr, max); | 923 | ret = BN_GF2m_poly2arr(p, arr, max); |
924 | if (!ret || ret > max) | 924 | if (!ret || ret > max) |
925 | { | 925 | { |
@@ -929,7 +929,7 @@ int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
929 | ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); | 929 | ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); |
930 | bn_check_top(r); | 930 | bn_check_top(r); |
931 | err: | 931 | err: |
932 | if (arr) OPENSSL_free(arr); | 932 | if (arr) free(arr); |
933 | return ret; | 933 | return ret; |
934 | } | 934 | } |
935 | 935 | ||
@@ -1037,7 +1037,7 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX * | |||
1037 | int *arr=NULL; | 1037 | int *arr=NULL; |
1038 | bn_check_top(a); | 1038 | bn_check_top(a); |
1039 | bn_check_top(p); | 1039 | bn_check_top(p); |
1040 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * | 1040 | if ((arr = (int *)malloc(sizeof(int) * |
1041 | max)) == NULL) goto err; | 1041 | max)) == NULL) goto err; |
1042 | ret = BN_GF2m_poly2arr(p, arr, max); | 1042 | ret = BN_GF2m_poly2arr(p, arr, max); |
1043 | if (!ret || ret > max) | 1043 | if (!ret || ret > max) |
@@ -1048,7 +1048,7 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX * | |||
1048 | ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); | 1048 | ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); |
1049 | bn_check_top(r); | 1049 | bn_check_top(r); |
1050 | err: | 1050 | err: |
1051 | if (arr) OPENSSL_free(arr); | 1051 | if (arr) free(arr); |
1052 | return ret; | 1052 | return ret; |
1053 | } | 1053 | } |
1054 | 1054 | ||
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 5461e6ee7d..b491c785d4 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -245,12 +245,12 @@ void BN_clear_free(BIGNUM *a) | |||
245 | { | 245 | { |
246 | OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0])); | 246 | OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0])); |
247 | if (!(BN_get_flags(a,BN_FLG_STATIC_DATA))) | 247 | if (!(BN_get_flags(a,BN_FLG_STATIC_DATA))) |
248 | OPENSSL_free(a->d); | 248 | free(a->d); |
249 | } | 249 | } |
250 | i=BN_get_flags(a,BN_FLG_MALLOCED); | 250 | i=BN_get_flags(a,BN_FLG_MALLOCED); |
251 | OPENSSL_cleanse(a,sizeof(BIGNUM)); | 251 | OPENSSL_cleanse(a,sizeof(BIGNUM)); |
252 | if (i) | 252 | if (i) |
253 | OPENSSL_free(a); | 253 | free(a); |
254 | } | 254 | } |
255 | 255 | ||
256 | void BN_free(BIGNUM *a) | 256 | void BN_free(BIGNUM *a) |
@@ -258,9 +258,9 @@ void BN_free(BIGNUM *a) | |||
258 | if (a == NULL) return; | 258 | if (a == NULL) return; |
259 | bn_check_top(a); | 259 | bn_check_top(a); |
260 | if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) | 260 | if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) |
261 | OPENSSL_free(a->d); | 261 | free(a->d); |
262 | if (a->flags & BN_FLG_MALLOCED) | 262 | if (a->flags & BN_FLG_MALLOCED) |
263 | OPENSSL_free(a); | 263 | free(a); |
264 | else | 264 | else |
265 | { | 265 | { |
266 | #ifndef OPENSSL_NO_DEPRECATED | 266 | #ifndef OPENSSL_NO_DEPRECATED |
@@ -280,7 +280,7 @@ BIGNUM *BN_new(void) | |||
280 | { | 280 | { |
281 | BIGNUM *ret; | 281 | BIGNUM *ret; |
282 | 282 | ||
283 | if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL) | 283 | if ((ret=(BIGNUM *)malloc(sizeof(BIGNUM))) == NULL) |
284 | { | 284 | { |
285 | BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); | 285 | BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); |
286 | return(NULL); | 286 | return(NULL); |
@@ -314,7 +314,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) | |||
314 | BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); | 314 | BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); |
315 | return(NULL); | 315 | return(NULL); |
316 | } | 316 | } |
317 | a=A=(BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG)*words); | 317 | a=A=(BN_ULONG *)malloc(sizeof(BN_ULONG)*words); |
318 | if (A == NULL) | 318 | if (A == NULL) |
319 | { | 319 | { |
320 | BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE); | 320 | BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE); |
@@ -401,7 +401,7 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, int words) | |||
401 | else | 401 | else |
402 | { | 402 | { |
403 | /* r == NULL, BN_new failure */ | 403 | /* r == NULL, BN_new failure */ |
404 | OPENSSL_free(a); | 404 | free(a); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | /* If a == NULL, there was an error in allocation in | 407 | /* If a == NULL, there was an error in allocation in |
@@ -431,7 +431,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words) | |||
431 | { | 431 | { |
432 | BN_ULONG *a = bn_expand_internal(b, words); | 432 | BN_ULONG *a = bn_expand_internal(b, words); |
433 | if(!a) return NULL; | 433 | if(!a) return NULL; |
434 | if(b->d) OPENSSL_free(b->d); | 434 | if(b->d) free(b->d); |
435 | b->d=a; | 435 | b->d=a; |
436 | b->dmax=words; | 436 | b->dmax=words; |
437 | } | 437 | } |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index a6713ae5b1..133c597c33 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
@@ -322,7 +322,7 @@ BN_MONT_CTX *BN_MONT_CTX_new(void) | |||
322 | { | 322 | { |
323 | BN_MONT_CTX *ret; | 323 | BN_MONT_CTX *ret; |
324 | 324 | ||
325 | if ((ret=(BN_MONT_CTX *)OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL) | 325 | if ((ret=(BN_MONT_CTX *)malloc(sizeof(BN_MONT_CTX))) == NULL) |
326 | return(NULL); | 326 | return(NULL); |
327 | 327 | ||
328 | BN_MONT_CTX_init(ret); | 328 | BN_MONT_CTX_init(ret); |
@@ -349,7 +349,7 @@ void BN_MONT_CTX_free(BN_MONT_CTX *mont) | |||
349 | BN_free(&(mont->N)); | 349 | BN_free(&(mont->N)); |
350 | BN_free(&(mont->Ni)); | 350 | BN_free(&(mont->Ni)); |
351 | if (mont->flags & BN_FLG_MALLOCED) | 351 | if (mont->flags & BN_FLG_MALLOCED) |
352 | OPENSSL_free(mont); | 352 | free(mont); |
353 | } | 353 | } |
354 | 354 | ||
355 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | 355 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) |
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index c7c407e494..e2cab2497f 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
@@ -64,14 +64,14 @@ | |||
64 | 64 | ||
65 | static const char Hex[]="0123456789ABCDEF"; | 65 | static const char Hex[]="0123456789ABCDEF"; |
66 | 66 | ||
67 | /* Must 'OPENSSL_free' the returned data */ | 67 | /* Must 'free' the returned data */ |
68 | char *BN_bn2hex(const BIGNUM *a) | 68 | char *BN_bn2hex(const BIGNUM *a) |
69 | { | 69 | { |
70 | int i,j,v,z=0; | 70 | int i,j,v,z=0; |
71 | char *buf; | 71 | char *buf; |
72 | char *p; | 72 | char *p; |
73 | 73 | ||
74 | buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2); | 74 | buf=(char *)malloc(a->top*BN_BYTES*2+2); |
75 | if (buf == NULL) | 75 | if (buf == NULL) |
76 | { | 76 | { |
77 | BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); | 77 | BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); |
@@ -99,7 +99,7 @@ err: | |||
99 | return(buf); | 99 | return(buf); |
100 | } | 100 | } |
101 | 101 | ||
102 | /* Must 'OPENSSL_free' the returned data */ | 102 | /* Must 'free' the returned data */ |
103 | char *BN_bn2dec(const BIGNUM *a) | 103 | char *BN_bn2dec(const BIGNUM *a) |
104 | { | 104 | { |
105 | int i=0,num, ok = 0; | 105 | int i=0,num, ok = 0; |
@@ -115,8 +115,8 @@ char *BN_bn2dec(const BIGNUM *a) | |||
115 | */ | 115 | */ |
116 | i=BN_num_bits(a)*3; | 116 | i=BN_num_bits(a)*3; |
117 | num=(i/10+i/1000+1)+1; | 117 | num=(i/10+i/1000+1)+1; |
118 | bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); | 118 | bn_data=(BN_ULONG *)malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); |
119 | buf=(char *)OPENSSL_malloc(num+3); | 119 | buf=(char *)malloc(num+3); |
120 | if ((buf == NULL) || (bn_data == NULL)) | 120 | if ((buf == NULL) || (bn_data == NULL)) |
121 | { | 121 | { |
122 | BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); | 122 | BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); |
@@ -158,11 +158,11 @@ char *BN_bn2dec(const BIGNUM *a) | |||
158 | } | 158 | } |
159 | ok = 1; | 159 | ok = 1; |
160 | err: | 160 | err: |
161 | if (bn_data != NULL) OPENSSL_free(bn_data); | 161 | if (bn_data != NULL) free(bn_data); |
162 | if (t != NULL) BN_free(t); | 162 | if (t != NULL) BN_free(t); |
163 | if (!ok && buf) | 163 | if (!ok && buf) |
164 | { | 164 | { |
165 | OPENSSL_free(buf); | 165 | free(buf); |
166 | buf = NULL; | 166 | buf = NULL; |
167 | } | 167 | } |
168 | 168 | ||
diff --git a/src/lib/libcrypto/bn/bn_rand.c b/src/lib/libcrypto/bn/bn_rand.c index 5cbb1f33c1..baa62d584c 100644 --- a/src/lib/libcrypto/bn/bn_rand.c +++ b/src/lib/libcrypto/bn/bn_rand.c | |||
@@ -130,7 +130,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
130 | bit=(bits-1)%8; | 130 | bit=(bits-1)%8; |
131 | mask=0xff<<(bit+1); | 131 | mask=0xff<<(bit+1); |
132 | 132 | ||
133 | buf=(unsigned char *)OPENSSL_malloc(bytes); | 133 | buf=(unsigned char *)malloc(bytes); |
134 | if (buf == NULL) | 134 | if (buf == NULL) |
135 | { | 135 | { |
136 | BNerr(BN_F_BNRAND,ERR_R_MALLOC_FAILURE); | 136 | BNerr(BN_F_BNRAND,ERR_R_MALLOC_FAILURE); |
@@ -199,7 +199,7 @@ err: | |||
199 | if (buf != NULL) | 199 | if (buf != NULL) |
200 | { | 200 | { |
201 | OPENSSL_cleanse(buf,bytes); | 201 | OPENSSL_cleanse(buf,bytes); |
202 | OPENSSL_free(buf); | 202 | free(buf); |
203 | } | 203 | } |
204 | bn_check_top(rnd); | 204 | bn_check_top(rnd); |
205 | return(ret); | 205 | return(ret); |
diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c index 2e8efb8dae..0f808fca64 100644 --- a/src/lib/libcrypto/bn/bn_recp.c +++ b/src/lib/libcrypto/bn/bn_recp.c | |||
@@ -72,7 +72,7 @@ BN_RECP_CTX *BN_RECP_CTX_new(void) | |||
72 | { | 72 | { |
73 | BN_RECP_CTX *ret; | 73 | BN_RECP_CTX *ret; |
74 | 74 | ||
75 | if ((ret=(BN_RECP_CTX *)OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL) | 75 | if ((ret=(BN_RECP_CTX *)malloc(sizeof(BN_RECP_CTX))) == NULL) |
76 | return(NULL); | 76 | return(NULL); |
77 | 77 | ||
78 | BN_RECP_CTX_init(ret); | 78 | BN_RECP_CTX_init(ret); |
@@ -88,7 +88,7 @@ void BN_RECP_CTX_free(BN_RECP_CTX *recp) | |||
88 | BN_free(&(recp->N)); | 88 | BN_free(&(recp->N)); |
89 | BN_free(&(recp->Nr)); | 89 | BN_free(&(recp->Nr)); |
90 | if (recp->flags & BN_FLG_MALLOCED) | 90 | if (recp->flags & BN_FLG_MALLOCED) |
91 | OPENSSL_free(recp); | 91 | free(recp); |
92 | } | 92 | } |
93 | 93 | ||
94 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) | 94 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) |
diff --git a/src/lib/libcrypto/buffer/buf_str.c b/src/lib/libcrypto/buffer/buf_str.c index 151f5ea971..ab5535f476 100644 --- a/src/lib/libcrypto/buffer/buf_str.c +++ b/src/lib/libcrypto/buffer/buf_str.c | |||
@@ -72,7 +72,7 @@ char *BUF_strndup(const char *str, size_t siz) | |||
72 | 72 | ||
73 | if (str == NULL) return(NULL); | 73 | if (str == NULL) return(NULL); |
74 | 74 | ||
75 | ret=OPENSSL_malloc(siz+1); | 75 | ret=malloc(siz+1); |
76 | if (ret == NULL) | 76 | if (ret == NULL) |
77 | { | 77 | { |
78 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); | 78 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); |
@@ -88,7 +88,7 @@ void *BUF_memdup(const void *data, size_t siz) | |||
88 | 88 | ||
89 | if (data == NULL) return(NULL); | 89 | if (data == NULL) return(NULL); |
90 | 90 | ||
91 | ret=OPENSSL_malloc(siz); | 91 | ret=malloc(siz); |
92 | if (ret == NULL) | 92 | if (ret == NULL) |
93 | { | 93 | { |
94 | BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); | 94 | BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index d4a4ce43b3..b52c59f8a3 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
@@ -69,7 +69,7 @@ BUF_MEM *BUF_MEM_new(void) | |||
69 | { | 69 | { |
70 | BUF_MEM *ret; | 70 | BUF_MEM *ret; |
71 | 71 | ||
72 | ret=OPENSSL_malloc(sizeof(BUF_MEM)); | 72 | ret=malloc(sizeof(BUF_MEM)); |
73 | if (ret == NULL) | 73 | if (ret == NULL) |
74 | { | 74 | { |
75 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); | 75 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); |
@@ -89,9 +89,9 @@ void BUF_MEM_free(BUF_MEM *a) | |||
89 | if (a->data != NULL) | 89 | if (a->data != NULL) |
90 | { | 90 | { |
91 | memset(a->data,0,(unsigned int)a->max); | 91 | memset(a->data,0,(unsigned int)a->max); |
92 | OPENSSL_free(a->data); | 92 | free(a->data); |
93 | } | 93 | } |
94 | OPENSSL_free(a); | 94 | free(a); |
95 | } | 95 | } |
96 | 96 | ||
97 | int BUF_MEM_grow(BUF_MEM *str, size_t len) | 97 | int BUF_MEM_grow(BUF_MEM *str, size_t len) |
@@ -118,9 +118,9 @@ int BUF_MEM_grow(BUF_MEM *str, size_t len) | |||
118 | } | 118 | } |
119 | n=(len+3)/3*4; | 119 | n=(len+3)/3*4; |
120 | if (str->data == NULL) | 120 | if (str->data == NULL) |
121 | ret=OPENSSL_malloc(n); | 121 | ret=malloc(n); |
122 | else | 122 | else |
123 | ret=OPENSSL_realloc(str->data,n); | 123 | ret=realloc(str->data,n); |
124 | if (ret == NULL) | 124 | if (ret == NULL) |
125 | { | 125 | { |
126 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | 126 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); |
@@ -161,7 +161,7 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) | |||
161 | } | 161 | } |
162 | n=(len+3)/3*4; | 162 | n=(len+3)/3*4; |
163 | if (str->data == NULL) | 163 | if (str->data == NULL) |
164 | ret=OPENSSL_malloc(n); | 164 | ret=malloc(n); |
165 | else | 165 | else |
166 | ret=OPENSSL_realloc_clean(str->data,str->max,n); | 166 | ret=OPENSSL_realloc_clean(str->data,str->max,n); |
167 | if (ret == NULL) | 167 | if (ret == NULL) |
diff --git a/src/lib/libcrypto/cmac/cm_pmeth.c b/src/lib/libcrypto/cmac/cm_pmeth.c index 072228ec7f..00aa4d64d2 100644 --- a/src/lib/libcrypto/cmac/cm_pmeth.c +++ b/src/lib/libcrypto/cmac/cm_pmeth.c | |||
@@ -182,7 +182,7 @@ static int pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx, | |||
182 | if (!key) | 182 | if (!key) |
183 | return 0; | 183 | return 0; |
184 | r = pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); | 184 | r = pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); |
185 | OPENSSL_free(key); | 185 | free(key); |
186 | return r; | 186 | return r; |
187 | } | 187 | } |
188 | return -2; | 188 | return -2; |
diff --git a/src/lib/libcrypto/cmac/cmac.c b/src/lib/libcrypto/cmac/cmac.c index f92a7bb143..81188c8f5a 100644 --- a/src/lib/libcrypto/cmac/cmac.c +++ b/src/lib/libcrypto/cmac/cmac.c | |||
@@ -93,7 +93,7 @@ static void make_kn(unsigned char *k1, unsigned char *l, int bl) | |||
93 | CMAC_CTX *CMAC_CTX_new(void) | 93 | CMAC_CTX *CMAC_CTX_new(void) |
94 | { | 94 | { |
95 | CMAC_CTX *ctx; | 95 | CMAC_CTX *ctx; |
96 | ctx = OPENSSL_malloc(sizeof(CMAC_CTX)); | 96 | ctx = malloc(sizeof(CMAC_CTX)); |
97 | if (!ctx) | 97 | if (!ctx) |
98 | return NULL; | 98 | return NULL; |
99 | EVP_CIPHER_CTX_init(&ctx->cctx); | 99 | EVP_CIPHER_CTX_init(&ctx->cctx); |
@@ -119,7 +119,7 @@ EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx) | |||
119 | void CMAC_CTX_free(CMAC_CTX *ctx) | 119 | void CMAC_CTX_free(CMAC_CTX *ctx) |
120 | { | 120 | { |
121 | CMAC_CTX_cleanup(ctx); | 121 | CMAC_CTX_cleanup(ctx); |
122 | OPENSSL_free(ctx); | 122 | free(ctx); |
123 | } | 123 | } |
124 | 124 | ||
125 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) | 125 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) |
diff --git a/src/lib/libcrypto/cms/cms_asn1.c b/src/lib/libcrypto/cms/cms_asn1.c index cfe67fb6c1..bd7466cc1d 100644 --- a/src/lib/libcrypto/cms/cms_asn1.c +++ b/src/lib/libcrypto/cms/cms_asn1.c | |||
@@ -234,7 +234,7 @@ static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
234 | if (kekri->key) | 234 | if (kekri->key) |
235 | { | 235 | { |
236 | OPENSSL_cleanse(kekri->key, kekri->keylen); | 236 | OPENSSL_cleanse(kekri->key, kekri->keylen); |
237 | OPENSSL_free(kekri->key); | 237 | free(kekri->key); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | else if (ri->type == CMS_RECIPINFO_PASS) | 240 | else if (ri->type == CMS_RECIPINFO_PASS) |
@@ -243,7 +243,7 @@ static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
243 | if (pwri->pass) | 243 | if (pwri->pass) |
244 | { | 244 | { |
245 | OPENSSL_cleanse(pwri->pass, pwri->passlen); | 245 | OPENSSL_cleanse(pwri->pass, pwri->passlen); |
246 | OPENSSL_free(pwri->pass); | 246 | free(pwri->pass); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } | 249 | } |
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index bebeaf29c7..612fce6dde 100644 --- a/src/lib/libcrypto/cms/cms_enc.c +++ b/src/lib/libcrypto/cms/cms_enc.c | |||
@@ -143,7 +143,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
143 | /* Generate random session key */ | 143 | /* Generate random session key */ |
144 | if (!enc || !ec->key) | 144 | if (!enc || !ec->key) |
145 | { | 145 | { |
146 | tkey = OPENSSL_malloc(tkeylen); | 146 | tkey = malloc(tkeylen); |
147 | if (!tkey) | 147 | if (!tkey) |
148 | { | 148 | { |
149 | CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, | 149 | CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, |
@@ -184,7 +184,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
184 | { | 184 | { |
185 | /* Use random key */ | 185 | /* Use random key */ |
186 | OPENSSL_cleanse(ec->key, ec->keylen); | 186 | OPENSSL_cleanse(ec->key, ec->keylen); |
187 | OPENSSL_free(ec->key); | 187 | free(ec->key); |
188 | ec->key = tkey; | 188 | ec->key = tkey; |
189 | ec->keylen = tkeylen; | 189 | ec->keylen = tkeylen; |
190 | tkey = NULL; | 190 | tkey = NULL; |
@@ -222,13 +222,13 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
222 | if (ec->key && !keep_key) | 222 | if (ec->key && !keep_key) |
223 | { | 223 | { |
224 | OPENSSL_cleanse(ec->key, ec->keylen); | 224 | OPENSSL_cleanse(ec->key, ec->keylen); |
225 | OPENSSL_free(ec->key); | 225 | free(ec->key); |
226 | ec->key = NULL; | 226 | ec->key = NULL; |
227 | } | 227 | } |
228 | if (tkey) | 228 | if (tkey) |
229 | { | 229 | { |
230 | OPENSSL_cleanse(tkey, tkeylen); | 230 | OPENSSL_cleanse(tkey, tkeylen); |
231 | OPENSSL_free(tkey); | 231 | free(tkey); |
232 | } | 232 | } |
233 | if (ok) | 233 | if (ok) |
234 | return b; | 234 | return b; |
@@ -243,7 +243,7 @@ int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, | |||
243 | ec->cipher = cipher; | 243 | ec->cipher = cipher; |
244 | if (key) | 244 | if (key) |
245 | { | 245 | { |
246 | ec->key = OPENSSL_malloc(keylen); | 246 | ec->key = malloc(keylen); |
247 | if (!ec->key) | 247 | if (!ec->key) |
248 | return 0; | 248 | return 0; |
249 | memcpy(ec->key, key, keylen); | 249 | memcpy(ec->key, key, keylen); |
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c index be20b1c024..78fa2aa7b7 100644 --- a/src/lib/libcrypto/cms/cms_env.c +++ b/src/lib/libcrypto/cms/cms_env.c | |||
@@ -334,7 +334,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, | |||
334 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) | 334 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) |
335 | goto err; | 335 | goto err; |
336 | 336 | ||
337 | ek = OPENSSL_malloc(eklen); | 337 | ek = malloc(eklen); |
338 | 338 | ||
339 | if (ek == NULL) | 339 | if (ek == NULL) |
340 | { | 340 | { |
@@ -355,7 +355,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, | |||
355 | if (pctx) | 355 | if (pctx) |
356 | EVP_PKEY_CTX_free(pctx); | 356 | EVP_PKEY_CTX_free(pctx); |
357 | if (ek) | 357 | if (ek) |
358 | OPENSSL_free(ek); | 358 | free(ek); |
359 | return ret; | 359 | return ret; |
360 | 360 | ||
361 | } | 361 | } |
@@ -399,7 +399,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
399 | ktri->encryptedKey->length) <= 0) | 399 | ktri->encryptedKey->length) <= 0) |
400 | goto err; | 400 | goto err; |
401 | 401 | ||
402 | ek = OPENSSL_malloc(eklen); | 402 | ek = malloc(eklen); |
403 | 403 | ||
404 | if (ek == NULL) | 404 | if (ek == NULL) |
405 | { | 405 | { |
@@ -421,7 +421,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
421 | if (ec->key) | 421 | if (ec->key) |
422 | { | 422 | { |
423 | OPENSSL_cleanse(ec->key, ec->keylen); | 423 | OPENSSL_cleanse(ec->key, ec->keylen); |
424 | OPENSSL_free(ec->key); | 424 | free(ec->key); |
425 | } | 425 | } |
426 | 426 | ||
427 | ec->key = ek; | 427 | ec->key = ek; |
@@ -431,7 +431,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
431 | if (pctx) | 431 | if (pctx) |
432 | EVP_PKEY_CTX_free(pctx); | 432 | EVP_PKEY_CTX_free(pctx); |
433 | if (!ret && ek) | 433 | if (!ret && ek) |
434 | OPENSSL_free(ek); | 434 | free(ek); |
435 | 435 | ||
436 | return ret; | 436 | return ret; |
437 | } | 437 | } |
@@ -671,7 +671,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, | |||
671 | goto err; | 671 | goto err; |
672 | } | 672 | } |
673 | 673 | ||
674 | wkey = OPENSSL_malloc(ec->keylen + 8); | 674 | wkey = malloc(ec->keylen + 8); |
675 | 675 | ||
676 | if (!wkey) | 676 | if (!wkey) |
677 | { | 677 | { |
@@ -695,7 +695,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, | |||
695 | err: | 695 | err: |
696 | 696 | ||
697 | if (!r && wkey) | 697 | if (!r && wkey) |
698 | OPENSSL_free(wkey); | 698 | free(wkey); |
699 | OPENSSL_cleanse(&actx, sizeof(actx)); | 699 | OPENSSL_cleanse(&actx, sizeof(actx)); |
700 | 700 | ||
701 | return r; | 701 | return r; |
@@ -748,7 +748,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, | |||
748 | goto err; | 748 | goto err; |
749 | } | 749 | } |
750 | 750 | ||
751 | ukey = OPENSSL_malloc(kekri->encryptedKey->length - 8); | 751 | ukey = malloc(kekri->encryptedKey->length - 8); |
752 | 752 | ||
753 | if (!ukey) | 753 | if (!ukey) |
754 | { | 754 | { |
@@ -776,7 +776,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, | |||
776 | err: | 776 | err: |
777 | 777 | ||
778 | if (!r && ukey) | 778 | if (!r && ukey) |
779 | OPENSSL_free(ukey); | 779 | free(ukey); |
780 | OPENSSL_cleanse(&actx, sizeof(actx)); | 780 | OPENSSL_cleanse(&actx, sizeof(actx)); |
781 | 781 | ||
782 | return r; | 782 | return r; |
@@ -864,7 +864,7 @@ BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) | |||
864 | if (ec->key) | 864 | if (ec->key) |
865 | { | 865 | { |
866 | OPENSSL_cleanse(ec->key, ec->keylen); | 866 | OPENSSL_cleanse(ec->key, ec->keylen); |
867 | OPENSSL_free(ec->key); | 867 | free(ec->key); |
868 | ec->key = NULL; | 868 | ec->key = NULL; |
869 | ec->keylen = 0; | 869 | ec->keylen = 0; |
870 | } | 870 | } |
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index 90c0b82fb5..99a4da6356 100644 --- a/src/lib/libcrypto/cms/cms_ess.c +++ b/src/lib/libcrypto/cms/cms_ess.c | |||
@@ -157,7 +157,7 @@ int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr) | |||
157 | CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); | 157 | CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); |
158 | 158 | ||
159 | if (rrder) | 159 | if (rrder) |
160 | OPENSSL_free(rrder); | 160 | free(rrder); |
161 | 161 | ||
162 | return r; | 162 | return r; |
163 | 163 | ||
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index b79612a12d..36a5db04b8 100644 --- a/src/lib/libcrypto/cms/cms_pwri.c +++ b/src/lib/libcrypto/cms/cms_pwri.c | |||
@@ -237,7 +237,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen, | |||
237 | /* Invalid size */ | 237 | /* Invalid size */ |
238 | return 0; | 238 | return 0; |
239 | } | 239 | } |
240 | tmp = OPENSSL_malloc(inlen); | 240 | tmp = malloc(inlen); |
241 | /* setup IV by decrypting last two blocks */ | 241 | /* setup IV by decrypting last two blocks */ |
242 | EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, | 242 | EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, |
243 | in + inlen - 2 * blocklen, blocklen * 2); | 243 | in + inlen - 2 * blocklen, blocklen * 2); |
@@ -270,7 +270,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen, | |||
270 | rv = 1; | 270 | rv = 1; |
271 | err: | 271 | err: |
272 | OPENSSL_cleanse(tmp, inlen); | 272 | OPENSSL_cleanse(tmp, inlen); |
273 | OPENSSL_free(tmp); | 273 | free(tmp); |
274 | return rv; | 274 | return rv; |
275 | 275 | ||
276 | } | 276 | } |
@@ -405,7 +405,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
405 | if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx)) | 405 | if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx)) |
406 | goto err; | 406 | goto err; |
407 | 407 | ||
408 | key = OPENSSL_malloc(keylen); | 408 | key = malloc(keylen); |
409 | 409 | ||
410 | if (!key) | 410 | if (!key) |
411 | goto err; | 411 | goto err; |
@@ -417,7 +417,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
417 | } | 417 | } |
418 | else | 418 | else |
419 | { | 419 | { |
420 | key = OPENSSL_malloc(pwri->encryptedKey->length); | 420 | key = malloc(pwri->encryptedKey->length); |
421 | 421 | ||
422 | if (!key) | 422 | if (!key) |
423 | { | 423 | { |
@@ -446,7 +446,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
446 | EVP_CIPHER_CTX_cleanup(&kekctx); | 446 | EVP_CIPHER_CTX_cleanup(&kekctx); |
447 | 447 | ||
448 | if (!r && key) | 448 | if (!r && key) |
449 | OPENSSL_free(key); | 449 | free(key); |
450 | X509_ALGOR_free(kekalg); | 450 | X509_ALGOR_free(kekalg); |
451 | 451 | ||
452 | return r; | 452 | return r; |
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 77fbd13596..d852af596d 100644 --- a/src/lib/libcrypto/cms/cms_sd.c +++ b/src/lib/libcrypto/cms/cms_sd.c | |||
@@ -658,7 +658,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, | |||
658 | { | 658 | { |
659 | unsigned char *sig; | 659 | unsigned char *sig; |
660 | unsigned int siglen; | 660 | unsigned int siglen; |
661 | sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); | 661 | sig = malloc(EVP_PKEY_size(si->pkey)); |
662 | if (!sig) | 662 | if (!sig) |
663 | { | 663 | { |
664 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, | 664 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, |
@@ -669,7 +669,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, | |||
669 | { | 669 | { |
670 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, | 670 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, |
671 | CMS_R_SIGNFINAL_ERROR); | 671 | CMS_R_SIGNFINAL_ERROR); |
672 | OPENSSL_free(sig); | 672 | free(sig); |
673 | goto err; | 673 | goto err; |
674 | } | 674 | } |
675 | ASN1_STRING_set0(si->signature, sig, siglen); | 675 | ASN1_STRING_set0(si->signature, sig, siglen); |
@@ -738,8 +738,8 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
738 | goto err; | 738 | goto err; |
739 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) | 739 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) |
740 | goto err; | 740 | goto err; |
741 | OPENSSL_free(abuf); | 741 | free(abuf); |
742 | abuf = OPENSSL_malloc(siglen); | 742 | abuf = malloc(siglen); |
743 | if(!abuf) | 743 | if(!abuf) |
744 | goto err; | 744 | goto err; |
745 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) | 745 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) |
@@ -760,7 +760,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
760 | 760 | ||
761 | err: | 761 | err: |
762 | if (abuf) | 762 | if (abuf) |
763 | OPENSSL_free(abuf); | 763 | free(abuf); |
764 | EVP_MD_CTX_cleanup(&mctx); | 764 | EVP_MD_CTX_cleanup(&mctx); |
765 | return 0; | 765 | return 0; |
766 | 766 | ||
@@ -792,7 +792,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) | |||
792 | if(!abuf) | 792 | if(!abuf) |
793 | goto err; | 793 | goto err; |
794 | r = EVP_DigestVerifyUpdate(&mctx, abuf, alen); | 794 | r = EVP_DigestVerifyUpdate(&mctx, abuf, alen); |
795 | OPENSSL_free(abuf); | 795 | free(abuf); |
796 | if (r <= 0) | 796 | if (r <= 0) |
797 | { | 797 | { |
798 | r = -1; | 798 | r = -1; |
@@ -917,7 +917,7 @@ int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs) | |||
917 | return 0; | 917 | return 0; |
918 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, | 918 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, |
919 | V_ASN1_SEQUENCE, smder, smderlen); | 919 | V_ASN1_SEQUENCE, smder, smderlen); |
920 | OPENSSL_free(smder); | 920 | free(smder); |
921 | return r; | 921 | return r; |
922 | } | 922 | } |
923 | 923 | ||
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 8adf35f3fc..2ced7c10cc 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -37,7 +37,7 @@ static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | |||
37 | { | 37 | { |
38 | void *p; | 38 | void *p; |
39 | 39 | ||
40 | p=OPENSSL_malloc(no*size); | 40 | p=malloc(no*size); |
41 | if (p) | 41 | if (p) |
42 | memset(p, 0, no*size); | 42 | memset(p, 0, no*size); |
43 | return p; | 43 | return p; |
@@ -46,7 +46,7 @@ static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | |||
46 | 46 | ||
47 | static void zlib_zfree(void* opaque, void* address) | 47 | static void zlib_zfree(void* opaque, void* address) |
48 | { | 48 | { |
49 | OPENSSL_free(address); | 49 | free(address); |
50 | } | 50 | } |
51 | 51 | ||
52 | #if 0 | 52 | #if 0 |
@@ -140,7 +140,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
140 | { | 140 | { |
141 | int err; | 141 | int err; |
142 | struct zlib_state *state = | 142 | struct zlib_state *state = |
143 | (struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state)); | 143 | (struct zlib_state *)malloc(sizeof(struct zlib_state)); |
144 | 144 | ||
145 | if (state == NULL) | 145 | if (state == NULL) |
146 | goto err; | 146 | goto err; |
@@ -173,7 +173,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); | 173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); |
174 | return 1; | 174 | return 1; |
175 | err: | 175 | err: |
176 | if (state) OPENSSL_free(state); | 176 | if (state) free(state); |
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
@@ -184,7 +184,7 @@ static void zlib_stateful_finish(COMP_CTX *ctx) | |||
184 | zlib_stateful_ex_idx); | 184 | zlib_stateful_ex_idx); |
185 | inflateEnd(&state->istream); | 185 | inflateEnd(&state->istream); |
186 | deflateEnd(&state->ostream); | 186 | deflateEnd(&state->ostream); |
187 | OPENSSL_free(state); | 187 | free(state); |
188 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data); | 188 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data); |
189 | } | 189 | } |
190 | 190 | ||
@@ -479,7 +479,7 @@ static int bio_zlib_new(BIO *bi) | |||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | #endif | 481 | #endif |
482 | ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX)); | 482 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); |
483 | if(!ctx) | 483 | if(!ctx) |
484 | { | 484 | { |
485 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); | 485 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); |
@@ -518,15 +518,15 @@ static int bio_zlib_free(BIO *bi) | |||
518 | { | 518 | { |
519 | /* Destroy decompress context */ | 519 | /* Destroy decompress context */ |
520 | inflateEnd(&ctx->zin); | 520 | inflateEnd(&ctx->zin); |
521 | OPENSSL_free(ctx->ibuf); | 521 | free(ctx->ibuf); |
522 | } | 522 | } |
523 | if(ctx->obuf) | 523 | if(ctx->obuf) |
524 | { | 524 | { |
525 | /* Destroy compress context */ | 525 | /* Destroy compress context */ |
526 | deflateEnd(&ctx->zout); | 526 | deflateEnd(&ctx->zout); |
527 | OPENSSL_free(ctx->obuf); | 527 | free(ctx->obuf); |
528 | } | 528 | } |
529 | OPENSSL_free(ctx); | 529 | free(ctx); |
530 | bi->ptr = NULL; | 530 | bi->ptr = NULL; |
531 | bi->init = 0; | 531 | bi->init = 0; |
532 | bi->flags = 0; | 532 | bi->flags = 0; |
@@ -544,7 +544,7 @@ static int bio_zlib_read(BIO *b, char *out, int outl) | |||
544 | BIO_clear_retry_flags(b); | 544 | BIO_clear_retry_flags(b); |
545 | if(!ctx->ibuf) | 545 | if(!ctx->ibuf) |
546 | { | 546 | { |
547 | ctx->ibuf = OPENSSL_malloc(ctx->ibufsize); | 547 | ctx->ibuf = malloc(ctx->ibufsize); |
548 | if(!ctx->ibuf) | 548 | if(!ctx->ibuf) |
549 | { | 549 | { |
550 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); | 550 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); |
@@ -606,7 +606,7 @@ static int bio_zlib_write(BIO *b, const char *in, int inl) | |||
606 | BIO_clear_retry_flags(b); | 606 | BIO_clear_retry_flags(b); |
607 | if(!ctx->obuf) | 607 | if(!ctx->obuf) |
608 | { | 608 | { |
609 | ctx->obuf = OPENSSL_malloc(ctx->obufsize); | 609 | ctx->obuf = malloc(ctx->obufsize); |
610 | /* Need error here */ | 610 | /* Need error here */ |
611 | if(!ctx->obuf) | 611 | if(!ctx->obuf) |
612 | { | 612 | { |
@@ -754,7 +754,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
754 | { | 754 | { |
755 | if (ctx->ibuf) | 755 | if (ctx->ibuf) |
756 | { | 756 | { |
757 | OPENSSL_free(ctx->ibuf); | 757 | free(ctx->ibuf); |
758 | ctx->ibuf = NULL; | 758 | ctx->ibuf = NULL; |
759 | } | 759 | } |
760 | ctx->ibufsize = ibs; | 760 | ctx->ibufsize = ibs; |
@@ -764,7 +764,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
764 | { | 764 | { |
765 | if (ctx->obuf) | 765 | if (ctx->obuf) |
766 | { | 766 | { |
767 | OPENSSL_free(ctx->obuf); | 767 | free(ctx->obuf); |
768 | ctx->obuf = NULL; | 768 | ctx->obuf = NULL; |
769 | } | 769 | } |
770 | ctx->obufsize = obs; | 770 | ctx->obufsize = obs; |
diff --git a/src/lib/libcrypto/comp/comp_lib.c b/src/lib/libcrypto/comp/comp_lib.c index b60ae371e8..feb07ea881 100644 --- a/src/lib/libcrypto/comp/comp_lib.c +++ b/src/lib/libcrypto/comp/comp_lib.c | |||
@@ -8,7 +8,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) | |||
8 | { | 8 | { |
9 | COMP_CTX *ret; | 9 | COMP_CTX *ret; |
10 | 10 | ||
11 | if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) | 11 | if ((ret=(COMP_CTX *)malloc(sizeof(COMP_CTX))) == NULL) |
12 | { | 12 | { |
13 | /* ZZZZZZZZZZZZZZZZ */ | 13 | /* ZZZZZZZZZZZZZZZZ */ |
14 | return(NULL); | 14 | return(NULL); |
@@ -17,7 +17,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) | |||
17 | ret->meth=meth; | 17 | ret->meth=meth; |
18 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | 18 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) |
19 | { | 19 | { |
20 | OPENSSL_free(ret); | 20 | free(ret); |
21 | ret=NULL; | 21 | ret=NULL; |
22 | } | 22 | } |
23 | return(ret); | 23 | return(ret); |
@@ -31,7 +31,7 @@ void COMP_CTX_free(COMP_CTX *ctx) | |||
31 | if (ctx->meth->finish != NULL) | 31 | if (ctx->meth->finish != NULL) |
32 | ctx->meth->finish(ctx); | 32 | ctx->meth->finish(ctx); |
33 | 33 | ||
34 | OPENSSL_free(ctx); | 34 | free(ctx); |
35 | } | 35 | } |
36 | 36 | ||
37 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, | 37 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, |
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index f5fcbb9f6b..dc6eb579bf 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
@@ -119,9 +119,9 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) | |||
119 | if (v != NULL) | 119 | if (v != NULL) |
120 | { | 120 | { |
121 | (void)sk_CONF_VALUE_delete_ptr(ts,v); | 121 | (void)sk_CONF_VALUE_delete_ptr(ts,v); |
122 | OPENSSL_free(v->name); | 122 | free(v->name); |
123 | OPENSSL_free(v->value); | 123 | free(v->value); |
124 | OPENSSL_free(v); | 124 | free(v); |
125 | } | 125 | } |
126 | return 1; | 126 | return 1; |
127 | } | 127 | } |
@@ -226,7 +226,7 @@ void _CONF_free_data(CONF *conf) | |||
226 | if (conf == NULL || conf->data == NULL) return; | 226 | if (conf == NULL || conf->data == NULL) return; |
227 | 227 | ||
228 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make | 228 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make |
229 | * sure the 'OPENSSL_free()' works as | 229 | * sure the 'free()' works as |
230 | * expected */ | 230 | * expected */ |
231 | lh_CONF_VALUE_doall_arg(conf->data, | 231 | lh_CONF_VALUE_doall_arg(conf->data, |
232 | LHASH_DOALL_ARG_FN(value_free_hash), | 232 | LHASH_DOALL_ARG_FN(value_free_hash), |
@@ -257,13 +257,13 @@ static void value_free_stack_doall(CONF_VALUE *a) | |||
257 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) | 257 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) |
258 | { | 258 | { |
259 | vv=sk_CONF_VALUE_value(sk,i); | 259 | vv=sk_CONF_VALUE_value(sk,i); |
260 | OPENSSL_free(vv->value); | 260 | free(vv->value); |
261 | OPENSSL_free(vv->name); | 261 | free(vv->name); |
262 | OPENSSL_free(vv); | 262 | free(vv); |
263 | } | 263 | } |
264 | if (sk != NULL) sk_CONF_VALUE_free(sk); | 264 | if (sk != NULL) sk_CONF_VALUE_free(sk); |
265 | OPENSSL_free(a->section); | 265 | free(a->section); |
266 | OPENSSL_free(a); | 266 | free(a); |
267 | } | 267 | } |
268 | 268 | ||
269 | /* Up until OpenSSL 0.9.5a, this was new_section */ | 269 | /* Up until OpenSSL 0.9.5a, this was new_section */ |
@@ -275,10 +275,10 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | |||
275 | 275 | ||
276 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) | 276 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) |
277 | goto err; | 277 | goto err; |
278 | if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) | 278 | if ((v=malloc(sizeof(CONF_VALUE))) == NULL) |
279 | goto err; | 279 | goto err; |
280 | i=strlen(section)+1; | 280 | i=strlen(section)+1; |
281 | if ((v->section=OPENSSL_malloc(i)) == NULL) | 281 | if ((v->section=malloc(i)) == NULL) |
282 | goto err; | 282 | goto err; |
283 | 283 | ||
284 | memcpy(v->section,section,i); | 284 | memcpy(v->section,section,i); |
@@ -292,7 +292,7 @@ err: | |||
292 | if (!ok) | 292 | if (!ok) |
293 | { | 293 | { |
294 | if (sk != NULL) sk_CONF_VALUE_free(sk); | 294 | if (sk != NULL) sk_CONF_VALUE_free(sk); |
295 | if (v != NULL) OPENSSL_free(v); | 295 | if (v != NULL) free(v); |
296 | v=NULL; | 296 | v=NULL; |
297 | } | 297 | } |
298 | return(v); | 298 | return(v); |
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index 15e5613e36..32d47458a0 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
@@ -129,11 +129,11 @@ static CONF *def_create(CONF_METHOD *meth) | |||
129 | { | 129 | { |
130 | CONF *ret; | 130 | CONF *ret; |
131 | 131 | ||
132 | ret = OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *)); | 132 | ret = malloc(sizeof(CONF) + sizeof(unsigned short *)); |
133 | if (ret) | 133 | if (ret) |
134 | if (meth->init(ret) == 0) | 134 | if (meth->init(ret) == 0) |
135 | { | 135 | { |
136 | OPENSSL_free(ret); | 136 | free(ret); |
137 | ret = NULL; | 137 | ret = NULL; |
138 | } | 138 | } |
139 | return ret; | 139 | return ret; |
@@ -167,7 +167,7 @@ static int def_destroy(CONF *conf) | |||
167 | { | 167 | { |
168 | if (def_destroy_data(conf)) | 168 | if (def_destroy_data(conf)) |
169 | { | 169 | { |
170 | OPENSSL_free(conf); | 170 | free(conf); |
171 | return 1; | 171 | return 1; |
172 | } | 172 | } |
173 | return 0; | 173 | return 0; |
@@ -228,7 +228,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
228 | goto err; | 228 | goto err; |
229 | } | 229 | } |
230 | 230 | ||
231 | section=(char *)OPENSSL_malloc(10); | 231 | section=(char *)malloc(10); |
232 | if (section == NULL) | 232 | if (section == NULL) |
233 | { | 233 | { |
234 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | 234 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); |
@@ -373,14 +373,14 @@ again: | |||
373 | p++; | 373 | p++; |
374 | *p='\0'; | 374 | *p='\0'; |
375 | 375 | ||
376 | if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) | 376 | if (!(v=(CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) |
377 | { | 377 | { |
378 | CONFerr(CONF_F_DEF_LOAD_BIO, | 378 | CONFerr(CONF_F_DEF_LOAD_BIO, |
379 | ERR_R_MALLOC_FAILURE); | 379 | ERR_R_MALLOC_FAILURE); |
380 | goto err; | 380 | goto err; |
381 | } | 381 | } |
382 | if (psection == NULL) psection=section; | 382 | if (psection == NULL) psection=section; |
383 | v->name=(char *)OPENSSL_malloc(strlen(pname)+1); | 383 | v->name=(char *)malloc(strlen(pname)+1); |
384 | v->value=NULL; | 384 | v->value=NULL; |
385 | if (v->name == NULL) | 385 | if (v->name == NULL) |
386 | { | 386 | { |
@@ -424,20 +424,20 @@ again: | |||
424 | if (vv != NULL) | 424 | if (vv != NULL) |
425 | { | 425 | { |
426 | sk_CONF_VALUE_delete_ptr(ts,vv); | 426 | sk_CONF_VALUE_delete_ptr(ts,vv); |
427 | OPENSSL_free(vv->name); | 427 | free(vv->name); |
428 | OPENSSL_free(vv->value); | 428 | free(vv->value); |
429 | OPENSSL_free(vv); | 429 | free(vv); |
430 | } | 430 | } |
431 | #endif | 431 | #endif |
432 | v=NULL; | 432 | v=NULL; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | if (buff != NULL) BUF_MEM_free(buff); | 435 | if (buff != NULL) BUF_MEM_free(buff); |
436 | if (section != NULL) OPENSSL_free(section); | 436 | if (section != NULL) free(section); |
437 | return(1); | 437 | return(1); |
438 | err: | 438 | err: |
439 | if (buff != NULL) BUF_MEM_free(buff); | 439 | if (buff != NULL) BUF_MEM_free(buff); |
440 | if (section != NULL) OPENSSL_free(section); | 440 | if (section != NULL) free(section); |
441 | if (line != NULL) *line=eline; | 441 | if (line != NULL) *line=eline; |
442 | (void) snprintf(btmp,sizeof btmp,"%ld",eline); | 442 | (void) snprintf(btmp,sizeof btmp,"%ld",eline); |
443 | ERR_add_error_data(2,"line ",btmp); | 443 | ERR_add_error_data(2,"line ",btmp); |
@@ -448,9 +448,9 @@ err: | |||
448 | } | 448 | } |
449 | if (v != NULL) | 449 | if (v != NULL) |
450 | { | 450 | { |
451 | if (v->name != NULL) OPENSSL_free(v->name); | 451 | if (v->name != NULL) free(v->name); |
452 | if (v->value != NULL) OPENSSL_free(v->value); | 452 | if (v->value != NULL) free(v->value); |
453 | if (v != NULL) OPENSSL_free(v); | 453 | if (v != NULL) free(v); |
454 | } | 454 | } |
455 | return(0); | 455 | return(0); |
456 | } | 456 | } |
@@ -637,9 +637,9 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) | |||
637 | buf->data[to++]= *(from++); | 637 | buf->data[to++]= *(from++); |
638 | } | 638 | } |
639 | buf->data[to]='\0'; | 639 | buf->data[to]='\0'; |
640 | if (*pto != NULL) OPENSSL_free(*pto); | 640 | if (*pto != NULL) free(*pto); |
641 | *pto=buf->data; | 641 | *pto=buf->data; |
642 | OPENSSL_free(buf); | 642 | free(buf); |
643 | return(1); | 643 | return(1); |
644 | err: | 644 | err: |
645 | if (buf != NULL) BUF_MEM_free(buf); | 645 | if (buf != NULL) BUF_MEM_free(buf); |
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index 994294f655..652ad6469a 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
@@ -197,7 +197,7 @@ int CONF_modules_load_file(const char *filename, const char *appname, | |||
197 | 197 | ||
198 | err: | 198 | err: |
199 | if (filename == NULL) | 199 | if (filename == NULL) |
200 | OPENSSL_free(file); | 200 | free(file); |
201 | NCONF_free(conf); | 201 | NCONF_free(conf); |
202 | 202 | ||
203 | return ret; | 203 | return ret; |
@@ -296,7 +296,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, | |||
296 | supported_modules = sk_CONF_MODULE_new_null(); | 296 | supported_modules = sk_CONF_MODULE_new_null(); |
297 | if (supported_modules == NULL) | 297 | if (supported_modules == NULL) |
298 | return NULL; | 298 | return NULL; |
299 | tmod = OPENSSL_malloc(sizeof(CONF_MODULE)); | 299 | tmod = malloc(sizeof(CONF_MODULE)); |
300 | if (tmod == NULL) | 300 | if (tmod == NULL) |
301 | return NULL; | 301 | return NULL; |
302 | 302 | ||
@@ -308,7 +308,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, | |||
308 | 308 | ||
309 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) | 309 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) |
310 | { | 310 | { |
311 | OPENSSL_free(tmod); | 311 | free(tmod); |
312 | return NULL; | 312 | return NULL; |
313 | } | 313 | } |
314 | 314 | ||
@@ -352,7 +352,7 @@ static int module_init(CONF_MODULE *pmod, char *name, char *value, | |||
352 | CONF_IMODULE *imod = NULL; | 352 | CONF_IMODULE *imod = NULL; |
353 | 353 | ||
354 | /* Otherwise add initialized module to list */ | 354 | /* Otherwise add initialized module to list */ |
355 | imod = OPENSSL_malloc(sizeof(CONF_IMODULE)); | 355 | imod = malloc(sizeof(CONF_IMODULE)); |
356 | if (!imod) | 356 | if (!imod) |
357 | goto err; | 357 | goto err; |
358 | 358 | ||
@@ -404,10 +404,10 @@ static int module_init(CONF_MODULE *pmod, char *name, char *value, | |||
404 | if (imod) | 404 | if (imod) |
405 | { | 405 | { |
406 | if (imod->name) | 406 | if (imod->name) |
407 | OPENSSL_free(imod->name); | 407 | free(imod->name); |
408 | if (imod->value) | 408 | if (imod->value) |
409 | OPENSSL_free(imod->value); | 409 | free(imod->value); |
410 | OPENSSL_free(imod); | 410 | free(imod); |
411 | } | 411 | } |
412 | 412 | ||
413 | return -1; | 413 | return -1; |
@@ -447,8 +447,8 @@ static void module_free(CONF_MODULE *md) | |||
447 | { | 447 | { |
448 | if (md->dso) | 448 | if (md->dso) |
449 | DSO_free(md->dso); | 449 | DSO_free(md->dso); |
450 | OPENSSL_free(md->name); | 450 | free(md->name); |
451 | OPENSSL_free(md); | 451 | free(md); |
452 | } | 452 | } |
453 | 453 | ||
454 | /* finish and free up all modules instances */ | 454 | /* finish and free up all modules instances */ |
@@ -472,9 +472,9 @@ static void module_finish(CONF_IMODULE *imod) | |||
472 | if (imod->pmod->finish) | 472 | if (imod->pmod->finish) |
473 | imod->pmod->finish(imod); | 473 | imod->pmod->finish(imod); |
474 | imod->pmod->links--; | 474 | imod->pmod->links--; |
475 | OPENSSL_free(imod->name); | 475 | free(imod->name); |
476 | OPENSSL_free(imod->value); | 476 | free(imod->value); |
477 | OPENSSL_free(imod); | 477 | free(imod); |
478 | } | 478 | } |
479 | 479 | ||
480 | /* Add a static module to OpenSSL */ | 480 | /* Add a static module to OpenSSL */ |
@@ -558,7 +558,7 @@ char *CONF_get1_default_config_file(void) | |||
558 | #endif | 558 | #endif |
559 | len += strlen(OPENSSL_CONF); | 559 | len += strlen(OPENSSL_CONF); |
560 | 560 | ||
561 | file = OPENSSL_malloc(len + 1); | 561 | file = malloc(len + 1); |
562 | 562 | ||
563 | if (!file) | 563 | if (!file) |
564 | return NULL; | 564 | return NULL; |
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 2bf5def17d..dc3cc2ab02 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
@@ -211,7 +211,7 @@ CRYPTO_get_new_lockid(char *name) | |||
211 | } | 211 | } |
212 | i = sk_OPENSSL_STRING_push(app_locks, str); | 212 | i = sk_OPENSSL_STRING_push(app_locks, str); |
213 | if (!i) | 213 | if (!i) |
214 | OPENSSL_free(str); | 214 | free(str); |
215 | else | 215 | else |
216 | i += CRYPTO_NUM_LOCKS; /* gap of one :-) */ | 216 | i += CRYPTO_NUM_LOCKS; /* gap of one :-) */ |
217 | return (i); | 217 | return (i); |
@@ -242,7 +242,7 @@ CRYPTO_get_new_dynlockid(void) | |||
242 | } | 242 | } |
243 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | 243 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); |
244 | 244 | ||
245 | pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock)); | 245 | pointer = (CRYPTO_dynlock *)malloc(sizeof(CRYPTO_dynlock)); |
246 | if (pointer == NULL) { | 246 | if (pointer == NULL) { |
247 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); | 247 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); |
248 | return (0); | 248 | return (0); |
@@ -250,7 +250,7 @@ CRYPTO_get_new_dynlockid(void) | |||
250 | pointer->references = 1; | 250 | pointer->references = 1; |
251 | pointer->data = dynlock_create_callback(__FILE__, __LINE__); | 251 | pointer->data = dynlock_create_callback(__FILE__, __LINE__); |
252 | if (pointer->data == NULL) { | 252 | if (pointer->data == NULL) { |
253 | OPENSSL_free(pointer); | 253 | free(pointer); |
254 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); | 254 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); |
255 | return (0); | 255 | return (0); |
256 | } | 256 | } |
@@ -273,7 +273,7 @@ CRYPTO_get_new_dynlockid(void) | |||
273 | 273 | ||
274 | if (i == -1) { | 274 | if (i == -1) { |
275 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); | 275 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); |
276 | OPENSSL_free(pointer); | 276 | free(pointer); |
277 | } else | 277 | } else |
278 | i += 1; /* to avoid 0 */ | 278 | i += 1; /* to avoid 0 */ |
279 | return - i; | 279 | return - i; |
@@ -312,7 +312,7 @@ CRYPTO_destroy_dynlockid(int i) | |||
312 | 312 | ||
313 | if (pointer) { | 313 | if (pointer) { |
314 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); | 314 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); |
315 | OPENSSL_free(pointer); | 315 | free(pointer); |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
diff --git a/src/lib/libcrypto/des/enc_read.c b/src/lib/libcrypto/des/enc_read.c index edb6620d08..23ad458dcf 100644 --- a/src/lib/libcrypto/des/enc_read.c +++ b/src/lib/libcrypto/des/enc_read.c | |||
@@ -106,17 +106,17 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | |||
106 | 106 | ||
107 | if (tmpbuf == NULL) | 107 | if (tmpbuf == NULL) |
108 | { | 108 | { |
109 | tmpbuf=OPENSSL_malloc(BSIZE); | 109 | tmpbuf=malloc(BSIZE); |
110 | if (tmpbuf == NULL) return(-1); | 110 | if (tmpbuf == NULL) return(-1); |
111 | } | 111 | } |
112 | if (net == NULL) | 112 | if (net == NULL) |
113 | { | 113 | { |
114 | net=OPENSSL_malloc(BSIZE); | 114 | net=malloc(BSIZE); |
115 | if (net == NULL) return(-1); | 115 | if (net == NULL) return(-1); |
116 | } | 116 | } |
117 | if (unnet == NULL) | 117 | if (unnet == NULL) |
118 | { | 118 | { |
119 | unnet=OPENSSL_malloc(BSIZE); | 119 | unnet=malloc(BSIZE); |
120 | if (unnet == NULL) return(-1); | 120 | if (unnet == NULL) return(-1); |
121 | } | 121 | } |
122 | /* left over data from last decrypt */ | 122 | /* left over data from last decrypt */ |
diff --git a/src/lib/libcrypto/des/enc_writ.c b/src/lib/libcrypto/des/enc_writ.c index 2353ac1e89..8f6b033c87 100644 --- a/src/lib/libcrypto/des/enc_writ.c +++ b/src/lib/libcrypto/des/enc_writ.c | |||
@@ -98,7 +98,7 @@ int DES_enc_write(int fd, const void *_buf, int len, | |||
98 | 98 | ||
99 | if (outbuf == NULL) | 99 | if (outbuf == NULL) |
100 | { | 100 | { |
101 | outbuf=OPENSSL_malloc(BSIZE+HDRSIZE); | 101 | outbuf=malloc(BSIZE+HDRSIZE); |
102 | if (outbuf == NULL) return(-1); | 102 | if (outbuf == NULL) return(-1); |
103 | } | 103 | } |
104 | /* If we are sending less than 8 bytes, the same char will look | 104 | /* If we are sending less than 8 bytes, the same char will look |
diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c index 02ec2d47b4..d39f4b373d 100644 --- a/src/lib/libcrypto/dh/dh_ameth.c +++ b/src/lib/libcrypto/dh/dh_ameth.c | |||
@@ -168,7 +168,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
168 | 168 | ||
169 | err: | 169 | err: |
170 | if (penc) | 170 | if (penc) |
171 | OPENSSL_free(penc); | 171 | free(penc); |
172 | if (pval) | 172 | if (pval) |
173 | ASN1_STRING_free(pval); | 173 | ASN1_STRING_free(pval); |
174 | 174 | ||
@@ -277,7 +277,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
277 | 277 | ||
278 | err: | 278 | err: |
279 | if (dp != NULL) | 279 | if (dp != NULL) |
280 | OPENSSL_free(dp); | 280 | free(dp); |
281 | if (params != NULL) | 281 | if (params != NULL) |
282 | ASN1_STRING_free(params); | 282 | ASN1_STRING_free(params); |
283 | if (prkey != NULL) | 283 | if (prkey != NULL) |
@@ -353,7 +353,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, | |||
353 | else | 353 | else |
354 | ktype = "PKCS#3 DH Parameters"; | 354 | ktype = "PKCS#3 DH Parameters"; |
355 | 355 | ||
356 | m= OPENSSL_malloc(buf_len+10); | 356 | m= malloc(buf_len+10); |
357 | if (m == NULL) | 357 | if (m == NULL) |
358 | { | 358 | { |
359 | reason=ERR_R_MALLOC_FAILURE; | 359 | reason=ERR_R_MALLOC_FAILURE; |
@@ -384,7 +384,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, | |||
384 | err: | 384 | err: |
385 | DHerr(DH_F_DO_DH_PRINT,reason); | 385 | DHerr(DH_F_DO_DH_PRINT,reason); |
386 | } | 386 | } |
387 | if (m != NULL) OPENSSL_free(m); | 387 | if (m != NULL) free(m); |
388 | return(ret); | 388 | return(ret); |
389 | } | 389 | } |
390 | 390 | ||
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index a40caaf75b..4e3d25b7e5 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
@@ -110,7 +110,7 @@ DH *DH_new_method(ENGINE *engine) | |||
110 | { | 110 | { |
111 | DH *ret; | 111 | DH *ret; |
112 | 112 | ||
113 | ret=(DH *)OPENSSL_malloc(sizeof(DH)); | 113 | ret=(DH *)malloc(sizeof(DH)); |
114 | if (ret == NULL) | 114 | if (ret == NULL) |
115 | { | 115 | { |
116 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 116 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -124,7 +124,7 @@ DH *DH_new_method(ENGINE *engine) | |||
124 | if (!ENGINE_init(engine)) | 124 | if (!ENGINE_init(engine)) |
125 | { | 125 | { |
126 | DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB); | 126 | DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB); |
127 | OPENSSL_free(ret); | 127 | free(ret); |
128 | return NULL; | 128 | return NULL; |
129 | } | 129 | } |
130 | ret->engine = engine; | 130 | ret->engine = engine; |
@@ -138,7 +138,7 @@ DH *DH_new_method(ENGINE *engine) | |||
138 | { | 138 | { |
139 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_ENGINE_LIB); | 139 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_ENGINE_LIB); |
140 | ENGINE_finish(ret->engine); | 140 | ENGINE_finish(ret->engine); |
141 | OPENSSL_free(ret); | 141 | free(ret); |
142 | return NULL; | 142 | return NULL; |
143 | } | 143 | } |
144 | } | 144 | } |
@@ -167,7 +167,7 @@ DH *DH_new_method(ENGINE *engine) | |||
167 | ENGINE_finish(ret->engine); | 167 | ENGINE_finish(ret->engine); |
168 | #endif | 168 | #endif |
169 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); | 169 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); |
170 | OPENSSL_free(ret); | 170 | free(ret); |
171 | ret=NULL; | 171 | ret=NULL; |
172 | } | 172 | } |
173 | return(ret); | 173 | return(ret); |
@@ -203,11 +203,11 @@ void DH_free(DH *r) | |||
203 | if (r->g != NULL) BN_clear_free(r->g); | 203 | if (r->g != NULL) BN_clear_free(r->g); |
204 | if (r->q != NULL) BN_clear_free(r->q); | 204 | if (r->q != NULL) BN_clear_free(r->q); |
205 | if (r->j != NULL) BN_clear_free(r->j); | 205 | if (r->j != NULL) BN_clear_free(r->j); |
206 | if (r->seed) OPENSSL_free(r->seed); | 206 | if (r->seed) free(r->seed); |
207 | if (r->counter != NULL) BN_clear_free(r->counter); | 207 | if (r->counter != NULL) BN_clear_free(r->counter); |
208 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); | 208 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); |
209 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); | 209 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); |
210 | OPENSSL_free(r); | 210 | free(r); |
211 | } | 211 | } |
212 | 212 | ||
213 | int DH_up_ref(DH *r) | 213 | int DH_up_ref(DH *r) |
diff --git a/src/lib/libcrypto/dh/dh_pmeth.c b/src/lib/libcrypto/dh/dh_pmeth.c index 5ae72b7d4c..ec4553c0a8 100644 --- a/src/lib/libcrypto/dh/dh_pmeth.c +++ b/src/lib/libcrypto/dh/dh_pmeth.c | |||
@@ -80,7 +80,7 @@ typedef struct | |||
80 | static int pkey_dh_init(EVP_PKEY_CTX *ctx) | 80 | static int pkey_dh_init(EVP_PKEY_CTX *ctx) |
81 | { | 81 | { |
82 | DH_PKEY_CTX *dctx; | 82 | DH_PKEY_CTX *dctx; |
83 | dctx = OPENSSL_malloc(sizeof(DH_PKEY_CTX)); | 83 | dctx = malloc(sizeof(DH_PKEY_CTX)); |
84 | if (!dctx) | 84 | if (!dctx) |
85 | return 0; | 85 | return 0; |
86 | dctx->prime_len = 1024; | 86 | dctx->prime_len = 1024; |
@@ -111,7 +111,7 @@ static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx) | |||
111 | { | 111 | { |
112 | DH_PKEY_CTX *dctx = ctx->data; | 112 | DH_PKEY_CTX *dctx = ctx->data; |
113 | if (dctx) | 113 | if (dctx) |
114 | OPENSSL_free(dctx); | 114 | free(dctx); |
115 | } | 115 | } |
116 | 116 | ||
117 | static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | 117 | static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) |
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 376156ec5e..e9c549802d 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c | |||
@@ -176,7 +176,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
176 | 176 | ||
177 | err: | 177 | err: |
178 | if (penc) | 178 | if (penc) |
179 | OPENSSL_free(penc); | 179 | free(penc); |
180 | if (pval) | 180 | if (pval) |
181 | ASN1_STRING_free(pval); | 181 | ASN1_STRING_free(pval); |
182 | 182 | ||
@@ -344,7 +344,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
344 | 344 | ||
345 | err: | 345 | err: |
346 | if (dp != NULL) | 346 | if (dp != NULL) |
347 | OPENSSL_free(dp); | 347 | free(dp); |
348 | if (params != NULL) | 348 | if (params != NULL) |
349 | ASN1_STRING_free(params); | 349 | ASN1_STRING_free(params); |
350 | if (prkey != NULL) | 350 | if (prkey != NULL) |
@@ -459,7 +459,7 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) | |||
459 | update_buflen(priv_key, &buf_len); | 459 | update_buflen(priv_key, &buf_len); |
460 | update_buflen(pub_key, &buf_len); | 460 | update_buflen(pub_key, &buf_len); |
461 | 461 | ||
462 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | 462 | m=(unsigned char *)malloc(buf_len+10); |
463 | if (m == NULL) | 463 | if (m == NULL) |
464 | { | 464 | { |
465 | DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE); | 465 | DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE); |
@@ -483,7 +483,7 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) | |||
483 | if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err; | 483 | if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err; |
484 | ret=1; | 484 | ret=1; |
485 | err: | 485 | err: |
486 | if (m != NULL) OPENSSL_free(m); | 486 | if (m != NULL) free(m); |
487 | return(ret); | 487 | return(ret); |
488 | } | 488 | } |
489 | 489 | ||
@@ -564,7 +564,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, | |||
564 | unsigned char *m=NULL; | 564 | unsigned char *m=NULL; |
565 | update_buflen(dsa_sig->r, &buf_len); | 565 | update_buflen(dsa_sig->r, &buf_len); |
566 | update_buflen(dsa_sig->s, &buf_len); | 566 | update_buflen(dsa_sig->s, &buf_len); |
567 | m = OPENSSL_malloc(buf_len+10); | 567 | m = malloc(buf_len+10); |
568 | if (m == NULL) | 568 | if (m == NULL) |
569 | { | 569 | { |
570 | DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE); | 570 | DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE); |
@@ -581,7 +581,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, | |||
581 | rv = 1; | 581 | rv = 1; |
582 | err: | 582 | err: |
583 | if (m) | 583 | if (m) |
584 | OPENSSL_free(m); | 584 | free(m); |
585 | DSA_SIG_free(dsa_sig); | 585 | DSA_SIG_free(dsa_sig); |
586 | return rv; | 586 | return rv; |
587 | } | 587 | } |
diff --git a/src/lib/libcrypto/dsa/dsa_asn1.c b/src/lib/libcrypto/dsa/dsa_asn1.c index 19528dcd7a..f8a918d72c 100644 --- a/src/lib/libcrypto/dsa/dsa_asn1.c +++ b/src/lib/libcrypto/dsa/dsa_asn1.c | |||
@@ -69,7 +69,7 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
69 | { | 69 | { |
70 | if(operation == ASN1_OP_NEW_PRE) { | 70 | if(operation == ASN1_OP_NEW_PRE) { |
71 | DSA_SIG *sig; | 71 | DSA_SIG *sig; |
72 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | 72 | sig = malloc(sizeof(DSA_SIG)); |
73 | if (!sig) | 73 | if (!sig) |
74 | { | 74 | { |
75 | DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); | 75 | DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index 897c085968..27a4c66618 100644 --- a/src/lib/libcrypto/dsa/dsa_lib.c +++ b/src/lib/libcrypto/dsa/dsa_lib.c | |||
@@ -116,7 +116,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
116 | { | 116 | { |
117 | DSA *ret; | 117 | DSA *ret; |
118 | 118 | ||
119 | ret=(DSA *)OPENSSL_malloc(sizeof(DSA)); | 119 | ret=(DSA *)malloc(sizeof(DSA)); |
120 | if (ret == NULL) | 120 | if (ret == NULL) |
121 | { | 121 | { |
122 | DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 122 | DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -129,7 +129,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
129 | if (!ENGINE_init(engine)) | 129 | if (!ENGINE_init(engine)) |
130 | { | 130 | { |
131 | DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 131 | DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
132 | OPENSSL_free(ret); | 132 | free(ret); |
133 | return NULL; | 133 | return NULL; |
134 | } | 134 | } |
135 | ret->engine = engine; | 135 | ret->engine = engine; |
@@ -144,7 +144,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
144 | DSAerr(DSA_F_DSA_NEW_METHOD, | 144 | DSAerr(DSA_F_DSA_NEW_METHOD, |
145 | ERR_R_ENGINE_LIB); | 145 | ERR_R_ENGINE_LIB); |
146 | ENGINE_finish(ret->engine); | 146 | ENGINE_finish(ret->engine); |
147 | OPENSSL_free(ret); | 147 | free(ret); |
148 | return NULL; | 148 | return NULL; |
149 | } | 149 | } |
150 | } | 150 | } |
@@ -174,7 +174,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
174 | ENGINE_finish(ret->engine); | 174 | ENGINE_finish(ret->engine); |
175 | #endif | 175 | #endif |
176 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data); | 176 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data); |
177 | OPENSSL_free(ret); | 177 | free(ret); |
178 | ret=NULL; | 178 | ret=NULL; |
179 | } | 179 | } |
180 | 180 | ||
@@ -216,7 +216,7 @@ void DSA_free(DSA *r) | |||
216 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); | 216 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); |
217 | if (r->kinv != NULL) BN_clear_free(r->kinv); | 217 | if (r->kinv != NULL) BN_clear_free(r->kinv); |
218 | if (r->r != NULL) BN_clear_free(r->r); | 218 | if (r->r != NULL) BN_clear_free(r->r); |
219 | OPENSSL_free(r); | 219 | free(r); |
220 | } | 220 | } |
221 | 221 | ||
222 | int DSA_up_ref(DSA *r) | 222 | int DSA_up_ref(DSA *r) |
diff --git a/src/lib/libcrypto/dsa/dsa_pmeth.c b/src/lib/libcrypto/dsa/dsa_pmeth.c index 715d8d675b..7076bf7b67 100644 --- a/src/lib/libcrypto/dsa/dsa_pmeth.c +++ b/src/lib/libcrypto/dsa/dsa_pmeth.c | |||
@@ -81,7 +81,7 @@ typedef struct | |||
81 | static int pkey_dsa_init(EVP_PKEY_CTX *ctx) | 81 | static int pkey_dsa_init(EVP_PKEY_CTX *ctx) |
82 | { | 82 | { |
83 | DSA_PKEY_CTX *dctx; | 83 | DSA_PKEY_CTX *dctx; |
84 | dctx = OPENSSL_malloc(sizeof(DSA_PKEY_CTX)); | 84 | dctx = malloc(sizeof(DSA_PKEY_CTX)); |
85 | if (!dctx) | 85 | if (!dctx) |
86 | return 0; | 86 | return 0; |
87 | dctx->nbits = 1024; | 87 | dctx->nbits = 1024; |
@@ -114,7 +114,7 @@ static void pkey_dsa_cleanup(EVP_PKEY_CTX *ctx) | |||
114 | { | 114 | { |
115 | DSA_PKEY_CTX *dctx = ctx->data; | 115 | DSA_PKEY_CTX *dctx = ctx->data; |
116 | if (dctx) | 116 | if (dctx) |
117 | OPENSSL_free(dctx); | 117 | free(dctx); |
118 | } | 118 | } |
119 | 119 | ||
120 | static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 120 | static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c index e02365a8b1..5f48d6b622 100644 --- a/src/lib/libcrypto/dsa/dsa_sign.c +++ b/src/lib/libcrypto/dsa/dsa_sign.c | |||
@@ -76,7 +76,7 @@ int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
76 | DSA_SIG *DSA_SIG_new(void) | 76 | DSA_SIG *DSA_SIG_new(void) |
77 | { | 77 | { |
78 | DSA_SIG *sig; | 78 | DSA_SIG *sig; |
79 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | 79 | sig = malloc(sizeof(DSA_SIG)); |
80 | if (!sig) | 80 | if (!sig) |
81 | return NULL; | 81 | return NULL; |
82 | sig->r = NULL; | 82 | sig->r = NULL; |
@@ -92,7 +92,7 @@ void DSA_SIG_free(DSA_SIG *sig) | |||
92 | BN_free(sig->r); | 92 | BN_free(sig->r); |
93 | if (sig->s) | 93 | if (sig->s) |
94 | BN_free(sig->s); | 94 | BN_free(sig->s); |
95 | OPENSSL_free(sig); | 95 | free(sig); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/src/lib/libcrypto/dso/dso.h b/src/lib/libcrypto/dso/dso.h index f36f209afd..9010251bbc 100644 --- a/src/lib/libcrypto/dso/dso.h +++ b/src/lib/libcrypto/dso/dso.h | |||
@@ -112,7 +112,7 @@ typedef struct dso_st DSO; | |||
112 | * (or NULL if they are to be used independantly of a DSO object) and a | 112 | * (or NULL if they are to be used independantly of a DSO object) and a |
113 | * filename to transform. They should either return NULL (if there is an error | 113 | * filename to transform. They should either return NULL (if there is an error |
114 | * condition) or a newly allocated string containing the transformed form that | 114 | * condition) or a newly allocated string containing the transformed form that |
115 | * the caller will need to free with OPENSSL_free() when done. */ | 115 | * the caller will need to free with free() when done. */ |
116 | typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); | 116 | typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); |
117 | /* The function prototype used for method functions (or caller-provided | 117 | /* The function prototype used for method functions (or caller-provided |
118 | * callbacks) that merge two file specifications. They are passed a | 118 | * callbacks) that merge two file specifications. They are passed a |
@@ -120,7 +120,7 @@ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); | |||
120 | * a DSO object) and two file specifications to merge. They should | 120 | * a DSO object) and two file specifications to merge. They should |
121 | * either return NULL (if there is an error condition) or a newly allocated | 121 | * either return NULL (if there is an error condition) or a newly allocated |
122 | * string containing the result of merging that the caller will need | 122 | * string containing the result of merging that the caller will need |
123 | * to free with OPENSSL_free() when done. | 123 | * to free with free() when done. |
124 | * Here, merging means that bits and pieces are taken from each of the | 124 | * Here, merging means that bits and pieces are taken from each of the |
125 | * file specifications and added together in whatever fashion that is | 125 | * file specifications and added together in whatever fashion that is |
126 | * sensible for the DSO method in question. The only rule that really | 126 | * sensible for the DSO method in question. The only rule that really |
@@ -136,7 +136,7 @@ typedef struct dso_meth_st | |||
136 | const char *name; | 136 | const char *name; |
137 | /* Loads a shared library, NB: new DSO_METHODs must ensure that a | 137 | /* Loads a shared library, NB: new DSO_METHODs must ensure that a |
138 | * successful load populates the loaded_filename field, and likewise a | 138 | * successful load populates the loaded_filename field, and likewise a |
139 | * successful unload OPENSSL_frees and NULLs it out. */ | 139 | * successful unload frees and NULLs it out. */ |
140 | int (*dso_load)(DSO *dso); | 140 | int (*dso_load)(DSO *dso); |
141 | /* Unloads a shared library */ | 141 | /* Unloads a shared library */ |
142 | int (*dso_unload)(DSO *dso); | 142 | int (*dso_unload)(DSO *dso); |
@@ -242,12 +242,12 @@ int DSO_set_filename(DSO *dso, const char *filename); | |||
242 | * simply duplicated. NB: This function is usually called from within a | 242 | * simply duplicated. NB: This function is usually called from within a |
243 | * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that | 243 | * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that |
244 | * caller-created DSO_METHODs can do the same thing. A non-NULL return value | 244 | * caller-created DSO_METHODs can do the same thing. A non-NULL return value |
245 | * will need to be OPENSSL_free()'d. */ | 245 | * will need to be free()'d. */ |
246 | char *DSO_convert_filename(DSO *dso, const char *filename); | 246 | char *DSO_convert_filename(DSO *dso, const char *filename); |
247 | /* This function will invoke the DSO's merger callback to merge two file | 247 | /* This function will invoke the DSO's merger callback to merge two file |
248 | * specifications, or if the callback isn't set it will instead use the | 248 | * specifications, or if the callback isn't set it will instead use the |
249 | * DSO_METHOD's merger. A non-NULL return value will need to be | 249 | * DSO_METHOD's merger. A non-NULL return value will need to be |
250 | * OPENSSL_free()'d. */ | 250 | * free()'d. */ |
251 | char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); | 251 | char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); |
252 | /* If the DSO is currently loaded, this returns the filename that it was loaded | 252 | /* If the DSO is currently loaded, this returns the filename that it was loaded |
253 | * under, otherwise it returns NULL. So it is also useful as a test as to | 253 | * under, otherwise it returns NULL. So it is also useful as a test as to |
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index fe5f0ffdb0..648ddb5ac0 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c | |||
@@ -153,7 +153,7 @@ static int dlfcn_load(DSO *dso) | |||
153 | err: | 153 | err: |
154 | /* Cleanup! */ | 154 | /* Cleanup! */ |
155 | if(filename != NULL) | 155 | if(filename != NULL) |
156 | OPENSSL_free(filename); | 156 | free(filename); |
157 | if(ptr != NULL) | 157 | if(ptr != NULL) |
158 | dlclose(ptr); | 158 | dlclose(ptr); |
159 | return(0); | 159 | return(0); |
@@ -264,7 +264,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
264 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) | 264 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) |
265 | { | 265 | { |
266 | len = strlen(filespec1) + 1; | 266 | len = strlen(filespec1) + 1; |
267 | merged = OPENSSL_malloc(len); | 267 | merged = malloc(len); |
268 | if(!merged) | 268 | if(!merged) |
269 | { | 269 | { |
270 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 270 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); |
@@ -276,7 +276,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
276 | else if (!filespec1) | 276 | else if (!filespec1) |
277 | { | 277 | { |
278 | len = strlen(filespec2) + 1; | 278 | len = strlen(filespec2) + 1; |
279 | merged = OPENSSL_malloc(strlen(filespec2) + 1); | 279 | merged = malloc(strlen(filespec2) + 1); |
280 | if(!merged) | 280 | if(!merged) |
281 | { | 281 | { |
282 | DSOerr(DSO_F_DLFCN_MERGER, | 282 | DSOerr(DSO_F_DLFCN_MERGER, |
@@ -302,7 +302,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
302 | spec2len--; | 302 | spec2len--; |
303 | len--; | 303 | len--; |
304 | } | 304 | } |
305 | merged = OPENSSL_malloc(len + 2); | 305 | merged = malloc(len + 2); |
306 | if(!merged) | 306 | if(!merged) |
307 | { | 307 | { |
308 | DSOerr(DSO_F_DLFCN_MERGER, | 308 | DSOerr(DSO_F_DLFCN_MERGER, |
@@ -334,7 +334,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) | |||
334 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | 334 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) |
335 | rsize += 3; /* The length of "lib" */ | 335 | rsize += 3; /* The length of "lib" */ |
336 | } | 336 | } |
337 | translated = OPENSSL_malloc(rsize); | 337 | translated = malloc(rsize); |
338 | if(translated == NULL) | 338 | if(translated == NULL) |
339 | { | 339 | { |
340 | DSOerr(DSO_F_DLFCN_NAME_CONVERTER, | 340 | DSOerr(DSO_F_DLFCN_NAME_CONVERTER, |
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index 8a15b794ab..68f5430ea8 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c | |||
@@ -100,7 +100,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
100 | * to stealing the "best available" method. Will fallback | 100 | * to stealing the "best available" method. Will fallback |
101 | * to DSO_METH_null() in the worst case. */ | 101 | * to DSO_METH_null() in the worst case. */ |
102 | default_DSO_meth = DSO_METHOD_openssl(); | 102 | default_DSO_meth = DSO_METHOD_openssl(); |
103 | ret = (DSO *)OPENSSL_malloc(sizeof(DSO)); | 103 | ret = (DSO *)malloc(sizeof(DSO)); |
104 | if(ret == NULL) | 104 | if(ret == NULL) |
105 | { | 105 | { |
106 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 106 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -112,7 +112,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
112 | { | 112 | { |
113 | /* sk_new doesn't generate any errors so we do */ | 113 | /* sk_new doesn't generate any errors so we do */ |
114 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 114 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
115 | OPENSSL_free(ret); | 115 | free(ret); |
116 | return(NULL); | 116 | return(NULL); |
117 | } | 117 | } |
118 | if(meth == NULL) | 118 | if(meth == NULL) |
@@ -122,7 +122,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
122 | ret->references = 1; | 122 | ret->references = 1; |
123 | if((ret->meth->init != NULL) && !ret->meth->init(ret)) | 123 | if((ret->meth->init != NULL) && !ret->meth->init(ret)) |
124 | { | 124 | { |
125 | OPENSSL_free(ret); | 125 | free(ret); |
126 | ret=NULL; | 126 | ret=NULL; |
127 | } | 127 | } |
128 | return(ret); | 128 | return(ret); |
@@ -165,11 +165,11 @@ int DSO_free(DSO *dso) | |||
165 | 165 | ||
166 | sk_void_free(dso->meth_data); | 166 | sk_void_free(dso->meth_data); |
167 | if(dso->filename != NULL) | 167 | if(dso->filename != NULL) |
168 | OPENSSL_free(dso->filename); | 168 | free(dso->filename); |
169 | if(dso->loaded_filename != NULL) | 169 | if(dso->loaded_filename != NULL) |
170 | OPENSSL_free(dso->loaded_filename); | 170 | free(dso->loaded_filename); |
171 | 171 | ||
172 | OPENSSL_free(dso); | 172 | free(dso); |
173 | return(1); | 173 | return(1); |
174 | } | 174 | } |
175 | 175 | ||
@@ -377,7 +377,7 @@ int DSO_set_filename(DSO *dso, const char *filename) | |||
377 | return(0); | 377 | return(0); |
378 | } | 378 | } |
379 | /* We'll duplicate filename */ | 379 | /* We'll duplicate filename */ |
380 | copied = OPENSSL_malloc(strlen(filename) + 1); | 380 | copied = malloc(strlen(filename) + 1); |
381 | if(copied == NULL) | 381 | if(copied == NULL) |
382 | { | 382 | { |
383 | DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); | 383 | DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); |
@@ -385,7 +385,7 @@ int DSO_set_filename(DSO *dso, const char *filename) | |||
385 | } | 385 | } |
386 | BUF_strlcpy(copied, filename, strlen(filename) + 1); | 386 | BUF_strlcpy(copied, filename, strlen(filename) + 1); |
387 | if(dso->filename) | 387 | if(dso->filename) |
388 | OPENSSL_free(dso->filename); | 388 | free(dso->filename); |
389 | dso->filename = copied; | 389 | dso->filename = copied; |
390 | return(1); | 390 | return(1); |
391 | } | 391 | } |
@@ -435,7 +435,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename) | |||
435 | } | 435 | } |
436 | if(result == NULL) | 436 | if(result == NULL) |
437 | { | 437 | { |
438 | result = OPENSSL_malloc(strlen(filename) + 1); | 438 | result = malloc(strlen(filename) + 1); |
439 | if(result == NULL) | 439 | if(result == NULL) |
440 | { | 440 | { |
441 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, | 441 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, |
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 0ce4524076..6331903141 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
@@ -116,7 +116,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
116 | penclen = i2o_ECPublicKey(ec_key, NULL); | 116 | penclen = i2o_ECPublicKey(ec_key, NULL); |
117 | if (penclen <= 0) | 117 | if (penclen <= 0) |
118 | goto err; | 118 | goto err; |
119 | penc = OPENSSL_malloc(penclen); | 119 | penc = malloc(penclen); |
120 | if (!penc) | 120 | if (!penc) |
121 | goto err; | 121 | goto err; |
122 | p = penc; | 122 | p = penc; |
@@ -132,7 +132,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
132 | else | 132 | else |
133 | ASN1_STRING_free(pval); | 133 | ASN1_STRING_free(pval); |
134 | if (penc) | 134 | if (penc) |
135 | OPENSSL_free(penc); | 135 | free(penc); |
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
@@ -339,7 +339,7 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
339 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); | 339 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); |
340 | return 0; | 340 | return 0; |
341 | } | 341 | } |
342 | ep = (unsigned char *) OPENSSL_malloc(eplen); | 342 | ep = (unsigned char *) malloc(eplen); |
343 | if (!ep) | 343 | if (!ep) |
344 | { | 344 | { |
345 | EC_KEY_set_enc_flags(ec_key, old_flags); | 345 | EC_KEY_set_enc_flags(ec_key, old_flags); |
@@ -350,7 +350,7 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
350 | if (!i2d_ECPrivateKey(ec_key, &p)) | 350 | if (!i2d_ECPrivateKey(ec_key, &p)) |
351 | { | 351 | { |
352 | EC_KEY_set_enc_flags(ec_key, old_flags); | 352 | EC_KEY_set_enc_flags(ec_key, old_flags); |
353 | OPENSSL_free(ep); | 353 | free(ep); |
354 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); | 354 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); |
355 | } | 355 | } |
356 | /* restore old encoding flags */ | 356 | /* restore old encoding flags */ |
@@ -474,7 +474,7 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype) | |||
474 | if (ktype > 0) | 474 | if (ktype > 0) |
475 | { | 475 | { |
476 | buf_len += 10; | 476 | buf_len += 10; |
477 | if ((buffer = OPENSSL_malloc(buf_len)) == NULL) | 477 | if ((buffer = malloc(buf_len)) == NULL) |
478 | { | 478 | { |
479 | reason = ERR_R_MALLOC_FAILURE; | 479 | reason = ERR_R_MALLOC_FAILURE; |
480 | goto err; | 480 | goto err; |
@@ -515,7 +515,7 @@ err: | |||
515 | if (ctx) | 515 | if (ctx) |
516 | BN_CTX_free(ctx); | 516 | BN_CTX_free(ctx); |
517 | if (buffer != NULL) | 517 | if (buffer != NULL) |
518 | OPENSSL_free(buffer); | 518 | free(buffer); |
519 | return(ret); | 519 | return(ret); |
520 | } | 520 | } |
521 | 521 | ||
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c index 145807b611..2bde9a6a3c 100644 --- a/src/lib/libcrypto/ec/ec_asn1.c +++ b/src/lib/libcrypto/ec/ec_asn1.c | |||
@@ -485,7 +485,7 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | |||
485 | } | 485 | } |
486 | else | 486 | else |
487 | { | 487 | { |
488 | if ((buffer_1 = OPENSSL_malloc(len_1)) == NULL) | 488 | if ((buffer_1 = malloc(len_1)) == NULL) |
489 | { | 489 | { |
490 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, | 490 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, |
491 | ERR_R_MALLOC_FAILURE); | 491 | ERR_R_MALLOC_FAILURE); |
@@ -507,7 +507,7 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | |||
507 | } | 507 | } |
508 | else | 508 | else |
509 | { | 509 | { |
510 | if ((buffer_2 = OPENSSL_malloc(len_2)) == NULL) | 510 | if ((buffer_2 = malloc(len_2)) == NULL) |
511 | { | 511 | { |
512 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, | 512 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, |
513 | ERR_R_MALLOC_FAILURE); | 513 | ERR_R_MALLOC_FAILURE); |
@@ -559,9 +559,9 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | |||
559 | ok = 1; | 559 | ok = 1; |
560 | 560 | ||
561 | err: if (buffer_1) | 561 | err: if (buffer_1) |
562 | OPENSSL_free(buffer_1); | 562 | free(buffer_1); |
563 | if (buffer_2) | 563 | if (buffer_2) |
564 | OPENSSL_free(buffer_2); | 564 | free(buffer_2); |
565 | if (tmp_1) | 565 | if (tmp_1) |
566 | BN_free(tmp_1); | 566 | BN_free(tmp_1); |
567 | if (tmp_2) | 567 | if (tmp_2) |
@@ -630,7 +630,7 @@ static ECPARAMETERS *ec_asn1_group2parameters(const EC_GROUP *group, | |||
630 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_EC_LIB); | 630 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_EC_LIB); |
631 | goto err; | 631 | goto err; |
632 | } | 632 | } |
633 | if ((buffer = OPENSSL_malloc(len)) == NULL) | 633 | if ((buffer = malloc(len)) == NULL) |
634 | { | 634 | { |
635 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_MALLOC_FAILURE); | 635 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_MALLOC_FAILURE); |
636 | goto err; | 636 | goto err; |
@@ -686,7 +686,7 @@ err : if(!ok) | |||
686 | if (tmp) | 686 | if (tmp) |
687 | BN_free(tmp); | 687 | BN_free(tmp); |
688 | if (buffer) | 688 | if (buffer) |
689 | OPENSSL_free(buffer); | 689 | free(buffer); |
690 | return(ret); | 690 | return(ret); |
691 | } | 691 | } |
692 | 692 | ||
@@ -925,8 +925,8 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params) | |||
925 | if (params->curve->seed != NULL) | 925 | if (params->curve->seed != NULL) |
926 | { | 926 | { |
927 | if (ret->seed != NULL) | 927 | if (ret->seed != NULL) |
928 | OPENSSL_free(ret->seed); | 928 | free(ret->seed); |
929 | if (!(ret->seed = OPENSSL_malloc(params->curve->seed->length))) | 929 | if (!(ret->seed = malloc(params->curve->seed->length))) |
930 | { | 930 | { |
931 | ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, | 931 | ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, |
932 | ERR_R_MALLOC_FAILURE); | 932 | ERR_R_MALLOC_FAILURE); |
@@ -1247,7 +1247,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | |||
1247 | priv_key->version = a->version; | 1247 | priv_key->version = a->version; |
1248 | 1248 | ||
1249 | buf_len = (size_t)BN_num_bytes(a->priv_key); | 1249 | buf_len = (size_t)BN_num_bytes(a->priv_key); |
1250 | buffer = OPENSSL_malloc(buf_len); | 1250 | buffer = malloc(buf_len); |
1251 | if (buffer == NULL) | 1251 | if (buffer == NULL) |
1252 | { | 1252 | { |
1253 | ECerr(EC_F_I2D_ECPRIVATEKEY, | 1253 | ECerr(EC_F_I2D_ECPRIVATEKEY, |
@@ -1292,7 +1292,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | |||
1292 | 1292 | ||
1293 | if (tmp_len > buf_len) | 1293 | if (tmp_len > buf_len) |
1294 | { | 1294 | { |
1295 | unsigned char *tmp_buffer = OPENSSL_realloc(buffer, tmp_len); | 1295 | unsigned char *tmp_buffer = realloc(buffer, tmp_len); |
1296 | if (!tmp_buffer) | 1296 | if (!tmp_buffer) |
1297 | { | 1297 | { |
1298 | ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE); | 1298 | ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE); |
@@ -1327,7 +1327,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | |||
1327 | ok=1; | 1327 | ok=1; |
1328 | err: | 1328 | err: |
1329 | if (buffer) | 1329 | if (buffer) |
1330 | OPENSSL_free(buffer); | 1330 | free(buffer); |
1331 | if (priv_key) | 1331 | if (priv_key) |
1332 | EC_PRIVATEKEY_free(priv_key); | 1332 | EC_PRIVATEKEY_free(priv_key); |
1333 | return(ok?ret:0); | 1333 | return(ok?ret:0); |
@@ -1424,7 +1424,7 @@ int i2o_ECPublicKey(EC_KEY *a, unsigned char **out) | |||
1424 | 1424 | ||
1425 | if (*out == NULL) | 1425 | if (*out == NULL) |
1426 | { | 1426 | { |
1427 | if ((*out = OPENSSL_malloc(buf_len)) == NULL) | 1427 | if ((*out = malloc(buf_len)) == NULL) |
1428 | { | 1428 | { |
1429 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE); | 1429 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE); |
1430 | return 0; | 1430 | return 0; |
@@ -1435,7 +1435,7 @@ int i2o_ECPublicKey(EC_KEY *a, unsigned char **out) | |||
1435 | *out, buf_len, NULL)) | 1435 | *out, buf_len, NULL)) |
1436 | { | 1436 | { |
1437 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB); | 1437 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB); |
1438 | OPENSSL_free(*out); | 1438 | free(*out); |
1439 | *out = NULL; | 1439 | *out = NULL; |
1440 | return 0; | 1440 | return 0; |
1441 | } | 1441 | } |
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index d528601036..4375514ef5 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
@@ -69,7 +69,7 @@ EC_KEY *EC_KEY_new(void) | |||
69 | { | 69 | { |
70 | EC_KEY *ret; | 70 | EC_KEY *ret; |
71 | 71 | ||
72 | ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY)); | 72 | ret=(EC_KEY *)malloc(sizeof(EC_KEY)); |
73 | if (ret == NULL) | 73 | if (ret == NULL) |
74 | { | 74 | { |
75 | ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE); | 75 | ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE); |
@@ -132,7 +132,7 @@ void EC_KEY_free(EC_KEY *r) | |||
132 | 132 | ||
133 | OPENSSL_cleanse((void *)r, sizeof(EC_KEY)); | 133 | OPENSSL_cleanse((void *)r, sizeof(EC_KEY)); |
134 | 134 | ||
135 | OPENSSL_free(r); | 135 | free(r); |
136 | } | 136 | } |
137 | 137 | ||
138 | EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) | 138 | EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index e2c4741b5b..546fd08e38 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -88,7 +88,7 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | |||
88 | return NULL; | 88 | return NULL; |
89 | } | 89 | } |
90 | 90 | ||
91 | ret = OPENSSL_malloc(sizeof *ret); | 91 | ret = malloc(sizeof *ret); |
92 | if (ret == NULL) | 92 | if (ret == NULL) |
93 | { | 93 | { |
94 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); | 94 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -112,7 +112,7 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | |||
112 | 112 | ||
113 | if (!meth->group_init(ret)) | 113 | if (!meth->group_init(ret)) |
114 | { | 114 | { |
115 | OPENSSL_free(ret); | 115 | free(ret); |
116 | return NULL; | 116 | return NULL; |
117 | } | 117 | } |
118 | 118 | ||
@@ -135,9 +135,9 @@ void EC_GROUP_free(EC_GROUP *group) | |||
135 | BN_free(&group->cofactor); | 135 | BN_free(&group->cofactor); |
136 | 136 | ||
137 | if (group->seed) | 137 | if (group->seed) |
138 | OPENSSL_free(group->seed); | 138 | free(group->seed); |
139 | 139 | ||
140 | OPENSSL_free(group); | 140 | free(group); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
@@ -160,11 +160,11 @@ void EC_GROUP_clear_free(EC_GROUP *group) | |||
160 | if (group->seed) | 160 | if (group->seed) |
161 | { | 161 | { |
162 | OPENSSL_cleanse(group->seed, group->seed_len); | 162 | OPENSSL_cleanse(group->seed, group->seed_len); |
163 | OPENSSL_free(group->seed); | 163 | free(group->seed); |
164 | } | 164 | } |
165 | 165 | ||
166 | OPENSSL_cleanse(group, sizeof *group); | 166 | OPENSSL_cleanse(group, sizeof *group); |
167 | OPENSSL_free(group); | 167 | free(group); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
@@ -226,8 +226,8 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
226 | if (src->seed) | 226 | if (src->seed) |
227 | { | 227 | { |
228 | if (dest->seed) | 228 | if (dest->seed) |
229 | OPENSSL_free(dest->seed); | 229 | free(dest->seed); |
230 | dest->seed = OPENSSL_malloc(src->seed_len); | 230 | dest->seed = malloc(src->seed_len); |
231 | if (dest->seed == NULL) | 231 | if (dest->seed == NULL) |
232 | return 0; | 232 | return 0; |
233 | if (!memcpy(dest->seed, src->seed, src->seed_len)) | 233 | if (!memcpy(dest->seed, src->seed, src->seed_len)) |
@@ -237,7 +237,7 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
237 | else | 237 | else |
238 | { | 238 | { |
239 | if (dest->seed) | 239 | if (dest->seed) |
240 | OPENSSL_free(dest->seed); | 240 | free(dest->seed); |
241 | dest->seed = NULL; | 241 | dest->seed = NULL; |
242 | dest->seed_len = 0; | 242 | dest->seed_len = 0; |
243 | } | 243 | } |
@@ -375,7 +375,7 @@ size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) | |||
375 | { | 375 | { |
376 | if (group->seed) | 376 | if (group->seed) |
377 | { | 377 | { |
378 | OPENSSL_free(group->seed); | 378 | free(group->seed); |
379 | group->seed = NULL; | 379 | group->seed = NULL; |
380 | group->seed_len = 0; | 380 | group->seed_len = 0; |
381 | } | 381 | } |
@@ -383,7 +383,7 @@ size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) | |||
383 | if (!len || !p) | 383 | if (!len || !p) |
384 | return 1; | 384 | return 1; |
385 | 385 | ||
386 | if ((group->seed = OPENSSL_malloc(len)) == NULL) | 386 | if ((group->seed = malloc(len)) == NULL) |
387 | return 0; | 387 | return 0; |
388 | memcpy(group->seed, p, len); | 388 | memcpy(group->seed, p, len); |
389 | group->seed_len = len; | 389 | group->seed_len = len; |
@@ -567,7 +567,7 @@ int EC_EX_DATA_set_data(EC_EXTRA_DATA **ex_data, void *data, | |||
567 | /* no explicit entry needed */ | 567 | /* no explicit entry needed */ |
568 | return 1; | 568 | return 1; |
569 | 569 | ||
570 | d = OPENSSL_malloc(sizeof *d); | 570 | d = malloc(sizeof *d); |
571 | if (d == NULL) | 571 | if (d == NULL) |
572 | return 0; | 572 | return 0; |
573 | 573 | ||
@@ -613,7 +613,7 @@ void EC_EX_DATA_free_data(EC_EXTRA_DATA **ex_data, | |||
613 | EC_EXTRA_DATA *next = (*p)->next; | 613 | EC_EXTRA_DATA *next = (*p)->next; |
614 | 614 | ||
615 | (*p)->free_func((*p)->data); | 615 | (*p)->free_func((*p)->data); |
616 | OPENSSL_free(*p); | 616 | free(*p); |
617 | 617 | ||
618 | *p = next; | 618 | *p = next; |
619 | return; | 619 | return; |
@@ -637,7 +637,7 @@ void EC_EX_DATA_clear_free_data(EC_EXTRA_DATA **ex_data, | |||
637 | EC_EXTRA_DATA *next = (*p)->next; | 637 | EC_EXTRA_DATA *next = (*p)->next; |
638 | 638 | ||
639 | (*p)->clear_free_func((*p)->data); | 639 | (*p)->clear_free_func((*p)->data); |
640 | OPENSSL_free(*p); | 640 | free(*p); |
641 | 641 | ||
642 | *p = next; | 642 | *p = next; |
643 | return; | 643 | return; |
@@ -659,7 +659,7 @@ void EC_EX_DATA_free_all_data(EC_EXTRA_DATA **ex_data) | |||
659 | EC_EXTRA_DATA *next = d->next; | 659 | EC_EXTRA_DATA *next = d->next; |
660 | 660 | ||
661 | d->free_func(d->data); | 661 | d->free_func(d->data); |
662 | OPENSSL_free(d); | 662 | free(d); |
663 | 663 | ||
664 | d = next; | 664 | d = next; |
665 | } | 665 | } |
@@ -680,7 +680,7 @@ void EC_EX_DATA_clear_free_all_data(EC_EXTRA_DATA **ex_data) | |||
680 | EC_EXTRA_DATA *next = d->next; | 680 | EC_EXTRA_DATA *next = d->next; |
681 | 681 | ||
682 | d->clear_free_func(d->data); | 682 | d->clear_free_func(d->data); |
683 | OPENSSL_free(d); | 683 | free(d); |
684 | 684 | ||
685 | d = next; | 685 | d = next; |
686 | } | 686 | } |
@@ -705,7 +705,7 @@ EC_POINT *EC_POINT_new(const EC_GROUP *group) | |||
705 | return NULL; | 705 | return NULL; |
706 | } | 706 | } |
707 | 707 | ||
708 | ret = OPENSSL_malloc(sizeof *ret); | 708 | ret = malloc(sizeof *ret); |
709 | if (ret == NULL) | 709 | if (ret == NULL) |
710 | { | 710 | { |
711 | ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); | 711 | ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); |
@@ -716,7 +716,7 @@ EC_POINT *EC_POINT_new(const EC_GROUP *group) | |||
716 | 716 | ||
717 | if (!ret->meth->point_init(ret)) | 717 | if (!ret->meth->point_init(ret)) |
718 | { | 718 | { |
719 | OPENSSL_free(ret); | 719 | free(ret); |
720 | return NULL; | 720 | return NULL; |
721 | } | 721 | } |
722 | 722 | ||
@@ -730,7 +730,7 @@ void EC_POINT_free(EC_POINT *point) | |||
730 | 730 | ||
731 | if (point->meth->point_finish != 0) | 731 | if (point->meth->point_finish != 0) |
732 | point->meth->point_finish(point); | 732 | point->meth->point_finish(point); |
733 | OPENSSL_free(point); | 733 | free(point); |
734 | } | 734 | } |
735 | 735 | ||
736 | 736 | ||
@@ -743,7 +743,7 @@ void EC_POINT_clear_free(EC_POINT *point) | |||
743 | else if (point->meth->point_finish != 0) | 743 | else if (point->meth->point_finish != 0) |
744 | point->meth->point_finish(point); | 744 | point->meth->point_finish(point); |
745 | OPENSSL_cleanse(point, sizeof *point); | 745 | OPENSSL_cleanse(point, sizeof *point); |
746 | OPENSSL_free(point); | 746 | free(point); |
747 | } | 747 | } |
748 | 748 | ||
749 | 749 | ||
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 19f21675fb..b48c888048 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
@@ -102,7 +102,7 @@ static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group) | |||
102 | if (!group) | 102 | if (!group) |
103 | return NULL; | 103 | return NULL; |
104 | 104 | ||
105 | ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP)); | 105 | ret = (EC_PRE_COMP *)malloc(sizeof(EC_PRE_COMP)); |
106 | if (!ret) | 106 | if (!ret) |
107 | { | 107 | { |
108 | ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 108 | ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -147,9 +147,9 @@ static void ec_pre_comp_free(void *pre_) | |||
147 | 147 | ||
148 | for (p = pre->points; *p != NULL; p++) | 148 | for (p = pre->points; *p != NULL; p++) |
149 | EC_POINT_free(*p); | 149 | EC_POINT_free(*p); |
150 | OPENSSL_free(pre->points); | 150 | free(pre->points); |
151 | } | 151 | } |
152 | OPENSSL_free(pre); | 152 | free(pre); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void ec_pre_comp_clear_free(void *pre_) | 155 | static void ec_pre_comp_clear_free(void *pre_) |
@@ -173,10 +173,10 @@ static void ec_pre_comp_clear_free(void *pre_) | |||
173 | EC_POINT_clear_free(*p); | 173 | EC_POINT_clear_free(*p); |
174 | OPENSSL_cleanse(p, sizeof *p); | 174 | OPENSSL_cleanse(p, sizeof *p); |
175 | } | 175 | } |
176 | OPENSSL_free(pre->points); | 176 | free(pre->points); |
177 | } | 177 | } |
178 | OPENSSL_cleanse(pre, sizeof *pre); | 178 | OPENSSL_cleanse(pre, sizeof *pre); |
179 | OPENSSL_free(pre); | 179 | free(pre); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
@@ -201,7 +201,7 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
201 | 201 | ||
202 | if (BN_is_zero(scalar)) | 202 | if (BN_is_zero(scalar)) |
203 | { | 203 | { |
204 | r = OPENSSL_malloc(1); | 204 | r = malloc(1); |
205 | if (!r) | 205 | if (!r) |
206 | { | 206 | { |
207 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE); | 207 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE); |
@@ -233,7 +233,7 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | len = BN_num_bits(scalar); | 235 | len = BN_num_bits(scalar); |
236 | r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation | 236 | r = malloc(len + 1); /* modified wNAF may be one digit longer than binary representation |
237 | * (*ret_len will be set to the actual length, i.e. at most | 237 | * (*ret_len will be set to the actual length, i.e. at most |
238 | * BN_num_bits(scalar) + 1) */ | 238 | * BN_num_bits(scalar) + 1) */ |
239 | if (r == NULL) | 239 | if (r == NULL) |
@@ -315,7 +315,7 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
315 | err: | 315 | err: |
316 | if (!ok) | 316 | if (!ok) |
317 | { | 317 | { |
318 | OPENSSL_free(r); | 318 | free(r); |
319 | r = NULL; | 319 | r = NULL; |
320 | } | 320 | } |
321 | if (ok) | 321 | if (ok) |
@@ -441,10 +441,10 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
441 | 441 | ||
442 | totalnum = num + numblocks; | 442 | totalnum = num + numblocks; |
443 | 443 | ||
444 | wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]); | 444 | wsize = malloc(totalnum * sizeof wsize[0]); |
445 | wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]); | 445 | wNAF_len = malloc(totalnum * sizeof wNAF_len[0]); |
446 | wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */ | 446 | wNAF = malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */ |
447 | val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]); | 447 | val_sub = malloc(totalnum * sizeof val_sub[0]); |
448 | 448 | ||
449 | if (!wsize || !wNAF_len || !wNAF || !val_sub) | 449 | if (!wsize || !wNAF_len || !wNAF || !val_sub) |
450 | { | 450 | { |
@@ -560,11 +560,11 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
560 | wNAF_len[i] = tmp_len; | 560 | wNAF_len[i] = tmp_len; |
561 | 561 | ||
562 | wNAF[i + 1] = NULL; | 562 | wNAF[i + 1] = NULL; |
563 | wNAF[i] = OPENSSL_malloc(wNAF_len[i]); | 563 | wNAF[i] = malloc(wNAF_len[i]); |
564 | if (wNAF[i] == NULL) | 564 | if (wNAF[i] == NULL) |
565 | { | 565 | { |
566 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); | 566 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); |
567 | OPENSSL_free(tmp_wNAF); | 567 | free(tmp_wNAF); |
568 | goto err; | 568 | goto err; |
569 | } | 569 | } |
570 | memcpy(wNAF[i], pp, wNAF_len[i]); | 570 | memcpy(wNAF[i], pp, wNAF_len[i]); |
@@ -574,14 +574,14 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
574 | if (*tmp_points == NULL) | 574 | if (*tmp_points == NULL) |
575 | { | 575 | { |
576 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); | 576 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); |
577 | OPENSSL_free(tmp_wNAF); | 577 | free(tmp_wNAF); |
578 | goto err; | 578 | goto err; |
579 | } | 579 | } |
580 | val_sub[i] = tmp_points; | 580 | val_sub[i] = tmp_points; |
581 | tmp_points += pre_points_per_block; | 581 | tmp_points += pre_points_per_block; |
582 | pp += blocksize; | 582 | pp += blocksize; |
583 | } | 583 | } |
584 | OPENSSL_free(tmp_wNAF); | 584 | free(tmp_wNAF); |
585 | } | 585 | } |
586 | } | 586 | } |
587 | } | 587 | } |
@@ -589,7 +589,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
589 | /* All points we precompute now go into a single array 'val'. | 589 | /* All points we precompute now go into a single array 'val'. |
590 | * 'val_sub[i]' is a pointer to the subarray for the i-th point, | 590 | * 'val_sub[i]' is a pointer to the subarray for the i-th point, |
591 | * or to a subarray of 'pre_comp->points' if we already have precomputation. */ | 591 | * or to a subarray of 'pre_comp->points' if we already have precomputation. */ |
592 | val = OPENSSL_malloc((num_val + 1) * sizeof val[0]); | 592 | val = malloc((num_val + 1) * sizeof val[0]); |
593 | if (val == NULL) | 593 | if (val == NULL) |
594 | { | 594 | { |
595 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); | 595 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); |
@@ -716,28 +716,28 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
716 | if (tmp != NULL) | 716 | if (tmp != NULL) |
717 | EC_POINT_free(tmp); | 717 | EC_POINT_free(tmp); |
718 | if (wsize != NULL) | 718 | if (wsize != NULL) |
719 | OPENSSL_free(wsize); | 719 | free(wsize); |
720 | if (wNAF_len != NULL) | 720 | if (wNAF_len != NULL) |
721 | OPENSSL_free(wNAF_len); | 721 | free(wNAF_len); |
722 | if (wNAF != NULL) | 722 | if (wNAF != NULL) |
723 | { | 723 | { |
724 | signed char **w; | 724 | signed char **w; |
725 | 725 | ||
726 | for (w = wNAF; *w != NULL; w++) | 726 | for (w = wNAF; *w != NULL; w++) |
727 | OPENSSL_free(*w); | 727 | free(*w); |
728 | 728 | ||
729 | OPENSSL_free(wNAF); | 729 | free(wNAF); |
730 | } | 730 | } |
731 | if (val != NULL) | 731 | if (val != NULL) |
732 | { | 732 | { |
733 | for (v = val; *v != NULL; v++) | 733 | for (v = val; *v != NULL; v++) |
734 | EC_POINT_clear_free(*v); | 734 | EC_POINT_clear_free(*v); |
735 | 735 | ||
736 | OPENSSL_free(val); | 736 | free(val); |
737 | } | 737 | } |
738 | if (val_sub != NULL) | 738 | if (val_sub != NULL) |
739 | { | 739 | { |
740 | OPENSSL_free(val_sub); | 740 | free(val_sub); |
741 | } | 741 | } |
742 | return ret; | 742 | return ret; |
743 | } | 743 | } |
@@ -825,7 +825,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) | |||
825 | pre_points_per_block = (size_t)1 << (w - 1); | 825 | pre_points_per_block = (size_t)1 << (w - 1); |
826 | num = pre_points_per_block * numblocks; /* number of points to compute and store */ | 826 | num = pre_points_per_block * numblocks; /* number of points to compute and store */ |
827 | 827 | ||
828 | points = OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1)); | 828 | points = malloc(sizeof (EC_POINT*)*(num + 1)); |
829 | if (!points) | 829 | if (!points) |
830 | { | 830 | { |
831 | ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); | 831 | ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); |
@@ -921,7 +921,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) | |||
921 | 921 | ||
922 | for (p = points; *p != NULL; p++) | 922 | for (p = points; *p != NULL; p++) |
923 | EC_POINT_free(*p); | 923 | EC_POINT_free(*p); |
924 | OPENSSL_free(points); | 924 | free(points); |
925 | } | 925 | } |
926 | if (tmp_point) | 926 | if (tmp_point) |
927 | EC_POINT_free(tmp_point); | 927 | EC_POINT_free(tmp_point); |
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c index 66ee397d86..dfc8ace27b 100644 --- a/src/lib/libcrypto/ec/ec_pmeth.c +++ b/src/lib/libcrypto/ec/ec_pmeth.c | |||
@@ -77,7 +77,7 @@ typedef struct | |||
77 | static int pkey_ec_init(EVP_PKEY_CTX *ctx) | 77 | static int pkey_ec_init(EVP_PKEY_CTX *ctx) |
78 | { | 78 | { |
79 | EC_PKEY_CTX *dctx; | 79 | EC_PKEY_CTX *dctx; |
80 | dctx = OPENSSL_malloc(sizeof(EC_PKEY_CTX)); | 80 | dctx = malloc(sizeof(EC_PKEY_CTX)); |
81 | if (!dctx) | 81 | if (!dctx) |
82 | return 0; | 82 | return 0; |
83 | dctx->gen_group = NULL; | 83 | dctx->gen_group = NULL; |
@@ -112,7 +112,7 @@ static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx) | |||
112 | { | 112 | { |
113 | if (dctx->gen_group) | 113 | if (dctx->gen_group) |
114 | EC_GROUP_free(dctx->gen_group); | 114 | EC_GROUP_free(dctx->gen_group); |
115 | OPENSSL_free(dctx); | 115 | free(dctx); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
diff --git a/src/lib/libcrypto/ec/ec_print.c b/src/lib/libcrypto/ec/ec_print.c index f7c8a303ac..1655332c3c 100644 --- a/src/lib/libcrypto/ec/ec_print.c +++ b/src/lib/libcrypto/ec/ec_print.c | |||
@@ -70,18 +70,18 @@ BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, | |||
70 | if (buf_len == 0) | 70 | if (buf_len == 0) |
71 | return NULL; | 71 | return NULL; |
72 | 72 | ||
73 | if ((buf = OPENSSL_malloc(buf_len)) == NULL) | 73 | if ((buf = malloc(buf_len)) == NULL) |
74 | return NULL; | 74 | return NULL; |
75 | 75 | ||
76 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) | 76 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) |
77 | { | 77 | { |
78 | OPENSSL_free(buf); | 78 | free(buf); |
79 | return NULL; | 79 | return NULL; |
80 | } | 80 | } |
81 | 81 | ||
82 | ret = BN_bin2bn(buf, buf_len, ret); | 82 | ret = BN_bin2bn(buf, buf_len, ret); |
83 | 83 | ||
84 | OPENSSL_free(buf); | 84 | free(buf); |
85 | 85 | ||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
@@ -96,13 +96,13 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, | |||
96 | EC_POINT *ret; | 96 | EC_POINT *ret; |
97 | 97 | ||
98 | if ((buf_len = BN_num_bytes(bn)) == 0) return NULL; | 98 | if ((buf_len = BN_num_bytes(bn)) == 0) return NULL; |
99 | buf = OPENSSL_malloc(buf_len); | 99 | buf = malloc(buf_len); |
100 | if (buf == NULL) | 100 | if (buf == NULL) |
101 | return NULL; | 101 | return NULL; |
102 | 102 | ||
103 | if (!BN_bn2bin(bn, buf)) | 103 | if (!BN_bn2bin(bn, buf)) |
104 | { | 104 | { |
105 | OPENSSL_free(buf); | 105 | free(buf); |
106 | return NULL; | 106 | return NULL; |
107 | } | 107 | } |
108 | 108 | ||
@@ -110,7 +110,7 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, | |||
110 | { | 110 | { |
111 | if ((ret = EC_POINT_new(group)) == NULL) | 111 | if ((ret = EC_POINT_new(group)) == NULL) |
112 | { | 112 | { |
113 | OPENSSL_free(buf); | 113 | free(buf); |
114 | return NULL; | 114 | return NULL; |
115 | } | 115 | } |
116 | } | 116 | } |
@@ -121,17 +121,17 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, | |||
121 | { | 121 | { |
122 | if (point == NULL) | 122 | if (point == NULL) |
123 | EC_POINT_clear_free(ret); | 123 | EC_POINT_clear_free(ret); |
124 | OPENSSL_free(buf); | 124 | free(buf); |
125 | return NULL; | 125 | return NULL; |
126 | } | 126 | } |
127 | 127 | ||
128 | OPENSSL_free(buf); | 128 | free(buf); |
129 | return ret; | 129 | return ret; |
130 | } | 130 | } |
131 | 131 | ||
132 | static const char *HEX_DIGITS = "0123456789ABCDEF"; | 132 | static const char *HEX_DIGITS = "0123456789ABCDEF"; |
133 | 133 | ||
134 | /* the return value must be freed (using OPENSSL_free()) */ | 134 | /* the return value must be freed (using free()) */ |
135 | char *EC_POINT_point2hex(const EC_GROUP *group, | 135 | char *EC_POINT_point2hex(const EC_GROUP *group, |
136 | const EC_POINT *point, | 136 | const EC_POINT *point, |
137 | point_conversion_form_t form, | 137 | point_conversion_form_t form, |
@@ -146,19 +146,19 @@ char *EC_POINT_point2hex(const EC_GROUP *group, | |||
146 | if (buf_len == 0) | 146 | if (buf_len == 0) |
147 | return NULL; | 147 | return NULL; |
148 | 148 | ||
149 | if ((buf = OPENSSL_malloc(buf_len)) == NULL) | 149 | if ((buf = malloc(buf_len)) == NULL) |
150 | return NULL; | 150 | return NULL; |
151 | 151 | ||
152 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) | 152 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) |
153 | { | 153 | { |
154 | OPENSSL_free(buf); | 154 | free(buf); |
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | ret = (char *)OPENSSL_malloc(buf_len*2+2); | 158 | ret = (char *)malloc(buf_len*2+2); |
159 | if (ret == NULL) | 159 | if (ret == NULL) |
160 | { | 160 | { |
161 | OPENSSL_free(buf); | 161 | free(buf); |
162 | return NULL; | 162 | return NULL; |
163 | } | 163 | } |
164 | p = ret; | 164 | p = ret; |
@@ -171,7 +171,7 @@ char *EC_POINT_point2hex(const EC_GROUP *group, | |||
171 | } | 171 | } |
172 | *p='\0'; | 172 | *p='\0'; |
173 | 173 | ||
174 | OPENSSL_free(buf); | 174 | free(buf); |
175 | 175 | ||
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
diff --git a/src/lib/libcrypto/ec/eck_prn.c b/src/lib/libcrypto/ec/eck_prn.c index 06de8f3959..4e8c748bbc 100644 --- a/src/lib/libcrypto/ec/eck_prn.c +++ b/src/lib/libcrypto/ec/eck_prn.c | |||
@@ -263,7 +263,7 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | |||
263 | seed_len = EC_GROUP_get_seed_len(x); | 263 | seed_len = EC_GROUP_get_seed_len(x); |
264 | 264 | ||
265 | buf_len += 10; | 265 | buf_len += 10; |
266 | if ((buffer = OPENSSL_malloc(buf_len)) == NULL) | 266 | if ((buffer = malloc(buf_len)) == NULL) |
267 | { | 267 | { |
268 | reason = ERR_R_MALLOC_FAILURE; | 268 | reason = ERR_R_MALLOC_FAILURE; |
269 | goto err; | 269 | goto err; |
@@ -349,7 +349,7 @@ err: | |||
349 | if (ctx) | 349 | if (ctx) |
350 | BN_CTX_free(ctx); | 350 | BN_CTX_free(ctx); |
351 | if (buffer != NULL) | 351 | if (buffer != NULL) |
352 | OPENSSL_free(buffer); | 352 | free(buffer); |
353 | return(ret); | 353 | return(ret); |
354 | } | 354 | } |
355 | 355 | ||
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c index b5ff56c252..03f2d9c1d7 100644 --- a/src/lib/libcrypto/ec/ecp_nistp224.c +++ b/src/lib/libcrypto/ec/ecp_nistp224.c | |||
@@ -1148,7 +1148,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out, | |||
1148 | static NISTP224_PRE_COMP *nistp224_pre_comp_new() | 1148 | static NISTP224_PRE_COMP *nistp224_pre_comp_new() |
1149 | { | 1149 | { |
1150 | NISTP224_PRE_COMP *ret = NULL; | 1150 | NISTP224_PRE_COMP *ret = NULL; |
1151 | ret = (NISTP224_PRE_COMP *) OPENSSL_malloc(sizeof *ret); | 1151 | ret = (NISTP224_PRE_COMP *) malloc(sizeof *ret); |
1152 | if (!ret) | 1152 | if (!ret) |
1153 | { | 1153 | { |
1154 | ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 1154 | ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -1181,7 +1181,7 @@ static void nistp224_pre_comp_free(void *pre_) | |||
1181 | if (i > 0) | 1181 | if (i > 0) |
1182 | return; | 1182 | return; |
1183 | 1183 | ||
1184 | OPENSSL_free(pre); | 1184 | free(pre); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | static void nistp224_pre_comp_clear_free(void *pre_) | 1187 | static void nistp224_pre_comp_clear_free(void *pre_) |
@@ -1197,7 +1197,7 @@ static void nistp224_pre_comp_clear_free(void *pre_) | |||
1197 | return; | 1197 | return; |
1198 | 1198 | ||
1199 | OPENSSL_cleanse(pre, sizeof *pre); | 1199 | OPENSSL_cleanse(pre, sizeof *pre); |
1200 | OPENSSL_free(pre); | 1200 | free(pre); |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | /******************************************************************************/ | 1203 | /******************************************************************************/ |
@@ -1382,10 +1382,10 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
1382 | * converting those into affine form is time well spent */ | 1382 | * converting those into affine form is time well spent */ |
1383 | mixed = 1; | 1383 | mixed = 1; |
1384 | } | 1384 | } |
1385 | secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); | 1385 | secrets = malloc(num_points * sizeof(felem_bytearray)); |
1386 | pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem)); | 1386 | pre_comp = malloc(num_points * 17 * 3 * sizeof(felem)); |
1387 | if (mixed) | 1387 | if (mixed) |
1388 | tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem)); | 1388 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); |
1389 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) | 1389 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) |
1390 | { | 1390 | { |
1391 | ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE); | 1391 | ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE); |
@@ -1506,11 +1506,11 @@ err: | |||
1506 | if (new_ctx != NULL) | 1506 | if (new_ctx != NULL) |
1507 | BN_CTX_free(new_ctx); | 1507 | BN_CTX_free(new_ctx); |
1508 | if (secrets != NULL) | 1508 | if (secrets != NULL) |
1509 | OPENSSL_free(secrets); | 1509 | free(secrets); |
1510 | if (pre_comp != NULL) | 1510 | if (pre_comp != NULL) |
1511 | OPENSSL_free(pre_comp); | 1511 | free(pre_comp); |
1512 | if (tmp_felems != NULL) | 1512 | if (tmp_felems != NULL) |
1513 | OPENSSL_free(tmp_felems); | 1513 | free(tmp_felems); |
1514 | return ret; | 1514 | return ret; |
1515 | } | 1515 | } |
1516 | 1516 | ||
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index 4bc0f5dce0..947fb7eee0 100644 --- a/src/lib/libcrypto/ec/ecp_nistp256.c +++ b/src/lib/libcrypto/ec/ecp_nistp256.c | |||
@@ -1666,7 +1666,7 @@ const EC_METHOD *EC_GFp_nistp256_method(void) | |||
1666 | static NISTP256_PRE_COMP *nistp256_pre_comp_new() | 1666 | static NISTP256_PRE_COMP *nistp256_pre_comp_new() |
1667 | { | 1667 | { |
1668 | NISTP256_PRE_COMP *ret = NULL; | 1668 | NISTP256_PRE_COMP *ret = NULL; |
1669 | ret = (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret); | 1669 | ret = (NISTP256_PRE_COMP *) malloc(sizeof *ret); |
1670 | if (!ret) | 1670 | if (!ret) |
1671 | { | 1671 | { |
1672 | ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 1672 | ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -1699,7 +1699,7 @@ static void nistp256_pre_comp_free(void *pre_) | |||
1699 | if (i > 0) | 1699 | if (i > 0) |
1700 | return; | 1700 | return; |
1701 | 1701 | ||
1702 | OPENSSL_free(pre); | 1702 | free(pre); |
1703 | } | 1703 | } |
1704 | 1704 | ||
1705 | static void nistp256_pre_comp_clear_free(void *pre_) | 1705 | static void nistp256_pre_comp_clear_free(void *pre_) |
@@ -1715,7 +1715,7 @@ static void nistp256_pre_comp_clear_free(void *pre_) | |||
1715 | return; | 1715 | return; |
1716 | 1716 | ||
1717 | OPENSSL_cleanse(pre, sizeof *pre); | 1717 | OPENSSL_cleanse(pre, sizeof *pre); |
1718 | OPENSSL_free(pre); | 1718 | free(pre); |
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | /******************************************************************************/ | 1721 | /******************************************************************************/ |
@@ -1901,10 +1901,10 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
1901 | * converting those into affine form is time well spent */ | 1901 | * converting those into affine form is time well spent */ |
1902 | mixed = 1; | 1902 | mixed = 1; |
1903 | } | 1903 | } |
1904 | secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); | 1904 | secrets = malloc(num_points * sizeof(felem_bytearray)); |
1905 | pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem)); | 1905 | pre_comp = malloc(num_points * 17 * 3 * sizeof(smallfelem)); |
1906 | if (mixed) | 1906 | if (mixed) |
1907 | tmp_smallfelems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(smallfelem)); | 1907 | tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem)); |
1908 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) | 1908 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) |
1909 | { | 1909 | { |
1910 | ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE); | 1910 | ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE); |
@@ -2026,11 +2026,11 @@ err: | |||
2026 | if (new_ctx != NULL) | 2026 | if (new_ctx != NULL) |
2027 | BN_CTX_free(new_ctx); | 2027 | BN_CTX_free(new_ctx); |
2028 | if (secrets != NULL) | 2028 | if (secrets != NULL) |
2029 | OPENSSL_free(secrets); | 2029 | free(secrets); |
2030 | if (pre_comp != NULL) | 2030 | if (pre_comp != NULL) |
2031 | OPENSSL_free(pre_comp); | 2031 | free(pre_comp); |
2032 | if (tmp_smallfelems != NULL) | 2032 | if (tmp_smallfelems != NULL) |
2033 | OPENSSL_free(tmp_smallfelems); | 2033 | free(tmp_smallfelems); |
2034 | return ret; | 2034 | return ret; |
2035 | } | 2035 | } |
2036 | 2036 | ||
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c index 178b655f7f..24eb032951 100644 --- a/src/lib/libcrypto/ec/ecp_nistp521.c +++ b/src/lib/libcrypto/ec/ecp_nistp521.c | |||
@@ -1533,7 +1533,7 @@ const EC_METHOD *EC_GFp_nistp521_method(void) | |||
1533 | static NISTP521_PRE_COMP *nistp521_pre_comp_new() | 1533 | static NISTP521_PRE_COMP *nistp521_pre_comp_new() |
1534 | { | 1534 | { |
1535 | NISTP521_PRE_COMP *ret = NULL; | 1535 | NISTP521_PRE_COMP *ret = NULL; |
1536 | ret = (NISTP521_PRE_COMP *)OPENSSL_malloc(sizeof(NISTP521_PRE_COMP)); | 1536 | ret = (NISTP521_PRE_COMP *)malloc(sizeof(NISTP521_PRE_COMP)); |
1537 | if (!ret) | 1537 | if (!ret) |
1538 | { | 1538 | { |
1539 | ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 1539 | ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -1566,7 +1566,7 @@ static void nistp521_pre_comp_free(void *pre_) | |||
1566 | if (i > 0) | 1566 | if (i > 0) |
1567 | return; | 1567 | return; |
1568 | 1568 | ||
1569 | OPENSSL_free(pre); | 1569 | free(pre); |
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | static void nistp521_pre_comp_clear_free(void *pre_) | 1572 | static void nistp521_pre_comp_clear_free(void *pre_) |
@@ -1582,7 +1582,7 @@ static void nistp521_pre_comp_clear_free(void *pre_) | |||
1582 | return; | 1582 | return; |
1583 | 1583 | ||
1584 | OPENSSL_cleanse(pre, sizeof(*pre)); | 1584 | OPENSSL_cleanse(pre, sizeof(*pre)); |
1585 | OPENSSL_free(pre); | 1585 | free(pre); |
1586 | } | 1586 | } |
1587 | 1587 | ||
1588 | /******************************************************************************/ | 1588 | /******************************************************************************/ |
@@ -1766,10 +1766,10 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
1766 | * converting those into affine form is time well spent */ | 1766 | * converting those into affine form is time well spent */ |
1767 | mixed = 1; | 1767 | mixed = 1; |
1768 | } | 1768 | } |
1769 | secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); | 1769 | secrets = malloc(num_points * sizeof(felem_bytearray)); |
1770 | pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem)); | 1770 | pre_comp = malloc(num_points * 17 * 3 * sizeof(felem)); |
1771 | if (mixed) | 1771 | if (mixed) |
1772 | tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem)); | 1772 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); |
1773 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) | 1773 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) |
1774 | { | 1774 | { |
1775 | ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE); | 1775 | ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE); |
@@ -1891,11 +1891,11 @@ err: | |||
1891 | if (new_ctx != NULL) | 1891 | if (new_ctx != NULL) |
1892 | BN_CTX_free(new_ctx); | 1892 | BN_CTX_free(new_ctx); |
1893 | if (secrets != NULL) | 1893 | if (secrets != NULL) |
1894 | OPENSSL_free(secrets); | 1894 | free(secrets); |
1895 | if (pre_comp != NULL) | 1895 | if (pre_comp != NULL) |
1896 | OPENSSL_free(pre_comp); | 1896 | free(pre_comp); |
1897 | if (tmp_felems != NULL) | 1897 | if (tmp_felems != NULL) |
1898 | OPENSSL_free(tmp_felems); | 1898 | free(tmp_felems); |
1899 | return ret; | 1899 | return ret; |
1900 | } | 1900 | } |
1901 | 1901 | ||
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index bf0ad998dd..a146752817 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
@@ -1205,7 +1205,7 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT | |||
1205 | * We need twice that. */ | 1205 | * We need twice that. */ |
1206 | pow2 <<= 1; | 1206 | pow2 <<= 1; |
1207 | 1207 | ||
1208 | heap = OPENSSL_malloc(pow2 * sizeof heap[0]); | 1208 | heap = malloc(pow2 * sizeof heap[0]); |
1209 | if (heap == NULL) goto err; | 1209 | if (heap == NULL) goto err; |
1210 | 1210 | ||
1211 | /* The array is used as a binary tree, exactly as in heapsort: | 1211 | /* The array is used as a binary tree, exactly as in heapsort: |
@@ -1333,7 +1333,7 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT | |||
1333 | if (heap[i] != NULL) | 1333 | if (heap[i] != NULL) |
1334 | BN_clear_free(heap[i]); | 1334 | BN_clear_free(heap[i]); |
1335 | } | 1335 | } |
1336 | OPENSSL_free(heap); | 1336 | free(heap); |
1337 | } | 1337 | } |
1338 | return ret; | 1338 | return ret; |
1339 | } | 1339 | } |
diff --git a/src/lib/libcrypto/ecdh/ech_lib.c b/src/lib/libcrypto/ecdh/ech_lib.c index ddf226b166..51fb7d6afb 100644 --- a/src/lib/libcrypto/ecdh/ech_lib.c +++ b/src/lib/libcrypto/ecdh/ech_lib.c | |||
@@ -129,7 +129,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine) | |||
129 | { | 129 | { |
130 | ECDH_DATA *ret; | 130 | ECDH_DATA *ret; |
131 | 131 | ||
132 | ret=(ECDH_DATA *)OPENSSL_malloc(sizeof(ECDH_DATA)); | 132 | ret=(ECDH_DATA *)malloc(sizeof(ECDH_DATA)); |
133 | if (ret == NULL) | 133 | if (ret == NULL) |
134 | { | 134 | { |
135 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 135 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); |
@@ -150,7 +150,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine) | |||
150 | { | 150 | { |
151 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); | 151 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); |
152 | ENGINE_finish(ret->engine); | 152 | ENGINE_finish(ret->engine); |
153 | OPENSSL_free(ret); | 153 | free(ret); |
154 | return NULL; | 154 | return NULL; |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -162,7 +162,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine) | |||
162 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | 162 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) |
163 | { | 163 | { |
164 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data); | 164 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data); |
165 | OPENSSL_free(ret); | 165 | free(ret); |
166 | ret=NULL; | 166 | ret=NULL; |
167 | } | 167 | } |
168 | #endif | 168 | #endif |
@@ -198,7 +198,7 @@ void ecdh_data_free(void *data) | |||
198 | 198 | ||
199 | OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA)); | 199 | OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA)); |
200 | 200 | ||
201 | OPENSSL_free(r); | 201 | free(r); |
202 | } | 202 | } |
203 | 203 | ||
204 | ECDH_DATA *ecdh_check(EC_KEY *key) | 204 | ECDH_DATA *ecdh_check(EC_KEY *key) |
diff --git a/src/lib/libcrypto/ecdh/ech_ossl.c b/src/lib/libcrypto/ecdh/ech_ossl.c index 4a30628fbc..a63eb4922d 100644 --- a/src/lib/libcrypto/ecdh/ech_ossl.c +++ b/src/lib/libcrypto/ecdh/ech_ossl.c | |||
@@ -175,7 +175,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | |||
175 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR); | 175 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR); |
176 | goto err; | 176 | goto err; |
177 | } | 177 | } |
178 | if ((buf = OPENSSL_malloc(buflen)) == NULL) | 178 | if ((buf = malloc(buflen)) == NULL) |
179 | { | 179 | { |
180 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); | 180 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); |
181 | goto err; | 181 | goto err; |
@@ -210,6 +210,6 @@ err: | |||
210 | if (tmp) EC_POINT_free(tmp); | 210 | if (tmp) EC_POINT_free(tmp); |
211 | if (ctx) BN_CTX_end(ctx); | 211 | if (ctx) BN_CTX_end(ctx); |
212 | if (ctx) BN_CTX_free(ctx); | 212 | if (ctx) BN_CTX_free(ctx); |
213 | if (buf) OPENSSL_free(buf); | 213 | if (buf) free(buf); |
214 | return(ret); | 214 | return(ret); |
215 | } | 215 | } |
diff --git a/src/lib/libcrypto/ecdsa/ecs_lib.c b/src/lib/libcrypto/ecdsa/ecs_lib.c index 7b53969ffd..81842a11a6 100644 --- a/src/lib/libcrypto/ecdsa/ecs_lib.c +++ b/src/lib/libcrypto/ecdsa/ecs_lib.c | |||
@@ -108,7 +108,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine) | |||
108 | { | 108 | { |
109 | ECDSA_DATA *ret; | 109 | ECDSA_DATA *ret; |
110 | 110 | ||
111 | ret=(ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA)); | 111 | ret=(ECDSA_DATA *)malloc(sizeof(ECDSA_DATA)); |
112 | if (ret == NULL) | 112 | if (ret == NULL) |
113 | { | 113 | { |
114 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 114 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); |
@@ -129,7 +129,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine) | |||
129 | { | 129 | { |
130 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); | 130 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); |
131 | ENGINE_finish(ret->engine); | 131 | ENGINE_finish(ret->engine); |
132 | OPENSSL_free(ret); | 132 | free(ret); |
133 | return NULL; | 133 | return NULL; |
134 | } | 134 | } |
135 | } | 135 | } |
@@ -141,7 +141,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine) | |||
141 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | 141 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) |
142 | { | 142 | { |
143 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data); | 143 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data); |
144 | OPENSSL_free(ret); | 144 | free(ret); |
145 | ret=NULL; | 145 | ret=NULL; |
146 | } | 146 | } |
147 | #endif | 147 | #endif |
@@ -176,7 +176,7 @@ static void ecdsa_data_free(void *data) | |||
176 | 176 | ||
177 | OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA)); | 177 | OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA)); |
178 | 178 | ||
179 | OPENSSL_free(r); | 179 | free(r); |
180 | } | 180 | } |
181 | 181 | ||
182 | ECDSA_DATA *ecdsa_check(EC_KEY *key) | 182 | ECDSA_DATA *ecdsa_check(EC_KEY *key) |
diff --git a/src/lib/libcrypto/engine/eng_dyn.c b/src/lib/libcrypto/engine/eng_dyn.c index 807da7a5eb..7878bd802e 100644 --- a/src/lib/libcrypto/engine/eng_dyn.c +++ b/src/lib/libcrypto/engine/eng_dyn.c | |||
@@ -153,7 +153,7 @@ struct st_dynamic_data_ctx | |||
153 | * structure. */ | 153 | * structure. */ |
154 | static int dynamic_ex_data_idx = -1; | 154 | static int dynamic_ex_data_idx = -1; |
155 | 155 | ||
156 | static void int_free_str(char *s) { OPENSSL_free(s); } | 156 | static void int_free_str(char *s) { free(s); } |
157 | /* Because our ex_data element may or may not get allocated depending on whether | 157 | /* Because our ex_data element may or may not get allocated depending on whether |
158 | * a "first-use" occurs before the ENGINE is freed, we have a memory leak | 158 | * a "first-use" occurs before the ENGINE is freed, we have a memory leak |
159 | * problem to solve. We can't declare a "new" handler for the ex_data as we | 159 | * problem to solve. We can't declare a "new" handler for the ex_data as we |
@@ -170,12 +170,12 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
170 | if(ctx->dynamic_dso) | 170 | if(ctx->dynamic_dso) |
171 | DSO_free(ctx->dynamic_dso); | 171 | DSO_free(ctx->dynamic_dso); |
172 | if(ctx->DYNAMIC_LIBNAME) | 172 | if(ctx->DYNAMIC_LIBNAME) |
173 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); | 173 | free((void*)ctx->DYNAMIC_LIBNAME); |
174 | if(ctx->engine_id) | 174 | if(ctx->engine_id) |
175 | OPENSSL_free((void*)ctx->engine_id); | 175 | free((void*)ctx->engine_id); |
176 | if(ctx->dirs) | 176 | if(ctx->dirs) |
177 | sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); | 177 | sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); |
178 | OPENSSL_free(ctx); | 178 | free(ctx); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
@@ -186,7 +186,7 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
186 | static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | 186 | static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) |
187 | { | 187 | { |
188 | dynamic_data_ctx *c; | 188 | dynamic_data_ctx *c; |
189 | c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); | 189 | c = malloc(sizeof(dynamic_data_ctx)); |
190 | if(!c) | 190 | if(!c) |
191 | { | 191 | { |
192 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 192 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
@@ -207,7 +207,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
207 | if(!c->dirs) | 207 | if(!c->dirs) |
208 | { | 208 | { |
209 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 209 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
210 | OPENSSL_free(c); | 210 | free(c); |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 213 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
@@ -223,7 +223,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
223 | /* If we lost the race to set the context, c is non-NULL and *ctx is the | 223 | /* If we lost the race to set the context, c is non-NULL and *ctx is the |
224 | * context of the thread that won. */ | 224 | * context of the thread that won. */ |
225 | if(c) | 225 | if(c) |
226 | OPENSSL_free(c); | 226 | free(c); |
227 | return 1; | 227 | return 1; |
228 | } | 228 | } |
229 | 229 | ||
@@ -337,7 +337,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) | |||
337 | if(p && (strlen((const char *)p) < 1)) | 337 | if(p && (strlen((const char *)p) < 1)) |
338 | p = NULL; | 338 | p = NULL; |
339 | if(ctx->DYNAMIC_LIBNAME) | 339 | if(ctx->DYNAMIC_LIBNAME) |
340 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); | 340 | free((void*)ctx->DYNAMIC_LIBNAME); |
341 | if(p) | 341 | if(p) |
342 | ctx->DYNAMIC_LIBNAME = BUF_strdup(p); | 342 | ctx->DYNAMIC_LIBNAME = BUF_strdup(p); |
343 | else | 343 | else |
@@ -351,7 +351,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) | |||
351 | if(p && (strlen((const char *)p) < 1)) | 351 | if(p && (strlen((const char *)p) < 1)) |
352 | p = NULL; | 352 | p = NULL; |
353 | if(ctx->engine_id) | 353 | if(ctx->engine_id) |
354 | OPENSSL_free((void*)ctx->engine_id); | 354 | free((void*)ctx->engine_id); |
355 | if(p) | 355 | if(p) |
356 | ctx->engine_id = BUF_strdup(p); | 356 | ctx->engine_id = BUF_strdup(p); |
357 | else | 357 | else |
@@ -422,10 +422,10 @@ static int int_load(dynamic_data_ctx *ctx) | |||
422 | if(DSO_load(ctx->dynamic_dso, merge, NULL, 0)) | 422 | if(DSO_load(ctx->dynamic_dso, merge, NULL, 0)) |
423 | { | 423 | { |
424 | /* Found what we're looking for */ | 424 | /* Found what we're looking for */ |
425 | OPENSSL_free(merge); | 425 | free(merge); |
426 | return 1; | 426 | return 1; |
427 | } | 427 | } |
428 | OPENSSL_free(merge); | 428 | free(merge); |
429 | } | 429 | } |
430 | return 0; | 430 | return 0; |
431 | } | 431 | } |
diff --git a/src/lib/libcrypto/engine/eng_lib.c b/src/lib/libcrypto/engine/eng_lib.c index 18a6664645..126bc02296 100644 --- a/src/lib/libcrypto/engine/eng_lib.c +++ b/src/lib/libcrypto/engine/eng_lib.c | |||
@@ -65,7 +65,7 @@ ENGINE *ENGINE_new(void) | |||
65 | { | 65 | { |
66 | ENGINE *ret; | 66 | ENGINE *ret; |
67 | 67 | ||
68 | ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE)); | 68 | ret = (ENGINE *)malloc(sizeof(ENGINE)); |
69 | if(ret == NULL) | 69 | if(ret == NULL) |
70 | { | 70 | { |
71 | ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE); | 71 | ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE); |
@@ -133,7 +133,7 @@ int engine_free_util(ENGINE *e, int locked) | |||
133 | if(e->destroy) | 133 | if(e->destroy) |
134 | e->destroy(e); | 134 | e->destroy(e); |
135 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); | 135 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); |
136 | OPENSSL_free(e); | 136 | free(e); |
137 | return 1; | 137 | return 1; |
138 | } | 138 | } |
139 | 139 | ||
@@ -158,7 +158,7 @@ static int int_cleanup_check(int create) | |||
158 | } | 158 | } |
159 | static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) | 159 | static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) |
160 | { | 160 | { |
161 | ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof( | 161 | ENGINE_CLEANUP_ITEM *item = malloc(sizeof( |
162 | ENGINE_CLEANUP_ITEM)); | 162 | ENGINE_CLEANUP_ITEM)); |
163 | if(!item) return NULL; | 163 | if(!item) return NULL; |
164 | item->cb = cb; | 164 | item->cb = cb; |
@@ -184,7 +184,7 @@ void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) | |||
184 | static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) | 184 | static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) |
185 | { | 185 | { |
186 | (*(item->cb))(); | 186 | (*(item->cb))(); |
187 | OPENSSL_free(item); | 187 | free(item); |
188 | } | 188 | } |
189 | void ENGINE_cleanup(void) | 189 | void ENGINE_cleanup(void) |
190 | { | 190 | { |
diff --git a/src/lib/libcrypto/engine/eng_rsax.c b/src/lib/libcrypto/engine/eng_rsax.c index 96e63477ee..fa9159499d 100644 --- a/src/lib/libcrypto/engine/eng_rsax.c +++ b/src/lib/libcrypto/engine/eng_rsax.c | |||
@@ -282,7 +282,7 @@ static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m) | |||
282 | 282 | ||
283 | hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); | 283 | hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); |
284 | if (!hptr) { | 284 | if (!hptr) { |
285 | hptr = OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX)); | 285 | hptr = malloc(3*sizeof(E_RSAX_MOD_CTX)); |
286 | if (!hptr) return NULL; | 286 | if (!hptr) return NULL; |
287 | hptr[2].type = hptr[1].type= hptr[0].type = 0; | 287 | hptr[2].type = hptr[1].type= hptr[0].type = 0; |
288 | RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr); | 288 | RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr); |
@@ -307,7 +307,7 @@ static int e_rsax_rsa_finish(RSA *rsa) | |||
307 | E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); | 307 | E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); |
308 | if(hptr) | 308 | if(hptr) |
309 | { | 309 | { |
310 | OPENSSL_free(hptr); | 310 | free(hptr); |
311 | RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); | 311 | RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); |
312 | } | 312 | } |
313 | if (rsa->_method_mod_n) | 313 | if (rsa->_method_mod_n) |
diff --git a/src/lib/libcrypto/engine/eng_table.c b/src/lib/libcrypto/engine/eng_table.c index 4fde948185..b7e77f7625 100644 --- a/src/lib/libcrypto/engine/eng_table.c +++ b/src/lib/libcrypto/engine/eng_table.c | |||
@@ -146,14 +146,14 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, | |||
146 | fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); | 146 | fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); |
147 | if(!fnd) | 147 | if(!fnd) |
148 | { | 148 | { |
149 | fnd = OPENSSL_malloc(sizeof(ENGINE_PILE)); | 149 | fnd = malloc(sizeof(ENGINE_PILE)); |
150 | if(!fnd) goto end; | 150 | if(!fnd) goto end; |
151 | fnd->uptodate = 1; | 151 | fnd->uptodate = 1; |
152 | fnd->nid = *nids; | 152 | fnd->nid = *nids; |
153 | fnd->sk = sk_ENGINE_new_null(); | 153 | fnd->sk = sk_ENGINE_new_null(); |
154 | if(!fnd->sk) | 154 | if(!fnd->sk) |
155 | { | 155 | { |
156 | OPENSSL_free(fnd); | 156 | free(fnd); |
157 | goto end; | 157 | goto end; |
158 | } | 158 | } |
159 | fnd->funct = NULL; | 159 | fnd->funct = NULL; |
@@ -218,7 +218,7 @@ static void int_cleanup_cb_doall(ENGINE_PILE *p) | |||
218 | sk_ENGINE_free(p->sk); | 218 | sk_ENGINE_free(p->sk); |
219 | if(p->funct) | 219 | if(p->funct) |
220 | engine_unlocked_finish(p->funct, 0); | 220 | engine_unlocked_finish(p->funct, 0); |
221 | OPENSSL_free(p); | 221 | free(p); |
222 | } | 222 | } |
223 | static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE) | 223 | static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE) |
224 | 224 | ||
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index f6f9d2c080..93ed1da943 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
@@ -572,7 +572,7 @@ static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1]; | |||
572 | 572 | ||
573 | static void build_SYS_str_reasons(void) | 573 | static void build_SYS_str_reasons(void) |
574 | { | 574 | { |
575 | /* OPENSSL_malloc cannot be used here, use static storage instead */ | 575 | /* malloc cannot be used here, use static storage instead */ |
576 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; | 576 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; |
577 | int i; | 577 | int i; |
578 | static int init = 1; | 578 | static int init = 1; |
@@ -625,7 +625,7 @@ static void build_SYS_str_reasons(void) | |||
625 | if (((p)->err_data[i] != NULL) && \ | 625 | if (((p)->err_data[i] != NULL) && \ |
626 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ | 626 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ |
627 | { \ | 627 | { \ |
628 | OPENSSL_free((p)->err_data[i]); \ | 628 | free((p)->err_data[i]); \ |
629 | (p)->err_data[i]=NULL; \ | 629 | (p)->err_data[i]=NULL; \ |
630 | } \ | 630 | } \ |
631 | (p)->err_data_flags[i]=0; \ | 631 | (p)->err_data_flags[i]=0; \ |
@@ -651,7 +651,7 @@ static void ERR_STATE_free(ERR_STATE *s) | |||
651 | { | 651 | { |
652 | err_clear_data(s,i); | 652 | err_clear_data(s,i); |
653 | } | 653 | } |
654 | OPENSSL_free(s); | 654 | free(s); |
655 | } | 655 | } |
656 | 656 | ||
657 | void ERR_load_ERR_strings(void) | 657 | void ERR_load_ERR_strings(void) |
@@ -1015,7 +1015,7 @@ ERR_STATE *ERR_get_state(void) | |||
1015 | /* ret == the error state, if NULL, make a new one */ | 1015 | /* ret == the error state, if NULL, make a new one */ |
1016 | if (ret == NULL) | 1016 | if (ret == NULL) |
1017 | { | 1017 | { |
1018 | ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE)); | 1018 | ret=(ERR_STATE *)malloc(sizeof(ERR_STATE)); |
1019 | if (ret == NULL) return(&fallback); | 1019 | if (ret == NULL) return(&fallback); |
1020 | CRYPTO_THREADID_cpy(&ret->tid, &tid); | 1020 | CRYPTO_THREADID_cpy(&ret->tid, &tid); |
1021 | ret->top=0; | 1021 | ret->top=0; |
@@ -1076,7 +1076,7 @@ void ERR_add_error_vdata(int num, va_list args) | |||
1076 | char *str,*p,*a; | 1076 | char *str,*p,*a; |
1077 | 1077 | ||
1078 | s=80; | 1078 | s=80; |
1079 | str=OPENSSL_malloc(s+1); | 1079 | str=malloc(s+1); |
1080 | if (str == NULL) return; | 1080 | if (str == NULL) return; |
1081 | str[0]='\0'; | 1081 | str[0]='\0'; |
1082 | 1082 | ||
@@ -1091,10 +1091,10 @@ void ERR_add_error_vdata(int num, va_list args) | |||
1091 | if (n > s) | 1091 | if (n > s) |
1092 | { | 1092 | { |
1093 | s=n+20; | 1093 | s=n+20; |
1094 | p=OPENSSL_realloc(str,s+1); | 1094 | p=realloc(str,s+1); |
1095 | if (p == NULL) | 1095 | if (p == NULL) |
1096 | { | 1096 | { |
1097 | OPENSSL_free(str); | 1097 | free(str); |
1098 | return; | 1098 | return; |
1099 | } | 1099 | } |
1100 | else | 1100 | else |
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c index ac6d441aad..27fc587ca8 100644 --- a/src/lib/libcrypto/evp/bio_b64.c +++ b/src/lib/libcrypto/evp/bio_b64.c | |||
@@ -113,7 +113,7 @@ static int b64_new(BIO *bi) | |||
113 | { | 113 | { |
114 | BIO_B64_CTX *ctx; | 114 | BIO_B64_CTX *ctx; |
115 | 115 | ||
116 | ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX)); | 116 | ctx=(BIO_B64_CTX *)malloc(sizeof(BIO_B64_CTX)); |
117 | if (ctx == NULL) return(0); | 117 | if (ctx == NULL) return(0); |
118 | 118 | ||
119 | ctx->buf_len=0; | 119 | ctx->buf_len=0; |
@@ -134,7 +134,7 @@ static int b64_new(BIO *bi) | |||
134 | static int b64_free(BIO *a) | 134 | static int b64_free(BIO *a) |
135 | { | 135 | { |
136 | if (a == NULL) return(0); | 136 | if (a == NULL) return(0); |
137 | OPENSSL_free(a->ptr); | 137 | free(a->ptr); |
138 | a->ptr=NULL; | 138 | a->ptr=NULL; |
139 | a->init=0; | 139 | a->init=0; |
140 | a->flags=0; | 140 | a->flags=0; |
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c index b6efb5fbc4..8fe9a45e48 100644 --- a/src/lib/libcrypto/evp/bio_enc.c +++ b/src/lib/libcrypto/evp/bio_enc.c | |||
@@ -109,7 +109,7 @@ static int enc_new(BIO *bi) | |||
109 | { | 109 | { |
110 | BIO_ENC_CTX *ctx; | 110 | BIO_ENC_CTX *ctx; |
111 | 111 | ||
112 | ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX)); | 112 | ctx=(BIO_ENC_CTX *)malloc(sizeof(BIO_ENC_CTX)); |
113 | if (ctx == NULL) return(0); | 113 | if (ctx == NULL) return(0); |
114 | EVP_CIPHER_CTX_init(&ctx->cipher); | 114 | EVP_CIPHER_CTX_init(&ctx->cipher); |
115 | 115 | ||
@@ -133,7 +133,7 @@ static int enc_free(BIO *a) | |||
133 | b=(BIO_ENC_CTX *)a->ptr; | 133 | b=(BIO_ENC_CTX *)a->ptr; |
134 | EVP_CIPHER_CTX_cleanup(&(b->cipher)); | 134 | EVP_CIPHER_CTX_cleanup(&(b->cipher)); |
135 | OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX)); | 135 | OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX)); |
136 | OPENSSL_free(a->ptr); | 136 | free(a->ptr); |
137 | a->ptr=NULL; | 137 | a->ptr=NULL; |
138 | a->init=0; | 138 | a->init=0; |
139 | a->flags=0; | 139 | a->flags=0; |
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c index e64335353f..fdb742f554 100644 --- a/src/lib/libcrypto/evp/bio_ok.c +++ b/src/lib/libcrypto/evp/bio_ok.c | |||
@@ -178,7 +178,7 @@ static int ok_new(BIO *bi) | |||
178 | { | 178 | { |
179 | BIO_OK_CTX *ctx; | 179 | BIO_OK_CTX *ctx; |
180 | 180 | ||
181 | ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX)); | 181 | ctx=(BIO_OK_CTX *)malloc(sizeof(BIO_OK_CTX)); |
182 | if (ctx == NULL) return(0); | 182 | if (ctx == NULL) return(0); |
183 | 183 | ||
184 | ctx->buf_len=0; | 184 | ctx->buf_len=0; |
@@ -203,7 +203,7 @@ static int ok_free(BIO *a) | |||
203 | if (a == NULL) return(0); | 203 | if (a == NULL) return(0); |
204 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); | 204 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); |
205 | OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); | 205 | OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); |
206 | OPENSSL_free(a->ptr); | 206 | free(a->ptr); |
207 | a->ptr=NULL; | 207 | a->ptr=NULL; |
208 | a->init=0; | 208 | a->init=0; |
209 | a->flags=0; | 209 | a->flags=0; |
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 782d3199a5..2fae68ef5e 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
@@ -124,7 +124,7 @@ void EVP_MD_CTX_init(EVP_MD_CTX *ctx) | |||
124 | 124 | ||
125 | EVP_MD_CTX *EVP_MD_CTX_create(void) | 125 | EVP_MD_CTX *EVP_MD_CTX_create(void) |
126 | { | 126 | { |
127 | EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | 127 | EVP_MD_CTX *ctx=malloc(sizeof *ctx); |
128 | 128 | ||
129 | if (ctx) | 129 | if (ctx) |
130 | EVP_MD_CTX_init(ctx); | 130 | EVP_MD_CTX_init(ctx); |
@@ -198,12 +198,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | |||
198 | if (ctx->digest != type) | 198 | if (ctx->digest != type) |
199 | { | 199 | { |
200 | if (ctx->digest && ctx->digest->ctx_size) | 200 | if (ctx->digest && ctx->digest->ctx_size) |
201 | OPENSSL_free(ctx->md_data); | 201 | free(ctx->md_data); |
202 | ctx->digest=type; | 202 | ctx->digest=type; |
203 | if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) | 203 | if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) |
204 | { | 204 | { |
205 | ctx->update = type->update; | 205 | ctx->update = type->update; |
206 | ctx->md_data=OPENSSL_malloc(type->ctx_size); | 206 | ctx->md_data=malloc(type->ctx_size); |
207 | if (ctx->md_data == NULL) | 207 | if (ctx->md_data == NULL) |
208 | { | 208 | { |
209 | EVPerr(EVP_F_EVP_DIGESTINIT_EX, | 209 | EVPerr(EVP_F_EVP_DIGESTINIT_EX, |
@@ -298,7 +298,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | |||
298 | out->md_data = tmp_buf; | 298 | out->md_data = tmp_buf; |
299 | else | 299 | else |
300 | { | 300 | { |
301 | out->md_data=OPENSSL_malloc(out->digest->ctx_size); | 301 | out->md_data=malloc(out->digest->ctx_size); |
302 | if (!out->md_data) | 302 | if (!out->md_data) |
303 | { | 303 | { |
304 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE); | 304 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE); |
@@ -347,7 +347,7 @@ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | |||
347 | if (ctx) | 347 | if (ctx) |
348 | { | 348 | { |
349 | EVP_MD_CTX_cleanup(ctx); | 349 | EVP_MD_CTX_cleanup(ctx); |
350 | OPENSSL_free(ctx); | 350 | free(ctx); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
@@ -364,7 +364,7 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
364 | && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) | 364 | && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) |
365 | { | 365 | { |
366 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); | 366 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); |
367 | OPENSSL_free(ctx->md_data); | 367 | free(ctx->md_data); |
368 | } | 368 | } |
369 | if (ctx->pctx) | 369 | if (ctx->pctx) |
370 | EVP_PKEY_CTX_free(ctx->pctx); | 370 | EVP_PKEY_CTX_free(ctx->pctx); |
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index c7eaafe89b..d6f0124a94 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -679,7 +679,7 @@ static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) | |||
679 | EVP_AES_GCM_CTX *gctx = c->cipher_data; | 679 | EVP_AES_GCM_CTX *gctx = c->cipher_data; |
680 | OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); | 680 | OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); |
681 | if (gctx->iv != c->iv) | 681 | if (gctx->iv != c->iv) |
682 | OPENSSL_free(gctx->iv); | 682 | free(gctx->iv); |
683 | return 1; | 683 | return 1; |
684 | } | 684 | } |
685 | 685 | ||
@@ -724,8 +724,8 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
724 | if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) | 724 | if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) |
725 | { | 725 | { |
726 | if (gctx->iv != c->iv) | 726 | if (gctx->iv != c->iv) |
727 | OPENSSL_free(gctx->iv); | 727 | free(gctx->iv); |
728 | gctx->iv = OPENSSL_malloc(arg); | 728 | gctx->iv = malloc(arg); |
729 | if (!gctx->iv) | 729 | if (!gctx->iv) |
730 | return 0; | 730 | return 0; |
731 | } | 731 | } |
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 50403a7578..e8ca502633 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -78,7 +78,7 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | |||
78 | 78 | ||
79 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) | 79 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) |
80 | { | 80 | { |
81 | EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | 81 | EVP_CIPHER_CTX *ctx=malloc(sizeof *ctx); |
82 | if (ctx) | 82 | if (ctx) |
83 | EVP_CIPHER_CTX_init(ctx); | 83 | EVP_CIPHER_CTX_init(ctx); |
84 | return ctx; | 84 | return ctx; |
@@ -164,7 +164,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
164 | ctx->cipher=cipher; | 164 | ctx->cipher=cipher; |
165 | if (ctx->cipher->ctx_size) | 165 | if (ctx->cipher->ctx_size) |
166 | { | 166 | { |
167 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | 167 | ctx->cipher_data=malloc(ctx->cipher->ctx_size); |
168 | if (!ctx->cipher_data) | 168 | if (!ctx->cipher_data) |
169 | { | 169 | { |
170 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); | 170 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); |
@@ -546,7 +546,7 @@ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | |||
546 | if (ctx) | 546 | if (ctx) |
547 | { | 547 | { |
548 | EVP_CIPHER_CTX_cleanup(ctx); | 548 | EVP_CIPHER_CTX_cleanup(ctx); |
549 | OPENSSL_free(ctx); | 549 | free(ctx); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | ||
@@ -561,7 +561,7 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | |||
561 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | 561 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); |
562 | } | 562 | } |
563 | if (c->cipher_data) | 563 | if (c->cipher_data) |
564 | OPENSSL_free(c->cipher_data); | 564 | free(c->cipher_data); |
565 | #ifndef OPENSSL_NO_ENGINE | 565 | #ifndef OPENSSL_NO_ENGINE |
566 | if (c->engine) | 566 | if (c->engine) |
567 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | 567 | /* The EVP_CIPHER we used belongs to an ENGINE, release the |
@@ -644,7 +644,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) | |||
644 | 644 | ||
645 | if (in->cipher_data && in->cipher->ctx_size) | 645 | if (in->cipher_data && in->cipher->ctx_size) |
646 | { | 646 | { |
647 | out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size); | 647 | out->cipher_data=malloc(in->cipher->ctx_size); |
648 | if (!out->cipher_data) | 648 | if (!out->cipher_data) |
649 | { | 649 | { |
650 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE); | 650 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index f8c32d825e..c808b96fef 100644 --- a/src/lib/libcrypto/evp/evp_pbe.c +++ b/src/lib/libcrypto/evp/evp_pbe.c | |||
@@ -238,7 +238,7 @@ int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, | |||
238 | EVP_PBE_CTL *pbe_tmp; | 238 | EVP_PBE_CTL *pbe_tmp; |
239 | if (!pbe_algs) | 239 | if (!pbe_algs) |
240 | pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp); | 240 | pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp); |
241 | if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) | 241 | if (!(pbe_tmp = (EVP_PBE_CTL*) malloc (sizeof(EVP_PBE_CTL)))) |
242 | { | 242 | { |
243 | EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE); | 243 | EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE); |
244 | return 0; | 244 | return 0; |
@@ -306,7 +306,7 @@ int EVP_PBE_find(int type, int pbe_nid, | |||
306 | 306 | ||
307 | static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe) | 307 | static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe) |
308 | { | 308 | { |
309 | OPENSSL_freeFunc(pbe); | 309 | free(pbe); |
310 | } | 310 | } |
311 | 311 | ||
312 | void EVP_PBE_cleanup(void) | 312 | void EVP_PBE_cleanup(void) |
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index e26ccd0d08..7a9da3487a 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
@@ -183,7 +183,7 @@ EVP_PKEY *EVP_PKEY_new(void) | |||
183 | { | 183 | { |
184 | EVP_PKEY *ret; | 184 | EVP_PKEY *ret; |
185 | 185 | ||
186 | ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY)); | 186 | ret=(EVP_PKEY *)malloc(sizeof(EVP_PKEY)); |
187 | if (ret == NULL) | 187 | if (ret == NULL) |
188 | { | 188 | { |
189 | EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE); | 189 | EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE); |
@@ -405,7 +405,7 @@ void EVP_PKEY_free(EVP_PKEY *x) | |||
405 | EVP_PKEY_free_it(x); | 405 | EVP_PKEY_free_it(x); |
406 | if (x->attributes) | 406 | if (x->attributes) |
407 | sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); | 407 | sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); |
408 | OPENSSL_free(x); | 408 | free(x); |
409 | } | 409 | } |
410 | 410 | ||
411 | static void EVP_PKEY_free_it(EVP_PKEY *x) | 411 | static void EVP_PKEY_free_it(EVP_PKEY *x) |
diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c index c748fbea87..2a5ab2b6cc 100644 --- a/src/lib/libcrypto/evp/p_open.c +++ b/src/lib/libcrypto/evp/p_open.c | |||
@@ -87,7 +87,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |||
87 | } | 87 | } |
88 | 88 | ||
89 | size=RSA_size(priv->pkey.rsa); | 89 | size=RSA_size(priv->pkey.rsa); |
90 | key=(unsigned char *)OPENSSL_malloc(size+2); | 90 | key=(unsigned char *)malloc(size+2); |
91 | if (key == NULL) | 91 | if (key == NULL) |
92 | { | 92 | { |
93 | /* ERROR */ | 93 | /* ERROR */ |
@@ -106,7 +106,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |||
106 | ret=1; | 106 | ret=1; |
107 | err: | 107 | err: |
108 | if (key != NULL) OPENSSL_cleanse(key,size); | 108 | if (key != NULL) OPENSSL_cleanse(key,size); |
109 | OPENSSL_free(key); | 109 | free(key); |
110 | return(ret); | 110 | return(ret); |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c index acfa7b6f87..a9fb15fdfe 100644 --- a/src/lib/libcrypto/evp/pmeth_lib.c +++ b/src/lib/libcrypto/evp/pmeth_lib.c | |||
@@ -165,7 +165,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) | |||
165 | return NULL; | 165 | return NULL; |
166 | } | 166 | } |
167 | 167 | ||
168 | ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); | 168 | ret = malloc(sizeof(EVP_PKEY_CTX)); |
169 | if (!ret) | 169 | if (!ret) |
170 | { | 170 | { |
171 | #ifndef OPENSSL_NO_ENGINE | 171 | #ifndef OPENSSL_NO_ENGINE |
@@ -200,7 +200,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) | |||
200 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags) | 200 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags) |
201 | { | 201 | { |
202 | EVP_PKEY_METHOD *pmeth; | 202 | EVP_PKEY_METHOD *pmeth; |
203 | pmeth = OPENSSL_malloc(sizeof(EVP_PKEY_METHOD)); | 203 | pmeth = malloc(sizeof(EVP_PKEY_METHOD)); |
204 | if (!pmeth) | 204 | if (!pmeth) |
205 | return NULL; | 205 | return NULL; |
206 | 206 | ||
@@ -291,7 +291,7 @@ void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src) | |||
291 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth) | 291 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth) |
292 | { | 292 | { |
293 | if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC)) | 293 | if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC)) |
294 | OPENSSL_free(pmeth); | 294 | free(pmeth); |
295 | } | 295 | } |
296 | 296 | ||
297 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) | 297 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) |
@@ -317,7 +317,7 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx) | |||
317 | return 0; | 317 | return 0; |
318 | } | 318 | } |
319 | #endif | 319 | #endif |
320 | rctx = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); | 320 | rctx = malloc(sizeof(EVP_PKEY_CTX)); |
321 | if (!rctx) | 321 | if (!rctx) |
322 | return NULL; | 322 | return NULL; |
323 | 323 | ||
@@ -378,7 +378,7 @@ void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx) | |||
378 | * functional reference we held for this reason. */ | 378 | * functional reference we held for this reason. */ |
379 | ENGINE_finish(ctx->engine); | 379 | ENGINE_finish(ctx->engine); |
380 | #endif | 380 | #endif |
381 | OPENSSL_free(ctx); | 381 | free(ctx); |
382 | } | 382 | } |
383 | 383 | ||
384 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | 384 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, |
diff --git a/src/lib/libcrypto/ex_data.c b/src/lib/libcrypto/ex_data.c index 44bad59527..4c09f9ee02 100644 --- a/src/lib/libcrypto/ex_data.c +++ b/src/lib/libcrypto/ex_data.c | |||
@@ -290,7 +290,7 @@ ex_data_check(void) | |||
290 | static void | 290 | static void |
291 | def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs) | 291 | def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs) |
292 | { | 292 | { |
293 | OPENSSL_free(funcs); | 293 | free(funcs); |
294 | } | 294 | } |
295 | 295 | ||
296 | /* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from | 296 | /* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from |
@@ -301,7 +301,7 @@ def_cleanup_cb(void *a_void) | |||
301 | { | 301 | { |
302 | EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void; | 302 | EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void; |
303 | sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, def_cleanup_util_cb); | 303 | sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, def_cleanup_util_cb); |
304 | OPENSSL_free(item); | 304 | free(item); |
305 | } | 305 | } |
306 | 306 | ||
307 | /* Return the EX_CLASS_ITEM from the "ex_data" hash table that corresponds to a | 307 | /* Return the EX_CLASS_ITEM from the "ex_data" hash table that corresponds to a |
@@ -315,13 +315,13 @@ static EX_CLASS_ITEM | |||
315 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); | 315 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); |
316 | p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d); | 316 | p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d); |
317 | if (!p) { | 317 | if (!p) { |
318 | gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM)); | 318 | gen = malloc(sizeof(EX_CLASS_ITEM)); |
319 | if (gen) { | 319 | if (gen) { |
320 | gen->class_index = class_index; | 320 | gen->class_index = class_index; |
321 | gen->meth_num = 0; | 321 | gen->meth_num = 0; |
322 | gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null(); | 322 | gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null(); |
323 | if (!gen->meth) | 323 | if (!gen->meth) |
324 | OPENSSL_free(gen); | 324 | free(gen); |
325 | else { | 325 | else { |
326 | /* Because we're inside the ex_data lock, the | 326 | /* Because we're inside the ex_data lock, the |
327 | * return value from the insert will be NULL */ | 327 | * return value from the insert will be NULL */ |
@@ -343,7 +343,7 @@ def_add_index(EX_CLASS_ITEM *item, long argl, void *argp, | |||
343 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | 343 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) |
344 | { | 344 | { |
345 | int toret = -1; | 345 | int toret = -1; |
346 | CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc( | 346 | CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)malloc( |
347 | sizeof(CRYPTO_EX_DATA_FUNCS)); | 347 | sizeof(CRYPTO_EX_DATA_FUNCS)); |
348 | if (!a) { | 348 | if (!a) { |
349 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); | 349 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); |
@@ -358,7 +358,7 @@ def_add_index(EX_CLASS_ITEM *item, long argl, void *argp, | |||
358 | while (sk_CRYPTO_EX_DATA_FUNCS_num(item->meth) <= item->meth_num) { | 358 | while (sk_CRYPTO_EX_DATA_FUNCS_num(item->meth) <= item->meth_num) { |
359 | if (!sk_CRYPTO_EX_DATA_FUNCS_push(item->meth, NULL)) { | 359 | if (!sk_CRYPTO_EX_DATA_FUNCS_push(item->meth, NULL)) { |
360 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); | 360 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); |
361 | OPENSSL_free(a); | 361 | free(a); |
362 | goto err; | 362 | goto err; |
363 | } | 363 | } |
364 | } | 364 | } |
@@ -422,7 +422,7 @@ int_new_ex_data(int class_index, void *obj, | |||
422 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); | 422 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); |
423 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); | 423 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); |
424 | if (mx > 0) { | 424 | if (mx > 0) { |
425 | storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); | 425 | storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); |
426 | if (!storage) | 426 | if (!storage) |
427 | goto skip; | 427 | goto skip; |
428 | for (i = 0; i < mx; i++) | 428 | for (i = 0; i < mx; i++) |
@@ -442,7 +442,7 @@ skip: | |||
442 | } | 442 | } |
443 | } | 443 | } |
444 | if (storage) | 444 | if (storage) |
445 | OPENSSL_free(storage); | 445 | free(storage); |
446 | return 1; | 446 | return 1; |
447 | } | 447 | } |
448 | 448 | ||
@@ -466,7 +466,7 @@ int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, | |||
466 | if (j < mx) | 466 | if (j < mx) |
467 | mx = j; | 467 | mx = j; |
468 | if (mx > 0) { | 468 | if (mx > 0) { |
469 | storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); | 469 | storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); |
470 | if (!storage) | 470 | if (!storage) |
471 | goto skip; | 471 | goto skip; |
472 | for (i = 0; i < mx; i++) | 472 | for (i = 0; i < mx; i++) |
@@ -486,7 +486,7 @@ skip: | |||
486 | CRYPTO_set_ex_data(to, i, ptr); | 486 | CRYPTO_set_ex_data(to, i, ptr); |
487 | } | 487 | } |
488 | if (storage) | 488 | if (storage) |
489 | OPENSSL_free(storage); | 489 | free(storage); |
490 | return 1; | 490 | return 1; |
491 | } | 491 | } |
492 | 492 | ||
@@ -503,7 +503,7 @@ int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | |||
503 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); | 503 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); |
504 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); | 504 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); |
505 | if (mx > 0) { | 505 | if (mx > 0) { |
506 | storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); | 506 | storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); |
507 | if (!storage) | 507 | if (!storage) |
508 | goto skip; | 508 | goto skip; |
509 | for (i = 0; i < mx; i++) | 509 | for (i = 0; i < mx; i++) |
@@ -523,7 +523,7 @@ skip: | |||
523 | } | 523 | } |
524 | } | 524 | } |
525 | if (storage) | 525 | if (storage) |
526 | OPENSSL_free(storage); | 526 | free(storage); |
527 | if (ad->sk) { | 527 | if (ad->sk) { |
528 | sk_void_free(ad->sk); | 528 | sk_void_free(ad->sk); |
529 | ad->sk = NULL; | 529 | ad->sk = NULL; |
diff --git a/src/lib/libcrypto/hmac/hm_ameth.c b/src/lib/libcrypto/hmac/hm_ameth.c index e03f24aeda..fbada40d9c 100644 --- a/src/lib/libcrypto/hmac/hm_ameth.c +++ b/src/lib/libcrypto/hmac/hm_ameth.c | |||
@@ -122,7 +122,7 @@ static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) | |||
122 | { | 122 | { |
123 | if (!*pder) | 123 | if (!*pder) |
124 | { | 124 | { |
125 | *pder = OPENSSL_malloc(os->length); | 125 | *pder = malloc(os->length); |
126 | inc = 0; | 126 | inc = 0; |
127 | } | 127 | } |
128 | else inc = 1; | 128 | else inc = 1; |
diff --git a/src/lib/libcrypto/hmac/hm_pmeth.c b/src/lib/libcrypto/hmac/hm_pmeth.c index 0daa44511d..f1c67329d0 100644 --- a/src/lib/libcrypto/hmac/hm_pmeth.c +++ b/src/lib/libcrypto/hmac/hm_pmeth.c | |||
@@ -75,7 +75,7 @@ typedef struct | |||
75 | static int pkey_hmac_init(EVP_PKEY_CTX *ctx) | 75 | static int pkey_hmac_init(EVP_PKEY_CTX *ctx) |
76 | { | 76 | { |
77 | HMAC_PKEY_CTX *hctx; | 77 | HMAC_PKEY_CTX *hctx; |
78 | hctx = OPENSSL_malloc(sizeof(HMAC_PKEY_CTX)); | 78 | hctx = malloc(sizeof(HMAC_PKEY_CTX)); |
79 | if (!hctx) | 79 | if (!hctx) |
80 | return 0; | 80 | return 0; |
81 | hctx->md = NULL; | 81 | hctx->md = NULL; |
@@ -119,10 +119,10 @@ static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx) | |||
119 | { | 119 | { |
120 | if (hctx->ktmp.length) | 120 | if (hctx->ktmp.length) |
121 | OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length); | 121 | OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length); |
122 | OPENSSL_free(hctx->ktmp.data); | 122 | free(hctx->ktmp.data); |
123 | hctx->ktmp.data = NULL; | 123 | hctx->ktmp.data = NULL; |
124 | } | 124 | } |
125 | OPENSSL_free(hctx); | 125 | free(hctx); |
126 | } | 126 | } |
127 | 127 | ||
128 | static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | 128 | static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) |
@@ -229,7 +229,7 @@ static int pkey_hmac_ctrl_str(EVP_PKEY_CTX *ctx, | |||
229 | if (!key) | 229 | if (!key) |
230 | return 0; | 230 | return 0; |
231 | r = pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); | 231 | r = pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); |
232 | OPENSSL_free(key); | 232 | free(key); |
233 | return r; | 233 | return r; |
234 | } | 234 | } |
235 | return -2; | 235 | return -2; |
diff --git a/src/lib/libcrypto/lhash/lh_test.c b/src/lib/libcrypto/lhash/lh_test.c index 85700c859b..2224a216ab 100644 --- a/src/lib/libcrypto/lhash/lh_test.c +++ b/src/lib/libcrypto/lhash/lh_test.c | |||
@@ -76,7 +76,7 @@ main() | |||
76 | fgets(buf,256,stdin); | 76 | fgets(buf,256,stdin); |
77 | if (buf[0] == '\0') break; | 77 | if (buf[0] == '\0') break; |
78 | i=strlen(buf); | 78 | i=strlen(buf); |
79 | p=OPENSSL_malloc(i+1); | 79 | p=malloc(i+1); |
80 | memcpy(p,buf,i+1); | 80 | memcpy(p,buf,i+1); |
81 | lh_insert(conf,p); | 81 | lh_insert(conf,p); |
82 | } | 82 | } |
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index 47f748081b..78ba26db83 100644 --- a/src/lib/libcrypto/lhash/lhash.c +++ b/src/lib/libcrypto/lhash/lhash.c | |||
@@ -116,9 +116,9 @@ _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) | |||
116 | _LHASH *ret; | 116 | _LHASH *ret; |
117 | int i; | 117 | int i; |
118 | 118 | ||
119 | if ((ret=OPENSSL_malloc(sizeof(_LHASH))) == NULL) | 119 | if ((ret=malloc(sizeof(_LHASH))) == NULL) |
120 | goto err0; | 120 | goto err0; |
121 | if ((ret->b=OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) | 121 | if ((ret->b=malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) |
122 | goto err1; | 122 | goto err1; |
123 | for (i=0; i<MIN_NODES; i++) | 123 | for (i=0; i<MIN_NODES; i++) |
124 | ret->b[i]=NULL; | 124 | ret->b[i]=NULL; |
@@ -149,7 +149,7 @@ _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) | |||
149 | ret->error=0; | 149 | ret->error=0; |
150 | return(ret); | 150 | return(ret); |
151 | err1: | 151 | err1: |
152 | OPENSSL_free(ret); | 152 | free(ret); |
153 | err0: | 153 | err0: |
154 | return(NULL); | 154 | return(NULL); |
155 | } | 155 | } |
@@ -168,12 +168,12 @@ void lh_free(_LHASH *lh) | |||
168 | while (n != NULL) | 168 | while (n != NULL) |
169 | { | 169 | { |
170 | nn=n->next; | 170 | nn=n->next; |
171 | OPENSSL_free(n); | 171 | free(n); |
172 | n=nn; | 172 | n=nn; |
173 | } | 173 | } |
174 | } | 174 | } |
175 | OPENSSL_free(lh->b); | 175 | free(lh->b); |
176 | OPENSSL_free(lh); | 176 | free(lh); |
177 | } | 177 | } |
178 | 178 | ||
179 | void *lh_insert(_LHASH *lh, void *data) | 179 | void *lh_insert(_LHASH *lh, void *data) |
@@ -190,7 +190,7 @@ void *lh_insert(_LHASH *lh, void *data) | |||
190 | 190 | ||
191 | if (*rn == NULL) | 191 | if (*rn == NULL) |
192 | { | 192 | { |
193 | if ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL) | 193 | if ((nn=(LHASH_NODE *)malloc(sizeof(LHASH_NODE))) == NULL) |
194 | { | 194 | { |
195 | lh->error++; | 195 | lh->error++; |
196 | return(NULL); | 196 | return(NULL); |
@@ -233,7 +233,7 @@ void *lh_delete(_LHASH *lh, const void *data) | |||
233 | nn= *rn; | 233 | nn= *rn; |
234 | *rn=nn->next; | 234 | *rn=nn->next; |
235 | ret=nn->data; | 235 | ret=nn->data; |
236 | OPENSSL_free(nn); | 236 | free(nn); |
237 | lh->num_delete++; | 237 | lh->num_delete++; |
238 | } | 238 | } |
239 | 239 | ||
@@ -343,7 +343,7 @@ static void expand(_LHASH *lh) | |||
343 | if ((lh->p) >= lh->pmax) | 343 | if ((lh->p) >= lh->pmax) |
344 | { | 344 | { |
345 | j=(int)lh->num_alloc_nodes*2; | 345 | j=(int)lh->num_alloc_nodes*2; |
346 | n=(LHASH_NODE **)OPENSSL_realloc(lh->b, | 346 | n=(LHASH_NODE **)realloc(lh->b, |
347 | (int)(sizeof(LHASH_NODE *)*j)); | 347 | (int)(sizeof(LHASH_NODE *)*j)); |
348 | if (n == NULL) | 348 | if (n == NULL) |
349 | { | 349 | { |
@@ -371,7 +371,7 @@ static void contract(_LHASH *lh) | |||
371 | lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ | 371 | lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ |
372 | if (lh->p == 0) | 372 | if (lh->p == 0) |
373 | { | 373 | { |
374 | n=(LHASH_NODE **)OPENSSL_realloc(lh->b, | 374 | n=(LHASH_NODE **)realloc(lh->b, |
375 | (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); | 375 | (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); |
376 | if (n == NULL) | 376 | if (n == NULL) |
377 | { | 377 | { |
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c index e1dc2b0f47..52de084318 100644 --- a/src/lib/libcrypto/modes/gcm128.c +++ b/src/lib/libcrypto/modes/gcm128.c | |||
@@ -1540,7 +1540,7 @@ GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block) | |||
1540 | { | 1540 | { |
1541 | GCM128_CONTEXT *ret; | 1541 | GCM128_CONTEXT *ret; |
1542 | 1542 | ||
1543 | if ((ret = (GCM128_CONTEXT *)OPENSSL_malloc(sizeof(GCM128_CONTEXT)))) | 1543 | if ((ret = (GCM128_CONTEXT *)malloc(sizeof(GCM128_CONTEXT)))) |
1544 | CRYPTO_gcm128_init(ret,key,block); | 1544 | CRYPTO_gcm128_init(ret,key,block); |
1545 | 1545 | ||
1546 | return ret; | 1546 | return ret; |
@@ -1550,7 +1550,7 @@ void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) | |||
1550 | { | 1550 | { |
1551 | if (ctx) { | 1551 | if (ctx) { |
1552 | OPENSSL_cleanse(ctx,sizeof(*ctx)); | 1552 | OPENSSL_cleanse(ctx,sizeof(*ctx)); |
1553 | OPENSSL_free(ctx); | 1553 | free(ctx); |
1554 | } | 1554 | } |
1555 | } | 1555 | } |
1556 | 1556 | ||
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index 4a548c2ed4..4c959db2da 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c | |||
@@ -83,7 +83,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), | |||
83 | for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++) | 83 | for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++) |
84 | { | 84 | { |
85 | MemCheck_off(); | 85 | MemCheck_off(); |
86 | name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); | 86 | name_funcs = malloc(sizeof(NAME_FUNCS)); |
87 | MemCheck_on(); | 87 | MemCheck_on(); |
88 | if (!name_funcs) | 88 | if (!name_funcs) |
89 | { | 89 | { |
@@ -192,7 +192,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
192 | alias=type&OBJ_NAME_ALIAS; | 192 | alias=type&OBJ_NAME_ALIAS; |
193 | type&= ~OBJ_NAME_ALIAS; | 193 | type&= ~OBJ_NAME_ALIAS; |
194 | 194 | ||
195 | onp=(OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME)); | 195 | onp=(OBJ_NAME *)malloc(sizeof(OBJ_NAME)); |
196 | if (onp == NULL) | 196 | if (onp == NULL) |
197 | { | 197 | { |
198 | /* ERROR */ | 198 | /* ERROR */ |
@@ -217,7 +217,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
217 | sk_NAME_FUNCS_value(name_funcs_stack, | 217 | sk_NAME_FUNCS_value(name_funcs_stack, |
218 | ret->type)->free_func(ret->name,ret->type,ret->data); | 218 | ret->type)->free_func(ret->name,ret->type,ret->data); |
219 | } | 219 | } |
220 | OPENSSL_free(ret); | 220 | free(ret); |
221 | } | 221 | } |
222 | else | 222 | else |
223 | { | 223 | { |
@@ -252,7 +252,7 @@ int OBJ_NAME_remove(const char *name, int type) | |||
252 | sk_NAME_FUNCS_value(name_funcs_stack, | 252 | sk_NAME_FUNCS_value(name_funcs_stack, |
253 | ret->type)->free_func(ret->name,ret->type,ret->data); | 253 | ret->type)->free_func(ret->name,ret->type,ret->data); |
254 | } | 254 | } |
255 | OPENSSL_free(ret); | 255 | free(ret); |
256 | return(1); | 256 | return(1); |
257 | } | 257 | } |
258 | else | 258 | else |
@@ -318,7 +318,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), | |||
318 | int n; | 318 | int n; |
319 | 319 | ||
320 | d.type=type; | 320 | d.type=type; |
321 | d.names=OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names); | 321 | d.names=malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names); |
322 | d.n=0; | 322 | d.n=0; |
323 | OBJ_NAME_do_all(type,do_all_sorted_fn,&d); | 323 | OBJ_NAME_do_all(type,do_all_sorted_fn,&d); |
324 | 324 | ||
@@ -327,7 +327,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), | |||
327 | for(n=0 ; n < d.n ; ++n) | 327 | for(n=0 ; n < d.n ; ++n) |
328 | fn(d.names[n],arg); | 328 | fn(d.names[n],arg); |
329 | 329 | ||
330 | OPENSSL_free((void *)d.names); | 330 | free((void *)d.names); |
331 | } | 331 | } |
332 | 332 | ||
333 | static int free_type; | 333 | static int free_type; |
@@ -345,7 +345,7 @@ static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME) | |||
345 | 345 | ||
346 | static void name_funcs_free(NAME_FUNCS *ptr) | 346 | static void name_funcs_free(NAME_FUNCS *ptr) |
347 | { | 347 | { |
348 | OPENSSL_free(ptr); | 348 | free(ptr); |
349 | } | 349 | } |
350 | 350 | ||
351 | void OBJ_NAME_cleanup(int type) | 351 | void OBJ_NAME_cleanup(int type) |
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index bced796e62..641a97c8aa 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
@@ -199,7 +199,7 @@ static void cleanup3_doall(ADDED_OBJ *a) | |||
199 | { | 199 | { |
200 | if (--a->obj->nid == 0) | 200 | if (--a->obj->nid == 0) |
201 | ASN1_OBJECT_free(a->obj); | 201 | ASN1_OBJECT_free(a->obj); |
202 | OPENSSL_free(a); | 202 | free(a); |
203 | } | 203 | } |
204 | 204 | ||
205 | static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ) | 205 | static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ) |
@@ -253,13 +253,13 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
253 | if (added == NULL) | 253 | if (added == NULL) |
254 | if (!init_added()) return(0); | 254 | if (!init_added()) return(0); |
255 | if ((o=OBJ_dup(obj)) == NULL) goto err; | 255 | if ((o=OBJ_dup(obj)) == NULL) goto err; |
256 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 256 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
257 | if ((o->length != 0) && (obj->data != NULL)) | 257 | if ((o->length != 0) && (obj->data != NULL)) |
258 | if (!(ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 258 | if (!(ao[ADDED_DATA]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
259 | if (o->sn != NULL) | 259 | if (o->sn != NULL) |
260 | if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 260 | if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
261 | if (o->ln != NULL) | 261 | if (o->ln != NULL) |
262 | if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 262 | if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
263 | 263 | ||
264 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 264 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
265 | { | 265 | { |
@@ -270,7 +270,7 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
270 | aop=lh_ADDED_OBJ_insert(added,ao[i]); | 270 | aop=lh_ADDED_OBJ_insert(added,ao[i]); |
271 | /* memory leak, buit should not normally matter */ | 271 | /* memory leak, buit should not normally matter */ |
272 | if (aop != NULL) | 272 | if (aop != NULL) |
273 | OPENSSL_free(aop); | 273 | free(aop); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS| | 276 | o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS| |
@@ -281,8 +281,8 @@ err2: | |||
281 | OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE); | 281 | OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE); |
282 | err: | 282 | err: |
283 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 283 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
284 | if (ao[i] != NULL) OPENSSL_free(ao[i]); | 284 | if (ao[i] != NULL) free(ao[i]); |
285 | if (o != NULL) OPENSSL_free(o); | 285 | if (o != NULL) free(o); |
286 | return(NID_undef); | 286 | return(NID_undef); |
287 | } | 287 | } |
288 | 288 | ||
@@ -449,7 +449,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) | |||
449 | /* Work out total size */ | 449 | /* Work out total size */ |
450 | j = ASN1_object_size(0,i,V_ASN1_OBJECT); | 450 | j = ASN1_object_size(0,i,V_ASN1_OBJECT); |
451 | 451 | ||
452 | if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL; | 452 | if((buf=(unsigned char *)malloc(j)) == NULL) return NULL; |
453 | 453 | ||
454 | p = buf; | 454 | p = buf; |
455 | /* Write out tag+length */ | 455 | /* Write out tag+length */ |
@@ -459,7 +459,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) | |||
459 | 459 | ||
460 | cp=buf; | 460 | cp=buf; |
461 | op=d2i_ASN1_OBJECT(NULL,&cp,j); | 461 | op=d2i_ASN1_OBJECT(NULL,&cp,j); |
462 | OPENSSL_free(buf); | 462 | free(buf); |
463 | return op; | 463 | return op; |
464 | } | 464 | } |
465 | 465 | ||
@@ -590,7 +590,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
590 | } | 590 | } |
591 | n++; | 591 | n++; |
592 | n += i; | 592 | n += i; |
593 | OPENSSL_free(bndec); | 593 | free(bndec); |
594 | } | 594 | } |
595 | else | 595 | else |
596 | { | 596 | { |
@@ -774,7 +774,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) | |||
774 | i=a2d_ASN1_OBJECT(NULL,0,oid,-1); | 774 | i=a2d_ASN1_OBJECT(NULL,0,oid,-1); |
775 | if (i <= 0) return(0); | 775 | if (i <= 0) return(0); |
776 | 776 | ||
777 | if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) | 777 | if ((buf=(unsigned char *)malloc(i)) == NULL) |
778 | { | 778 | { |
779 | OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); | 779 | OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); |
780 | return(0); | 780 | return(0); |
@@ -788,7 +788,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) | |||
788 | ok=OBJ_add_object(op); | 788 | ok=OBJ_add_object(op); |
789 | err: | 789 | err: |
790 | ASN1_OBJECT_free(op); | 790 | ASN1_OBJECT_free(op); |
791 | OPENSSL_free(buf); | 791 | free(buf); |
792 | return(ok); | 792 | return(ok); |
793 | } | 793 | } |
794 | 794 | ||
diff --git a/src/lib/libcrypto/objects/obj_lib.c b/src/lib/libcrypto/objects/obj_lib.c index 23e9d48cdf..338fe851fc 100644 --- a/src/lib/libcrypto/objects/obj_lib.c +++ b/src/lib/libcrypto/objects/obj_lib.c | |||
@@ -80,7 +80,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
80 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); | 80 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); |
81 | return(NULL); | 81 | return(NULL); |
82 | } | 82 | } |
83 | data=OPENSSL_malloc(o->length); | 83 | data=malloc(o->length); |
84 | if (data == NULL) | 84 | if (data == NULL) |
85 | goto err; | 85 | goto err; |
86 | if (o->data != NULL) | 86 | if (o->data != NULL) |
@@ -93,7 +93,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
93 | if (o->ln != NULL) | 93 | if (o->ln != NULL) |
94 | { | 94 | { |
95 | i=strlen(o->ln)+1; | 95 | i=strlen(o->ln)+1; |
96 | ln=OPENSSL_malloc(i); | 96 | ln=malloc(i); |
97 | if (ln == NULL) goto err; | 97 | if (ln == NULL) goto err; |
98 | memcpy(ln,o->ln,i); | 98 | memcpy(ln,o->ln,i); |
99 | r->ln=ln; | 99 | r->ln=ln; |
@@ -102,7 +102,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
102 | if (o->sn != NULL) | 102 | if (o->sn != NULL) |
103 | { | 103 | { |
104 | i=strlen(o->sn)+1; | 104 | i=strlen(o->sn)+1; |
105 | sn=OPENSSL_malloc(i); | 105 | sn=malloc(i); |
106 | if (sn == NULL) goto err; | 106 | if (sn == NULL) goto err; |
107 | memcpy(sn,o->sn,i); | 107 | memcpy(sn,o->sn,i); |
108 | r->sn=sn; | 108 | r->sn=sn; |
@@ -112,10 +112,10 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
112 | return(r); | 112 | return(r); |
113 | err: | 113 | err: |
114 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); | 114 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); |
115 | if (ln != NULL) OPENSSL_free(ln); | 115 | if (ln != NULL) free(ln); |
116 | if (sn != NULL) OPENSSL_free(sn); | 116 | if (sn != NULL) free(sn); |
117 | if (data != NULL) OPENSSL_free(data); | 117 | if (data != NULL) free(data); |
118 | if (r != NULL) OPENSSL_free(r); | 118 | if (r != NULL) free(r); |
119 | return(NULL); | 119 | return(NULL); |
120 | } | 120 | } |
121 | 121 | ||
diff --git a/src/lib/libcrypto/objects/obj_xref.c b/src/lib/libcrypto/objects/obj_xref.c index 9f744bcede..797adc8d10 100644 --- a/src/lib/libcrypto/objects/obj_xref.c +++ b/src/lib/libcrypto/objects/obj_xref.c | |||
@@ -162,7 +162,7 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | |||
162 | sigx_app = sk_nid_triple_new(sigx_cmp); | 162 | sigx_app = sk_nid_triple_new(sigx_cmp); |
163 | if (!sigx_app) | 163 | if (!sigx_app) |
164 | return 0; | 164 | return 0; |
165 | ntr = OPENSSL_malloc(sizeof(int) * 3); | 165 | ntr = malloc(sizeof(int) * 3); |
166 | if (!ntr) | 166 | if (!ntr) |
167 | return 0; | 167 | return 0; |
168 | ntr->sign_id = signid; | 168 | ntr->sign_id = signid; |
@@ -171,7 +171,7 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | |||
171 | 171 | ||
172 | if (!sk_nid_triple_push(sig_app, ntr)) | 172 | if (!sk_nid_triple_push(sig_app, ntr)) |
173 | { | 173 | { |
174 | OPENSSL_free(ntr); | 174 | free(ntr); |
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
@@ -186,7 +186,7 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | |||
186 | 186 | ||
187 | static void sid_free(nid_triple *tt) | 187 | static void sid_free(nid_triple *tt) |
188 | { | 188 | { |
189 | OPENSSL_free(tt); | 189 | free(tt); |
190 | } | 190 | } |
191 | 191 | ||
192 | void OBJ_sigid_free(void) | 192 | void OBJ_sigid_free(void) |
diff --git a/src/lib/libcrypto/ocsp/ocsp_ext.c b/src/lib/libcrypto/ocsp/ocsp_ext.c index ec884cb08f..9c7832b301 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ext.c +++ b/src/lib/libcrypto/ocsp/ocsp_ext.c | |||
@@ -274,7 +274,7 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
274 | if (data) | 274 | if (data) |
275 | { | 275 | { |
276 | if ((i=i2d(data,NULL)) <= 0) goto err; | 276 | if ((i=i2d(data,NULL)) <= 0) goto err; |
277 | if (!(b=p=OPENSSL_malloc((unsigned int)i))) | 277 | if (!(b=p=malloc((unsigned int)i))) |
278 | goto err; | 278 | goto err; |
279 | if (i2d(data, &p) <= 0) goto err; | 279 | if (i2d(data, &p) <= 0) goto err; |
280 | } | 280 | } |
@@ -285,7 +285,7 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
285 | V_ASN1_SEQUENCE, | 285 | V_ASN1_SEQUENCE, |
286 | V_ASN1_UNIVERSAL, | 286 | V_ASN1_UNIVERSAL, |
287 | IS_SEQUENCE))<=0) goto err; | 287 | IS_SEQUENCE))<=0) goto err; |
288 | if (!(b=p=OPENSSL_malloc((unsigned int)i))) | 288 | if (!(b=p=malloc((unsigned int)i))) |
289 | goto err; | 289 | goto err; |
290 | if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d, | 290 | if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d, |
291 | V_ASN1_SEQUENCE, | 291 | V_ASN1_SEQUENCE, |
@@ -299,10 +299,10 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
299 | } | 299 | } |
300 | if (!s && !(s = ASN1_STRING_new())) goto err; | 300 | if (!s && !(s = ASN1_STRING_new())) goto err; |
301 | if (!(ASN1_STRING_set(s, b, i))) goto err; | 301 | if (!(ASN1_STRING_set(s, b, i))) goto err; |
302 | OPENSSL_free(b); | 302 | free(b); |
303 | return s; | 303 | return s; |
304 | err: | 304 | err: |
305 | if (b) OPENSSL_free(b); | 305 | if (b) free(b); |
306 | return NULL; | 306 | return NULL; |
307 | } | 307 | } |
308 | #endif | 308 | #endif |
@@ -327,7 +327,7 @@ static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts, unsigned char *val, | |||
327 | * it relies on library internals. | 327 | * it relies on library internals. |
328 | */ | 328 | */ |
329 | os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING); | 329 | os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING); |
330 | os.data = OPENSSL_malloc(os.length); | 330 | os.data = malloc(os.length); |
331 | if (os.data == NULL) | 331 | if (os.data == NULL) |
332 | goto err; | 332 | goto err; |
333 | tmpval = os.data; | 333 | tmpval = os.data; |
@@ -342,7 +342,7 @@ static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts, unsigned char *val, | |||
342 | ret = 1; | 342 | ret = 1; |
343 | err: | 343 | err: |
344 | if (os.data) | 344 | if (os.data) |
345 | OPENSSL_free(os.data); | 345 | free(os.data); |
346 | return ret; | 346 | return ret; |
347 | } | 347 | } |
348 | 348 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index af5fc16691..17b252d6a8 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
@@ -114,8 +114,8 @@ void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) | |||
114 | if (rctx->mem) | 114 | if (rctx->mem) |
115 | BIO_free(rctx->mem); | 115 | BIO_free(rctx->mem); |
116 | if (rctx->iobuf) | 116 | if (rctx->iobuf) |
117 | OPENSSL_free(rctx->iobuf); | 117 | free(rctx->iobuf); |
118 | OPENSSL_free(rctx); | 118 | free(rctx); |
119 | } | 119 | } |
120 | 120 | ||
121 | int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) | 121 | int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) |
@@ -157,7 +157,7 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | |||
157 | static const char post_hdr[] = "POST %s HTTP/1.0\r\n"; | 157 | static const char post_hdr[] = "POST %s HTTP/1.0\r\n"; |
158 | 158 | ||
159 | OCSP_REQ_CTX *rctx; | 159 | OCSP_REQ_CTX *rctx; |
160 | rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX)); | 160 | rctx = malloc(sizeof(OCSP_REQ_CTX)); |
161 | rctx->state = OHS_ERROR; | 161 | rctx->state = OHS_ERROR; |
162 | rctx->mem = BIO_new(BIO_s_mem()); | 162 | rctx->mem = BIO_new(BIO_s_mem()); |
163 | rctx->io = io; | 163 | rctx->io = io; |
@@ -166,7 +166,7 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | |||
166 | rctx->iobuflen = maxline; | 166 | rctx->iobuflen = maxline; |
167 | else | 167 | else |
168 | rctx->iobuflen = OCSP_MAX_LINE_LEN; | 168 | rctx->iobuflen = OCSP_MAX_LINE_LEN; |
169 | rctx->iobuf = OPENSSL_malloc(rctx->iobuflen); | 169 | rctx->iobuf = malloc(rctx->iobuflen); |
170 | if (!rctx->iobuf) | 170 | if (!rctx->iobuf) |
171 | return 0; | 171 | return 0; |
172 | if (!path) | 172 | if (!path) |
diff --git a/src/lib/libcrypto/ocsp/ocsp_lib.c b/src/lib/libcrypto/ocsp/ocsp_lib.c index a94dc838ee..514cdabf2d 100644 --- a/src/lib/libcrypto/ocsp/ocsp_lib.c +++ b/src/lib/libcrypto/ocsp/ocsp_lib.c | |||
@@ -242,7 +242,7 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss | |||
242 | 242 | ||
243 | if (!*phost) goto mem_err; | 243 | if (!*phost) goto mem_err; |
244 | 244 | ||
245 | OPENSSL_free(buf); | 245 | free(buf); |
246 | 246 | ||
247 | return 1; | 247 | return 1; |
248 | 248 | ||
@@ -255,10 +255,10 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss | |||
255 | 255 | ||
256 | 256 | ||
257 | err: | 257 | err: |
258 | if (buf) OPENSSL_free(buf); | 258 | if (buf) free(buf); |
259 | if (*ppath) OPENSSL_free(*ppath); | 259 | if (*ppath) free(*ppath); |
260 | if (*pport) OPENSSL_free(*pport); | 260 | if (*pport) free(*pport); |
261 | if (*phost) OPENSSL_free(*phost); | 261 | if (*phost) free(*phost); |
262 | return 0; | 262 | return 0; |
263 | 263 | ||
264 | } | 264 | } |
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index cc7f24a9c1..4351260dfb 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
@@ -272,9 +272,9 @@ start: | |||
272 | else { | 272 | else { |
273 | /* unknown */ | 273 | /* unknown */ |
274 | } | 274 | } |
275 | if (name != NULL) OPENSSL_free(name); | 275 | if (name != NULL) free(name); |
276 | if (header != NULL) OPENSSL_free(header); | 276 | if (header != NULL) free(header); |
277 | if (data != NULL) OPENSSL_free(data); | 277 | if (data != NULL) free(data); |
278 | name=NULL; | 278 | name=NULL; |
279 | header=NULL; | 279 | header=NULL; |
280 | data=NULL; | 280 | data=NULL; |
@@ -303,9 +303,9 @@ err: | |||
303 | ret=NULL; | 303 | ret=NULL; |
304 | } | 304 | } |
305 | 305 | ||
306 | if (name != NULL) OPENSSL_free(name); | 306 | if (name != NULL) free(name); |
307 | if (header != NULL) OPENSSL_free(header); | 307 | if (header != NULL) free(header); |
308 | if (data != NULL) OPENSSL_free(data); | 308 | if (data != NULL) free(data); |
309 | return(ret); | 309 | return(ret); |
310 | } | 310 | } |
311 | 311 | ||
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 0dfa7c7376..aa6a4c9387 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
@@ -288,9 +288,9 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char | |||
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | if(check_pem(nm, name)) break; | 290 | if(check_pem(nm, name)) break; |
291 | OPENSSL_free(nm); | 291 | free(nm); |
292 | OPENSSL_free(header); | 292 | free(header); |
293 | OPENSSL_free(data); | 293 | free(data); |
294 | } | 294 | } |
295 | if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err; | 295 | if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err; |
296 | if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err; | 296 | if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err; |
@@ -304,9 +304,9 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char | |||
304 | ret = 1; | 304 | ret = 1; |
305 | 305 | ||
306 | err: | 306 | err: |
307 | if (!ret || !pnm) OPENSSL_free(nm); | 307 | if (!ret || !pnm) free(nm); |
308 | OPENSSL_free(header); | 308 | free(header); |
309 | if (!ret) OPENSSL_free(data); | 309 | if (!ret) free(data); |
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
@@ -360,7 +360,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | |||
360 | } | 360 | } |
361 | /* dzise + 8 bytes are needed */ | 361 | /* dzise + 8 bytes are needed */ |
362 | /* actually it needs the cipher block size extra... */ | 362 | /* actually it needs the cipher block size extra... */ |
363 | data=(unsigned char *)OPENSSL_malloc((unsigned int)dsize+20); | 363 | data=(unsigned char *)malloc((unsigned int)dsize+20); |
364 | if (data == NULL) | 364 | if (data == NULL) |
365 | { | 365 | { |
366 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); | 366 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); |
@@ -427,7 +427,7 @@ err: | |||
427 | if (data != NULL) | 427 | if (data != NULL) |
428 | { | 428 | { |
429 | OPENSSL_cleanse(data,(unsigned int)dsize); | 429 | OPENSSL_cleanse(data,(unsigned int)dsize); |
430 | OPENSSL_free(data); | 430 | free(data); |
431 | } | 431 | } |
432 | return(ret); | 432 | return(ret); |
433 | } | 433 | } |
@@ -599,7 +599,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
599 | goto err; | 599 | goto err; |
600 | } | 600 | } |
601 | 601 | ||
602 | buf = OPENSSL_malloc(PEM_BUFSIZE*8); | 602 | buf = malloc(PEM_BUFSIZE*8); |
603 | if (buf == NULL) | 603 | if (buf == NULL) |
604 | { | 604 | { |
605 | reason=ERR_R_MALLOC_FAILURE; | 605 | reason=ERR_R_MALLOC_FAILURE; |
@@ -620,7 +620,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
620 | EVP_EncodeFinal(&ctx,buf,&outl); | 620 | EVP_EncodeFinal(&ctx,buf,&outl); |
621 | if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err; | 621 | if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err; |
622 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); | 622 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); |
623 | OPENSSL_free(buf); | 623 | free(buf); |
624 | buf = NULL; | 624 | buf = NULL; |
625 | if ( (BIO_write(bp,"-----END ",9) != 9) || | 625 | if ( (BIO_write(bp,"-----END ",9) != 9) || |
626 | (BIO_write(bp,name,nlen) != nlen) || | 626 | (BIO_write(bp,name,nlen) != nlen) || |
@@ -630,7 +630,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
630 | err: | 630 | err: |
631 | if (buf) { | 631 | if (buf) { |
632 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); | 632 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); |
633 | OPENSSL_free(buf); | 633 | free(buf); |
634 | } | 634 | } |
635 | PEMerr(PEM_F_PEM_WRITE_BIO,reason); | 635 | PEMerr(PEM_F_PEM_WRITE_BIO,reason); |
636 | return(0); | 636 | return(0); |
@@ -809,9 +809,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, | |||
809 | *header=headerB->data; | 809 | *header=headerB->data; |
810 | *data=(unsigned char *)dataB->data; | 810 | *data=(unsigned char *)dataB->data; |
811 | *len=bl; | 811 | *len=bl; |
812 | OPENSSL_free(nameB); | 812 | free(nameB); |
813 | OPENSSL_free(headerB); | 813 | free(headerB); |
814 | OPENSSL_free(dataB); | 814 | free(dataB); |
815 | return(1); | 815 | return(1); |
816 | err: | 816 | err: |
817 | BUF_MEM_free(nameB); | 817 | BUF_MEM_free(nameB); |
diff --git a/src/lib/libcrypto/pem/pem_oth.c b/src/lib/libcrypto/pem/pem_oth.c index b33868d25a..69d281aa9d 100644 --- a/src/lib/libcrypto/pem/pem_oth.c +++ b/src/lib/libcrypto/pem/pem_oth.c | |||
@@ -81,6 +81,6 @@ void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, | |||
81 | ret=d2i(x,&p,len); | 81 | ret=d2i(x,&p,len); |
82 | if (ret == NULL) | 82 | if (ret == NULL) |
83 | PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB); | 83 | PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB); |
84 | OPENSSL_free(data); | 84 | free(data); |
85 | return(ret); | 85 | return(ret); |
86 | } | 86 | } |
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c index ef152be264..a3b609b2f3 100644 --- a/src/lib/libcrypto/pem/pem_pkey.c +++ b/src/lib/libcrypto/pem/pem_pkey.c | |||
@@ -131,9 +131,9 @@ p8err: | |||
131 | if (ret == NULL) | 131 | if (ret == NULL) |
132 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB); | 132 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB); |
133 | err: | 133 | err: |
134 | OPENSSL_free(nm); | 134 | free(nm); |
135 | OPENSSL_cleanse(data, len); | 135 | OPENSSL_cleanse(data, len); |
136 | OPENSSL_free(data); | 136 | free(data); |
137 | return(ret); | 137 | return(ret); |
138 | } | 138 | } |
139 | 139 | ||
@@ -188,8 +188,8 @@ EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x) | |||
188 | err: | 188 | err: |
189 | if (ret == NULL) | 189 | if (ret == NULL) |
190 | PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB); | 190 | PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB); |
191 | OPENSSL_free(nm); | 191 | free(nm); |
192 | OPENSSL_free(data); | 192 | free(data); |
193 | return(ret); | 193 | return(ret); |
194 | } | 194 | } |
195 | 195 | ||
diff --git a/src/lib/libcrypto/pem/pem_seal.c b/src/lib/libcrypto/pem/pem_seal.c index b6b4e13498..bac7b16b44 100644 --- a/src/lib/libcrypto/pem/pem_seal.c +++ b/src/lib/libcrypto/pem/pem_seal.c | |||
@@ -86,7 +86,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
86 | j=RSA_size(pubk[i]->pkey.rsa); | 86 | j=RSA_size(pubk[i]->pkey.rsa); |
87 | if (j > max) max=j; | 87 | if (j > max) max=j; |
88 | } | 88 | } |
89 | s=(char *)OPENSSL_malloc(max*2); | 89 | s=(char *)malloc(max*2); |
90 | if (s == NULL) | 90 | if (s == NULL) |
91 | { | 91 | { |
92 | PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE); | 92 | PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE); |
@@ -114,7 +114,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
114 | 114 | ||
115 | ret=npubk; | 115 | ret=npubk; |
116 | err: | 116 | err: |
117 | if (s != NULL) OPENSSL_free(s); | 117 | if (s != NULL) free(s); |
118 | OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH); | 118 | OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH); |
119 | return(ret); | 119 | return(ret); |
120 | } | 120 | } |
@@ -157,7 +157,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, | |||
157 | } | 157 | } |
158 | i=RSA_size(priv->pkey.rsa); | 158 | i=RSA_size(priv->pkey.rsa); |
159 | if (i < 100) i=100; | 159 | if (i < 100) i=100; |
160 | s=(unsigned char *)OPENSSL_malloc(i*2); | 160 | s=(unsigned char *)malloc(i*2); |
161 | if (s == NULL) | 161 | if (s == NULL) |
162 | { | 162 | { |
163 | PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE); | 163 | PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE); |
@@ -179,7 +179,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, | |||
179 | err: | 179 | err: |
180 | EVP_MD_CTX_cleanup(&ctx->md); | 180 | EVP_MD_CTX_cleanup(&ctx->md); |
181 | EVP_CIPHER_CTX_cleanup(&ctx->cipher); | 181 | EVP_CIPHER_CTX_cleanup(&ctx->cipher); |
182 | if (s != NULL) OPENSSL_free(s); | 182 | if (s != NULL) free(s); |
183 | return(ret); | 183 | return(ret); |
184 | } | 184 | } |
185 | #else /* !OPENSSL_NO_RSA */ | 185 | #else /* !OPENSSL_NO_RSA */ |
diff --git a/src/lib/libcrypto/pem/pem_sign.c b/src/lib/libcrypto/pem/pem_sign.c index c3b9808cb2..cbd3cd0793 100644 --- a/src/lib/libcrypto/pem/pem_sign.c +++ b/src/lib/libcrypto/pem/pem_sign.c | |||
@@ -82,7 +82,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
82 | int i,ret=0; | 82 | int i,ret=0; |
83 | unsigned int m_len; | 83 | unsigned int m_len; |
84 | 84 | ||
85 | m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2); | 85 | m=(unsigned char *)malloc(EVP_PKEY_size(pkey)+2); |
86 | if (m == NULL) | 86 | if (m == NULL) |
87 | { | 87 | { |
88 | PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE); | 88 | PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE); |
@@ -96,7 +96,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
96 | ret=1; | 96 | ret=1; |
97 | err: | 97 | err: |
98 | /* ctx has been zeroed by EVP_SignFinal() */ | 98 | /* ctx has been zeroed by EVP_SignFinal() */ |
99 | if (m != NULL) OPENSSL_free(m); | 99 | if (m != NULL) free(m); |
100 | return(ret); | 100 | return(ret); |
101 | } | 101 | } |
102 | 102 | ||
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c index b1bf71a5da..8da8e77973 100644 --- a/src/lib/libcrypto/pem/pvkfmt.c +++ b/src/lib/libcrypto/pem/pvkfmt.c | |||
@@ -93,14 +93,14 @@ static int read_lebn(const unsigned char **in, unsigned int nbyte, BIGNUM **r) | |||
93 | unsigned char *tmpbuf, *q; | 93 | unsigned char *tmpbuf, *q; |
94 | unsigned int i; | 94 | unsigned int i; |
95 | p = *in + nbyte - 1; | 95 | p = *in + nbyte - 1; |
96 | tmpbuf = OPENSSL_malloc(nbyte); | 96 | tmpbuf = malloc(nbyte); |
97 | if (!tmpbuf) | 97 | if (!tmpbuf) |
98 | return 0; | 98 | return 0; |
99 | q = tmpbuf; | 99 | q = tmpbuf; |
100 | for (i = 0; i < nbyte; i++) | 100 | for (i = 0; i < nbyte; i++) |
101 | *q++ = *p--; | 101 | *q++ = *p--; |
102 | *r = BN_bin2bn(tmpbuf, nbyte, NULL); | 102 | *r = BN_bin2bn(tmpbuf, nbyte, NULL); |
103 | OPENSSL_free(tmpbuf); | 103 | free(tmpbuf); |
104 | if (*r) | 104 | if (*r) |
105 | { | 105 | { |
106 | *in += nbyte; | 106 | *in += nbyte; |
@@ -284,7 +284,7 @@ static EVP_PKEY *do_b2i_bio(BIO *in, int ispub) | |||
284 | return NULL; | 284 | return NULL; |
285 | 285 | ||
286 | length = blob_length(bitlen, isdss, ispub); | 286 | length = blob_length(bitlen, isdss, ispub); |
287 | buf = OPENSSL_malloc(length); | 287 | buf = malloc(length); |
288 | if (!buf) | 288 | if (!buf) |
289 | { | 289 | { |
290 | PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE); | 290 | PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE); |
@@ -304,7 +304,7 @@ static EVP_PKEY *do_b2i_bio(BIO *in, int ispub) | |||
304 | 304 | ||
305 | err: | 305 | err: |
306 | if (buf) | 306 | if (buf) |
307 | OPENSSL_free(buf); | 307 | free(buf); |
308 | return ret; | 308 | return ret; |
309 | } | 309 | } |
310 | 310 | ||
@@ -508,7 +508,7 @@ static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub) | |||
508 | p = *out; | 508 | p = *out; |
509 | else | 509 | else |
510 | { | 510 | { |
511 | p = OPENSSL_malloc(outlen); | 511 | p = malloc(outlen); |
512 | if (!p) | 512 | if (!p) |
513 | return -1; | 513 | return -1; |
514 | *out = p; | 514 | *out = p; |
@@ -541,7 +541,7 @@ static int do_i2b_bio(BIO *out, EVP_PKEY *pk, int ispub) | |||
541 | if (outlen < 0) | 541 | if (outlen < 0) |
542 | return -1; | 542 | return -1; |
543 | wrlen = BIO_write(out, tmp, outlen); | 543 | wrlen = BIO_write(out, tmp, outlen); |
544 | OPENSSL_free(tmp); | 544 | free(tmp); |
545 | if (wrlen == outlen) | 545 | if (wrlen == outlen) |
546 | return outlen; | 546 | return outlen; |
547 | return -1; | 547 | return -1; |
@@ -746,7 +746,7 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in, | |||
746 | PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ); | 746 | PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ); |
747 | return NULL; | 747 | return NULL; |
748 | } | 748 | } |
749 | enctmp = OPENSSL_malloc(keylen + 8); | 749 | enctmp = malloc(keylen + 8); |
750 | if (!enctmp) | 750 | if (!enctmp) |
751 | { | 751 | { |
752 | PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); | 752 | PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); |
@@ -797,7 +797,7 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in, | |||
797 | err: | 797 | err: |
798 | EVP_CIPHER_CTX_cleanup(&cctx); | 798 | EVP_CIPHER_CTX_cleanup(&cctx); |
799 | if (enctmp && saltlen) | 799 | if (enctmp && saltlen) |
800 | OPENSSL_free(enctmp); | 800 | free(enctmp); |
801 | return ret; | 801 | return ret; |
802 | } | 802 | } |
803 | 803 | ||
@@ -819,7 +819,7 @@ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u) | |||
819 | if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) | 819 | if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) |
820 | return 0; | 820 | return 0; |
821 | buflen = (int) keylen + saltlen; | 821 | buflen = (int) keylen + saltlen; |
822 | buf = OPENSSL_malloc(buflen); | 822 | buf = malloc(buflen); |
823 | if (!buf) | 823 | if (!buf) |
824 | { | 824 | { |
825 | PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE); | 825 | PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE); |
@@ -837,7 +837,7 @@ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u) | |||
837 | if (buf) | 837 | if (buf) |
838 | { | 838 | { |
839 | OPENSSL_cleanse(buf, buflen); | 839 | OPENSSL_cleanse(buf, buflen); |
840 | OPENSSL_free(buf); | 840 | free(buf); |
841 | } | 841 | } |
842 | return ret; | 842 | return ret; |
843 | } | 843 | } |
@@ -863,7 +863,7 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel, | |||
863 | p = *out; | 863 | p = *out; |
864 | else | 864 | else |
865 | { | 865 | { |
866 | p = OPENSSL_malloc(outlen); | 866 | p = malloc(outlen); |
867 | if (!p) | 867 | if (!p) |
868 | { | 868 | { |
869 | PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE); | 869 | PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE); |
@@ -936,7 +936,7 @@ int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, | |||
936 | if (outlen < 0) | 936 | if (outlen < 0) |
937 | return -1; | 937 | return -1; |
938 | wrlen = BIO_write(out, tmp, outlen); | 938 | wrlen = BIO_write(out, tmp, outlen); |
939 | OPENSSL_free(tmp); | 939 | free(tmp); |
940 | if (wrlen == outlen) | 940 | if (wrlen == outlen) |
941 | { | 941 | { |
942 | PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE); | 942 | PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE); |
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c index 9d3557e8d7..9a73c21866 100644 --- a/src/lib/libcrypto/pkcs12/p12_decr.c +++ b/src/lib/libcrypto/pkcs12/p12_decr.c | |||
@@ -65,7 +65,7 @@ | |||
65 | 65 | ||
66 | 66 | ||
67 | /* Encrypt/Decrypt a buffer based on password and algor, result in a | 67 | /* Encrypt/Decrypt a buffer based on password and algor, result in a |
68 | * OPENSSL_malloc'ed buffer | 68 | * malloc'ed buffer |
69 | */ | 69 | */ |
70 | 70 | ||
71 | unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | 71 | unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, |
@@ -84,14 +84,14 @@ unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | |||
84 | return NULL; | 84 | return NULL; |
85 | } | 85 | } |
86 | 86 | ||
87 | if(!(out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) { | 87 | if(!(out = malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) { |
88 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE); | 88 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE); |
89 | goto err; | 89 | goto err; |
90 | } | 90 | } |
91 | 91 | ||
92 | if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen)) | 92 | if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen)) |
93 | { | 93 | { |
94 | OPENSSL_free(out); | 94 | free(out); |
95 | out = NULL; | 95 | out = NULL; |
96 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB); | 96 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB); |
97 | goto err; | 97 | goto err; |
@@ -99,7 +99,7 @@ unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | |||
99 | 99 | ||
100 | outlen = i; | 100 | outlen = i; |
101 | if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) { | 101 | if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) { |
102 | OPENSSL_free(out); | 102 | free(out); |
103 | out = NULL; | 103 | out = NULL; |
104 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR); | 104 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR); |
105 | goto err; | 105 | goto err; |
@@ -146,7 +146,7 @@ void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, | |||
146 | ret = ASN1_item_d2i(NULL, &p, outlen, it); | 146 | ret = ASN1_item_d2i(NULL, &p, outlen, it); |
147 | if (zbuf) OPENSSL_cleanse(out, outlen); | 147 | if (zbuf) OPENSSL_cleanse(out, outlen); |
148 | if(!ret) PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,PKCS12_R_DECODE_ERROR); | 148 | if(!ret) PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,PKCS12_R_DECODE_ERROR); |
149 | OPENSSL_free(out); | 149 | free(out); |
150 | return ret; | 150 | return ret; |
151 | } | 151 | } |
152 | 152 | ||
@@ -173,11 +173,11 @@ ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *i | |||
173 | if (!PKCS12_pbe_crypt(algor, pass, passlen, in, inlen, &oct->data, | 173 | if (!PKCS12_pbe_crypt(algor, pass, passlen, in, inlen, &oct->data, |
174 | &oct->length, 1)) { | 174 | &oct->length, 1)) { |
175 | PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR); | 175 | PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR); |
176 | OPENSSL_free(in); | 176 | free(in); |
177 | return NULL; | 177 | return NULL; |
178 | } | 178 | } |
179 | if (zbuf) OPENSSL_cleanse(in, inlen); | 179 | if (zbuf) OPENSSL_cleanse(in, inlen); |
180 | OPENSSL_free(in); | 180 | free(in); |
181 | return oct; | 181 | return oct; |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index 61d58502fd..b3672a95e5 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
@@ -95,7 +95,7 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, | |||
95 | return 0; | 95 | return 0; |
96 | if(unipass) { | 96 | if(unipass) { |
97 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ | 97 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ |
98 | OPENSSL_free(unipass); | 98 | free(unipass); |
99 | } | 99 | } |
100 | return ret; | 100 | return ret; |
101 | } | 101 | } |
@@ -135,14 +135,14 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
135 | u = EVP_MD_size (md_type); | 135 | u = EVP_MD_size (md_type); |
136 | if (u < 0) | 136 | if (u < 0) |
137 | return 0; | 137 | return 0; |
138 | D = OPENSSL_malloc (v); | 138 | D = malloc (v); |
139 | Ai = OPENSSL_malloc (u); | 139 | Ai = malloc (u); |
140 | B = OPENSSL_malloc (v + 1); | 140 | B = malloc (v + 1); |
141 | Slen = v * ((saltlen+v-1)/v); | 141 | Slen = v * ((saltlen+v-1)/v); |
142 | if(passlen) Plen = v * ((passlen+v-1)/v); | 142 | if(passlen) Plen = v * ((passlen+v-1)/v); |
143 | else Plen = 0; | 143 | else Plen = 0; |
144 | Ilen = Slen + Plen; | 144 | Ilen = Slen + Plen; |
145 | I = OPENSSL_malloc (Ilen); | 145 | I = malloc (Ilen); |
146 | Ij = BN_new(); | 146 | Ij = BN_new(); |
147 | Bpl1 = BN_new(); | 147 | Bpl1 = BN_new(); |
148 | if (!D || !Ai || !B || !I || !Ij || !Bpl1) | 148 | if (!D || !Ai || !B || !I || !Ij || !Bpl1) |
@@ -209,10 +209,10 @@ err: | |||
209 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); | 209 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); |
210 | 210 | ||
211 | end: | 211 | end: |
212 | OPENSSL_free (Ai); | 212 | free (Ai); |
213 | OPENSSL_free (B); | 213 | free (B); |
214 | OPENSSL_free (D); | 214 | free (D); |
215 | OPENSSL_free (I); | 215 | free (I); |
216 | BN_free (Ij); | 216 | BN_free (Ij); |
217 | BN_free (Bpl1); | 217 | BN_free (Bpl1); |
218 | EVP_MD_CTX_cleanup(&ctx); | 218 | EVP_MD_CTX_cleanup(&ctx); |
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index 206b1b0b18..bc1fcff45d 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
@@ -271,7 +271,7 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
271 | len = ASN1_STRING_to_UTF8(&data, fname); | 271 | len = ASN1_STRING_to_UTF8(&data, fname); |
272 | if(len > 0) { | 272 | if(len > 0) { |
273 | r = X509_alias_set1(x509, data, len); | 273 | r = X509_alias_set1(x509, data, len); |
274 | OPENSSL_free(data); | 274 | free(data); |
275 | if (!r) | 275 | if (!r) |
276 | { | 276 | { |
277 | X509_free(x509); | 277 | X509_free(x509); |
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index 96de1bd11e..98128e31cb 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
@@ -169,7 +169,7 @@ int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, | |||
169 | } | 169 | } |
170 | if (!saltlen) saltlen = PKCS12_SALT_LEN; | 170 | if (!saltlen) saltlen = PKCS12_SALT_LEN; |
171 | p12->mac->salt->length = saltlen; | 171 | p12->mac->salt->length = saltlen; |
172 | if (!(p12->mac->salt->data = OPENSSL_malloc (saltlen))) { | 172 | if (!(p12->mac->salt->data = malloc (saltlen))) { |
173 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); | 173 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_utl.c b/src/lib/libcrypto/pkcs12/p12_utl.c index 59c6f453f6..9c58036169 100644 --- a/src/lib/libcrypto/pkcs12/p12_utl.c +++ b/src/lib/libcrypto/pkcs12/p12_utl.c | |||
@@ -68,7 +68,7 @@ unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, | |||
68 | unsigned char *unitmp; | 68 | unsigned char *unitmp; |
69 | if (asclen == -1) asclen = strlen(asc); | 69 | if (asclen == -1) asclen = strlen(asc); |
70 | ulen = asclen*2 + 2; | 70 | ulen = asclen*2 + 2; |
71 | if (!(unitmp = OPENSSL_malloc(ulen))) return NULL; | 71 | if (!(unitmp = malloc(ulen))) return NULL; |
72 | for (i = 0; i < ulen - 2; i+=2) { | 72 | for (i = 0; i < ulen - 2; i+=2) { |
73 | unitmp[i] = 0; | 73 | unitmp[i] = 0; |
74 | unitmp[i + 1] = asc[i>>1]; | 74 | unitmp[i + 1] = asc[i>>1]; |
@@ -89,7 +89,7 @@ char *OPENSSL_uni2asc(unsigned char *uni, int unilen) | |||
89 | /* If no terminating zero allow for one */ | 89 | /* If no terminating zero allow for one */ |
90 | if (!unilen || uni[unilen - 1]) asclen++; | 90 | if (!unilen || uni[unilen - 1]) asclen++; |
91 | uni++; | 91 | uni++; |
92 | if (!(asctmp = OPENSSL_malloc(asclen))) return NULL; | 92 | if (!(asctmp = malloc(asclen))) return NULL; |
93 | for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i]; | 93 | for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i]; |
94 | asctmp[asclen - 1] = 0; | 94 | asctmp[asclen - 1] = 0; |
95 | return asctmp; | 95 | return asctmp; |
diff --git a/src/lib/libcrypto/pkcs7/bio_ber.c b/src/lib/libcrypto/pkcs7/bio_ber.c index 31973fcd1f..04dc5c9b96 100644 --- a/src/lib/libcrypto/pkcs7/bio_ber.c +++ b/src/lib/libcrypto/pkcs7/bio_ber.c | |||
@@ -128,7 +128,7 @@ static int ber_new(BIO *bi) | |||
128 | { | 128 | { |
129 | BIO_BER_CTX *ctx; | 129 | BIO_BER_CTX *ctx; |
130 | 130 | ||
131 | ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX)); | 131 | ctx=(BIO_BER_CTX *)malloc(sizeof(BIO_BER_CTX)); |
132 | if (ctx == NULL) return(0); | 132 | if (ctx == NULL) return(0); |
133 | 133 | ||
134 | memset((char *)ctx,0,sizeof(BIO_BER_CTX)); | 134 | memset((char *)ctx,0,sizeof(BIO_BER_CTX)); |
@@ -146,7 +146,7 @@ static int ber_free(BIO *a) | |||
146 | if (a == NULL) return(0); | 146 | if (a == NULL) return(0); |
147 | b=(BIO_BER_CTX *)a->ptr; | 147 | b=(BIO_BER_CTX *)a->ptr; |
148 | OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX)); | 148 | OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX)); |
149 | OPENSSL_free(a->ptr); | 149 | free(a->ptr); |
150 | a->ptr=NULL; | 150 | a->ptr=NULL; |
151 | a->init=0; | 151 | a->init=0; |
152 | a->flags=0; | 152 | a->flags=0; |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 77fda3b82a..396a863f3b 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
@@ -169,7 +169,7 @@ static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, | |||
169 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0) | 169 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0) |
170 | goto err; | 170 | goto err; |
171 | 171 | ||
172 | ek = OPENSSL_malloc(eklen); | 172 | ek = malloc(eklen); |
173 | 173 | ||
174 | if (ek == NULL) | 174 | if (ek == NULL) |
175 | { | 175 | { |
@@ -191,7 +191,7 @@ static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, | |||
191 | if (pctx) | 191 | if (pctx) |
192 | EVP_PKEY_CTX_free(pctx); | 192 | EVP_PKEY_CTX_free(pctx); |
193 | if (ek) | 193 | if (ek) |
194 | OPENSSL_free(ek); | 194 | free(ek); |
195 | return ret; | 195 | return ret; |
196 | 196 | ||
197 | } | 197 | } |
@@ -224,7 +224,7 @@ static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | |||
224 | ri->enc_key->data, ri->enc_key->length) <= 0) | 224 | ri->enc_key->data, ri->enc_key->length) <= 0) |
225 | goto err; | 225 | goto err; |
226 | 226 | ||
227 | ek = OPENSSL_malloc(eklen); | 227 | ek = malloc(eklen); |
228 | 228 | ||
229 | if (ek == NULL) | 229 | if (ek == NULL) |
230 | { | 230 | { |
@@ -245,7 +245,7 @@ static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | |||
245 | if (*pek) | 245 | if (*pek) |
246 | { | 246 | { |
247 | OPENSSL_cleanse(*pek, *peklen); | 247 | OPENSSL_cleanse(*pek, *peklen); |
248 | OPENSSL_free(*pek); | 248 | free(*pek); |
249 | } | 249 | } |
250 | 250 | ||
251 | *pek = ek; | 251 | *pek = ek; |
@@ -255,7 +255,7 @@ static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | |||
255 | if (pctx) | 255 | if (pctx) |
256 | EVP_PKEY_CTX_free(pctx); | 256 | EVP_PKEY_CTX_free(pctx); |
257 | if (!ret && ek) | 257 | if (!ret && ek) |
258 | OPENSSL_free(ek); | 258 | free(ek); |
259 | 259 | ||
260 | return ret; | 260 | return ret; |
261 | } | 261 | } |
@@ -573,7 +573,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
573 | goto err; | 573 | goto err; |
574 | /* Generate random key as MMA defence */ | 574 | /* Generate random key as MMA defence */ |
575 | tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); | 575 | tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); |
576 | tkey = OPENSSL_malloc(tkeylen); | 576 | tkey = malloc(tkeylen); |
577 | if (!tkey) | 577 | if (!tkey) |
578 | goto err; | 578 | goto err; |
579 | if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) | 579 | if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) |
@@ -594,7 +594,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
594 | { | 594 | { |
595 | /* Use random key as MMA defence */ | 595 | /* Use random key as MMA defence */ |
596 | OPENSSL_cleanse(ek, eklen); | 596 | OPENSSL_cleanse(ek, eklen); |
597 | OPENSSL_free(ek); | 597 | free(ek); |
598 | ek = tkey; | 598 | ek = tkey; |
599 | eklen = tkeylen; | 599 | eklen = tkeylen; |
600 | tkey = NULL; | 600 | tkey = NULL; |
@@ -608,13 +608,13 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
608 | if (ek) | 608 | if (ek) |
609 | { | 609 | { |
610 | OPENSSL_cleanse(ek,eklen); | 610 | OPENSSL_cleanse(ek,eklen); |
611 | OPENSSL_free(ek); | 611 | free(ek); |
612 | ek = NULL; | 612 | ek = NULL; |
613 | } | 613 | } |
614 | if (tkey) | 614 | if (tkey) |
615 | { | 615 | { |
616 | OPENSSL_cleanse(tkey,tkeylen); | 616 | OPENSSL_cleanse(tkey,tkeylen); |
617 | OPENSSL_free(tkey); | 617 | free(tkey); |
618 | tkey = NULL; | 618 | tkey = NULL; |
619 | } | 619 | } |
620 | 620 | ||
@@ -661,12 +661,12 @@ err: | |||
661 | if (ek) | 661 | if (ek) |
662 | { | 662 | { |
663 | OPENSSL_cleanse(ek,eklen); | 663 | OPENSSL_cleanse(ek,eklen); |
664 | OPENSSL_free(ek); | 664 | free(ek); |
665 | } | 665 | } |
666 | if (tkey) | 666 | if (tkey) |
667 | { | 667 | { |
668 | OPENSSL_cleanse(tkey,tkeylen); | 668 | OPENSSL_cleanse(tkey,tkeylen); |
669 | OPENSSL_free(tkey); | 669 | free(tkey); |
670 | } | 670 | } |
671 | if (out != NULL) BIO_free_all(out); | 671 | if (out != NULL) BIO_free_all(out); |
672 | if (btmp != NULL) BIO_free_all(btmp); | 672 | if (btmp != NULL) BIO_free_all(btmp); |
@@ -846,7 +846,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
846 | unsigned char *abuf = NULL; | 846 | unsigned char *abuf = NULL; |
847 | unsigned int abuflen; | 847 | unsigned int abuflen; |
848 | abuflen = EVP_PKEY_size(si->pkey); | 848 | abuflen = EVP_PKEY_size(si->pkey); |
849 | abuf = OPENSSL_malloc(abuflen); | 849 | abuf = malloc(abuflen); |
850 | if (!abuf) | 850 | if (!abuf) |
851 | goto err; | 851 | goto err; |
852 | 852 | ||
@@ -927,10 +927,10 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) | |||
927 | goto err; | 927 | goto err; |
928 | if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) | 928 | if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) |
929 | goto err; | 929 | goto err; |
930 | OPENSSL_free(abuf); | 930 | free(abuf); |
931 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) | 931 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) |
932 | goto err; | 932 | goto err; |
933 | abuf = OPENSSL_malloc(siglen); | 933 | abuf = malloc(siglen); |
934 | if(!abuf) | 934 | if(!abuf) |
935 | goto err; | 935 | goto err; |
936 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) | 936 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) |
@@ -951,7 +951,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) | |||
951 | 951 | ||
952 | err: | 952 | err: |
953 | if (abuf) | 953 | if (abuf) |
954 | OPENSSL_free(abuf); | 954 | free(abuf); |
955 | EVP_MD_CTX_cleanup(&mctx); | 955 | EVP_MD_CTX_cleanup(&mctx); |
956 | return 0; | 956 | return 0; |
957 | 957 | ||
@@ -1113,7 +1113,7 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
1113 | if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) | 1113 | if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) |
1114 | goto err; | 1114 | goto err; |
1115 | 1115 | ||
1116 | OPENSSL_free(abuf); | 1116 | free(abuf); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | os=si->enc_digest; | 1119 | os=si->enc_digest; |
diff --git a/src/lib/libcrypto/pqueue/pqueue.c b/src/lib/libcrypto/pqueue/pqueue.c index eab13a1250..3ca8e049e4 100644 --- a/src/lib/libcrypto/pqueue/pqueue.c +++ b/src/lib/libcrypto/pqueue/pqueue.c | |||
@@ -70,7 +70,7 @@ typedef struct _pqueue | |||
70 | pitem * | 70 | pitem * |
71 | pitem_new(unsigned char *prio64be, void *data) | 71 | pitem_new(unsigned char *prio64be, void *data) |
72 | { | 72 | { |
73 | pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem)); | 73 | pitem *item = (pitem *) malloc(sizeof(pitem)); |
74 | if (item == NULL) return NULL; | 74 | if (item == NULL) return NULL; |
75 | 75 | ||
76 | memcpy(item->priority,prio64be,sizeof(item->priority)); | 76 | memcpy(item->priority,prio64be,sizeof(item->priority)); |
@@ -86,13 +86,13 @@ pitem_free(pitem *item) | |||
86 | { | 86 | { |
87 | if (item == NULL) return; | 87 | if (item == NULL) return; |
88 | 88 | ||
89 | OPENSSL_free(item); | 89 | free(item); |
90 | } | 90 | } |
91 | 91 | ||
92 | pqueue_s * | 92 | pqueue_s * |
93 | pqueue_new() | 93 | pqueue_new() |
94 | { | 94 | { |
95 | pqueue_s *pq = (pqueue_s *) OPENSSL_malloc(sizeof(pqueue_s)); | 95 | pqueue_s *pq = (pqueue_s *) malloc(sizeof(pqueue_s)); |
96 | if (pq == NULL) return NULL; | 96 | if (pq == NULL) return NULL; |
97 | 97 | ||
98 | memset(pq, 0x00, sizeof(pqueue_s)); | 98 | memset(pq, 0x00, sizeof(pqueue_s)); |
@@ -104,7 +104,7 @@ pqueue_free(pqueue_s *pq) | |||
104 | { | 104 | { |
105 | if (pq == NULL) return; | 105 | if (pq == NULL) return; |
106 | 106 | ||
107 | OPENSSL_free(pq); | 107 | free(pq); |
108 | } | 108 | } |
109 | 109 | ||
110 | pitem * | 110 | pitem * |
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 5a2062f903..fdd11835ad 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
@@ -78,7 +78,7 @@ static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
78 | V_ASN1_NULL, NULL, penc, penclen)) | 78 | V_ASN1_NULL, NULL, penc, penclen)) |
79 | return 1; | 79 | return 1; |
80 | 80 | ||
81 | OPENSSL_free(penc); | 81 | free(penc); |
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
@@ -201,7 +201,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
201 | update_buflen(x->iqmp, &buf_len); | 201 | update_buflen(x->iqmp, &buf_len); |
202 | } | 202 | } |
203 | 203 | ||
204 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | 204 | m=(unsigned char *)malloc(buf_len+10); |
205 | if (m == NULL) | 205 | if (m == NULL) |
206 | { | 206 | { |
207 | RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE); | 207 | RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE); |
@@ -248,7 +248,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
248 | } | 248 | } |
249 | ret=1; | 249 | ret=1; |
250 | err: | 250 | err: |
251 | if (m != NULL) OPENSSL_free(m); | 251 | if (m != NULL) free(m); |
252 | return(ret); | 252 | return(ret); |
253 | } | 253 | } |
254 | 254 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 88ee2cb557..dcf0c16a8f 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -185,7 +185,7 @@ static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | |||
185 | f = BN_CTX_get(ctx); | 185 | f = BN_CTX_get(ctx); |
186 | ret = BN_CTX_get(ctx); | 186 | ret = BN_CTX_get(ctx); |
187 | num=BN_num_bytes(rsa->n); | 187 | num=BN_num_bytes(rsa->n); |
188 | buf = OPENSSL_malloc(num); | 188 | buf = malloc(num); |
189 | if (!f || !ret || !buf) | 189 | if (!f || !ret || !buf) |
190 | { | 190 | { |
191 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); | 191 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); |
@@ -247,7 +247,7 @@ err: | |||
247 | if (buf != NULL) | 247 | if (buf != NULL) |
248 | { | 248 | { |
249 | OPENSSL_cleanse(buf,num); | 249 | OPENSSL_cleanse(buf,num); |
250 | OPENSSL_free(buf); | 250 | free(buf); |
251 | } | 251 | } |
252 | return(r); | 252 | return(r); |
253 | } | 253 | } |
@@ -366,7 +366,7 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | |||
366 | f = BN_CTX_get(ctx); | 366 | f = BN_CTX_get(ctx); |
367 | ret = BN_CTX_get(ctx); | 367 | ret = BN_CTX_get(ctx); |
368 | num = BN_num_bytes(rsa->n); | 368 | num = BN_num_bytes(rsa->n); |
369 | buf = OPENSSL_malloc(num); | 369 | buf = malloc(num); |
370 | if(!f || !ret || !buf) | 370 | if(!f || !ret || !buf) |
371 | { | 371 | { |
372 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); | 372 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); |
@@ -484,7 +484,7 @@ err: | |||
484 | if (buf != NULL) | 484 | if (buf != NULL) |
485 | { | 485 | { |
486 | OPENSSL_cleanse(buf,num); | 486 | OPENSSL_cleanse(buf,num); |
487 | OPENSSL_free(buf); | 487 | free(buf); |
488 | } | 488 | } |
489 | return(r); | 489 | return(r); |
490 | } | 490 | } |
@@ -509,7 +509,7 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | |||
509 | f = BN_CTX_get(ctx); | 509 | f = BN_CTX_get(ctx); |
510 | ret = BN_CTX_get(ctx); | 510 | ret = BN_CTX_get(ctx); |
511 | num = BN_num_bytes(rsa->n); | 511 | num = BN_num_bytes(rsa->n); |
512 | buf = OPENSSL_malloc(num); | 512 | buf = malloc(num); |
513 | if(!f || !ret || !buf) | 513 | if(!f || !ret || !buf) |
514 | { | 514 | { |
515 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); | 515 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); |
@@ -624,7 +624,7 @@ err: | |||
624 | if (buf != NULL) | 624 | if (buf != NULL) |
625 | { | 625 | { |
626 | OPENSSL_cleanse(buf,num); | 626 | OPENSSL_cleanse(buf,num); |
627 | OPENSSL_free(buf); | 627 | free(buf); |
628 | } | 628 | } |
629 | return(r); | 629 | return(r); |
630 | } | 630 | } |
@@ -666,7 +666,7 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from, | |||
666 | f = BN_CTX_get(ctx); | 666 | f = BN_CTX_get(ctx); |
667 | ret = BN_CTX_get(ctx); | 667 | ret = BN_CTX_get(ctx); |
668 | num=BN_num_bytes(rsa->n); | 668 | num=BN_num_bytes(rsa->n); |
669 | buf = OPENSSL_malloc(num); | 669 | buf = malloc(num); |
670 | if(!f || !ret || !buf) | 670 | if(!f || !ret || !buf) |
671 | { | 671 | { |
672 | RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE); | 672 | RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE); |
@@ -729,7 +729,7 @@ err: | |||
729 | if (buf != NULL) | 729 | if (buf != NULL) |
730 | { | 730 | { |
731 | OPENSSL_cleanse(buf,num); | 731 | OPENSSL_cleanse(buf,num); |
732 | OPENSSL_free(buf); | 732 | free(buf); |
733 | } | 733 | } |
734 | return(r); | 734 | return(r); |
735 | } | 735 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 9e3f7dafcd..e99a3627dc 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
@@ -125,7 +125,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
125 | { | 125 | { |
126 | RSA *ret; | 126 | RSA *ret; |
127 | 127 | ||
128 | ret=(RSA *)OPENSSL_malloc(sizeof(RSA)); | 128 | ret=(RSA *)malloc(sizeof(RSA)); |
129 | if (ret == NULL) | 129 | if (ret == NULL) |
130 | { | 130 | { |
131 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 131 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -139,7 +139,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
139 | if (!ENGINE_init(engine)) | 139 | if (!ENGINE_init(engine)) |
140 | { | 140 | { |
141 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 141 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
142 | OPENSSL_free(ret); | 142 | free(ret); |
143 | return NULL; | 143 | return NULL; |
144 | } | 144 | } |
145 | ret->engine = engine; | 145 | ret->engine = engine; |
@@ -154,7 +154,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
154 | RSAerr(RSA_F_RSA_NEW_METHOD, | 154 | RSAerr(RSA_F_RSA_NEW_METHOD, |
155 | ERR_R_ENGINE_LIB); | 155 | ERR_R_ENGINE_LIB); |
156 | ENGINE_finish(ret->engine); | 156 | ENGINE_finish(ret->engine); |
157 | OPENSSL_free(ret); | 157 | free(ret); |
158 | return NULL; | 158 | return NULL; |
159 | } | 159 | } |
160 | } | 160 | } |
@@ -184,7 +184,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
184 | if (ret->engine) | 184 | if (ret->engine) |
185 | ENGINE_finish(ret->engine); | 185 | ENGINE_finish(ret->engine); |
186 | #endif | 186 | #endif |
187 | OPENSSL_free(ret); | 187 | free(ret); |
188 | return(NULL); | 188 | return(NULL); |
189 | } | 189 | } |
190 | 190 | ||
@@ -195,7 +195,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
195 | ENGINE_finish(ret->engine); | 195 | ENGINE_finish(ret->engine); |
196 | #endif | 196 | #endif |
197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); | 197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); |
198 | OPENSSL_free(ret); | 198 | free(ret); |
199 | ret=NULL; | 199 | ret=NULL; |
200 | } | 200 | } |
201 | return(ret); | 201 | return(ret); |
@@ -240,7 +240,7 @@ void RSA_free(RSA *r) | |||
240 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | 240 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); |
241 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | 241 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); |
242 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | 242 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); |
243 | OPENSSL_free(r); | 243 | free(r); |
244 | } | 244 | } |
245 | 245 | ||
246 | int RSA_up_ref(RSA *r) | 246 | int RSA_up_ref(RSA *r) |
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index af4d24a56e..a107e89b81 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
@@ -70,7 +70,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
70 | 20); | 70 | 20); |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH); | 73 | dbmask = malloc(emlen - SHA_DIGEST_LENGTH); |
74 | if (dbmask == NULL) | 74 | if (dbmask == NULL) |
75 | { | 75 | { |
76 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | 76 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); |
@@ -87,7 +87,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
87 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 87 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
88 | seed[i] ^= seedmask[i]; | 88 | seed[i] ^= seedmask[i]; |
89 | 89 | ||
90 | OPENSSL_free(dbmask); | 90 | free(dbmask); |
91 | return 1; | 91 | return 1; |
92 | } | 92 | } |
93 | 93 | ||
@@ -121,7 +121,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | dblen = num - SHA_DIGEST_LENGTH; | 123 | dblen = num - SHA_DIGEST_LENGTH; |
124 | db = OPENSSL_malloc(dblen + num); | 124 | db = malloc(dblen + num); |
125 | if (db == NULL) | 125 | if (db == NULL) |
126 | { | 126 | { |
127 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | 127 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); |
@@ -172,14 +172,14 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
172 | memcpy(to, db + i, mlen); | 172 | memcpy(to, db + i, mlen); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | OPENSSL_free(db); | 175 | free(db); |
176 | return mlen; | 176 | return mlen; |
177 | 177 | ||
178 | decoding_err: | 178 | decoding_err: |
179 | /* to avoid chosen ciphertext attacks, the error message should not reveal | 179 | /* to avoid chosen ciphertext attacks, the error message should not reveal |
180 | * which kind of decoding error happened */ | 180 | * which kind of decoding error happened */ |
181 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); | 181 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); |
182 | if (db != NULL) OPENSSL_free(db); | 182 | if (db != NULL) free(db); |
183 | return -1; | 183 | return -1; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index d706d35ff6..adec632b3b 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
@@ -93,7 +93,7 @@ typedef struct | |||
93 | static int pkey_rsa_init(EVP_PKEY_CTX *ctx) | 93 | static int pkey_rsa_init(EVP_PKEY_CTX *ctx) |
94 | { | 94 | { |
95 | RSA_PKEY_CTX *rctx; | 95 | RSA_PKEY_CTX *rctx; |
96 | rctx = OPENSSL_malloc(sizeof(RSA_PKEY_CTX)); | 96 | rctx = malloc(sizeof(RSA_PKEY_CTX)); |
97 | if (!rctx) | 97 | if (!rctx) |
98 | return 0; | 98 | return 0; |
99 | rctx->nbits = 1024; | 99 | rctx->nbits = 1024; |
@@ -135,7 +135,7 @@ static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk) | |||
135 | { | 135 | { |
136 | if (ctx->tbuf) | 136 | if (ctx->tbuf) |
137 | return 1; | 137 | return 1; |
138 | ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey)); | 138 | ctx->tbuf = malloc(EVP_PKEY_size(pk->pkey)); |
139 | if (!ctx->tbuf) | 139 | if (!ctx->tbuf) |
140 | return 0; | 140 | return 0; |
141 | return 1; | 141 | return 1; |
@@ -149,8 +149,8 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) | |||
149 | if (rctx->pub_exp) | 149 | if (rctx->pub_exp) |
150 | BN_free(rctx->pub_exp); | 150 | BN_free(rctx->pub_exp); |
151 | if (rctx->tbuf) | 151 | if (rctx->tbuf) |
152 | OPENSSL_free(rctx->tbuf); | 152 | free(rctx->tbuf); |
153 | OPENSSL_free(rctx); | 153 | free(rctx); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 156 | static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c index 5f9f533d0c..75e8c18533 100644 --- a/src/lib/libcrypto/rsa/rsa_pss.c +++ b/src/lib/libcrypto/rsa/rsa_pss.c | |||
@@ -133,7 +133,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
133 | } | 133 | } |
134 | maskedDBLen = emLen - hLen - 1; | 134 | maskedDBLen = emLen - hLen - 1; |
135 | H = EM + maskedDBLen; | 135 | H = EM + maskedDBLen; |
136 | DB = OPENSSL_malloc(maskedDBLen); | 136 | DB = malloc(maskedDBLen); |
137 | if (!DB) | 137 | if (!DB) |
138 | { | 138 | { |
139 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE); | 139 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE); |
@@ -177,7 +177,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
177 | 177 | ||
178 | err: | 178 | err: |
179 | if (DB) | 179 | if (DB) |
180 | OPENSSL_free(DB); | 180 | free(DB); |
181 | EVP_MD_CTX_cleanup(&ctx); | 181 | EVP_MD_CTX_cleanup(&ctx); |
182 | 182 | ||
183 | return ret; | 183 | return ret; |
@@ -239,7 +239,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | |||
239 | } | 239 | } |
240 | if (sLen > 0) | 240 | if (sLen > 0) |
241 | { | 241 | { |
242 | salt = OPENSSL_malloc(sLen); | 242 | salt = malloc(sLen); |
243 | if (!salt) | 243 | if (!salt) |
244 | { | 244 | { |
245 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE); | 245 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE); |
@@ -289,7 +289,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | |||
289 | 289 | ||
290 | err: | 290 | err: |
291 | if (salt) | 291 | if (salt) |
292 | OPENSSL_free(salt); | 292 | free(salt); |
293 | 293 | ||
294 | return ret; | 294 | return ret; |
295 | 295 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index f98e0a80a6..ee5473a184 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c | |||
@@ -82,7 +82,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, | |||
82 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); | 82 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); |
83 | return(0); | 83 | return(0); |
84 | } | 84 | } |
85 | s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1); | 85 | s=(unsigned char *)malloc((unsigned int)j+1); |
86 | if (s == NULL) | 86 | if (s == NULL) |
87 | { | 87 | { |
88 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); | 88 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); |
@@ -97,7 +97,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, | |||
97 | *siglen=i; | 97 | *siglen=i; |
98 | 98 | ||
99 | OPENSSL_cleanse(s,(unsigned int)j+1); | 99 | OPENSSL_cleanse(s,(unsigned int)j+1); |
100 | OPENSSL_free(s); | 100 | free(s); |
101 | return(ret); | 101 | return(ret); |
102 | } | 102 | } |
103 | 103 | ||
@@ -117,7 +117,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, | |||
117 | return(0); | 117 | return(0); |
118 | } | 118 | } |
119 | 119 | ||
120 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 120 | s=(unsigned char *)malloc((unsigned int)siglen); |
121 | if (s == NULL) | 121 | if (s == NULL) |
122 | { | 122 | { |
123 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); | 123 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); |
@@ -143,7 +143,7 @@ err: | |||
143 | if (s != NULL) | 143 | if (s != NULL) |
144 | { | 144 | { |
145 | OPENSSL_cleanse(s,(unsigned int)siglen); | 145 | OPENSSL_cleanse(s,(unsigned int)siglen); |
146 | OPENSSL_free(s); | 146 | free(s); |
147 | } | 147 | } |
148 | return(ret); | 148 | return(ret); |
149 | } | 149 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index fa3239ab30..71d6bb3ce4 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
@@ -120,7 +120,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
120 | return(0); | 120 | return(0); |
121 | } | 121 | } |
122 | if(type != NID_md5_sha1) { | 122 | if(type != NID_md5_sha1) { |
123 | tmps=(unsigned char *)OPENSSL_malloc((unsigned int)j+1); | 123 | tmps=(unsigned char *)malloc((unsigned int)j+1); |
124 | if (tmps == NULL) | 124 | if (tmps == NULL) |
125 | { | 125 | { |
126 | RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE); | 126 | RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE); |
@@ -138,7 +138,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
138 | 138 | ||
139 | if(type != NID_md5_sha1) { | 139 | if(type != NID_md5_sha1) { |
140 | OPENSSL_cleanse(tmps,(unsigned int)j+1); | 140 | OPENSSL_cleanse(tmps,(unsigned int)j+1); |
141 | OPENSSL_free(tmps); | 141 | free(tmps); |
142 | } | 142 | } |
143 | return(ret); | 143 | return(ret); |
144 | } | 144 | } |
@@ -169,7 +169,7 @@ int int_rsa_verify(int dtype, const unsigned char *m, | |||
169 | return 1; | 169 | return 1; |
170 | } | 170 | } |
171 | 171 | ||
172 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 172 | s=(unsigned char *)malloc((unsigned int)siglen); |
173 | if (s == NULL) | 173 | if (s == NULL) |
174 | { | 174 | { |
175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); | 175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); |
@@ -281,7 +281,7 @@ err: | |||
281 | if (s != NULL) | 281 | if (s != NULL) |
282 | { | 282 | { |
283 | OPENSSL_cleanse(s,(unsigned int)siglen); | 283 | OPENSSL_cleanse(s,(unsigned int)siglen); |
284 | OPENSSL_free(s); | 284 | free(s); |
285 | } | 285 | } |
286 | return(ret); | 286 | return(ret); |
287 | } | 287 | } |
diff --git a/src/lib/libcrypto/srp/srp_lib.c b/src/lib/libcrypto/srp/srp_lib.c index 7c1dcc5111..8cc94f51db 100644 --- a/src/lib/libcrypto/srp/srp_lib.c +++ b/src/lib/libcrypto/srp/srp_lib.c | |||
@@ -89,7 +89,7 @@ static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) | |||
89 | int longg ; | 89 | int longg ; |
90 | int longN = BN_num_bytes(N); | 90 | int longN = BN_num_bytes(N); |
91 | 91 | ||
92 | if ((tmp = OPENSSL_malloc(longN)) == NULL) | 92 | if ((tmp = malloc(longN)) == NULL) |
93 | return NULL; | 93 | return NULL; |
94 | BN_bn2bin(N,tmp) ; | 94 | BN_bn2bin(N,tmp) ; |
95 | 95 | ||
@@ -102,7 +102,7 @@ static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) | |||
102 | /* use the zeros behind to pad on left */ | 102 | /* use the zeros behind to pad on left */ |
103 | EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg); | 103 | EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg); |
104 | EVP_DigestUpdate(&ctxt, tmp, longg); | 104 | EVP_DigestUpdate(&ctxt, tmp, longg); |
105 | OPENSSL_free(tmp); | 105 | free(tmp); |
106 | 106 | ||
107 | EVP_DigestFinal_ex(&ctxt, digest, NULL); | 107 | EVP_DigestFinal_ex(&ctxt, digest, NULL); |
108 | EVP_MD_CTX_cleanup(&ctxt); | 108 | EVP_MD_CTX_cleanup(&ctxt); |
@@ -123,7 +123,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) | |||
123 | 123 | ||
124 | longN= BN_num_bytes(N); | 124 | longN= BN_num_bytes(N); |
125 | 125 | ||
126 | if ((cAB = OPENSSL_malloc(2*longN)) == NULL) | 126 | if ((cAB = malloc(2*longN)) == NULL) |
127 | return NULL; | 127 | return NULL; |
128 | 128 | ||
129 | memset(cAB, 0, longN); | 129 | memset(cAB, 0, longN); |
@@ -132,7 +132,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) | |||
132 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); | 132 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); |
133 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN); | 133 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN); |
134 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN); | 134 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN); |
135 | OPENSSL_free(cAB); | 135 | free(cAB); |
136 | EVP_DigestFinal_ex(&ctxt, cu, NULL); | 136 | EVP_DigestFinal_ex(&ctxt, cu, NULL); |
137 | EVP_MD_CTX_cleanup(&ctxt); | 137 | EVP_MD_CTX_cleanup(&ctxt); |
138 | 138 | ||
@@ -215,7 +215,7 @@ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass) | |||
215 | (pass == NULL)) | 215 | (pass == NULL)) |
216 | return NULL; | 216 | return NULL; |
217 | 217 | ||
218 | if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL) | 218 | if ((cs = malloc(BN_num_bytes(s))) == NULL) |
219 | return NULL; | 219 | return NULL; |
220 | 220 | ||
221 | EVP_MD_CTX_init(&ctxt); | 221 | EVP_MD_CTX_init(&ctxt); |
@@ -228,7 +228,7 @@ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass) | |||
228 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); | 228 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); |
229 | BN_bn2bin(s,cs); | 229 | BN_bn2bin(s,cs); |
230 | EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s)); | 230 | EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s)); |
231 | OPENSSL_free(cs); | 231 | free(cs); |
232 | EVP_DigestUpdate(&ctxt, dig, sizeof(dig)); | 232 | EVP_DigestUpdate(&ctxt, dig, sizeof(dig)); |
233 | EVP_DigestFinal_ex(&ctxt, dig, NULL); | 233 | EVP_DigestFinal_ex(&ctxt, dig, NULL); |
234 | EVP_MD_CTX_cleanup(&ctxt); | 234 | EVP_MD_CTX_cleanup(&ctxt); |
diff --git a/src/lib/libcrypto/srp/srp_vfy.c b/src/lib/libcrypto/srp/srp_vfy.c index 4a3d13edf6..de7dbe5bbd 100644 --- a/src/lib/libcrypto/srp/srp_vfy.c +++ b/src/lib/libcrypto/srp/srp_vfy.c | |||
@@ -185,14 +185,14 @@ static void SRP_user_pwd_free(SRP_user_pwd *user_pwd) | |||
185 | return; | 185 | return; |
186 | BN_free(user_pwd->s); | 186 | BN_free(user_pwd->s); |
187 | BN_clear_free(user_pwd->v); | 187 | BN_clear_free(user_pwd->v); |
188 | OPENSSL_free(user_pwd->id); | 188 | free(user_pwd->id); |
189 | OPENSSL_free(user_pwd->info); | 189 | free(user_pwd->info); |
190 | OPENSSL_free(user_pwd); | 190 | free(user_pwd); |
191 | } | 191 | } |
192 | 192 | ||
193 | static SRP_user_pwd *SRP_user_pwd_new() | 193 | static SRP_user_pwd *SRP_user_pwd_new() |
194 | { | 194 | { |
195 | SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd)); | 195 | SRP_user_pwd *ret = malloc(sizeof(SRP_user_pwd)); |
196 | if (ret == NULL) | 196 | if (ret == NULL) |
197 | return NULL; | 197 | return NULL; |
198 | ret->N = NULL; | 198 | ret->N = NULL; |
@@ -243,14 +243,14 @@ static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v) | |||
243 | 243 | ||
244 | SRP_VBASE *SRP_VBASE_new(char *seed_key) | 244 | SRP_VBASE *SRP_VBASE_new(char *seed_key) |
245 | { | 245 | { |
246 | SRP_VBASE *vb = (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE)); | 246 | SRP_VBASE *vb = (SRP_VBASE *) malloc(sizeof(SRP_VBASE)); |
247 | 247 | ||
248 | if (vb == NULL) | 248 | if (vb == NULL) |
249 | return NULL; | 249 | return NULL; |
250 | if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) || | 250 | if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) || |
251 | !(vb->gN_cache = sk_SRP_gN_cache_new_null())) | 251 | !(vb->gN_cache = sk_SRP_gN_cache_new_null())) |
252 | { | 252 | { |
253 | OPENSSL_free(vb); | 253 | free(vb); |
254 | return NULL; | 254 | return NULL; |
255 | } | 255 | } |
256 | vb->default_g = NULL; | 256 | vb->default_g = NULL; |
@@ -261,7 +261,7 @@ SRP_VBASE *SRP_VBASE_new(char *seed_key) | |||
261 | { | 261 | { |
262 | sk_SRP_user_pwd_free(vb->users_pwd); | 262 | sk_SRP_user_pwd_free(vb->users_pwd); |
263 | sk_SRP_gN_cache_free(vb->gN_cache); | 263 | sk_SRP_gN_cache_free(vb->gN_cache); |
264 | OPENSSL_free(vb); | 264 | free(vb); |
265 | return NULL; | 265 | return NULL; |
266 | } | 266 | } |
267 | return vb; | 267 | return vb; |
@@ -272,8 +272,8 @@ int SRP_VBASE_free(SRP_VBASE *vb) | |||
272 | { | 272 | { |
273 | sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free); | 273 | sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free); |
274 | sk_SRP_gN_cache_free(vb->gN_cache); | 274 | sk_SRP_gN_cache_free(vb->gN_cache); |
275 | OPENSSL_free(vb->seed_key); | 275 | free(vb->seed_key); |
276 | OPENSSL_free(vb); | 276 | free(vb); |
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
279 | 279 | ||
@@ -283,7 +283,7 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch) | |||
283 | unsigned char tmp[MAX_LEN]; | 283 | unsigned char tmp[MAX_LEN]; |
284 | int len; | 284 | int len; |
285 | 285 | ||
286 | SRP_gN_cache *newgN = (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache)); | 286 | SRP_gN_cache *newgN = (SRP_gN_cache *)malloc(sizeof(SRP_gN_cache)); |
287 | if (newgN == NULL) | 287 | if (newgN == NULL) |
288 | return NULL; | 288 | return NULL; |
289 | 289 | ||
@@ -294,9 +294,9 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch) | |||
294 | if ((newgN->bn = BN_bin2bn(tmp, len, NULL))) | 294 | if ((newgN->bn = BN_bin2bn(tmp, len, NULL))) |
295 | return newgN; | 295 | return newgN; |
296 | 296 | ||
297 | OPENSSL_free(newgN->b64_bn); | 297 | free(newgN->b64_bn); |
298 | err: | 298 | err: |
299 | OPENSSL_free(newgN); | 299 | free(newgN); |
300 | return NULL; | 300 | return NULL; |
301 | } | 301 | } |
302 | 302 | ||
@@ -305,9 +305,9 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache) | |||
305 | { | 305 | { |
306 | if (gN_cache == NULL) | 306 | if (gN_cache == NULL) |
307 | return; | 307 | return; |
308 | OPENSSL_free(gN_cache->b64_bn); | 308 | free(gN_cache->b64_bn); |
309 | BN_free(gN_cache->bn); | 309 | BN_free(gN_cache->bn); |
310 | OPENSSL_free(gN_cache); | 310 | free(gN_cache); |
311 | } | 311 | } |
312 | 312 | ||
313 | static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) | 313 | static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) |
@@ -395,7 +395,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) | |||
395 | { | 395 | { |
396 | /*we add this couple in the internal Stack */ | 396 | /*we add this couple in the internal Stack */ |
397 | 397 | ||
398 | if ((gN = (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) == NULL) | 398 | if ((gN = (SRP_gN *)malloc(sizeof(SRP_gN))) == NULL) |
399 | goto err; | 399 | goto err; |
400 | 400 | ||
401 | if (!(gN->id = BUF_strdup(pp[DB_srpid])) | 401 | if (!(gN->id = BUF_strdup(pp[DB_srpid])) |
@@ -456,8 +456,8 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) | |||
456 | 456 | ||
457 | if (gN != NULL) | 457 | if (gN != NULL) |
458 | { | 458 | { |
459 | OPENSSL_free(gN->id); | 459 | free(gN->id); |
460 | OPENSSL_free(gN); | 460 | free(gN); |
461 | } | 461 | } |
462 | 462 | ||
463 | SRP_user_pwd_free(user_pwd); | 463 | SRP_user_pwd_free(user_pwd); |
@@ -573,7 +573,7 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt, | |||
573 | if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err; | 573 | if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err; |
574 | 574 | ||
575 | BN_bn2bin(v,tmp); | 575 | BN_bn2bin(v,tmp); |
576 | if (((vf = OPENSSL_malloc(BN_num_bytes(v)*2)) == NULL)) | 576 | if (((vf = malloc(BN_num_bytes(v)*2)) == NULL)) |
577 | goto err; | 577 | goto err; |
578 | t_tob64(vf, tmp, BN_num_bytes(v)); | 578 | t_tob64(vf, tmp, BN_num_bytes(v)); |
579 | 579 | ||
@@ -582,9 +582,9 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt, | |||
582 | { | 582 | { |
583 | char *tmp_salt; | 583 | char *tmp_salt; |
584 | 584 | ||
585 | if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL) | 585 | if ((tmp_salt = malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL) |
586 | { | 586 | { |
587 | OPENSSL_free(vf); | 587 | free(vf); |
588 | goto err; | 588 | goto err; |
589 | } | 589 | } |
590 | t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN); | 590 | t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN); |
diff --git a/src/lib/libcrypto/stack/stack.c b/src/lib/libcrypto/stack/stack.c index 76cf1a1168..dabf26d2cd 100644 --- a/src/lib/libcrypto/stack/stack.c +++ b/src/lib/libcrypto/stack/stack.c | |||
@@ -95,7 +95,7 @@ _STACK *sk_dup(_STACK *sk) | |||
95 | char **s; | 95 | char **s; |
96 | 96 | ||
97 | if ((ret=sk_new(sk->comp)) == NULL) goto err; | 97 | if ((ret=sk_new(sk->comp)) == NULL) goto err; |
98 | s=(char **)OPENSSL_realloc((char *)ret->data, | 98 | s=(char **)realloc((char *)ret->data, |
99 | (unsigned int)sizeof(char *)*sk->num_alloc); | 99 | (unsigned int)sizeof(char *)*sk->num_alloc); |
100 | if (s == NULL) goto err; | 100 | if (s == NULL) goto err; |
101 | ret->data=s; | 101 | ret->data=s; |
@@ -122,9 +122,9 @@ _STACK *sk_new(int (*c)(const void *, const void *)) | |||
122 | _STACK *ret; | 122 | _STACK *ret; |
123 | int i; | 123 | int i; |
124 | 124 | ||
125 | if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL) | 125 | if ((ret=malloc(sizeof(_STACK))) == NULL) |
126 | goto err; | 126 | goto err; |
127 | if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL) | 127 | if ((ret->data=malloc(sizeof(char *)*MIN_NODES)) == NULL) |
128 | goto err; | 128 | goto err; |
129 | for (i=0; i<MIN_NODES; i++) | 129 | for (i=0; i<MIN_NODES; i++) |
130 | ret->data[i]=NULL; | 130 | ret->data[i]=NULL; |
@@ -135,7 +135,7 @@ _STACK *sk_new(int (*c)(const void *, const void *)) | |||
135 | return(ret); | 135 | return(ret); |
136 | err: | 136 | err: |
137 | if(ret) | 137 | if(ret) |
138 | OPENSSL_free(ret); | 138 | free(ret); |
139 | return(NULL); | 139 | return(NULL); |
140 | } | 140 | } |
141 | 141 | ||
@@ -146,7 +146,7 @@ int sk_insert(_STACK *st, void *data, int loc) | |||
146 | if(st == NULL) return 0; | 146 | if(st == NULL) return 0; |
147 | if (st->num_alloc <= st->num+1) | 147 | if (st->num_alloc <= st->num+1) |
148 | { | 148 | { |
149 | s=OPENSSL_realloc((char *)st->data, | 149 | s=realloc((char *)st->data, |
150 | (unsigned int)sizeof(char *)*st->num_alloc*2); | 150 | (unsigned int)sizeof(char *)*st->num_alloc*2); |
151 | if (s == NULL) | 151 | if (s == NULL) |
152 | return(0); | 152 | return(0); |
@@ -287,8 +287,8 @@ void sk_pop_free(_STACK *st, void (*func)(void *)) | |||
287 | void sk_free(_STACK *st) | 287 | void sk_free(_STACK *st) |
288 | { | 288 | { |
289 | if (st == NULL) return; | 289 | if (st == NULL) return; |
290 | if (st->data != NULL) OPENSSL_free(st->data); | 290 | if (st->data != NULL) free(st->data); |
291 | OPENSSL_free(st); | 291 | free(st); |
292 | } | 292 | } |
293 | 293 | ||
294 | int sk_num(const _STACK *st) | 294 | int sk_num(const _STACK *st) |
diff --git a/src/lib/libcrypto/store/str_lib.c b/src/lib/libcrypto/store/str_lib.c index e92dc1f51c..a451e9cb74 100644 --- a/src/lib/libcrypto/store/str_lib.c +++ b/src/lib/libcrypto/store/str_lib.c | |||
@@ -112,7 +112,7 @@ STORE *STORE_new_method(const STORE_METHOD *method) | |||
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | ret=(STORE *)OPENSSL_malloc(sizeof(STORE)); | 115 | ret=(STORE *)malloc(sizeof(STORE)); |
116 | if (ret == NULL) | 116 | if (ret == NULL) |
117 | { | 117 | { |
118 | STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 118 | STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -185,7 +185,7 @@ void STORE_free(STORE *store) | |||
185 | if (store->meth->clean) | 185 | if (store->meth->clean) |
186 | store->meth->clean(store); | 186 | store->meth->clean(store); |
187 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data); | 187 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data); |
188 | OPENSSL_free(store); | 188 | free(store); |
189 | } | 189 | } |
190 | 190 | ||
191 | int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)) | 191 | int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)) |
@@ -1227,7 +1227,7 @@ int STORE_delete_arbitrary(STORE *s, OPENSSL_ITEM attributes[], | |||
1227 | 1227 | ||
1228 | STORE_OBJECT *STORE_OBJECT_new(void) | 1228 | STORE_OBJECT *STORE_OBJECT_new(void) |
1229 | { | 1229 | { |
1230 | STORE_OBJECT *object = OPENSSL_malloc(sizeof(STORE_OBJECT)); | 1230 | STORE_OBJECT *object = malloc(sizeof(STORE_OBJECT)); |
1231 | if (object) memset(object, 0, sizeof(STORE_OBJECT)); | 1231 | if (object) memset(object, 0, sizeof(STORE_OBJECT)); |
1232 | return object; | 1232 | return object; |
1233 | } | 1233 | } |
@@ -1253,7 +1253,7 @@ void STORE_OBJECT_free(STORE_OBJECT *data) | |||
1253 | BUF_MEM_free(data->data.arbitrary); | 1253 | BUF_MEM_free(data->data.arbitrary); |
1254 | break; | 1254 | break; |
1255 | } | 1255 | } |
1256 | OPENSSL_free(data); | 1256 | free(data); |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | IMPLEMENT_STACK_OF(STORE_OBJECT*) | 1259 | IMPLEMENT_STACK_OF(STORE_OBJECT*) |
@@ -1280,7 +1280,7 @@ struct STORE_attr_info_st | |||
1280 | 1280 | ||
1281 | STORE_ATTR_INFO *STORE_ATTR_INFO_new(void) | 1281 | STORE_ATTR_INFO *STORE_ATTR_INFO_new(void) |
1282 | { | 1282 | { |
1283 | return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO)); | 1283 | return (STORE_ATTR_INFO *)malloc(sizeof(STORE_ATTR_INFO)); |
1284 | } | 1284 | } |
1285 | static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, | 1285 | static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, |
1286 | STORE_ATTR_TYPES code) | 1286 | STORE_ATTR_TYPES code) |
@@ -1320,7 +1320,7 @@ int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs) | |||
1320 | STORE_ATTR_TYPES i; | 1320 | STORE_ATTR_TYPES i; |
1321 | for(i = 0; i++ < STORE_ATTR_TYPE_NUM;) | 1321 | for(i = 0; i++ < STORE_ATTR_TYPE_NUM;) |
1322 | STORE_ATTR_INFO_attr_free(attrs, i); | 1322 | STORE_ATTR_INFO_attr_free(attrs, i); |
1323 | OPENSSL_free(attrs); | 1323 | free(attrs); |
1324 | } | 1324 | } |
1325 | return 1; | 1325 | return 1; |
1326 | } | 1326 | } |
@@ -1474,7 +1474,7 @@ int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
1474 | } | 1474 | } |
1475 | if (ATTR_IS_SET(attrs,code)) | 1475 | if (ATTR_IS_SET(attrs,code)) |
1476 | { | 1476 | { |
1477 | OPENSSL_free(attrs->values[code].cstring); | 1477 | free(attrs->values[code].cstring); |
1478 | attrs->values[code].cstring = NULL; | 1478 | attrs->values[code].cstring = NULL; |
1479 | CLEAR_ATTRBIT(attrs, code); | 1479 | CLEAR_ATTRBIT(attrs, code); |
1480 | } | 1480 | } |
@@ -1491,7 +1491,7 @@ int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code | |||
1491 | } | 1491 | } |
1492 | if (ATTR_IS_SET(attrs,code)) | 1492 | if (ATTR_IS_SET(attrs,code)) |
1493 | { | 1493 | { |
1494 | OPENSSL_free(attrs->values[code].sha1string); | 1494 | free(attrs->values[code].sha1string); |
1495 | attrs->values[code].sha1string = NULL; | 1495 | attrs->values[code].sha1string = NULL; |
1496 | CLEAR_ATTRBIT(attrs, code); | 1496 | CLEAR_ATTRBIT(attrs, code); |
1497 | } | 1497 | } |
@@ -1508,7 +1508,7 @@ int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
1508 | } | 1508 | } |
1509 | if (ATTR_IS_SET(attrs,code)) | 1509 | if (ATTR_IS_SET(attrs,code)) |
1510 | { | 1510 | { |
1511 | OPENSSL_free(attrs->values[code].dn); | 1511 | free(attrs->values[code].dn); |
1512 | attrs->values[code].dn = NULL; | 1512 | attrs->values[code].dn = NULL; |
1513 | CLEAR_ATTRBIT(attrs, code); | 1513 | CLEAR_ATTRBIT(attrs, code); |
1514 | } | 1514 | } |
@@ -1525,7 +1525,7 @@ int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
1525 | } | 1525 | } |
1526 | if (ATTR_IS_SET(attrs,code)) | 1526 | if (ATTR_IS_SET(attrs,code)) |
1527 | { | 1527 | { |
1528 | OPENSSL_free(attrs->values[code].number); | 1528 | free(attrs->values[code].number); |
1529 | attrs->values[code].number = NULL; | 1529 | attrs->values[code].number = NULL; |
1530 | CLEAR_ATTRBIT(attrs, code); | 1530 | CLEAR_ATTRBIT(attrs, code); |
1531 | } | 1531 | } |
@@ -1541,7 +1541,7 @@ void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes) | |||
1541 | if (attributes) | 1541 | if (attributes) |
1542 | { | 1542 | { |
1543 | struct attr_list_ctx_st *context = | 1543 | struct attr_list_ctx_st *context = |
1544 | (struct attr_list_ctx_st *)OPENSSL_malloc(sizeof(struct attr_list_ctx_st)); | 1544 | (struct attr_list_ctx_st *)malloc(sizeof(struct attr_list_ctx_st)); |
1545 | if (context) | 1545 | if (context) |
1546 | context->attributes = attributes; | 1546 | context->attributes = attributes; |
1547 | else | 1547 | else |
@@ -1650,7 +1650,7 @@ int STORE_parse_attrs_end(void *handle) | |||
1650 | #if 0 | 1650 | #if 0 |
1651 | OPENSSL_ITEM *attributes = context->attributes; | 1651 | OPENSSL_ITEM *attributes = context->attributes; |
1652 | #endif | 1652 | #endif |
1653 | OPENSSL_free(context); | 1653 | free(context); |
1654 | return 1; | 1654 | return 1; |
1655 | } | 1655 | } |
1656 | STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER); | 1656 | STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER); |
diff --git a/src/lib/libcrypto/store/str_mem.c b/src/lib/libcrypto/store/str_mem.c index 8ac4f7e55c..997e60fe93 100644 --- a/src/lib/libcrypto/store/str_mem.c +++ b/src/lib/libcrypto/store/str_mem.c | |||
@@ -222,7 +222,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | |||
222 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) | 222 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) |
223 | { | 223 | { |
224 | struct mem_ctx_st *context = | 224 | struct mem_ctx_st *context = |
225 | (struct mem_ctx_st *)OPENSSL_malloc(sizeof(struct mem_ctx_st)); | 225 | (struct mem_ctx_st *)malloc(sizeof(struct mem_ctx_st)); |
226 | void *attribute_context = NULL; | 226 | void *attribute_context = NULL; |
227 | STORE_ATTR_INFO *attrs = NULL; | 227 | STORE_ATTR_INFO *attrs = NULL; |
228 | 228 | ||
@@ -336,7 +336,7 @@ static int mem_list_end(STORE *s, void *handle) | |||
336 | } | 336 | } |
337 | if (context && context->search_attributes) | 337 | if (context && context->search_attributes) |
338 | sk_STORE_ATTR_INFO_free(context->search_attributes); | 338 | sk_STORE_ATTR_INFO_free(context->search_attributes); |
339 | if (context) OPENSSL_free(context); | 339 | if (context) free(context); |
340 | return 1; | 340 | return 1; |
341 | } | 341 | } |
342 | static int mem_list_endp(STORE *s, void *handle) | 342 | static int mem_list_endp(STORE *s, void *handle) |
diff --git a/src/lib/libcrypto/store/str_meth.c b/src/lib/libcrypto/store/str_meth.c index a46de03a26..8944824618 100644 --- a/src/lib/libcrypto/store/str_meth.c +++ b/src/lib/libcrypto/store/str_meth.c | |||
@@ -62,7 +62,7 @@ | |||
62 | 62 | ||
63 | STORE_METHOD *STORE_create_method(char *name) | 63 | STORE_METHOD *STORE_create_method(char *name) |
64 | { | 64 | { |
65 | STORE_METHOD *store_method = (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD)); | 65 | STORE_METHOD *store_method = (STORE_METHOD *)malloc(sizeof(STORE_METHOD)); |
66 | 66 | ||
67 | if (store_method) | 67 | if (store_method) |
68 | { | 68 | { |
@@ -78,9 +78,9 @@ STORE_METHOD *STORE_create_method(char *name) | |||
78 | void STORE_destroy_method(STORE_METHOD *store_method) | 78 | void STORE_destroy_method(STORE_METHOD *store_method) |
79 | { | 79 | { |
80 | if (!store_method) return; | 80 | if (!store_method) return; |
81 | OPENSSL_free(store_method->name); | 81 | free(store_method->name); |
82 | store_method->name = NULL; | 82 | store_method->name = NULL; |
83 | OPENSSL_free(store_method); | 83 | free(store_method); |
84 | } | 84 | } |
85 | 85 | ||
86 | int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f) | 86 | int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f) |
diff --git a/src/lib/libcrypto/ts/ts_lib.c b/src/lib/libcrypto/ts/ts_lib.c index e8608dbf71..a8de801e28 100644 --- a/src/lib/libcrypto/ts/ts_lib.c +++ b/src/lib/libcrypto/ts/ts_lib.c | |||
@@ -79,7 +79,7 @@ int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num) | |||
79 | { | 79 | { |
80 | result = BIO_write(bio, "0x", 2) > 0; | 80 | result = BIO_write(bio, "0x", 2) > 0; |
81 | result = result && BIO_write(bio, hex, strlen(hex)) > 0; | 81 | result = result && BIO_write(bio, hex, strlen(hex)) > 0; |
82 | OPENSSL_free(hex); | 82 | free(hex); |
83 | } | 83 | } |
84 | BN_free(&num_bn); | 84 | BN_free(&num_bn); |
85 | 85 | ||
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c index e7186a8ce0..e52c9ff03b 100644 --- a/src/lib/libcrypto/ts/ts_rsp_sign.c +++ b/src/lib/libcrypto/ts/ts_rsp_sign.c | |||
@@ -167,7 +167,7 @@ TS_RESP_CTX *TS_RESP_CTX_new() | |||
167 | { | 167 | { |
168 | TS_RESP_CTX *ctx; | 168 | TS_RESP_CTX *ctx; |
169 | 169 | ||
170 | if (!(ctx = (TS_RESP_CTX *) OPENSSL_malloc(sizeof(TS_RESP_CTX)))) | 170 | if (!(ctx = (TS_RESP_CTX *) malloc(sizeof(TS_RESP_CTX)))) |
171 | { | 171 | { |
172 | TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE); | 172 | TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE); |
173 | return NULL; | 173 | return NULL; |
@@ -195,7 +195,7 @@ void TS_RESP_CTX_free(TS_RESP_CTX *ctx) | |||
195 | ASN1_INTEGER_free(ctx->seconds); | 195 | ASN1_INTEGER_free(ctx->seconds); |
196 | ASN1_INTEGER_free(ctx->millis); | 196 | ASN1_INTEGER_free(ctx->millis); |
197 | ASN1_INTEGER_free(ctx->micros); | 197 | ASN1_INTEGER_free(ctx->micros); |
198 | OPENSSL_free(ctx); | 198 | free(ctx); |
199 | } | 199 | } |
200 | 200 | ||
201 | int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer) | 201 | int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer) |
@@ -922,7 +922,7 @@ static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) | |||
922 | int len; | 922 | int len; |
923 | 923 | ||
924 | len = i2d_ESS_SIGNING_CERT(sc, NULL); | 924 | len = i2d_ESS_SIGNING_CERT(sc, NULL); |
925 | if (!(pp = (unsigned char *) OPENSSL_malloc(len))) | 925 | if (!(pp = (unsigned char *) malloc(len))) |
926 | { | 926 | { |
927 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); | 927 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); |
928 | goto err; | 928 | goto err; |
@@ -934,13 +934,13 @@ static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) | |||
934 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); | 934 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); |
935 | goto err; | 935 | goto err; |
936 | } | 936 | } |
937 | OPENSSL_free(pp); pp = NULL; | 937 | free(pp); pp = NULL; |
938 | return PKCS7_add_signed_attribute(si, | 938 | return PKCS7_add_signed_attribute(si, |
939 | NID_id_smime_aa_signingCertificate, | 939 | NID_id_smime_aa_signingCertificate, |
940 | V_ASN1_SEQUENCE, seq); | 940 | V_ASN1_SEQUENCE, seq); |
941 | err: | 941 | err: |
942 | ASN1_STRING_free(seq); | 942 | ASN1_STRING_free(seq); |
943 | OPENSSL_free(pp); | 943 | free(pp); |
944 | 944 | ||
945 | return 0; | 945 | return 0; |
946 | } | 946 | } |
diff --git a/src/lib/libcrypto/ts/ts_rsp_verify.c b/src/lib/libcrypto/ts/ts_rsp_verify.c index f241230ef4..d51500b5d4 100644 --- a/src/lib/libcrypto/ts/ts_rsp_verify.c +++ b/src/lib/libcrypto/ts/ts_rsp_verify.c | |||
@@ -472,7 +472,7 @@ static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx, | |||
472 | err: | 472 | err: |
473 | X509_free(signer); | 473 | X509_free(signer); |
474 | X509_ALGOR_free(md_alg); | 474 | X509_ALGOR_free(md_alg); |
475 | OPENSSL_free(imprint); | 475 | free(imprint); |
476 | return ret; | 476 | return ret; |
477 | } | 477 | } |
478 | 478 | ||
@@ -528,7 +528,7 @@ static int TS_check_status_info(TS_RESP *response) | |||
528 | ", status text: ", embedded_status_text ? | 528 | ", status text: ", embedded_status_text ? |
529 | embedded_status_text : "unspecified", | 529 | embedded_status_text : "unspecified", |
530 | ", failure codes: ", failure_text); | 530 | ", failure codes: ", failure_text); |
531 | OPENSSL_free(embedded_status_text); | 531 | free(embedded_status_text); |
532 | 532 | ||
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
@@ -547,7 +547,7 @@ static char *TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text) | |||
547 | length += 1; /* separator character */ | 547 | length += 1; /* separator character */ |
548 | } | 548 | } |
549 | /* Allocate memory (closing '\0' included). */ | 549 | /* Allocate memory (closing '\0' included). */ |
550 | if (!(result = OPENSSL_malloc(length))) | 550 | if (!(result = malloc(length))) |
551 | { | 551 | { |
552 | TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE); | 552 | TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE); |
553 | return NULL; | 553 | return NULL; |
@@ -606,7 +606,7 @@ static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, | |||
606 | if (length < 0) | 606 | if (length < 0) |
607 | goto err; | 607 | goto err; |
608 | *imprint_len = length; | 608 | *imprint_len = length; |
609 | if (!(*imprint = OPENSSL_malloc(*imprint_len))) | 609 | if (!(*imprint = malloc(*imprint_len))) |
610 | { | 610 | { |
611 | TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE); | 611 | TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE); |
612 | goto err; | 612 | goto err; |
@@ -625,7 +625,7 @@ static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, | |||
625 | return 1; | 625 | return 1; |
626 | err: | 626 | err: |
627 | X509_ALGOR_free(*md_alg); | 627 | X509_ALGOR_free(*md_alg); |
628 | OPENSSL_free(*imprint); | 628 | free(*imprint); |
629 | *imprint_len = 0; | 629 | *imprint_len = 0; |
630 | return 0; | 630 | return 0; |
631 | } | 631 | } |
diff --git a/src/lib/libcrypto/ts/ts_verify_ctx.c b/src/lib/libcrypto/ts/ts_verify_ctx.c index 609b7735d4..629107aeec 100644 --- a/src/lib/libcrypto/ts/ts_verify_ctx.c +++ b/src/lib/libcrypto/ts/ts_verify_ctx.c | |||
@@ -63,7 +63,7 @@ | |||
63 | TS_VERIFY_CTX *TS_VERIFY_CTX_new(void) | 63 | TS_VERIFY_CTX *TS_VERIFY_CTX_new(void) |
64 | { | 64 | { |
65 | TS_VERIFY_CTX *ctx = | 65 | TS_VERIFY_CTX *ctx = |
66 | (TS_VERIFY_CTX *) OPENSSL_malloc(sizeof(TS_VERIFY_CTX)); | 66 | (TS_VERIFY_CTX *) malloc(sizeof(TS_VERIFY_CTX)); |
67 | if (ctx) | 67 | if (ctx) |
68 | memset(ctx, 0, sizeof(TS_VERIFY_CTX)); | 68 | memset(ctx, 0, sizeof(TS_VERIFY_CTX)); |
69 | else | 69 | else |
@@ -82,7 +82,7 @@ void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) | |||
82 | if (!ctx) return; | 82 | if (!ctx) return; |
83 | 83 | ||
84 | TS_VERIFY_CTX_cleanup(ctx); | 84 | TS_VERIFY_CTX_cleanup(ctx); |
85 | OPENSSL_free(ctx); | 85 | free(ctx); |
86 | } | 86 | } |
87 | 87 | ||
88 | void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) | 88 | void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) |
@@ -95,7 +95,7 @@ void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) | |||
95 | ASN1_OBJECT_free(ctx->policy); | 95 | ASN1_OBJECT_free(ctx->policy); |
96 | 96 | ||
97 | X509_ALGOR_free(ctx->md_alg); | 97 | X509_ALGOR_free(ctx->md_alg); |
98 | OPENSSL_free(ctx->imprint); | 98 | free(ctx->imprint); |
99 | 99 | ||
100 | BIO_free_all(ctx->data); | 100 | BIO_free_all(ctx->data); |
101 | 101 | ||
@@ -138,7 +138,7 @@ TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx) | |||
138 | if (!(ret->md_alg = X509_ALGOR_dup(md_alg))) goto err; | 138 | if (!(ret->md_alg = X509_ALGOR_dup(md_alg))) goto err; |
139 | msg = TS_MSG_IMPRINT_get_msg(imprint); | 139 | msg = TS_MSG_IMPRINT_get_msg(imprint); |
140 | ret->imprint_len = ASN1_STRING_length(msg); | 140 | ret->imprint_len = ASN1_STRING_length(msg); |
141 | if (!(ret->imprint = OPENSSL_malloc(ret->imprint_len))) goto err; | 141 | if (!(ret->imprint = malloc(ret->imprint_len))) goto err; |
142 | memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len); | 142 | memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len); |
143 | 143 | ||
144 | /* Setting nonce. */ | 144 | /* Setting nonce. */ |
diff --git a/src/lib/libcrypto/txt_db/txt_db.c b/src/lib/libcrypto/txt_db/txt_db.c index 6f2ce3b5a4..c1e7a79a1a 100644 --- a/src/lib/libcrypto/txt_db/txt_db.c +++ b/src/lib/libcrypto/txt_db/txt_db.c | |||
@@ -84,16 +84,16 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
84 | if ((buf=BUF_MEM_new()) == NULL) goto err; | 84 | if ((buf=BUF_MEM_new()) == NULL) goto err; |
85 | if (!BUF_MEM_grow(buf,size)) goto err; | 85 | if (!BUF_MEM_grow(buf,size)) goto err; |
86 | 86 | ||
87 | if ((ret=OPENSSL_malloc(sizeof(TXT_DB))) == NULL) | 87 | if ((ret=malloc(sizeof(TXT_DB))) == NULL) |
88 | goto err; | 88 | goto err; |
89 | ret->num_fields=num; | 89 | ret->num_fields=num; |
90 | ret->index=NULL; | 90 | ret->index=NULL; |
91 | ret->qual=NULL; | 91 | ret->qual=NULL; |
92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) | 92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) |
93 | goto err; | 93 | goto err; |
94 | if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL) | 94 | if ((ret->index=malloc(sizeof(*ret->index)*num)) == NULL) |
95 | goto err; | 95 | goto err; |
96 | if ((ret->qual=OPENSSL_malloc(sizeof(*(ret->qual))*num)) == NULL) | 96 | if ((ret->qual=malloc(sizeof(*(ret->qual))*num)) == NULL) |
97 | goto err; | 97 | goto err; |
98 | for (i=0; i<num; i++) | 98 | for (i=0; i<num; i++) |
99 | { | 99 | { |
@@ -123,7 +123,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
123 | else | 123 | else |
124 | { | 124 | { |
125 | buf->data[offset-1]='\0'; /* blat the '\n' */ | 125 | buf->data[offset-1]='\0'; /* blat the '\n' */ |
126 | if (!(p=OPENSSL_malloc(add+offset))) goto err; | 126 | if (!(p=malloc(add+offset))) goto err; |
127 | offset=0; | 127 | offset=0; |
128 | } | 128 | } |
129 | pp=(char **)p; | 129 | pp=(char **)p; |
@@ -178,14 +178,14 @@ err: | |||
178 | if (er) | 178 | if (er) |
179 | { | 179 | { |
180 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | 180 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) |
181 | if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n"); | 181 | if (er == 1) fprintf(stderr,"malloc failure\n"); |
182 | #endif | 182 | #endif |
183 | if (ret != NULL) | 183 | if (ret != NULL) |
184 | { | 184 | { |
185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); | 185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); |
186 | if (ret->index != NULL) OPENSSL_free(ret->index); | 186 | if (ret->index != NULL) free(ret->index); |
187 | if (ret->qual != NULL) OPENSSL_free(ret->qual); | 187 | if (ret->qual != NULL) free(ret->qual); |
188 | if (ret != NULL) OPENSSL_free(ret); | 188 | if (ret != NULL) free(ret); |
189 | } | 189 | } |
190 | return(NULL); | 190 | return(NULL); |
191 | } | 191 | } |
@@ -354,10 +354,10 @@ void TXT_DB_free(TXT_DB *db) | |||
354 | { | 354 | { |
355 | for (i=db->num_fields-1; i>=0; i--) | 355 | for (i=db->num_fields-1; i>=0; i--) |
356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); | 356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); |
357 | OPENSSL_free(db->index); | 357 | free(db->index); |
358 | } | 358 | } |
359 | if (db->qual != NULL) | 359 | if (db->qual != NULL) |
360 | OPENSSL_free(db->qual); | 360 | free(db->qual); |
361 | if (db->data != NULL) | 361 | if (db->data != NULL) |
362 | { | 362 | { |
363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) | 363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) |
@@ -369,7 +369,7 @@ void TXT_DB_free(TXT_DB *db) | |||
369 | if (max == NULL) /* new row */ | 369 | if (max == NULL) /* new row */ |
370 | { | 370 | { |
371 | for (n=0; n<db->num_fields; n++) | 371 | for (n=0; n<db->num_fields; n++) |
372 | if (p[n] != NULL) OPENSSL_free(p[n]); | 372 | if (p[n] != NULL) free(p[n]); |
373 | } | 373 | } |
374 | else | 374 | else |
375 | { | 375 | { |
@@ -377,12 +377,12 @@ void TXT_DB_free(TXT_DB *db) | |||
377 | { | 377 | { |
378 | if (((p[n] < (char *)p) || (p[n] > max)) | 378 | if (((p[n] < (char *)p) || (p[n] > max)) |
379 | && (p[n] != NULL)) | 379 | && (p[n] != NULL)) |
380 | OPENSSL_free(p[n]); | 380 | free(p[n]); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i)); | 383 | free(sk_OPENSSL_PSTRING_value(db->data,i)); |
384 | } | 384 | } |
385 | sk_OPENSSL_PSTRING_free(db->data); | 385 | sk_OPENSSL_PSTRING_free(db->data); |
386 | } | 386 | } |
387 | OPENSSL_free(db); | 387 | free(db); |
388 | } | 388 | } |
diff --git a/src/lib/libcrypto/ui/ui.h b/src/lib/libcrypto/ui/ui.h index bd78aa413f..ed35e50eb4 100644 --- a/src/lib/libcrypto/ui/ui.h +++ b/src/lib/libcrypto/ui/ui.h | |||
@@ -173,7 +173,7 @@ int UI_dup_error_string(UI *ui, const char *text); | |||
173 | and object_name is the name of the object (might be a card name or | 173 | and object_name is the name of the object (might be a card name or |
174 | a file name. | 174 | a file name. |
175 | The returned string shall always be allocated on the heap with | 175 | The returned string shall always be allocated on the heap with |
176 | OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). | 176 | malloc(), and need to be free'd with free(). |
177 | 177 | ||
178 | If the ui_method doesn't contain a pointer to a user-defined prompt | 178 | If the ui_method doesn't contain a pointer to a user-defined prompt |
179 | constructor, a default string is built, looking like this: | 179 | constructor, a default string is built, looking like this: |
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index 6113060aa9..d3cadd51f6 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c | |||
@@ -77,7 +77,7 @@ UI *UI_new_method(const UI_METHOD *method) | |||
77 | { | 77 | { |
78 | UI *ret; | 78 | UI *ret; |
79 | 79 | ||
80 | ret=(UI *)OPENSSL_malloc(sizeof(UI)); | 80 | ret=(UI *)malloc(sizeof(UI)); |
81 | if (ret == NULL) | 81 | if (ret == NULL) |
82 | { | 82 | { |
83 | UIerr(UI_F_UI_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 83 | UIerr(UI_F_UI_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -99,19 +99,19 @@ static void free_string(UI_STRING *uis) | |||
99 | { | 99 | { |
100 | if (uis->flags & OUT_STRING_FREEABLE) | 100 | if (uis->flags & OUT_STRING_FREEABLE) |
101 | { | 101 | { |
102 | OPENSSL_free((char *)uis->out_string); | 102 | free((char *)uis->out_string); |
103 | switch(uis->type) | 103 | switch(uis->type) |
104 | { | 104 | { |
105 | case UIT_BOOLEAN: | 105 | case UIT_BOOLEAN: |
106 | OPENSSL_free((char *)uis->_.boolean_data.action_desc); | 106 | free((char *)uis->_.boolean_data.action_desc); |
107 | OPENSSL_free((char *)uis->_.boolean_data.ok_chars); | 107 | free((char *)uis->_.boolean_data.ok_chars); |
108 | OPENSSL_free((char *)uis->_.boolean_data.cancel_chars); | 108 | free((char *)uis->_.boolean_data.cancel_chars); |
109 | break; | 109 | break; |
110 | default: | 110 | default: |
111 | break; | 111 | break; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | OPENSSL_free(uis); | 114 | free(uis); |
115 | } | 115 | } |
116 | 116 | ||
117 | void UI_free(UI *ui) | 117 | void UI_free(UI *ui) |
@@ -120,7 +120,7 @@ void UI_free(UI *ui) | |||
120 | return; | 120 | return; |
121 | sk_UI_STRING_pop_free(ui->strings,free_string); | 121 | sk_UI_STRING_pop_free(ui->strings,free_string); |
122 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data); | 122 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data); |
123 | OPENSSL_free(ui); | 123 | free(ui); |
124 | } | 124 | } |
125 | 125 | ||
126 | static int allocate_string_stack(UI *ui) | 126 | static int allocate_string_stack(UI *ui) |
@@ -151,7 +151,7 @@ static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt, | |||
151 | { | 151 | { |
152 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); | 152 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); |
153 | } | 153 | } |
154 | else if ((ret = (UI_STRING *)OPENSSL_malloc(sizeof(UI_STRING)))) | 154 | else if ((ret = (UI_STRING *)malloc(sizeof(UI_STRING)))) |
155 | { | 155 | { |
156 | ret->out_string=prompt; | 156 | ret->out_string=prompt; |
157 | ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0; | 157 | ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0; |
@@ -354,10 +354,10 @@ int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, | |||
354 | ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags, | 354 | ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags, |
355 | result_buf); | 355 | result_buf); |
356 | err: | 356 | err: |
357 | if (prompt_copy) OPENSSL_free(prompt_copy); | 357 | if (prompt_copy) free(prompt_copy); |
358 | if (action_desc_copy) OPENSSL_free(action_desc_copy); | 358 | if (action_desc_copy) free(action_desc_copy); |
359 | if (ok_chars_copy) OPENSSL_free(ok_chars_copy); | 359 | if (ok_chars_copy) free(ok_chars_copy); |
360 | if (cancel_chars_copy) OPENSSL_free(cancel_chars_copy); | 360 | if (cancel_chars_copy) free(cancel_chars_copy); |
361 | return -1; | 361 | return -1; |
362 | } | 362 | } |
363 | 363 | ||
@@ -430,7 +430,7 @@ char *UI_construct_prompt(UI *ui, const char *object_desc, | |||
430 | len += sizeof(prompt2) - 1 + strlen(object_name); | 430 | len += sizeof(prompt2) - 1 + strlen(object_name); |
431 | len += sizeof(prompt3) - 1; | 431 | len += sizeof(prompt3) - 1; |
432 | 432 | ||
433 | prompt = (char *)OPENSSL_malloc(len + 1); | 433 | prompt = (char *)malloc(len + 1); |
434 | BUF_strlcpy(prompt, prompt1, len + 1); | 434 | BUF_strlcpy(prompt, prompt1, len + 1); |
435 | BUF_strlcat(prompt, object_desc, len + 1); | 435 | BUF_strlcat(prompt, object_desc, len + 1); |
436 | if (object_name) | 436 | if (object_name) |
@@ -618,7 +618,7 @@ const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth) | |||
618 | 618 | ||
619 | UI_METHOD *UI_create_method(char *name) | 619 | UI_METHOD *UI_create_method(char *name) |
620 | { | 620 | { |
621 | UI_METHOD *ui_method = (UI_METHOD *)OPENSSL_malloc(sizeof(UI_METHOD)); | 621 | UI_METHOD *ui_method = (UI_METHOD *)malloc(sizeof(UI_METHOD)); |
622 | 622 | ||
623 | if (ui_method) | 623 | if (ui_method) |
624 | { | 624 | { |
@@ -633,9 +633,9 @@ UI_METHOD *UI_create_method(char *name) | |||
633 | anything Murphy can throw at you and more! You have been warned. */ | 633 | anything Murphy can throw at you and more! You have been warned. */ |
634 | void UI_destroy_method(UI_METHOD *ui_method) | 634 | void UI_destroy_method(UI_METHOD *ui_method) |
635 | { | 635 | { |
636 | OPENSSL_free(ui_method->name); | 636 | free(ui_method->name); |
637 | ui_method->name = NULL; | 637 | ui_method->name = NULL; |
638 | OPENSSL_free(ui_method); | 638 | free(ui_method); |
639 | } | 639 | } |
640 | 640 | ||
641 | int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)) | 641 | int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)) |
diff --git a/src/lib/libcrypto/ui/ui_locl.h b/src/lib/libcrypto/ui/ui_locl.h index aa4a55637d..39789e2638 100644 --- a/src/lib/libcrypto/ui/ui_locl.h +++ b/src/lib/libcrypto/ui/ui_locl.h | |||
@@ -94,7 +94,7 @@ struct ui_method_st | |||
94 | and object_name is the name of the object (might be a card name or | 94 | and object_name is the name of the object (might be a card name or |
95 | a file name. | 95 | a file name. |
96 | The returned string shall always be allocated on the heap with | 96 | The returned string shall always be allocated on the heap with |
97 | OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). */ | 97 | malloc(), and need to be free'd with free(). */ |
98 | char *(*ui_construct_prompt)(UI *ui, const char *object_desc, | 98 | char *(*ui_construct_prompt)(UI *ui, const char *object_desc, |
99 | const char *object_name); | 99 | const char *object_name); |
100 | }; | 100 | }; |
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index ccf2f6e0bf..3b72fd302f 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -153,10 +153,10 @@ new_dir(X509_LOOKUP *lu) | |||
153 | { | 153 | { |
154 | BY_DIR *a; | 154 | BY_DIR *a; |
155 | 155 | ||
156 | if ((a = (BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL) | 156 | if ((a = (BY_DIR *)malloc(sizeof(BY_DIR))) == NULL) |
157 | return (0); | 157 | return (0); |
158 | if ((a->buffer = BUF_MEM_new()) == NULL) { | 158 | if ((a->buffer = BUF_MEM_new()) == NULL) { |
159 | OPENSSL_free(a); | 159 | free(a); |
160 | return (0); | 160 | return (0); |
161 | } | 161 | } |
162 | a->dirs = NULL; | 162 | a->dirs = NULL; |
@@ -167,7 +167,7 @@ new_dir(X509_LOOKUP *lu) | |||
167 | static void | 167 | static void |
168 | by_dir_hash_free(BY_DIR_HASH *hash) | 168 | by_dir_hash_free(BY_DIR_HASH *hash) |
169 | { | 169 | { |
170 | OPENSSL_free(hash); | 170 | free(hash); |
171 | } | 171 | } |
172 | 172 | ||
173 | static int | 173 | static int |
@@ -185,10 +185,10 @@ static void | |||
185 | by_dir_entry_free(BY_DIR_ENTRY *ent) | 185 | by_dir_entry_free(BY_DIR_ENTRY *ent) |
186 | { | 186 | { |
187 | if (ent->dir) | 187 | if (ent->dir) |
188 | OPENSSL_free(ent->dir); | 188 | free(ent->dir); |
189 | if (ent->hashes) | 189 | if (ent->hashes) |
190 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); | 190 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); |
191 | OPENSSL_free(ent); | 191 | free(ent); |
192 | } | 192 | } |
193 | 193 | ||
194 | static void | 194 | static void |
@@ -201,7 +201,7 @@ free_dir(X509_LOOKUP *lu) | |||
201 | sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); | 201 | sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); |
202 | if (a->buffer != NULL) | 202 | if (a->buffer != NULL) |
203 | BUF_MEM_free(a->buffer); | 203 | BUF_MEM_free(a->buffer); |
204 | OPENSSL_free(a); | 204 | free(a); |
205 | } | 205 | } |
206 | 206 | ||
207 | static int | 207 | static int |
@@ -241,7 +241,7 @@ add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | ent = OPENSSL_malloc(sizeof(BY_DIR_ENTRY)); | 244 | ent = malloc(sizeof(BY_DIR_ENTRY)); |
245 | if (!ent) | 245 | if (!ent) |
246 | return 0; | 246 | return 0; |
247 | ent->dir_type = type; | 247 | ent->dir_type = type; |
@@ -411,12 +411,12 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
411 | ent->hashes, idx); | 411 | ent->hashes, idx); |
412 | } | 412 | } |
413 | if (!hent) { | 413 | if (!hent) { |
414 | hent = OPENSSL_malloc(sizeof(BY_DIR_HASH)); | 414 | hent = malloc(sizeof(BY_DIR_HASH)); |
415 | hent->hash = h; | 415 | hent->hash = h; |
416 | hent->suffix = k; | 416 | hent->suffix = k; |
417 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) { | 417 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) { |
418 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | 418 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); |
419 | OPENSSL_free(hent); | 419 | free(hent); |
420 | ok = 0; | 420 | ok = 0; |
421 | goto finish; | 421 | goto finish; |
422 | } | 422 | } |
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c index 352aa37434..2f1b8953e5 100644 --- a/src/lib/libcrypto/x509/x509_cmp.c +++ b/src/lib/libcrypto/x509/x509_cmp.c | |||
@@ -90,7 +90,7 @@ unsigned long X509_issuer_and_serial_hash(X509 *a) | |||
90 | goto err; | 90 | goto err; |
91 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) | 91 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) |
92 | goto err; | 92 | goto err; |
93 | OPENSSL_free(f); | 93 | free(f); |
94 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, | 94 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, |
95 | (unsigned long)a->cert_info->serialNumber->length)) | 95 | (unsigned long)a->cert_info->serialNumber->length)) |
96 | goto err; | 96 | goto err; |
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c index 38525a8cdd..644ea83bac 100644 --- a/src/lib/libcrypto/x509/x509_lu.c +++ b/src/lib/libcrypto/x509/x509_lu.c | |||
@@ -66,7 +66,7 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) | |||
66 | { | 66 | { |
67 | X509_LOOKUP *ret; | 67 | X509_LOOKUP *ret; |
68 | 68 | ||
69 | ret=(X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP)); | 69 | ret=(X509_LOOKUP *)malloc(sizeof(X509_LOOKUP)); |
70 | if (ret == NULL) return NULL; | 70 | if (ret == NULL) return NULL; |
71 | 71 | ||
72 | ret->init=0; | 72 | ret->init=0; |
@@ -76,7 +76,7 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) | |||
76 | ret->store_ctx=NULL; | 76 | ret->store_ctx=NULL; |
77 | if ((method->new_item != NULL) && !method->new_item(ret)) | 77 | if ((method->new_item != NULL) && !method->new_item(ret)) |
78 | { | 78 | { |
79 | OPENSSL_free(ret); | 79 | free(ret); |
80 | return NULL; | 80 | return NULL; |
81 | } | 81 | } |
82 | return ret; | 82 | return ret; |
@@ -88,7 +88,7 @@ void X509_LOOKUP_free(X509_LOOKUP *ctx) | |||
88 | if ( (ctx->method != NULL) && | 88 | if ( (ctx->method != NULL) && |
89 | (ctx->method->free != NULL)) | 89 | (ctx->method->free != NULL)) |
90 | (*ctx->method->free)(ctx); | 90 | (*ctx->method->free)(ctx); |
91 | OPENSSL_free(ctx); | 91 | free(ctx); |
92 | } | 92 | } |
93 | 93 | ||
94 | int X509_LOOKUP_init(X509_LOOKUP *ctx) | 94 | int X509_LOOKUP_init(X509_LOOKUP *ctx) |
@@ -179,7 +179,7 @@ X509_STORE *X509_STORE_new(void) | |||
179 | { | 179 | { |
180 | X509_STORE *ret; | 180 | X509_STORE *ret; |
181 | 181 | ||
182 | if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) | 182 | if ((ret=(X509_STORE *)malloc(sizeof(X509_STORE))) == NULL) |
183 | return NULL; | 183 | return NULL; |
184 | ret->objs = sk_X509_OBJECT_new(x509_object_cmp); | 184 | ret->objs = sk_X509_OBJECT_new(x509_object_cmp); |
185 | ret->cache=1; | 185 | ret->cache=1; |
@@ -203,7 +203,7 @@ X509_STORE *X509_STORE_new(void) | |||
203 | if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) | 203 | if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) |
204 | { | 204 | { |
205 | sk_X509_OBJECT_free(ret->objs); | 205 | sk_X509_OBJECT_free(ret->objs); |
206 | OPENSSL_free(ret); | 206 | free(ret); |
207 | return NULL; | 207 | return NULL; |
208 | } | 208 | } |
209 | 209 | ||
@@ -226,7 +226,7 @@ static void cleanup(X509_OBJECT *a) | |||
226 | /* abort(); */ | 226 | /* abort(); */ |
227 | } | 227 | } |
228 | 228 | ||
229 | OPENSSL_free(a); | 229 | free(a); |
230 | } | 230 | } |
231 | 231 | ||
232 | void X509_STORE_free(X509_STORE *vfy) | 232 | void X509_STORE_free(X509_STORE *vfy) |
@@ -251,7 +251,7 @@ void X509_STORE_free(X509_STORE *vfy) | |||
251 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data); | 251 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data); |
252 | if (vfy->param) | 252 | if (vfy->param) |
253 | X509_VERIFY_PARAM_free(vfy->param); | 253 | X509_VERIFY_PARAM_free(vfy->param); |
254 | OPENSSL_free(vfy); | 254 | free(vfy); |
255 | } | 255 | } |
256 | 256 | ||
257 | X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) | 257 | X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) |
@@ -337,7 +337,7 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) | |||
337 | int ret=1; | 337 | int ret=1; |
338 | 338 | ||
339 | if (x == NULL) return 0; | 339 | if (x == NULL) return 0; |
340 | obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT)); | 340 | obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT)); |
341 | if (obj == NULL) | 341 | if (obj == NULL) |
342 | { | 342 | { |
343 | X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE); | 343 | X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE); |
@@ -353,7 +353,7 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) | |||
353 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) | 353 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) |
354 | { | 354 | { |
355 | X509_OBJECT_free_contents(obj); | 355 | X509_OBJECT_free_contents(obj); |
356 | OPENSSL_free(obj); | 356 | free(obj); |
357 | X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE); | 357 | X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE); |
358 | ret=0; | 358 | ret=0; |
359 | } | 359 | } |
@@ -370,7 +370,7 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x) | |||
370 | int ret=1; | 370 | int ret=1; |
371 | 371 | ||
372 | if (x == NULL) return 0; | 372 | if (x == NULL) return 0; |
373 | obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT)); | 373 | obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT)); |
374 | if (obj == NULL) | 374 | if (obj == NULL) |
375 | { | 375 | { |
376 | X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE); | 376 | X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE); |
@@ -386,7 +386,7 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x) | |||
386 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) | 386 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) |
387 | { | 387 | { |
388 | X509_OBJECT_free_contents(obj); | 388 | X509_OBJECT_free_contents(obj); |
389 | OPENSSL_free(obj); | 389 | free(obj); |
390 | X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE); | 390 | X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE); |
391 | ret=0; | 391 | ret=0; |
392 | } | 392 | } |
diff --git a/src/lib/libcrypto/x509/x509_obj.c b/src/lib/libcrypto/x509/x509_obj.c index 1d3cf547d7..5f38315f22 100644 --- a/src/lib/libcrypto/x509/x509_obj.c +++ b/src/lib/libcrypto/x509/x509_obj.c | |||
@@ -88,7 +88,7 @@ int i; | |||
88 | if(b) | 88 | if(b) |
89 | { | 89 | { |
90 | buf=b->data; | 90 | buf=b->data; |
91 | OPENSSL_free(b); | 91 | free(b); |
92 | } | 92 | } |
93 | strlcpy(buf,"NO X509_NAME",len); | 93 | strlcpy(buf,"NO X509_NAME",len); |
94 | return buf; | 94 | return buf; |
@@ -170,7 +170,7 @@ int i; | |||
170 | if (b != NULL) | 170 | if (b != NULL) |
171 | { | 171 | { |
172 | p=b->data; | 172 | p=b->data; |
173 | OPENSSL_free(b); | 173 | free(b); |
174 | } | 174 | } |
175 | else | 175 | else |
176 | p=buf; | 176 | p=buf; |
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c index 48183dc00c..1c5cee8030 100644 --- a/src/lib/libcrypto/x509/x509_req.c +++ b/src/lib/libcrypto/x509/x509_req.c | |||
@@ -84,7 +84,7 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
84 | ri=ret->req_info; | 84 | ri=ret->req_info; |
85 | 85 | ||
86 | ri->version->length=1; | 86 | ri->version->length=1; |
87 | ri->version->data=(unsigned char *)OPENSSL_malloc(1); | 87 | ri->version->data=(unsigned char *)malloc(1); |
88 | if (ri->version->data == NULL) goto err; | 88 | if (ri->version->data == NULL) goto err; |
89 | ri->version->data[0]=0; /* version == 0 */ | 89 | ri->version->data[0]=0; /* version == 0 */ |
90 | 90 | ||
diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c index a6cb9c8b1b..7bb5094e64 100644 --- a/src/lib/libcrypto/x509/x509_trs.c +++ b/src/lib/libcrypto/x509/x509_trs.c | |||
@@ -169,15 +169,15 @@ int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), | |||
169 | idx = X509_TRUST_get_by_id(id); | 169 | idx = X509_TRUST_get_by_id(id); |
170 | /* Need a new entry */ | 170 | /* Need a new entry */ |
171 | if(idx == -1) { | 171 | if(idx == -1) { |
172 | if(!(trtmp = OPENSSL_malloc(sizeof(X509_TRUST)))) { | 172 | if(!(trtmp = malloc(sizeof(X509_TRUST)))) { |
173 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); | 173 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | trtmp->flags = X509_TRUST_DYNAMIC; | 176 | trtmp->flags = X509_TRUST_DYNAMIC; |
177 | } else trtmp = X509_TRUST_get0(idx); | 177 | } else trtmp = X509_TRUST_get0(idx); |
178 | 178 | ||
179 | /* OPENSSL_free existing name if dynamic */ | 179 | /* free existing name if dynamic */ |
180 | if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name); | 180 | if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) free(trtmp->name); |
181 | /* dup supplied name */ | 181 | /* dup supplied name */ |
182 | if(!(trtmp->name = BUF_strdup(name))) { | 182 | if(!(trtmp->name = BUF_strdup(name))) { |
183 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); | 183 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); |
@@ -213,8 +213,8 @@ static void trtable_free(X509_TRUST *p) | |||
213 | if (p->flags & X509_TRUST_DYNAMIC) | 213 | if (p->flags & X509_TRUST_DYNAMIC) |
214 | { | 214 | { |
215 | if (p->flags & X509_TRUST_DYNAMIC_NAME) | 215 | if (p->flags & X509_TRUST_DYNAMIC_NAME) |
216 | OPENSSL_free(p->name); | 216 | free(p->name); |
217 | OPENSSL_free(p); | 217 | free(p); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index a82c2872e0..077bfd8f2d 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -1986,7 +1986,7 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, | |||
1986 | X509_STORE_CTX *X509_STORE_CTX_new(void) | 1986 | X509_STORE_CTX *X509_STORE_CTX_new(void) |
1987 | { | 1987 | { |
1988 | X509_STORE_CTX *ctx; | 1988 | X509_STORE_CTX *ctx; |
1989 | ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX)); | 1989 | ctx = (X509_STORE_CTX *)malloc(sizeof(X509_STORE_CTX)); |
1990 | if (!ctx) | 1990 | if (!ctx) |
1991 | { | 1991 | { |
1992 | X509err(X509_F_X509_STORE_CTX_NEW,ERR_R_MALLOC_FAILURE); | 1992 | X509err(X509_F_X509_STORE_CTX_NEW,ERR_R_MALLOC_FAILURE); |
@@ -1999,7 +1999,7 @@ X509_STORE_CTX *X509_STORE_CTX_new(void) | |||
1999 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx) | 1999 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx) |
2000 | { | 2000 | { |
2001 | X509_STORE_CTX_cleanup(ctx); | 2001 | X509_STORE_CTX_cleanup(ctx); |
2002 | OPENSSL_free(ctx); | 2002 | free(ctx); |
2003 | } | 2003 | } |
2004 | 2004 | ||
2005 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | 2005 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, |
@@ -2122,7 +2122,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
2122 | if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, | 2122 | if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, |
2123 | &(ctx->ex_data))) | 2123 | &(ctx->ex_data))) |
2124 | { | 2124 | { |
2125 | OPENSSL_free(ctx); | 2125 | free(ctx); |
2126 | X509err(X509_F_X509_STORE_CTX_INIT,ERR_R_MALLOC_FAILURE); | 2126 | X509err(X509_F_X509_STORE_CTX_INIT,ERR_R_MALLOC_FAILURE); |
2127 | return 0; | 2127 | return 0; |
2128 | } | 2128 | } |
diff --git a/src/lib/libcrypto/x509/x509_vpm.c b/src/lib/libcrypto/x509/x509_vpm.c index dfd89d89fa..5e3eba4029 100644 --- a/src/lib/libcrypto/x509/x509_vpm.c +++ b/src/lib/libcrypto/x509/x509_vpm.c | |||
@@ -88,7 +88,7 @@ static void x509_verify_param_zero(X509_VERIFY_PARAM *param) | |||
88 | X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) | 88 | X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) |
89 | { | 89 | { |
90 | X509_VERIFY_PARAM *param; | 90 | X509_VERIFY_PARAM *param; |
91 | param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM)); | 91 | param = malloc(sizeof(X509_VERIFY_PARAM)); |
92 | memset(param, 0, sizeof(X509_VERIFY_PARAM)); | 92 | memset(param, 0, sizeof(X509_VERIFY_PARAM)); |
93 | x509_verify_param_zero(param); | 93 | x509_verify_param_zero(param); |
94 | return param; | 94 | return param; |
@@ -97,7 +97,7 @@ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) | |||
97 | void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) | 97 | void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) |
98 | { | 98 | { |
99 | x509_verify_param_zero(param); | 99 | x509_verify_param_zero(param); |
100 | OPENSSL_free(param); | 100 | free(param); |
101 | } | 101 | } |
102 | 102 | ||
103 | /* This function determines how parameters are "inherited" from one structure | 103 | /* This function determines how parameters are "inherited" from one structure |
@@ -210,7 +210,7 @@ int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, | |||
210 | int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) | 210 | int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) |
211 | { | 211 | { |
212 | if (param->name) | 212 | if (param->name) |
213 | OPENSSL_free(param->name); | 213 | free(param->name); |
214 | param->name = BUF_strdup(name); | 214 | param->name = BUF_strdup(name); |
215 | if (param->name) | 215 | if (param->name) |
216 | return 1; | 216 | return 1; |
diff --git a/src/lib/libcrypto/x509/x509spki.c b/src/lib/libcrypto/x509/x509spki.c index 02a203d72c..28bc12e1a2 100644 --- a/src/lib/libcrypto/x509/x509spki.c +++ b/src/lib/libcrypto/x509/x509spki.c | |||
@@ -82,7 +82,7 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len) | |||
82 | int spki_len; | 82 | int spki_len; |
83 | NETSCAPE_SPKI *spki; | 83 | NETSCAPE_SPKI *spki; |
84 | if(len <= 0) len = strlen(str); | 84 | if(len <= 0) len = strlen(str); |
85 | if (!(spki_der = OPENSSL_malloc(len + 1))) { | 85 | if (!(spki_der = malloc(len + 1))) { |
86 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE); | 86 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE); |
87 | return NULL; | 87 | return NULL; |
88 | } | 88 | } |
@@ -90,12 +90,12 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len) | |||
90 | if(spki_len < 0) { | 90 | if(spki_len < 0) { |
91 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, | 91 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, |
92 | X509_R_BASE64_DECODE_ERROR); | 92 | X509_R_BASE64_DECODE_ERROR); |
93 | OPENSSL_free(spki_der); | 93 | free(spki_der); |
94 | return NULL; | 94 | return NULL; |
95 | } | 95 | } |
96 | p = spki_der; | 96 | p = spki_der; |
97 | spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len); | 97 | spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len); |
98 | OPENSSL_free(spki_der); | 98 | free(spki_der); |
99 | return spki; | 99 | return spki; |
100 | } | 100 | } |
101 | 101 | ||
@@ -107,8 +107,8 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) | |||
107 | char *b64_str; | 107 | char *b64_str; |
108 | int der_len; | 108 | int der_len; |
109 | der_len = i2d_NETSCAPE_SPKI(spki, NULL); | 109 | der_len = i2d_NETSCAPE_SPKI(spki, NULL); |
110 | der_spki = OPENSSL_malloc(der_len); | 110 | der_spki = malloc(der_len); |
111 | b64_str = OPENSSL_malloc(der_len * 2); | 111 | b64_str = malloc(der_len * 2); |
112 | if(!der_spki || !b64_str) { | 112 | if(!der_spki || !b64_str) { |
113 | X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); | 113 | X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); |
114 | return NULL; | 114 | return NULL; |
@@ -116,6 +116,6 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) | |||
116 | p = der_spki; | 116 | p = der_spki; |
117 | i2d_NETSCAPE_SPKI(spki, &p); | 117 | i2d_NETSCAPE_SPKI(spki, &p); |
118 | EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len); | 118 | EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len); |
119 | OPENSSL_free(der_spki); | 119 | free(der_spki); |
120 | return b64_str; | 120 | return b64_str; |
121 | } | 121 | } |
diff --git a/src/lib/libcrypto/x509v3/pcy_cache.c b/src/lib/libcrypto/x509v3/pcy_cache.c index 172b7e7ee4..24c79b4a80 100644 --- a/src/lib/libcrypto/x509v3/pcy_cache.c +++ b/src/lib/libcrypto/x509v3/pcy_cache.c | |||
@@ -134,7 +134,7 @@ static int policy_cache_new(X509 *x) | |||
134 | CERTIFICATEPOLICIES *ext_cpols = NULL; | 134 | CERTIFICATEPOLICIES *ext_cpols = NULL; |
135 | POLICY_MAPPINGS *ext_pmaps = NULL; | 135 | POLICY_MAPPINGS *ext_pmaps = NULL; |
136 | int i; | 136 | int i; |
137 | cache = OPENSSL_malloc(sizeof(X509_POLICY_CACHE)); | 137 | cache = malloc(sizeof(X509_POLICY_CACHE)); |
138 | if (!cache) | 138 | if (!cache) |
139 | return 0; | 139 | return 0; |
140 | cache->anyPolicy = NULL; | 140 | cache->anyPolicy = NULL; |
@@ -240,7 +240,7 @@ void policy_cache_free(X509_POLICY_CACHE *cache) | |||
240 | policy_data_free(cache->anyPolicy); | 240 | policy_data_free(cache->anyPolicy); |
241 | if (cache->data) | 241 | if (cache->data) |
242 | sk_X509_POLICY_DATA_pop_free(cache->data, policy_data_free); | 242 | sk_X509_POLICY_DATA_pop_free(cache->data, policy_data_free); |
243 | OPENSSL_free(cache); | 243 | free(cache); |
244 | } | 244 | } |
245 | 245 | ||
246 | const X509_POLICY_CACHE *policy_cache_set(X509 *x) | 246 | const X509_POLICY_CACHE *policy_cache_set(X509 *x) |
diff --git a/src/lib/libcrypto/x509v3/pcy_data.c b/src/lib/libcrypto/x509v3/pcy_data.c index 3444b03195..7c80915f5b 100644 --- a/src/lib/libcrypto/x509v3/pcy_data.c +++ b/src/lib/libcrypto/x509v3/pcy_data.c | |||
@@ -72,7 +72,7 @@ void policy_data_free(X509_POLICY_DATA *data) | |||
72 | sk_POLICYQUALINFO_pop_free(data->qualifier_set, | 72 | sk_POLICYQUALINFO_pop_free(data->qualifier_set, |
73 | POLICYQUALINFO_free); | 73 | POLICYQUALINFO_free); |
74 | sk_ASN1_OBJECT_pop_free(data->expected_policy_set, ASN1_OBJECT_free); | 74 | sk_ASN1_OBJECT_pop_free(data->expected_policy_set, ASN1_OBJECT_free); |
75 | OPENSSL_free(data); | 75 | free(data); |
76 | } | 76 | } |
77 | 77 | ||
78 | /* Create a data based on an existing policy. If 'id' is NULL use the | 78 | /* Create a data based on an existing policy. If 'id' is NULL use the |
@@ -97,13 +97,13 @@ X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, | |||
97 | } | 97 | } |
98 | else | 98 | else |
99 | id = NULL; | 99 | id = NULL; |
100 | ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA)); | 100 | ret = malloc(sizeof(X509_POLICY_DATA)); |
101 | if (!ret) | 101 | if (!ret) |
102 | return NULL; | 102 | return NULL; |
103 | ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); | 103 | ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); |
104 | if (!ret->expected_policy_set) | 104 | if (!ret->expected_policy_set) |
105 | { | 105 | { |
106 | OPENSSL_free(ret); | 106 | free(ret); |
107 | if (id) | 107 | if (id) |
108 | ASN1_OBJECT_free(id); | 108 | ASN1_OBJECT_free(id); |
109 | return NULL; | 109 | return NULL; |
diff --git a/src/lib/libcrypto/x509v3/pcy_node.c b/src/lib/libcrypto/x509v3/pcy_node.c index bd1e7f1ae8..8c2124a7f6 100644 --- a/src/lib/libcrypto/x509v3/pcy_node.c +++ b/src/lib/libcrypto/x509v3/pcy_node.c | |||
@@ -115,7 +115,7 @@ X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level, | |||
115 | X509_POLICY_TREE *tree) | 115 | X509_POLICY_TREE *tree) |
116 | { | 116 | { |
117 | X509_POLICY_NODE *node; | 117 | X509_POLICY_NODE *node; |
118 | node = OPENSSL_malloc(sizeof(X509_POLICY_NODE)); | 118 | node = malloc(sizeof(X509_POLICY_NODE)); |
119 | if (!node) | 119 | if (!node) |
120 | return NULL; | 120 | return NULL; |
121 | node->data = data; | 121 | node->data = data; |
@@ -164,7 +164,7 @@ X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level, | |||
164 | 164 | ||
165 | void policy_node_free(X509_POLICY_NODE *node) | 165 | void policy_node_free(X509_POLICY_NODE *node) |
166 | { | 166 | { |
167 | OPENSSL_free(node); | 167 | free(node); |
168 | } | 168 | } |
169 | 169 | ||
170 | /* See if a policy node matches a policy OID. If mapping enabled look through | 170 | /* See if a policy node matches a policy OID. If mapping enabled look through |
diff --git a/src/lib/libcrypto/x509v3/pcy_tree.c b/src/lib/libcrypto/x509v3/pcy_tree.c index bb9777348f..c4239b1fd9 100644 --- a/src/lib/libcrypto/x509v3/pcy_tree.c +++ b/src/lib/libcrypto/x509v3/pcy_tree.c | |||
@@ -219,13 +219,13 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
219 | 219 | ||
220 | /* If we get this far initialize the tree */ | 220 | /* If we get this far initialize the tree */ |
221 | 221 | ||
222 | tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE)); | 222 | tree = malloc(sizeof(X509_POLICY_TREE)); |
223 | 223 | ||
224 | if (!tree) | 224 | if (!tree) |
225 | return 0; | 225 | return 0; |
226 | 226 | ||
227 | tree->flags = 0; | 227 | tree->flags = 0; |
228 | tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n); | 228 | tree->levels = malloc(sizeof(X509_POLICY_LEVEL) * n); |
229 | tree->nlevel = 0; | 229 | tree->nlevel = 0; |
230 | tree->extra_data = NULL; | 230 | tree->extra_data = NULL; |
231 | tree->auth_policies = NULL; | 231 | tree->auth_policies = NULL; |
@@ -233,7 +233,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
233 | 233 | ||
234 | if (!tree->levels) | 234 | if (!tree->levels) |
235 | { | 235 | { |
236 | OPENSSL_free(tree); | 236 | free(tree); |
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | 239 | ||
@@ -516,7 +516,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | |||
516 | if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) | 516 | if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) |
517 | { | 517 | { |
518 | node->parent->nchild--; | 518 | node->parent->nchild--; |
519 | OPENSSL_free(node); | 519 | free(node); |
520 | (void)sk_X509_POLICY_NODE_delete(nodes,i); | 520 | (void)sk_X509_POLICY_NODE_delete(nodes,i); |
521 | } | 521 | } |
522 | } | 522 | } |
@@ -531,7 +531,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | |||
531 | if (node->nchild == 0) | 531 | if (node->nchild == 0) |
532 | { | 532 | { |
533 | node->parent->nchild--; | 533 | node->parent->nchild--; |
534 | OPENSSL_free(node); | 534 | free(node); |
535 | (void)sk_X509_POLICY_NODE_delete(nodes, i); | 535 | (void)sk_X509_POLICY_NODE_delete(nodes, i); |
536 | } | 536 | } |
537 | } | 537 | } |
@@ -539,7 +539,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | |||
539 | { | 539 | { |
540 | if (curr->anyPolicy->parent) | 540 | if (curr->anyPolicy->parent) |
541 | curr->anyPolicy->parent->nchild--; | 541 | curr->anyPolicy->parent->nchild--; |
542 | OPENSSL_free(curr->anyPolicy); | 542 | free(curr->anyPolicy); |
543 | curr->anyPolicy = NULL; | 543 | curr->anyPolicy = NULL; |
544 | } | 544 | } |
545 | if (curr == tree->levels) | 545 | if (curr == tree->levels) |
@@ -721,7 +721,7 @@ static int tree_evaluate(X509_POLICY_TREE *tree) | |||
721 | static void exnode_free(X509_POLICY_NODE *node) | 721 | static void exnode_free(X509_POLICY_NODE *node) |
722 | { | 722 | { |
723 | if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE)) | 723 | if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE)) |
724 | OPENSSL_free(node); | 724 | free(node); |
725 | } | 725 | } |
726 | 726 | ||
727 | 727 | ||
@@ -751,8 +751,8 @@ void X509_policy_tree_free(X509_POLICY_TREE *tree) | |||
751 | sk_X509_POLICY_DATA_pop_free(tree->extra_data, | 751 | sk_X509_POLICY_DATA_pop_free(tree->extra_data, |
752 | policy_data_free); | 752 | policy_data_free); |
753 | 753 | ||
754 | OPENSSL_free(tree->levels); | 754 | free(tree->levels); |
755 | OPENSSL_free(tree); | 755 | free(tree); |
756 | 756 | ||
757 | } | 757 | } |
758 | 758 | ||
diff --git a/src/lib/libcrypto/x509v3/v3_addr.c b/src/lib/libcrypto/x509v3/v3_addr.c index df46a4983b..179f08d222 100644 --- a/src/lib/libcrypto/x509v3/v3_addr.c +++ b/src/lib/libcrypto/x509v3/v3_addr.c | |||
@@ -1013,7 +1013,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
1013 | X509V3_conf_err(val); | 1013 | X509V3_conf_err(val); |
1014 | goto err; | 1014 | goto err; |
1015 | } | 1015 | } |
1016 | OPENSSL_free(s); | 1016 | free(s); |
1017 | s = NULL; | 1017 | s = NULL; |
1018 | continue; | 1018 | continue; |
1019 | } | 1019 | } |
@@ -1077,7 +1077,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
1077 | goto err; | 1077 | goto err; |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | OPENSSL_free(s); | 1080 | free(s); |
1081 | s = NULL; | 1081 | s = NULL; |
1082 | } | 1082 | } |
1083 | 1083 | ||
@@ -1089,7 +1089,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
1089 | return addr; | 1089 | return addr; |
1090 | 1090 | ||
1091 | err: | 1091 | err: |
1092 | OPENSSL_free(s); | 1092 | free(s); |
1093 | sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); | 1093 | sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); |
1094 | return NULL; | 1094 | return NULL; |
1095 | } | 1095 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_akey.c b/src/lib/libcrypto/x509v3/v3_akey.c index c6b68ee221..04e1fb9544 100644 --- a/src/lib/libcrypto/x509v3/v3_akey.c +++ b/src/lib/libcrypto/x509v3/v3_akey.c | |||
@@ -87,7 +87,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, | |||
87 | if(akeyid->keyid) { | 87 | if(akeyid->keyid) { |
88 | tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length); | 88 | tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length); |
89 | X509V3_add_value("keyid", tmp, &extlist); | 89 | X509V3_add_value("keyid", tmp, &extlist); |
90 | OPENSSL_free(tmp); | 90 | free(tmp); |
91 | } | 91 | } |
92 | if(akeyid->issuer) | 92 | if(akeyid->issuer) |
93 | extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); | 93 | extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); |
@@ -95,7 +95,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, | |||
95 | tmp = hex_to_string(akeyid->serial->data, | 95 | tmp = hex_to_string(akeyid->serial->data, |
96 | akeyid->serial->length); | 96 | akeyid->serial->length); |
97 | X509V3_add_value("serial", tmp, &extlist); | 97 | X509V3_add_value("serial", tmp, &extlist); |
98 | OPENSSL_free(tmp); | 98 | free(tmp); |
99 | } | 99 | } |
100 | return extlist; | 100 | return extlist; |
101 | } | 101 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_alt.c b/src/lib/libcrypto/x509v3/v3_alt.c index 8de5dd041b..636677df94 100644 --- a/src/lib/libcrypto/x509v3/v3_alt.c +++ b/src/lib/libcrypto/x509v3/v3_alt.c | |||
@@ -578,11 +578,11 @@ static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx) | |||
578 | if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx))) | 578 | if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx))) |
579 | return 0; | 579 | return 0; |
580 | objlen = p - value; | 580 | objlen = p - value; |
581 | objtmp = OPENSSL_malloc(objlen + 1); | 581 | objtmp = malloc(objlen + 1); |
582 | if (objtmp) { | 582 | if (objtmp) { |
583 | strlcpy(objtmp, value, objlen + 1); | 583 | strlcpy(objtmp, value, objlen + 1); |
584 | gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0); | 584 | gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0); |
585 | OPENSSL_free(objtmp); | 585 | free(objtmp); |
586 | } else | 586 | } else |
587 | gen->d.otherName->type_id = NULL; | 587 | gen->d.otherName->type_id = NULL; |
588 | if (!gen->d.otherName->type_id) | 588 | if (!gen->d.otherName->type_id) |
diff --git a/src/lib/libcrypto/x509v3/v3_asid.c b/src/lib/libcrypto/x509v3/v3_asid.c index 1587e8ed72..325c8e0406 100644 --- a/src/lib/libcrypto/x509v3/v3_asid.c +++ b/src/lib/libcrypto/x509v3/v3_asid.c | |||
@@ -125,17 +125,17 @@ static int i2r_ASIdentifierChoice(BIO *out, | |||
125 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL) | 125 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL) |
126 | return 0; | 126 | return 0; |
127 | BIO_printf(out, "%*s%s\n", indent + 2, "", s); | 127 | BIO_printf(out, "%*s%s\n", indent + 2, "", s); |
128 | OPENSSL_free(s); | 128 | free(s); |
129 | break; | 129 | break; |
130 | case ASIdOrRange_range: | 130 | case ASIdOrRange_range: |
131 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL) | 131 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL) |
132 | return 0; | 132 | return 0; |
133 | BIO_printf(out, "%*s%s-", indent + 2, "", s); | 133 | BIO_printf(out, "%*s%s-", indent + 2, "", s); |
134 | OPENSSL_free(s); | 134 | free(s); |
135 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL) | 135 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL) |
136 | return 0; | 136 | return 0; |
137 | BIO_printf(out, "%s\n", s); | 137 | BIO_printf(out, "%s\n", s); |
138 | OPENSSL_free(s); | 138 | free(s); |
139 | break; | 139 | break; |
140 | default: | 140 | default: |
141 | return 0; | 141 | return 0; |
@@ -471,7 +471,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
471 | ASRange *r; | 471 | ASRange *r; |
472 | switch (a->type) { | 472 | switch (a->type) { |
473 | case ASIdOrRange_id: | 473 | case ASIdOrRange_id: |
474 | if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) { | 474 | if ((r = malloc(sizeof(ASRange))) == NULL) { |
475 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 475 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, |
476 | ERR_R_MALLOC_FAILURE); | 476 | ERR_R_MALLOC_FAILURE); |
477 | goto done; | 477 | goto done; |
@@ -620,7 +620,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
620 | s[i1] = '\0'; | 620 | s[i1] = '\0'; |
621 | min = s2i_ASN1_INTEGER(NULL, s); | 621 | min = s2i_ASN1_INTEGER(NULL, s); |
622 | max = s2i_ASN1_INTEGER(NULL, s + i2); | 622 | max = s2i_ASN1_INTEGER(NULL, s + i2); |
623 | OPENSSL_free(s); | 623 | free(s); |
624 | if (min == NULL || max == NULL) { | 624 | if (min == NULL || max == NULL) { |
625 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 625 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); |
626 | goto err; | 626 | goto err; |
diff --git a/src/lib/libcrypto/x509v3/v3_conf.c b/src/lib/libcrypto/x509v3/v3_conf.c index 6730f9a6ee..519aefc93c 100644 --- a/src/lib/libcrypto/x509v3/v3_conf.c +++ b/src/lib/libcrypto/x509v3/v3_conf.c | |||
@@ -190,7 +190,7 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, | |||
190 | { | 190 | { |
191 | unsigned char *p; | 191 | unsigned char *p; |
192 | ext_len = method->i2d(ext_struc, NULL); | 192 | ext_len = method->i2d(ext_struc, NULL); |
193 | if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr; | 193 | if(!(ext_der = malloc(ext_len))) goto merr; |
194 | p = ext_der; | 194 | p = ext_der; |
195 | method->i2d(ext_struc, &p); | 195 | method->i2d(ext_struc, &p); |
196 | } | 196 | } |
@@ -300,7 +300,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, | |||
300 | err: | 300 | err: |
301 | ASN1_OBJECT_free(obj); | 301 | ASN1_OBJECT_free(obj); |
302 | M_ASN1_OCTET_STRING_free(oct); | 302 | M_ASN1_OCTET_STRING_free(oct); |
303 | if(ext_der) OPENSSL_free(ext_der); | 303 | if(ext_der) free(ext_der); |
304 | return extension; | 304 | return extension; |
305 | 305 | ||
306 | } | 306 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_cpols.c b/src/lib/libcrypto/x509v3/v3_cpols.c index 1f0798b946..1a337fa07e 100644 --- a/src/lib/libcrypto/x509v3/v3_cpols.c +++ b/src/lib/libcrypto/x509v3/v3_cpols.c | |||
@@ -426,7 +426,7 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent) | |||
426 | if(i) BIO_puts(out, ", "); | 426 | if(i) BIO_puts(out, ", "); |
427 | tmp = i2s_ASN1_INTEGER(NULL, num); | 427 | tmp = i2s_ASN1_INTEGER(NULL, num); |
428 | BIO_puts(out, tmp); | 428 | BIO_puts(out, tmp); |
429 | OPENSSL_free(tmp); | 429 | free(tmp); |
430 | } | 430 | } |
431 | BIO_puts(out, "\n"); | 431 | BIO_puts(out, "\n"); |
432 | } | 432 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_ia5.c b/src/lib/libcrypto/x509v3/v3_ia5.c index ab1c5188b8..98789b36e9 100644 --- a/src/lib/libcrypto/x509v3/v3_ia5.c +++ b/src/lib/libcrypto/x509v3/v3_ia5.c | |||
@@ -82,7 +82,7 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | |||
82 | { | 82 | { |
83 | char *tmp; | 83 | char *tmp; |
84 | if(!ia5 || !ia5->length) return NULL; | 84 | if(!ia5 || !ia5->length) return NULL; |
85 | if(!(tmp = OPENSSL_malloc(ia5->length + 1))) { | 85 | if(!(tmp = malloc(ia5->length + 1))) { |
86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | 86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); |
87 | return NULL; | 87 | return NULL; |
88 | } | 88 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_info.c b/src/lib/libcrypto/x509v3/v3_info.c index 44bc3e1105..2b290ca00c 100644 --- a/src/lib/libcrypto/x509v3/v3_info.c +++ b/src/lib/libcrypto/x509v3/v3_info.c | |||
@@ -115,7 +115,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method | |||
115 | vtmp = sk_CONF_VALUE_value(ret, i); | 115 | vtmp = sk_CONF_VALUE_value(ret, i); |
116 | i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method); | 116 | i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method); |
117 | nlen = strlen(objtmp) + strlen(vtmp->name) + 5; | 117 | nlen = strlen(objtmp) + strlen(vtmp->name) + 5; |
118 | ntmp = OPENSSL_malloc(nlen); | 118 | ntmp = malloc(nlen); |
119 | if(!ntmp) { | 119 | if(!ntmp) { |
120 | X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, | 120 | X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, |
121 | ERR_R_MALLOC_FAILURE); | 121 | ERR_R_MALLOC_FAILURE); |
@@ -124,7 +124,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method | |||
124 | BUF_strlcpy(ntmp, objtmp, nlen); | 124 | BUF_strlcpy(ntmp, objtmp, nlen); |
125 | BUF_strlcat(ntmp, " - ", nlen); | 125 | BUF_strlcat(ntmp, " - ", nlen); |
126 | BUF_strlcat(ntmp, vtmp->name, nlen); | 126 | BUF_strlcat(ntmp, vtmp->name, nlen); |
127 | OPENSSL_free(vtmp->name); | 127 | free(vtmp->name); |
128 | vtmp->name = ntmp; | 128 | vtmp->name = ntmp; |
129 | 129 | ||
130 | } | 130 | } |
@@ -161,7 +161,7 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *metho | |||
161 | ctmp.value = cnf->value; | 161 | ctmp.value = cnf->value; |
162 | if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0)) | 162 | if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0)) |
163 | goto err; | 163 | goto err; |
164 | if(!(objtmp = OPENSSL_malloc(objlen + 1))) { | 164 | if(!(objtmp = malloc(objlen + 1))) { |
165 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE); | 165 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE); |
166 | goto err; | 166 | goto err; |
167 | } | 167 | } |
@@ -170,10 +170,10 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *metho | |||
170 | if(!acc->method) { | 170 | if(!acc->method) { |
171 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT); | 171 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT); |
172 | ERR_add_error_data(2, "value=", objtmp); | 172 | ERR_add_error_data(2, "value=", objtmp); |
173 | OPENSSL_free(objtmp); | 173 | free(objtmp); |
174 | goto err; | 174 | goto err; |
175 | } | 175 | } |
176 | OPENSSL_free(objtmp); | 176 | free(objtmp); |
177 | 177 | ||
178 | } | 178 | } |
179 | return ainfo; | 179 | return ainfo; |
diff --git a/src/lib/libcrypto/x509v3/v3_lib.c b/src/lib/libcrypto/x509v3/v3_lib.c index 0f1e1d4422..0613ea7f22 100644 --- a/src/lib/libcrypto/x509v3/v3_lib.c +++ b/src/lib/libcrypto/x509v3/v3_lib.c | |||
@@ -133,7 +133,7 @@ int X509V3_EXT_add_alias(int nid_to, int nid_from) | |||
133 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND); | 133 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND); |
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | if(!(tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) { | 136 | if(!(tmpext = (X509V3_EXT_METHOD *)malloc(sizeof(X509V3_EXT_METHOD)))) { |
137 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE); | 137 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE); |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
@@ -151,7 +151,7 @@ void X509V3_EXT_cleanup(void) | |||
151 | 151 | ||
152 | static void ext_list_free(X509V3_EXT_METHOD *ext) | 152 | static void ext_list_free(X509V3_EXT_METHOD *ext) |
153 | { | 153 | { |
154 | if(ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext); | 154 | if(ext->ext_flags & X509V3_EXT_DYNAMIC) free(ext); |
155 | } | 155 | } |
156 | 156 | ||
157 | /* Legacy function: we don't need to add standard extensions | 157 | /* Legacy function: we don't need to add standard extensions |
diff --git a/src/lib/libcrypto/x509v3/v3_pci.c b/src/lib/libcrypto/x509v3/v3_pci.c index 0dcfa004fe..9cef94258c 100644 --- a/src/lib/libcrypto/x509v3/v3_pci.c +++ b/src/lib/libcrypto/x509v3/v3_pci.c | |||
@@ -135,7 +135,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
135 | goto err; | 135 | goto err; |
136 | } | 136 | } |
137 | 137 | ||
138 | tmp_data = OPENSSL_realloc((*policy)->data, | 138 | tmp_data = realloc((*policy)->data, |
139 | (*policy)->length + val_len + 1); | 139 | (*policy)->length + val_len + 1); |
140 | if (tmp_data) | 140 | if (tmp_data) |
141 | { | 141 | { |
@@ -147,7 +147,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
147 | } | 147 | } |
148 | else | 148 | else |
149 | { | 149 | { |
150 | OPENSSL_free(tmp_data2); | 150 | free(tmp_data2); |
151 | /* realloc failure implies the original data space is b0rked too! */ | 151 | /* realloc failure implies the original data space is b0rked too! */ |
152 | (*policy)->data = NULL; | 152 | (*policy)->data = NULL; |
153 | (*policy)->length = 0; | 153 | (*policy)->length = 0; |
@@ -155,7 +155,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
155 | X509V3_conf_err(val); | 155 | X509V3_conf_err(val); |
156 | goto err; | 156 | goto err; |
157 | } | 157 | } |
158 | OPENSSL_free(tmp_data2); | 158 | free(tmp_data2); |
159 | } | 159 | } |
160 | else if (strncmp(val->value, "file:", 5) == 0) | 160 | else if (strncmp(val->value, "file:", 5) == 0) |
161 | { | 161 | { |
@@ -173,7 +173,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
173 | { | 173 | { |
174 | if (!n) continue; | 174 | if (!n) continue; |
175 | 175 | ||
176 | tmp_data = OPENSSL_realloc((*policy)->data, | 176 | tmp_data = realloc((*policy)->data, |
177 | (*policy)->length + n + 1); | 177 | (*policy)->length + n + 1); |
178 | 178 | ||
179 | if (!tmp_data) | 179 | if (!tmp_data) |
@@ -197,7 +197,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
197 | else if (strncmp(val->value, "text:", 5) == 0) | 197 | else if (strncmp(val->value, "text:", 5) == 0) |
198 | { | 198 | { |
199 | val_len = strlen(val->value + 5); | 199 | val_len = strlen(val->value + 5); |
200 | tmp_data = OPENSSL_realloc((*policy)->data, | 200 | tmp_data = realloc((*policy)->data, |
201 | (*policy)->length + val_len + 1); | 201 | (*policy)->length + val_len + 1); |
202 | if (tmp_data) | 202 | if (tmp_data) |
203 | { | 203 | { |
diff --git a/src/lib/libcrypto/x509v3/v3_prn.c b/src/lib/libcrypto/x509v3/v3_prn.c index 2124b447b4..565937af47 100644 --- a/src/lib/libcrypto/x509v3/v3_prn.c +++ b/src/lib/libcrypto/x509v3/v3_prn.c | |||
@@ -126,7 +126,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde | |||
126 | 126 | ||
127 | err: | 127 | err: |
128 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); | 128 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); |
129 | if(value) OPENSSL_free(value); | 129 | if(value) free(value); |
130 | if(method->it) ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it)); | 130 | if(method->it) ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it)); |
131 | else method->ext_free(ext_str); | 131 | else method->ext_free(ext_str); |
132 | return ok; | 132 | return ok; |
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index f59bfc1844..45d7251c29 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
@@ -183,17 +183,17 @@ int X509_PURPOSE_add(int id, int trust, int flags, | |||
183 | idx = X509_PURPOSE_get_by_id(id); | 183 | idx = X509_PURPOSE_get_by_id(id); |
184 | /* Need a new entry */ | 184 | /* Need a new entry */ |
185 | if(idx == -1) { | 185 | if(idx == -1) { |
186 | if(!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) { | 186 | if(!(ptmp = malloc(sizeof(X509_PURPOSE)))) { |
187 | X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE); | 187 | X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | ptmp->flags = X509_PURPOSE_DYNAMIC; | 190 | ptmp->flags = X509_PURPOSE_DYNAMIC; |
191 | } else ptmp = X509_PURPOSE_get0(idx); | 191 | } else ptmp = X509_PURPOSE_get0(idx); |
192 | 192 | ||
193 | /* OPENSSL_free existing name if dynamic */ | 193 | /* free existing name if dynamic */ |
194 | if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) { | 194 | if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) { |
195 | OPENSSL_free(ptmp->name); | 195 | free(ptmp->name); |
196 | OPENSSL_free(ptmp->sname); | 196 | free(ptmp->sname); |
197 | } | 197 | } |
198 | /* dup supplied name */ | 198 | /* dup supplied name */ |
199 | ptmp->name = BUF_strdup(name); | 199 | ptmp->name = BUF_strdup(name); |
@@ -232,10 +232,10 @@ static void xptable_free(X509_PURPOSE *p) | |||
232 | if (p->flags & X509_PURPOSE_DYNAMIC) | 232 | if (p->flags & X509_PURPOSE_DYNAMIC) |
233 | { | 233 | { |
234 | if (p->flags & X509_PURPOSE_DYNAMIC_NAME) { | 234 | if (p->flags & X509_PURPOSE_DYNAMIC_NAME) { |
235 | OPENSSL_free(p->name); | 235 | free(p->name); |
236 | OPENSSL_free(p->sname); | 236 | free(p->sname); |
237 | } | 237 | } |
238 | OPENSSL_free(p); | 238 | free(p); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
diff --git a/src/lib/libcrypto/x509v3/v3_sxnet.c b/src/lib/libcrypto/x509v3/v3_sxnet.c index 2a6bf11b65..a2b0322e44 100644 --- a/src/lib/libcrypto/x509v3/v3_sxnet.c +++ b/src/lib/libcrypto/x509v3/v3_sxnet.c | |||
@@ -114,7 +114,7 @@ static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out, | |||
114 | id = sk_SXNETID_value(sx->ids, i); | 114 | id = sk_SXNETID_value(sx->ids, i); |
115 | tmp = i2s_ASN1_INTEGER(NULL, id->zone); | 115 | tmp = i2s_ASN1_INTEGER(NULL, id->zone); |
116 | BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp); | 116 | BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp); |
117 | OPENSSL_free(tmp); | 117 | free(tmp); |
118 | M_ASN1_OCTET_STRING_print(out, id->user); | 118 | M_ASN1_OCTET_STRING_print(out, id->user); |
119 | } | 119 | } |
120 | return 1; | 120 | return 1; |
diff --git a/src/lib/libcrypto/x509v3/v3_utl.c b/src/lib/libcrypto/x509v3/v3_utl.c index c4b6143eff..d938a175ed 100644 --- a/src/lib/libcrypto/x509v3/v3_utl.c +++ b/src/lib/libcrypto/x509v3/v3_utl.c | |||
@@ -85,7 +85,7 @@ int X509V3_add_value(const char *name, const char *value, | |||
85 | char *tname = NULL, *tvalue = NULL; | 85 | char *tname = NULL, *tvalue = NULL; |
86 | if(name && !(tname = BUF_strdup(name))) goto err; | 86 | if(name && !(tname = BUF_strdup(name))) goto err; |
87 | if(value && !(tvalue = BUF_strdup(value))) goto err; | 87 | if(value && !(tvalue = BUF_strdup(value))) goto err; |
88 | if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err; | 88 | if(!(vtmp = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) goto err; |
89 | if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; | 89 | if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; |
90 | vtmp->section = NULL; | 90 | vtmp->section = NULL; |
91 | vtmp->name = tname; | 91 | vtmp->name = tname; |
@@ -94,9 +94,9 @@ int X509V3_add_value(const char *name, const char *value, | |||
94 | return 1; | 94 | return 1; |
95 | err: | 95 | err: |
96 | X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE); | 96 | X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE); |
97 | if(vtmp) OPENSSL_free(vtmp); | 97 | if(vtmp) free(vtmp); |
98 | if(tname) OPENSSL_free(tname); | 98 | if(tname) free(tname); |
99 | if(tvalue) OPENSSL_free(tvalue); | 99 | if(tvalue) free(tvalue); |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
@@ -111,10 +111,10 @@ int X509V3_add_value_uchar(const char *name, const unsigned char *value, | |||
111 | void X509V3_conf_free(CONF_VALUE *conf) | 111 | void X509V3_conf_free(CONF_VALUE *conf) |
112 | { | 112 | { |
113 | if(!conf) return; | 113 | if(!conf) return; |
114 | if(conf->name) OPENSSL_free(conf->name); | 114 | if(conf->name) free(conf->name); |
115 | if(conf->value) OPENSSL_free(conf->value); | 115 | if(conf->value) free(conf->value); |
116 | if(conf->section) OPENSSL_free(conf->section); | 116 | if(conf->section) free(conf->section); |
117 | OPENSSL_free(conf); | 117 | free(conf); |
118 | } | 118 | } |
119 | 119 | ||
120 | int X509V3_add_value_bool(const char *name, int asn1_bool, | 120 | int X509V3_add_value_bool(const char *name, int asn1_bool, |
@@ -206,7 +206,7 @@ int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, | |||
206 | if(!aint) return 1; | 206 | if(!aint) return 1; |
207 | if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0; | 207 | if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0; |
208 | ret = X509V3_add_value(name, strtmp, extlist); | 208 | ret = X509V3_add_value(name, strtmp, extlist); |
209 | OPENSSL_free(strtmp); | 209 | free(strtmp); |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
@@ -328,11 +328,11 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line) | |||
328 | } | 328 | } |
329 | X509V3_add_value(ntmp, NULL, &values); | 329 | X509V3_add_value(ntmp, NULL, &values); |
330 | } | 330 | } |
331 | OPENSSL_free(linebuf); | 331 | free(linebuf); |
332 | return values; | 332 | return values; |
333 | 333 | ||
334 | err: | 334 | err: |
335 | OPENSSL_free(linebuf); | 335 | free(linebuf); |
336 | sk_CONF_VALUE_pop_free(values, X509V3_conf_free); | 336 | sk_CONF_VALUE_pop_free(values, X509V3_conf_free); |
337 | return NULL; | 337 | return NULL; |
338 | 338 | ||
@@ -355,7 +355,7 @@ static char *strip_spaces(char *name) | |||
355 | 355 | ||
356 | /* hex string utilities */ | 356 | /* hex string utilities */ |
357 | 357 | ||
358 | /* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its | 358 | /* Given a buffer of length 'len' return a malloc'ed string with its |
359 | * hex representation | 359 | * hex representation |
360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) | 360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) |
361 | */ | 361 | */ |
@@ -367,7 +367,7 @@ char *hex_to_string(const unsigned char *buffer, long len) | |||
367 | int i; | 367 | int i; |
368 | const static char hexdig[] = "0123456789ABCDEF"; | 368 | const static char hexdig[] = "0123456789ABCDEF"; |
369 | if(!buffer || !len) return NULL; | 369 | if(!buffer || !len) return NULL; |
370 | if(!(tmp = OPENSSL_malloc(len * 3 + 1))) { | 370 | if(!(tmp = malloc(len * 3 + 1))) { |
371 | X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE); | 371 | X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE); |
372 | return NULL; | 372 | return NULL; |
373 | } | 373 | } |
@@ -393,14 +393,14 @@ unsigned char *string_to_hex(const char *str, long *len) | |||
393 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT); | 393 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT); |
394 | return NULL; | 394 | return NULL; |
395 | } | 395 | } |
396 | if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err; | 396 | if(!(hexbuf = malloc(strlen(str) >> 1))) goto err; |
397 | for(p = (unsigned char *)str, q = hexbuf; *p;) { | 397 | for(p = (unsigned char *)str, q = hexbuf; *p;) { |
398 | ch = *p++; | 398 | ch = *p++; |
399 | if(ch == ':') continue; | 399 | if(ch == ':') continue; |
400 | cl = *p++; | 400 | cl = *p++; |
401 | if(!cl) { | 401 | if(!cl) { |
402 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); | 402 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); |
403 | OPENSSL_free(hexbuf); | 403 | free(hexbuf); |
404 | return NULL; | 404 | return NULL; |
405 | } | 405 | } |
406 | if(isupper(ch)) ch = tolower(ch); | 406 | if(isupper(ch)) ch = tolower(ch); |
@@ -422,12 +422,12 @@ unsigned char *string_to_hex(const char *str, long *len) | |||
422 | return hexbuf; | 422 | return hexbuf; |
423 | 423 | ||
424 | err: | 424 | err: |
425 | if(hexbuf) OPENSSL_free(hexbuf); | 425 | if(hexbuf) free(hexbuf); |
426 | X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE); | 426 | X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE); |
427 | return NULL; | 427 | return NULL; |
428 | 428 | ||
429 | badhex: | 429 | badhex: |
430 | OPENSSL_free(hexbuf); | 430 | free(hexbuf); |
431 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT); | 431 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT); |
432 | return NULL; | 432 | return NULL; |
433 | 433 | ||
@@ -531,7 +531,7 @@ static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES *gens) | |||
531 | 531 | ||
532 | static void str_free(OPENSSL_STRING str) | 532 | static void str_free(OPENSSL_STRING str) |
533 | { | 533 | { |
534 | OPENSSL_free(str); | 534 | free(str); |
535 | } | 535 | } |
536 | 536 | ||
537 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) | 537 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) |
@@ -608,7 +608,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc) | |||
608 | 608 | ||
609 | iplen2 = a2i_ipadd(ipout + iplen1, p); | 609 | iplen2 = a2i_ipadd(ipout + iplen1, p); |
610 | 610 | ||
611 | OPENSSL_free(iptmp); | 611 | free(iptmp); |
612 | iptmp = NULL; | 612 | iptmp = NULL; |
613 | 613 | ||
614 | if (!iplen2 || (iplen1 != iplen2)) | 614 | if (!iplen2 || (iplen1 != iplen2)) |
@@ -624,7 +624,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc) | |||
624 | 624 | ||
625 | err: | 625 | err: |
626 | if (iptmp) | 626 | if (iptmp) |
627 | OPENSSL_free(iptmp); | 627 | free(iptmp); |
628 | if (ret) | 628 | if (ret) |
629 | ASN1_OCTET_STRING_free(ret); | 629 | ASN1_OCTET_STRING_free(ret); |
630 | return NULL; | 630 | return NULL; |
diff --git a/src/lib/libssl/bio_ssl.c b/src/lib/libssl/bio_ssl.c index 65077aaa00..35463c73d4 100644 --- a/src/lib/libssl/bio_ssl.c +++ b/src/lib/libssl/bio_ssl.c | |||
@@ -105,7 +105,7 @@ ssl_new(BIO *bi) | |||
105 | { | 105 | { |
106 | BIO_SSL *bs; | 106 | BIO_SSL *bs; |
107 | 107 | ||
108 | bs = (BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL)); | 108 | bs = (BIO_SSL *)malloc(sizeof(BIO_SSL)); |
109 | if (bs == NULL) { | 109 | if (bs == NULL) { |
110 | BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE); | 110 | BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE); |
111 | return (0); | 111 | return (0); |
@@ -134,7 +134,7 @@ ssl_free(BIO *a) | |||
134 | a->flags = 0; | 134 | a->flags = 0; |
135 | } | 135 | } |
136 | if (a->ptr != NULL) | 136 | if (a->ptr != NULL) |
137 | OPENSSL_free(a->ptr); | 137 | free(a->ptr); |
138 | return (1); | 138 | return (1); |
139 | } | 139 | } |
140 | 140 | ||
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c index 731245c6a6..2f7dc283a0 100644 --- a/src/lib/libssl/d1_both.c +++ b/src/lib/libssl/d1_both.c | |||
@@ -179,14 +179,14 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) | |||
179 | unsigned char *buf = NULL; | 179 | unsigned char *buf = NULL; |
180 | unsigned char *bitmask = NULL; | 180 | unsigned char *bitmask = NULL; |
181 | 181 | ||
182 | frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); | 182 | frag = (hm_fragment *)malloc(sizeof(hm_fragment)); |
183 | if (frag == NULL) | 183 | if (frag == NULL) |
184 | return NULL; | 184 | return NULL; |
185 | 185 | ||
186 | if (frag_len) { | 186 | if (frag_len) { |
187 | buf = (unsigned char *)OPENSSL_malloc(frag_len); | 187 | buf = (unsigned char *)malloc(frag_len); |
188 | if (buf == NULL) { | 188 | if (buf == NULL) { |
189 | OPENSSL_free(frag); | 189 | free(frag); |
190 | return NULL; | 190 | return NULL; |
191 | } | 191 | } |
192 | } | 192 | } |
@@ -196,11 +196,11 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) | |||
196 | 196 | ||
197 | /* Initialize reassembly bitmask if necessary */ | 197 | /* Initialize reassembly bitmask if necessary */ |
198 | if (reassembly) { | 198 | if (reassembly) { |
199 | bitmask = (unsigned char *)OPENSSL_malloc(RSMBLY_BITMASK_SIZE(frag_len)); | 199 | bitmask = (unsigned char *)malloc(RSMBLY_BITMASK_SIZE(frag_len)); |
200 | if (bitmask == NULL) { | 200 | if (bitmask == NULL) { |
201 | if (buf != NULL) | 201 | if (buf != NULL) |
202 | OPENSSL_free(buf); | 202 | free(buf); |
203 | OPENSSL_free(frag); | 203 | free(frag); |
204 | return NULL; | 204 | return NULL; |
205 | } | 205 | } |
206 | memset(bitmask, 0, RSMBLY_BITMASK_SIZE(frag_len)); | 206 | memset(bitmask, 0, RSMBLY_BITMASK_SIZE(frag_len)); |
@@ -220,10 +220,10 @@ dtls1_hm_fragment_free(hm_fragment *frag) | |||
220 | EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash); | 220 | EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash); |
221 | } | 221 | } |
222 | if (frag->fragment) | 222 | if (frag->fragment) |
223 | OPENSSL_free(frag->fragment); | 223 | free(frag->fragment); |
224 | if (frag->reassembly) | 224 | if (frag->reassembly) |
225 | OPENSSL_free(frag->reassembly); | 225 | free(frag->reassembly); |
226 | OPENSSL_free(frag); | 226 | free(frag); |
227 | } | 227 | } |
228 | 228 | ||
229 | /* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ | 229 | /* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ |
@@ -636,7 +636,7 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) { | |||
636 | is_complete); | 636 | is_complete); |
637 | 637 | ||
638 | if (is_complete) { | 638 | if (is_complete) { |
639 | OPENSSL_free(frag->reassembly); | 639 | free(frag->reassembly); |
640 | frag->reassembly = NULL; | 640 | frag->reassembly = NULL; |
641 | } | 641 | } |
642 | 642 | ||
@@ -660,7 +660,7 @@ err: | |||
660 | if (frag != NULL) | 660 | if (frag != NULL) |
661 | dtls1_hm_fragment_free(frag); | 661 | dtls1_hm_fragment_free(frag); |
662 | if (item != NULL) | 662 | if (item != NULL) |
663 | OPENSSL_free(item); | 663 | free(item); |
664 | *ok = 0; | 664 | *ok = 0; |
665 | return i; | 665 | return i; |
666 | } | 666 | } |
@@ -742,7 +742,7 @@ err: | |||
742 | if (frag != NULL) | 742 | if (frag != NULL) |
743 | dtls1_hm_fragment_free(frag); | 743 | dtls1_hm_fragment_free(frag); |
744 | if (item != NULL) | 744 | if (item != NULL) |
745 | OPENSSL_free(item); | 745 | free(item); |
746 | *ok = 0; | 746 | *ok = 0; |
747 | return i; | 747 | return i; |
748 | } | 748 | } |
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c index 1b7cbaec15..3f159eed26 100644 --- a/src/lib/libssl/d1_clnt.c +++ b/src/lib/libssl/d1_clnt.c | |||
@@ -1317,7 +1317,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1317 | NULL, 0, NULL); | 1317 | NULL, 0, NULL); |
1318 | 1318 | ||
1319 | encodedPoint = (unsigned char *) | 1319 | encodedPoint = (unsigned char *) |
1320 | OPENSSL_malloc(encoded_pt_len * | 1320 | malloc(encoded_pt_len * |
1321 | sizeof(unsigned char)); | 1321 | sizeof(unsigned char)); |
1322 | 1322 | ||
1323 | bn_ctx = BN_CTX_new(); | 1323 | bn_ctx = BN_CTX_new(); |
@@ -1347,7 +1347,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1347 | /* Free allocated memory */ | 1347 | /* Free allocated memory */ |
1348 | BN_CTX_free(bn_ctx); | 1348 | BN_CTX_free(bn_ctx); |
1349 | if (encodedPoint != NULL) | 1349 | if (encodedPoint != NULL) |
1350 | OPENSSL_free(encodedPoint); | 1350 | free(encodedPoint); |
1351 | if (clnt_ecdh != NULL) | 1351 | if (clnt_ecdh != NULL) |
1352 | EC_KEY_free(clnt_ecdh); | 1352 | EC_KEY_free(clnt_ecdh); |
1353 | EVP_PKEY_free(srvr_pub_pkey); | 1353 | EVP_PKEY_free(srvr_pub_pkey); |
@@ -1393,7 +1393,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1393 | s2n(psk_len, t); | 1393 | s2n(psk_len, t); |
1394 | 1394 | ||
1395 | if (s->session->psk_identity_hint != NULL) | 1395 | if (s->session->psk_identity_hint != NULL) |
1396 | OPENSSL_free(s->session->psk_identity_hint); | 1396 | free(s->session->psk_identity_hint); |
1397 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); | 1397 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); |
1398 | if (s->ctx->psk_identity_hint != NULL && | 1398 | if (s->ctx->psk_identity_hint != NULL && |
1399 | s->session->psk_identity_hint == NULL) { | 1399 | s->session->psk_identity_hint == NULL) { |
@@ -1403,7 +1403,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | if (s->session->psk_identity != NULL) | 1405 | if (s->session->psk_identity != NULL) |
1406 | OPENSSL_free(s->session->psk_identity); | 1406 | free(s->session->psk_identity); |
1407 | s->session->psk_identity = BUF_strdup(identity); | 1407 | s->session->psk_identity = BUF_strdup(identity); |
1408 | if (s->session->psk_identity == NULL) { | 1408 | if (s->session->psk_identity == NULL) { |
1409 | SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, | 1409 | SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, |
@@ -1460,7 +1460,7 @@ err: | |||
1460 | #ifndef OPENSSL_NO_ECDH | 1460 | #ifndef OPENSSL_NO_ECDH |
1461 | BN_CTX_free(bn_ctx); | 1461 | BN_CTX_free(bn_ctx); |
1462 | if (encodedPoint != NULL) | 1462 | if (encodedPoint != NULL) |
1463 | OPENSSL_free(encodedPoint); | 1463 | free(encodedPoint); |
1464 | if (clnt_ecdh != NULL) | 1464 | if (clnt_ecdh != NULL) |
1465 | EC_KEY_free(clnt_ecdh); | 1465 | EC_KEY_free(clnt_ecdh); |
1466 | EVP_PKEY_free(srvr_pub_pkey); | 1466 | EVP_PKEY_free(srvr_pub_pkey); |
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index 73c44c807a..7da57b0a36 100644 --- a/src/lib/libssl/d1_lib.c +++ b/src/lib/libssl/d1_lib.c | |||
@@ -100,7 +100,7 @@ dtls1_new(SSL *s) | |||
100 | 100 | ||
101 | if (!ssl3_new(s)) | 101 | if (!ssl3_new(s)) |
102 | return (0); | 102 | return (0); |
103 | if ((d1 = OPENSSL_malloc(sizeof *d1)) == NULL) return (0); | 103 | if ((d1 = malloc(sizeof *d1)) == NULL) return (0); |
104 | memset(d1, 0, sizeof *d1); | 104 | memset(d1, 0, sizeof *d1); |
105 | 105 | ||
106 | /* d1->handshake_epoch=0; */ | 106 | /* d1->handshake_epoch=0; */ |
@@ -128,7 +128,7 @@ dtls1_new(SSL *s) | |||
128 | pqueue_free(d1->sent_messages); | 128 | pqueue_free(d1->sent_messages); |
129 | if (d1->buffered_app_data.q) | 129 | if (d1->buffered_app_data.q) |
130 | pqueue_free(d1->buffered_app_data.q); | 130 | pqueue_free(d1->buffered_app_data.q); |
131 | OPENSSL_free(d1); | 131 | free(d1); |
132 | return (0); | 132 | return (0); |
133 | } | 133 | } |
134 | 134 | ||
@@ -147,39 +147,39 @@ dtls1_clear_queues(SSL *s) | |||
147 | while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) { | 147 | while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) { |
148 | rdata = (DTLS1_RECORD_DATA *) item->data; | 148 | rdata = (DTLS1_RECORD_DATA *) item->data; |
149 | if (rdata->rbuf.buf) { | 149 | if (rdata->rbuf.buf) { |
150 | OPENSSL_free(rdata->rbuf.buf); | 150 | free(rdata->rbuf.buf); |
151 | } | 151 | } |
152 | OPENSSL_free(item->data); | 152 | free(item->data); |
153 | pitem_free(item); | 153 | pitem_free(item); |
154 | } | 154 | } |
155 | 155 | ||
156 | while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) { | 156 | while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) { |
157 | rdata = (DTLS1_RECORD_DATA *) item->data; | 157 | rdata = (DTLS1_RECORD_DATA *) item->data; |
158 | if (rdata->rbuf.buf) { | 158 | if (rdata->rbuf.buf) { |
159 | OPENSSL_free(rdata->rbuf.buf); | 159 | free(rdata->rbuf.buf); |
160 | } | 160 | } |
161 | OPENSSL_free(item->data); | 161 | free(item->data); |
162 | pitem_free(item); | 162 | pitem_free(item); |
163 | } | 163 | } |
164 | 164 | ||
165 | while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) { | 165 | while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) { |
166 | frag = (hm_fragment *)item->data; | 166 | frag = (hm_fragment *)item->data; |
167 | OPENSSL_free(frag->fragment); | 167 | free(frag->fragment); |
168 | OPENSSL_free(frag); | 168 | free(frag); |
169 | pitem_free(item); | 169 | pitem_free(item); |
170 | } | 170 | } |
171 | 171 | ||
172 | while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { | 172 | while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { |
173 | frag = (hm_fragment *)item->data; | 173 | frag = (hm_fragment *)item->data; |
174 | OPENSSL_free(frag->fragment); | 174 | free(frag->fragment); |
175 | OPENSSL_free(frag); | 175 | free(frag); |
176 | pitem_free(item); | 176 | pitem_free(item); |
177 | } | 177 | } |
178 | 178 | ||
179 | while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) { | 179 | while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) { |
180 | frag = (hm_fragment *)item->data; | 180 | frag = (hm_fragment *)item->data; |
181 | OPENSSL_free(frag->fragment); | 181 | free(frag->fragment); |
182 | OPENSSL_free(frag); | 182 | free(frag); |
183 | pitem_free(item); | 183 | pitem_free(item); |
184 | } | 184 | } |
185 | } | 185 | } |
@@ -197,7 +197,7 @@ dtls1_free(SSL *s) | |||
197 | pqueue_free(s->d1->sent_messages); | 197 | pqueue_free(s->d1->sent_messages); |
198 | pqueue_free(s->d1->buffered_app_data.q); | 198 | pqueue_free(s->d1->buffered_app_data.q); |
199 | 199 | ||
200 | OPENSSL_free(s->d1); | 200 | free(s->d1); |
201 | s->d1 = NULL; | 201 | s->d1 = NULL; |
202 | } | 202 | } |
203 | 203 | ||
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index cb5f2c3199..69f3d45734 100644 --- a/src/lib/libssl/d1_pkt.c +++ b/src/lib/libssl/d1_pkt.c | |||
@@ -200,7 +200,7 @@ dtls1_copy_record(SSL *s, pitem *item) | |||
200 | rdata = (DTLS1_RECORD_DATA *)item->data; | 200 | rdata = (DTLS1_RECORD_DATA *)item->data; |
201 | 201 | ||
202 | if (s->s3->rbuf.buf != NULL) | 202 | if (s->s3->rbuf.buf != NULL) |
203 | OPENSSL_free(s->s3->rbuf.buf); | 203 | free(s->s3->rbuf.buf); |
204 | 204 | ||
205 | s->packet = rdata->packet; | 205 | s->packet = rdata->packet; |
206 | s->packet_length = rdata->packet_length; | 206 | s->packet_length = rdata->packet_length; |
@@ -224,11 +224,11 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
224 | if (pqueue_size(queue->q) >= 100) | 224 | if (pqueue_size(queue->q) >= 100) |
225 | return 0; | 225 | return 0; |
226 | 226 | ||
227 | rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); | 227 | rdata = malloc(sizeof(DTLS1_RECORD_DATA)); |
228 | item = pitem_new(priority, rdata); | 228 | item = pitem_new(priority, rdata); |
229 | if (rdata == NULL || item == NULL) { | 229 | if (rdata == NULL || item == NULL) { |
230 | if (rdata != NULL) | 230 | if (rdata != NULL) |
231 | OPENSSL_free(rdata); | 231 | free(rdata); |
232 | if (item != NULL) | 232 | if (item != NULL) |
233 | pitem_free(item); | 233 | pitem_free(item); |
234 | 234 | ||
@@ -253,7 +253,7 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
253 | 253 | ||
254 | /* insert should not fail, since duplicates are dropped */ | 254 | /* insert should not fail, since duplicates are dropped */ |
255 | if (pqueue_insert(queue->q, item) == NULL) { | 255 | if (pqueue_insert(queue->q, item) == NULL) { |
256 | OPENSSL_free(rdata); | 256 | free(rdata); |
257 | pitem_free(item); | 257 | pitem_free(item); |
258 | return (0); | 258 | return (0); |
259 | } | 259 | } |
@@ -265,7 +265,7 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
265 | 265 | ||
266 | if (!ssl3_setup_buffers(s)) { | 266 | if (!ssl3_setup_buffers(s)) { |
267 | SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); | 267 | SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); |
268 | OPENSSL_free(rdata); | 268 | free(rdata); |
269 | pitem_free(item); | 269 | pitem_free(item); |
270 | return (0); | 270 | return (0); |
271 | } | 271 | } |
@@ -283,7 +283,7 @@ dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue) | |||
283 | if (item) { | 283 | if (item) { |
284 | dtls1_copy_record(s, item); | 284 | dtls1_copy_record(s, item); |
285 | 285 | ||
286 | OPENSSL_free(item->data); | 286 | free(item->data); |
287 | pitem_free(item); | 287 | pitem_free(item); |
288 | 288 | ||
289 | return (1); | 289 | return (1); |
@@ -360,14 +360,14 @@ dtls1_get_buffered_record(SSL *s) | |||
360 | rdata = (DTLS1_RECORD_DATA *)item->data; | 360 | rdata = (DTLS1_RECORD_DATA *)item->data; |
361 | 361 | ||
362 | if (s->s3->rbuf.buf != NULL) | 362 | if (s->s3->rbuf.buf != NULL) |
363 | OPENSSL_free(s->s3->rbuf.buf); | 363 | free(s->s3->rbuf.buf); |
364 | 364 | ||
365 | s->packet = rdata->packet; | 365 | s->packet = rdata->packet; |
366 | s->packet_length = rdata->packet_length; | 366 | s->packet_length = rdata->packet_length; |
367 | memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER)); | 367 | memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER)); |
368 | memcpy(&(s->s3->rrec), &(rdata->rrec), sizeof(SSL3_RECORD)); | 368 | memcpy(&(s->s3->rrec), &(rdata->rrec), sizeof(SSL3_RECORD)); |
369 | 369 | ||
370 | OPENSSL_free(item->data); | 370 | free(item->data); |
371 | pitem_free(item); | 371 | pitem_free(item); |
372 | 372 | ||
373 | /* s->d1->next_expected_seq_num++; */ | 373 | /* s->d1->next_expected_seq_num++; */ |
@@ -810,7 +810,7 @@ start: | |||
810 | 810 | ||
811 | dtls1_copy_record(s, item); | 811 | dtls1_copy_record(s, item); |
812 | 812 | ||
813 | OPENSSL_free(item->data); | 813 | free(item->data); |
814 | pitem_free(item); | 814 | pitem_free(item); |
815 | } | 815 | } |
816 | } | 816 | } |
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c index 6040dd96ca..9b87dcd067 100644 --- a/src/lib/libssl/d1_srvr.c +++ b/src/lib/libssl/d1_srvr.c | |||
@@ -1188,7 +1188,7 @@ dtls1_send_server_key_exchange(SSL *s) | |||
1188 | NULL, 0, NULL); | 1188 | NULL, 0, NULL); |
1189 | 1189 | ||
1190 | encodedPoint = (unsigned char *) | 1190 | encodedPoint = (unsigned char *) |
1191 | OPENSSL_malloc(encodedlen*sizeof(unsigned char)); | 1191 | malloc(encodedlen*sizeof(unsigned char)); |
1192 | 1192 | ||
1193 | bn_ctx = BN_CTX_new(); | 1193 | bn_ctx = BN_CTX_new(); |
1194 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { | 1194 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { |
@@ -1289,7 +1289,7 @@ dtls1_send_server_key_exchange(SSL *s) | |||
1289 | memcpy((unsigned char*)p, | 1289 | memcpy((unsigned char*)p, |
1290 | (unsigned char *)encodedPoint, | 1290 | (unsigned char *)encodedPoint, |
1291 | encodedlen); | 1291 | encodedlen); |
1292 | OPENSSL_free(encodedPoint); | 1292 | free(encodedPoint); |
1293 | p += encodedlen; | 1293 | p += encodedlen; |
1294 | } | 1294 | } |
1295 | #endif | 1295 | #endif |
@@ -1398,7 +1398,7 @@ f_err: | |||
1398 | err: | 1398 | err: |
1399 | #ifndef OPENSSL_NO_ECDH | 1399 | #ifndef OPENSSL_NO_ECDH |
1400 | if (encodedPoint != NULL) | 1400 | if (encodedPoint != NULL) |
1401 | OPENSSL_free(encodedPoint); | 1401 | free(encodedPoint); |
1402 | BN_CTX_free(bn_ctx); | 1402 | BN_CTX_free(bn_ctx); |
1403 | #endif | 1403 | #endif |
1404 | EVP_MD_CTX_cleanup(&md_ctx); | 1404 | EVP_MD_CTX_cleanup(&md_ctx); |
@@ -1564,7 +1564,7 @@ dtls1_send_newsession_ticket(SSL *s) | |||
1564 | DTLS1_HM_HEADER_LENGTH + 22 + EVP_MAX_IV_LENGTH + | 1564 | DTLS1_HM_HEADER_LENGTH + 22 + EVP_MAX_IV_LENGTH + |
1565 | EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen)) | 1565 | EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen)) |
1566 | return -1; | 1566 | return -1; |
1567 | senc = OPENSSL_malloc(slen); | 1567 | senc = malloc(slen); |
1568 | if (!senc) | 1568 | if (!senc) |
1569 | return -1; | 1569 | return -1; |
1570 | p = senc; | 1570 | p = senc; |
@@ -1580,7 +1580,7 @@ dtls1_send_newsession_ticket(SSL *s) | |||
1580 | if (tctx->tlsext_ticket_key_cb) { | 1580 | if (tctx->tlsext_ticket_key_cb) { |
1581 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, | 1581 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, |
1582 | &hctx, 1) < 0) { | 1582 | &hctx, 1) < 0) { |
1583 | OPENSSL_free(senc); | 1583 | free(senc); |
1584 | return -1; | 1584 | return -1; |
1585 | } | 1585 | } |
1586 | } else { | 1586 | } else { |
@@ -1624,7 +1624,7 @@ dtls1_send_newsession_ticket(SSL *s) | |||
1624 | s->init_num = len; | 1624 | s->init_num = len; |
1625 | s->state = SSL3_ST_SW_SESSION_TICKET_B; | 1625 | s->state = SSL3_ST_SW_SESSION_TICKET_B; |
1626 | s->init_off = 0; | 1626 | s->init_off = 0; |
1627 | OPENSSL_free(senc); | 1627 | free(senc); |
1628 | 1628 | ||
1629 | /* XDTLS: set message header ? */ | 1629 | /* XDTLS: set message header ? */ |
1630 | msg_len = s->init_num - DTLS1_HM_HEADER_LENGTH; | 1630 | msg_len = s->init_num - DTLS1_HM_HEADER_LENGTH; |
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c index 35651183b7..8010d72fa7 100644 --- a/src/lib/libssl/s23_srvr.c +++ b/src/lib/libssl/s23_srvr.c | |||
@@ -533,10 +533,10 @@ ssl23_get_client_hello(SSL *s) | |||
533 | s->init_num = 0; | 533 | s->init_num = 0; |
534 | 534 | ||
535 | if (buf != buf_space) | 535 | if (buf != buf_space) |
536 | OPENSSL_free(buf); | 536 | free(buf); |
537 | return (SSL_accept(s)); | 537 | return (SSL_accept(s)); |
538 | err: | 538 | err: |
539 | if (buf != buf_space) | 539 | if (buf != buf_space) |
540 | OPENSSL_free(buf); | 540 | free(buf); |
541 | return (-1); | 541 | return (-1); |
542 | } | 542 | } |
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c index 5642e6c175..12b38c4596 100644 --- a/src/lib/libssl/s3_both.c +++ b/src/lib/libssl/s3_both.c | |||
@@ -650,7 +650,7 @@ ssl3_setup_read_buffer(SSL *s) | |||
650 | if (!(s->options & SSL_OP_NO_COMPRESSION)) | 650 | if (!(s->options & SSL_OP_NO_COMPRESSION)) |
651 | len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; | 651 | len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; |
652 | #endif | 652 | #endif |
653 | if ((p = OPENSSL_malloc(len)) == NULL) | 653 | if ((p = malloc(len)) == NULL) |
654 | goto err; | 654 | goto err; |
655 | s->s3->rbuf.buf = p; | 655 | s->s3->rbuf.buf = p; |
656 | s->s3->rbuf.len = len; | 656 | s->s3->rbuf.len = len; |
@@ -690,7 +690,7 @@ ssl3_setup_write_buffer(SSL *s) | |||
690 | len += headerlen + align + | 690 | len += headerlen + align + |
691 | SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD; | 691 | SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD; |
692 | 692 | ||
693 | if ((p = OPENSSL_malloc(len)) == NULL) | 693 | if ((p = malloc(len)) == NULL) |
694 | goto err; | 694 | goto err; |
695 | s->s3->wbuf.buf = p; | 695 | s->s3->wbuf.buf = p; |
696 | s->s3->wbuf.len = len; | 696 | s->s3->wbuf.len = len; |
@@ -718,7 +718,7 @@ int | |||
718 | ssl3_release_write_buffer(SSL *s) | 718 | ssl3_release_write_buffer(SSL *s) |
719 | { | 719 | { |
720 | if (s->s3->wbuf.buf != NULL) { | 720 | if (s->s3->wbuf.buf != NULL) { |
721 | OPENSSL_free(s->s3->wbuf.buf); | 721 | free(s->s3->wbuf.buf); |
722 | s->s3->wbuf.buf = NULL; | 722 | s->s3->wbuf.buf = NULL; |
723 | } | 723 | } |
724 | return 1; | 724 | return 1; |
@@ -728,7 +728,7 @@ int | |||
728 | ssl3_release_read_buffer(SSL *s) | 728 | ssl3_release_read_buffer(SSL *s) |
729 | { | 729 | { |
730 | if (s->s3->rbuf.buf != NULL) { | 730 | if (s->s3->rbuf.buf != NULL) { |
731 | OPENSSL_free(s->s3->rbuf.buf); | 731 | free(s->s3->rbuf.buf); |
732 | s->s3->rbuf.buf = NULL; | 732 | s->s3->rbuf.buf = NULL; |
733 | } | 733 | } |
734 | return 1; | 734 | return 1; |
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c index 88be294ab7..26bdef6b4f 100644 --- a/src/lib/libssl/s3_clnt.c +++ b/src/lib/libssl/s3_clnt.c | |||
@@ -1222,7 +1222,7 @@ ssl3_get_key_exchange(SSL *s) | |||
1222 | if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) { | 1222 | if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) { |
1223 | s->session->sess_cert = ssl_sess_cert_new(); | 1223 | s->session->sess_cert = ssl_sess_cert_new(); |
1224 | if (s->ctx->psk_identity_hint) | 1224 | if (s->ctx->psk_identity_hint) |
1225 | OPENSSL_free(s->ctx->psk_identity_hint); | 1225 | free(s->ctx->psk_identity_hint); |
1226 | s->ctx->psk_identity_hint = NULL; | 1226 | s->ctx->psk_identity_hint = NULL; |
1227 | } | 1227 | } |
1228 | #endif | 1228 | #endif |
@@ -1288,7 +1288,7 @@ ssl3_get_key_exchange(SSL *s) | |||
1288 | memcpy(tmp_id_hint, p, i); | 1288 | memcpy(tmp_id_hint, p, i); |
1289 | memset(tmp_id_hint + i, 0, PSK_MAX_IDENTITY_LEN + 1 - i); | 1289 | memset(tmp_id_hint + i, 0, PSK_MAX_IDENTITY_LEN + 1 - i); |
1290 | if (s->ctx->psk_identity_hint != NULL) | 1290 | if (s->ctx->psk_identity_hint != NULL) |
1291 | OPENSSL_free(s->ctx->psk_identity_hint); | 1291 | free(s->ctx->psk_identity_hint); |
1292 | s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint); | 1292 | s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint); |
1293 | if (s->ctx->psk_identity_hint == NULL) { | 1293 | if (s->ctx->psk_identity_hint == NULL) { |
1294 | SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); | 1294 | SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); |
@@ -1913,10 +1913,10 @@ ssl3_get_new_session_ticket(SSL *s) | |||
1913 | goto f_err; | 1913 | goto f_err; |
1914 | } | 1914 | } |
1915 | if (s->session->tlsext_tick) { | 1915 | if (s->session->tlsext_tick) { |
1916 | OPENSSL_free(s->session->tlsext_tick); | 1916 | free(s->session->tlsext_tick); |
1917 | s->session->tlsext_ticklen = 0; | 1917 | s->session->tlsext_ticklen = 0; |
1918 | } | 1918 | } |
1919 | s->session->tlsext_tick = OPENSSL_malloc(ticklen); | 1919 | s->session->tlsext_tick = malloc(ticklen); |
1920 | if (!s->session->tlsext_tick) { | 1920 | if (!s->session->tlsext_tick) { |
1921 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE); | 1921 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE); |
1922 | goto err; | 1922 | goto err; |
@@ -1988,7 +1988,7 @@ ssl3_get_cert_status(SSL *s) | |||
1988 | goto f_err; | 1988 | goto f_err; |
1989 | } | 1989 | } |
1990 | if (s->tlsext_ocsp_resp) | 1990 | if (s->tlsext_ocsp_resp) |
1991 | OPENSSL_free(s->tlsext_ocsp_resp); | 1991 | free(s->tlsext_ocsp_resp); |
1992 | s->tlsext_ocsp_resp = BUF_memdup(p, resplen); | 1992 | s->tlsext_ocsp_resp = BUF_memdup(p, resplen); |
1993 | if (!s->tlsext_ocsp_resp) { | 1993 | if (!s->tlsext_ocsp_resp) { |
1994 | al = SSL_AD_INTERNAL_ERROR; | 1994 | al = SSL_AD_INTERNAL_ERROR; |
@@ -2449,7 +2449,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2449 | NULL, 0, NULL); | 2449 | NULL, 0, NULL); |
2450 | 2450 | ||
2451 | encodedPoint = | 2451 | encodedPoint = |
2452 | (unsigned char *)OPENSSL_malloc( | 2452 | (unsigned char *)malloc( |
2453 | encoded_pt_len * sizeof(unsigned char)); | 2453 | encoded_pt_len * sizeof(unsigned char)); |
2454 | 2454 | ||
2455 | bn_ctx = BN_CTX_new(); | 2455 | bn_ctx = BN_CTX_new(); |
@@ -2479,7 +2479,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2479 | /* Free allocated memory */ | 2479 | /* Free allocated memory */ |
2480 | BN_CTX_free(bn_ctx); | 2480 | BN_CTX_free(bn_ctx); |
2481 | if (encodedPoint != NULL) | 2481 | if (encodedPoint != NULL) |
2482 | OPENSSL_free(encodedPoint); | 2482 | free(encodedPoint); |
2483 | if (clnt_ecdh != NULL) | 2483 | if (clnt_ecdh != NULL) |
2484 | EC_KEY_free(clnt_ecdh); | 2484 | EC_KEY_free(clnt_ecdh); |
2485 | EVP_PKEY_free(srvr_pub_pkey); | 2485 | EVP_PKEY_free(srvr_pub_pkey); |
@@ -2584,7 +2584,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2584 | goto err; | 2584 | goto err; |
2585 | } | 2585 | } |
2586 | if (s->session->srp_username != NULL) | 2586 | if (s->session->srp_username != NULL) |
2587 | OPENSSL_free(s->session->srp_username); | 2587 | free(s->session->srp_username); |
2588 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); | 2588 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); |
2589 | if (s->session->srp_username == NULL) { | 2589 | if (s->session->srp_username == NULL) { |
2590 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, | 2590 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, |
@@ -2636,7 +2636,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2636 | s2n(psk_len, t); | 2636 | s2n(psk_len, t); |
2637 | 2637 | ||
2638 | if (s->session->psk_identity_hint != NULL) | 2638 | if (s->session->psk_identity_hint != NULL) |
2639 | OPENSSL_free(s->session->psk_identity_hint); | 2639 | free(s->session->psk_identity_hint); |
2640 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); | 2640 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); |
2641 | if (s->ctx->psk_identity_hint != NULL && | 2641 | if (s->ctx->psk_identity_hint != NULL && |
2642 | s->session->psk_identity_hint == NULL) { | 2642 | s->session->psk_identity_hint == NULL) { |
@@ -2646,7 +2646,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | if (s->session->psk_identity != NULL) | 2648 | if (s->session->psk_identity != NULL) |
2649 | OPENSSL_free(s->session->psk_identity); | 2649 | free(s->session->psk_identity); |
2650 | s->session->psk_identity = BUF_strdup(identity); | 2650 | s->session->psk_identity = BUF_strdup(identity); |
2651 | if (s->session->psk_identity == NULL) { | 2651 | if (s->session->psk_identity == NULL) { |
2652 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, | 2652 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, |
@@ -2696,7 +2696,7 @@ err: | |||
2696 | #ifndef OPENSSL_NO_ECDH | 2696 | #ifndef OPENSSL_NO_ECDH |
2697 | BN_CTX_free(bn_ctx); | 2697 | BN_CTX_free(bn_ctx); |
2698 | if (encodedPoint != NULL) | 2698 | if (encodedPoint != NULL) |
2699 | OPENSSL_free(encodedPoint); | 2699 | free(encodedPoint); |
2700 | if (clnt_ecdh != NULL) | 2700 | if (clnt_ecdh != NULL) |
2701 | EC_KEY_free(clnt_ecdh); | 2701 | EC_KEY_free(clnt_ecdh); |
2702 | EVP_PKEY_free(srvr_pub_pkey); | 2702 | EVP_PKEY_free(srvr_pub_pkey); |
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index 68a4b8ca2d..8df07a1e4c 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
@@ -2946,7 +2946,7 @@ ssl3_new(SSL *s) | |||
2946 | { | 2946 | { |
2947 | SSL3_STATE *s3; | 2947 | SSL3_STATE *s3; |
2948 | 2948 | ||
2949 | if ((s3 = OPENSSL_malloc(sizeof *s3)) == NULL) goto err; | 2949 | if ((s3 = malloc(sizeof *s3)) == NULL) goto err; |
2950 | memset(s3, 0, sizeof *s3); | 2950 | memset(s3, 0, sizeof *s3); |
2951 | memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num)); | 2951 | memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num)); |
2952 | memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num)); | 2952 | memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num)); |
@@ -2970,9 +2970,9 @@ ssl3_free(SSL *s) | |||
2970 | 2970 | ||
2971 | #ifdef TLSEXT_TYPE_opaque_prf_input | 2971 | #ifdef TLSEXT_TYPE_opaque_prf_input |
2972 | if (s->s3->client_opaque_prf_input != NULL) | 2972 | if (s->s3->client_opaque_prf_input != NULL) |
2973 | OPENSSL_free(s->s3->client_opaque_prf_input); | 2973 | free(s->s3->client_opaque_prf_input); |
2974 | if (s->s3->server_opaque_prf_input != NULL) | 2974 | if (s->s3->server_opaque_prf_input != NULL) |
2975 | OPENSSL_free(s->s3->server_opaque_prf_input); | 2975 | free(s->s3->server_opaque_prf_input); |
2976 | #endif | 2976 | #endif |
2977 | 2977 | ||
2978 | ssl3_cleanup_key_block(s); | 2978 | ssl3_cleanup_key_block(s); |
@@ -2981,7 +2981,7 @@ ssl3_free(SSL *s) | |||
2981 | if (s->s3->wbuf.buf != NULL) | 2981 | if (s->s3->wbuf.buf != NULL) |
2982 | ssl3_release_write_buffer(s); | 2982 | ssl3_release_write_buffer(s); |
2983 | if (s->s3->rrec.comp != NULL) | 2983 | if (s->s3->rrec.comp != NULL) |
2984 | OPENSSL_free(s->s3->rrec.comp); | 2984 | free(s->s3->rrec.comp); |
2985 | #ifndef OPENSSL_NO_DH | 2985 | #ifndef OPENSSL_NO_DH |
2986 | if (s->s3->tmp.dh != NULL) | 2986 | if (s->s3->tmp.dh != NULL) |
2987 | DH_free(s->s3->tmp.dh); | 2987 | DH_free(s->s3->tmp.dh); |
@@ -3002,7 +3002,7 @@ ssl3_free(SSL *s) | |||
3002 | SSL_SRP_CTX_free(s); | 3002 | SSL_SRP_CTX_free(s); |
3003 | #endif | 3003 | #endif |
3004 | OPENSSL_cleanse(s->s3, sizeof *s->s3); | 3004 | OPENSSL_cleanse(s->s3, sizeof *s->s3); |
3005 | OPENSSL_free(s->s3); | 3005 | free(s->s3); |
3006 | s->s3 = NULL; | 3006 | s->s3 = NULL; |
3007 | } | 3007 | } |
3008 | 3008 | ||
@@ -3015,10 +3015,10 @@ ssl3_clear(SSL *s) | |||
3015 | 3015 | ||
3016 | #ifdef TLSEXT_TYPE_opaque_prf_input | 3016 | #ifdef TLSEXT_TYPE_opaque_prf_input |
3017 | if (s->s3->client_opaque_prf_input != NULL) | 3017 | if (s->s3->client_opaque_prf_input != NULL) |
3018 | OPENSSL_free(s->s3->client_opaque_prf_input); | 3018 | free(s->s3->client_opaque_prf_input); |
3019 | s->s3->client_opaque_prf_input = NULL; | 3019 | s->s3->client_opaque_prf_input = NULL; |
3020 | if (s->s3->server_opaque_prf_input != NULL) | 3020 | if (s->s3->server_opaque_prf_input != NULL) |
3021 | OPENSSL_free(s->s3->server_opaque_prf_input); | 3021 | free(s->s3->server_opaque_prf_input); |
3022 | s->s3->server_opaque_prf_input = NULL; | 3022 | s->s3->server_opaque_prf_input = NULL; |
3023 | #endif | 3023 | #endif |
3024 | 3024 | ||
@@ -3027,7 +3027,7 @@ ssl3_clear(SSL *s) | |||
3027 | sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); | 3027 | sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); |
3028 | 3028 | ||
3029 | if (s->s3->rrec.comp != NULL) { | 3029 | if (s->s3->rrec.comp != NULL) { |
3030 | OPENSSL_free(s->s3->rrec.comp); | 3030 | free(s->s3->rrec.comp); |
3031 | s->s3->rrec.comp = NULL; | 3031 | s->s3->rrec.comp = NULL; |
3032 | } | 3032 | } |
3033 | #ifndef OPENSSL_NO_DH | 3033 | #ifndef OPENSSL_NO_DH |
@@ -3078,7 +3078,7 @@ ssl3_clear(SSL *s) | |||
3078 | 3078 | ||
3079 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 3079 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
3080 | if (s->next_proto_negotiated) { | 3080 | if (s->next_proto_negotiated) { |
3081 | OPENSSL_free(s->next_proto_negotiated); | 3081 | free(s->next_proto_negotiated); |
3082 | s->next_proto_negotiated = NULL; | 3082 | s->next_proto_negotiated = NULL; |
3083 | s->next_proto_negotiated_len = 0; | 3083 | s->next_proto_negotiated_len = 0; |
3084 | } | 3084 | } |
@@ -3236,7 +3236,7 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
3236 | case SSL_CTRL_SET_TLSEXT_HOSTNAME: | 3236 | case SSL_CTRL_SET_TLSEXT_HOSTNAME: |
3237 | if (larg == TLSEXT_NAMETYPE_host_name) { | 3237 | if (larg == TLSEXT_NAMETYPE_host_name) { |
3238 | if (s->tlsext_hostname != NULL) | 3238 | if (s->tlsext_hostname != NULL) |
3239 | OPENSSL_free(s->tlsext_hostname); | 3239 | free(s->tlsext_hostname); |
3240 | s->tlsext_hostname = NULL; | 3240 | s->tlsext_hostname = NULL; |
3241 | 3241 | ||
3242 | ret = 1; | 3242 | ret = 1; |
@@ -3269,9 +3269,9 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
3269 | break; | 3269 | break; |
3270 | } | 3270 | } |
3271 | if (s->tlsext_opaque_prf_input != NULL) | 3271 | if (s->tlsext_opaque_prf_input != NULL) |
3272 | OPENSSL_free(s->tlsext_opaque_prf_input); | 3272 | free(s->tlsext_opaque_prf_input); |
3273 | if ((size_t)larg == 0) | 3273 | if ((size_t)larg == 0) |
3274 | s->tlsext_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 3274 | s->tlsext_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
3275 | else | 3275 | else |
3276 | s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg); | 3276 | s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg); |
3277 | if (s->tlsext_opaque_prf_input != NULL) { | 3277 | if (s->tlsext_opaque_prf_input != NULL) { |
@@ -3313,7 +3313,7 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
3313 | 3313 | ||
3314 | case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP: | 3314 | case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP: |
3315 | if (s->tlsext_ocsp_resp) | 3315 | if (s->tlsext_ocsp_resp) |
3316 | OPENSSL_free(s->tlsext_ocsp_resp); | 3316 | free(s->tlsext_ocsp_resp); |
3317 | s->tlsext_ocsp_resp = parg; | 3317 | s->tlsext_ocsp_resp = parg; |
3318 | s->tlsext_ocsp_resplen = larg; | 3318 | s->tlsext_ocsp_resplen = larg; |
3319 | ret = 1; | 3319 | ret = 1; |
@@ -3537,7 +3537,7 @@ ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) | |||
3537 | case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME: | 3537 | case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME: |
3538 | ctx->srp_ctx.srp_Mask|=SSL_kSRP; | 3538 | ctx->srp_ctx.srp_Mask|=SSL_kSRP; |
3539 | if (ctx->srp_ctx.login != NULL) | 3539 | if (ctx->srp_ctx.login != NULL) |
3540 | OPENSSL_free(ctx->srp_ctx.login); | 3540 | free(ctx->srp_ctx.login); |
3541 | ctx->srp_ctx.login = NULL; | 3541 | ctx->srp_ctx.login = NULL; |
3542 | if (parg == NULL) | 3542 | if (parg == NULL) |
3543 | break; | 3543 | break; |
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c index cc46e241d4..927b0d7db1 100644 --- a/src/lib/libssl/s3_srvr.c +++ b/src/lib/libssl/s3_srvr.c | |||
@@ -1760,7 +1760,7 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1760 | NULL, 0, NULL); | 1760 | NULL, 0, NULL); |
1761 | 1761 | ||
1762 | encodedPoint = (unsigned char *) | 1762 | encodedPoint = (unsigned char *) |
1763 | OPENSSL_malloc(encodedlen*sizeof(unsigned char)); | 1763 | malloc(encodedlen*sizeof(unsigned char)); |
1764 | 1764 | ||
1765 | bn_ctx = BN_CTX_new(); | 1765 | bn_ctx = BN_CTX_new(); |
1766 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { | 1766 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { |
@@ -1891,7 +1891,7 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1891 | p += 1; | 1891 | p += 1; |
1892 | memcpy((unsigned char*)p, | 1892 | memcpy((unsigned char*)p, |
1893 | (unsigned char *)encodedPoint, encodedlen); | 1893 | (unsigned char *)encodedPoint, encodedlen); |
1894 | OPENSSL_free(encodedPoint); | 1894 | free(encodedPoint); |
1895 | encodedPoint = NULL; | 1895 | encodedPoint = NULL; |
1896 | p += encodedlen; | 1896 | p += encodedlen; |
1897 | } | 1897 | } |
@@ -2012,7 +2012,7 @@ f_err: | |||
2012 | err: | 2012 | err: |
2013 | #ifndef OPENSSL_NO_ECDH | 2013 | #ifndef OPENSSL_NO_ECDH |
2014 | if (encodedPoint != NULL) | 2014 | if (encodedPoint != NULL) |
2015 | OPENSSL_free(encodedPoint); | 2015 | free(encodedPoint); |
2016 | BN_CTX_free(bn_ctx); | 2016 | BN_CTX_free(bn_ctx); |
2017 | #endif | 2017 | #endif |
2018 | EVP_MD_CTX_cleanup(&md_ctx); | 2018 | EVP_MD_CTX_cleanup(&md_ctx); |
@@ -2706,7 +2706,7 @@ ssl3_get_client_key_exchange(SSL *s) | |||
2706 | s2n(psk_len, t); | 2706 | s2n(psk_len, t); |
2707 | 2707 | ||
2708 | if (s->session->psk_identity != NULL) | 2708 | if (s->session->psk_identity != NULL) |
2709 | OPENSSL_free(s->session->psk_identity); | 2709 | free(s->session->psk_identity); |
2710 | s->session->psk_identity = BUF_strdup((char *)p); | 2710 | s->session->psk_identity = BUF_strdup((char *)p); |
2711 | if (s->session->psk_identity == NULL) { | 2711 | if (s->session->psk_identity == NULL) { |
2712 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 2712 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
@@ -2715,7 +2715,7 @@ ssl3_get_client_key_exchange(SSL *s) | |||
2715 | } | 2715 | } |
2716 | 2716 | ||
2717 | if (s->session->psk_identity_hint != NULL) | 2717 | if (s->session->psk_identity_hint != NULL) |
2718 | OPENSSL_free(s->session->psk_identity_hint); | 2718 | free(s->session->psk_identity_hint); |
2719 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); | 2719 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); |
2720 | if (s->ctx->psk_identity_hint != NULL && | 2720 | if (s->ctx->psk_identity_hint != NULL && |
2721 | s->session->psk_identity_hint == NULL) { | 2721 | s->session->psk_identity_hint == NULL) { |
@@ -2752,7 +2752,7 @@ ssl3_get_client_key_exchange(SSL *s) | |||
2752 | goto err; | 2752 | goto err; |
2753 | } | 2753 | } |
2754 | if (s->session->srp_username != NULL) | 2754 | if (s->session->srp_username != NULL) |
2755 | OPENSSL_free(s->session->srp_username); | 2755 | free(s->session->srp_username); |
2756 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); | 2756 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); |
2757 | if (s->session->srp_username == NULL) { | 2757 | if (s->session->srp_username == NULL) { |
2758 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 2758 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
@@ -3314,7 +3314,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3314 | */ | 3314 | */ |
3315 | if (slen_full > 0xFF00) | 3315 | if (slen_full > 0xFF00) |
3316 | return -1; | 3316 | return -1; |
3317 | senc = OPENSSL_malloc(slen_full); | 3317 | senc = malloc(slen_full); |
3318 | if (!senc) | 3318 | if (!senc) |
3319 | return -1; | 3319 | return -1; |
3320 | p = senc; | 3320 | p = senc; |
@@ -3327,7 +3327,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3327 | const_p = senc; | 3327 | const_p = senc; |
3328 | sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); | 3328 | sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); |
3329 | if (sess == NULL) { | 3329 | if (sess == NULL) { |
3330 | OPENSSL_free(senc); | 3330 | free(senc); |
3331 | return -1; | 3331 | return -1; |
3332 | } | 3332 | } |
3333 | 3333 | ||
@@ -3337,7 +3337,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3337 | slen = i2d_SSL_SESSION(sess, NULL); | 3337 | slen = i2d_SSL_SESSION(sess, NULL); |
3338 | if (slen > slen_full) { | 3338 | if (slen > slen_full) { |
3339 | /* shouldn't ever happen */ | 3339 | /* shouldn't ever happen */ |
3340 | OPENSSL_free(senc); | 3340 | free(senc); |
3341 | return -1; | 3341 | return -1; |
3342 | } | 3342 | } |
3343 | p = senc; | 3343 | p = senc; |
@@ -3372,7 +3372,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3372 | if (tctx->tlsext_ticket_key_cb) { | 3372 | if (tctx->tlsext_ticket_key_cb) { |
3373 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, | 3373 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, |
3374 | &hctx, 1) < 0) { | 3374 | &hctx, 1) < 0) { |
3375 | OPENSSL_free(senc); | 3375 | free(senc); |
3376 | return -1; | 3376 | return -1; |
3377 | } | 3377 | } |
3378 | } else { | 3378 | } else { |
@@ -3426,7 +3426,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3426 | s->init_num = len; | 3426 | s->init_num = len; |
3427 | s->state = SSL3_ST_SW_SESSION_TICKET_B; | 3427 | s->state = SSL3_ST_SW_SESSION_TICKET_B; |
3428 | s->init_off = 0; | 3428 | s->init_off = 0; |
3429 | OPENSSL_free(senc); | 3429 | free(senc); |
3430 | } | 3430 | } |
3431 | 3431 | ||
3432 | /* SSL3_ST_SW_SESSION_TICKET_B */ | 3432 | /* SSL3_ST_SW_SESSION_TICKET_B */ |
@@ -3529,7 +3529,7 @@ ssl3_get_next_proto(SSL *s) | |||
3529 | if (proto_len + padding_len + 2 != s->init_num) | 3529 | if (proto_len + padding_len + 2 != s->init_num) |
3530 | return 0; | 3530 | return 0; |
3531 | 3531 | ||
3532 | s->next_proto_negotiated = OPENSSL_malloc(proto_len); | 3532 | s->next_proto_negotiated = malloc(proto_len); |
3533 | if (!s->next_proto_negotiated) { | 3533 | if (!s->next_proto_negotiated) { |
3534 | SSLerr(SSL_F_SSL3_GET_NEXT_PROTO, ERR_R_MALLOC_FAILURE); | 3534 | SSLerr(SSL_F_SSL3_GET_NEXT_PROTO, ERR_R_MALLOC_FAILURE); |
3535 | return 0; | 3535 | return 0; |
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c index e92e95b332..753dbf52b5 100644 --- a/src/lib/libssl/src/apps/apps.c +++ b/src/lib/libssl/src/apps/apps.c | |||
@@ -211,7 +211,7 @@ chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) | |||
211 | i = 0; | 211 | i = 0; |
212 | if (arg->count == 0) { | 212 | if (arg->count == 0) { |
213 | arg->count = 20; | 213 | arg->count = 20; |
214 | arg->data = (char **)OPENSSL_malloc(sizeof(char *)*arg->count); | 214 | arg->data = (char **)malloc(sizeof(char *)*arg->count); |
215 | } | 215 | } |
216 | for (i = 0; i < arg->count; i++) | 216 | for (i = 0; i < arg->count; i++) |
217 | arg->data[i] = NULL; | 217 | arg->data[i] = NULL; |
@@ -231,7 +231,7 @@ chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) | |||
231 | if (num >= arg->count) { | 231 | if (num >= arg->count) { |
232 | char **tmp_p; | 232 | char **tmp_p; |
233 | int tlen = arg->count + 20; | 233 | int tlen = arg->count + 20; |
234 | tmp_p = (char **)OPENSSL_realloc(arg->data, | 234 | tmp_p = (char **)realloc(arg->data, |
235 | sizeof(char *)*tlen); | 235 | sizeof(char *)*tlen); |
236 | if (tmp_p == NULL) | 236 | if (tmp_p == NULL) |
237 | return 0; | 237 | return 0; |
@@ -284,13 +284,13 @@ int dump_cert_text (BIO *out, X509 *x) | |||
284 | p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0); | 284 | p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0); |
285 | BIO_puts(out, "subject="); | 285 | BIO_puts(out, "subject="); |
286 | BIO_puts(out, p); | 286 | BIO_puts(out, p); |
287 | OPENSSL_free(p); | 287 | free(p); |
288 | 288 | ||
289 | p = X509_NAME_oneline(X509_get_issuer_name(x), NULL, 0); | 289 | p = X509_NAME_oneline(X509_get_issuer_name(x), NULL, 0); |
290 | BIO_puts(out, "\nissuer="); | 290 | BIO_puts(out, "\nissuer="); |
291 | BIO_puts(out, p); | 291 | BIO_puts(out, p); |
292 | BIO_puts(out, "\n"); | 292 | BIO_puts(out, "\n"); |
293 | OPENSSL_free(p); | 293 | free(p); |
294 | 294 | ||
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
@@ -413,7 +413,7 @@ password_callback(char *buf, int bufsiz, int verify, | |||
413 | ok = UI_add_input_string(ui, prompt, ui_flags, buf, | 413 | ok = UI_add_input_string(ui, prompt, ui_flags, buf, |
414 | PW_MIN_LENGTH, bufsiz - 1); | 414 | PW_MIN_LENGTH, bufsiz - 1); |
415 | if (ok >= 0 && verify) { | 415 | if (ok >= 0 && verify) { |
416 | buff = (char *)OPENSSL_malloc(bufsiz); | 416 | buff = (char *)malloc(bufsiz); |
417 | ok = UI_add_verify_string(ui, prompt, ui_flags, buff, | 417 | ok = UI_add_verify_string(ui, prompt, ui_flags, buff, |
418 | PW_MIN_LENGTH, bufsiz - 1, buf); | 418 | PW_MIN_LENGTH, bufsiz - 1, buf); |
419 | } | 419 | } |
@@ -425,7 +425,7 @@ password_callback(char *buf, int bufsiz, int verify, | |||
425 | 425 | ||
426 | if (buff) { | 426 | if (buff) { |
427 | OPENSSL_cleanse(buff, (unsigned int)bufsiz); | 427 | OPENSSL_cleanse(buff, (unsigned int)bufsiz); |
428 | OPENSSL_free(buff); | 428 | free(buff); |
429 | } | 429 | } |
430 | 430 | ||
431 | if (ok >= 0) | 431 | if (ok >= 0) |
@@ -442,7 +442,7 @@ password_callback(char *buf, int bufsiz, int verify, | |||
442 | res = 0; | 442 | res = 0; |
443 | } | 443 | } |
444 | UI_free(ui); | 444 | UI_free(ui); |
445 | OPENSSL_free(prompt); | 445 | free(prompt); |
446 | } | 446 | } |
447 | return res; | 447 | return res; |
448 | } | 448 | } |
@@ -1200,7 +1200,7 @@ print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags) | |||
1200 | buf = X509_NAME_oneline(nm, 0, 0); | 1200 | buf = X509_NAME_oneline(nm, 0, 0); |
1201 | BIO_puts(out, buf); | 1201 | BIO_puts(out, buf); |
1202 | BIO_puts(out, "\n"); | 1202 | BIO_puts(out, "\n"); |
1203 | OPENSSL_free(buf); | 1203 | free(buf); |
1204 | } else { | 1204 | } else { |
1205 | if (mline) | 1205 | if (mline) |
1206 | BIO_puts(out, "\n"); | 1206 | BIO_puts(out, "\n"); |
@@ -1330,7 +1330,7 @@ make_config_name() | |||
1330 | char *p; | 1330 | char *p; |
1331 | 1331 | ||
1332 | len = strlen(t) + strlen(OPENSSL_CONF) + 2; | 1332 | len = strlen(t) + strlen(OPENSSL_CONF) + 2; |
1333 | p = OPENSSL_malloc(len); | 1333 | p = malloc(len); |
1334 | BUF_strlcpy(p, t, len); | 1334 | BUF_strlcpy(p, t, len); |
1335 | BUF_strlcat(p, "/", len); | 1335 | BUF_strlcat(p, "/", len); |
1336 | BUF_strlcat(p, OPENSSL_CONF, len); | 1336 | BUF_strlcat(p, OPENSSL_CONF, len); |
@@ -1607,7 +1607,7 @@ load_index(char *dbfile, DB_ATTR *db_attr) | |||
1607 | } | 1607 | } |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | if ((retdb = OPENSSL_malloc(sizeof(CA_DB))) == NULL) { | 1610 | if ((retdb = malloc(sizeof(CA_DB))) == NULL) { |
1611 | fprintf(stderr, "Out of memory\n"); | 1611 | fprintf(stderr, "Out of memory\n"); |
1612 | goto err; | 1612 | goto err; |
1613 | } | 1613 | } |
@@ -1809,7 +1809,7 @@ free_index(CA_DB *db) | |||
1809 | if (db) { | 1809 | if (db) { |
1810 | if (db->db) | 1810 | if (db->db) |
1811 | TXT_DB_free(db->db); | 1811 | TXT_DB_free(db->db); |
1812 | OPENSSL_free(db); | 1812 | free(db); |
1813 | } | 1813 | } |
1814 | } | 1814 | } |
1815 | 1815 | ||
@@ -1849,11 +1849,11 @@ X509_NAME * | |||
1849 | parse_name(char *subject, long chtype, int multirdn) | 1849 | parse_name(char *subject, long chtype, int multirdn) |
1850 | { | 1850 | { |
1851 | size_t buflen = strlen(subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */ | 1851 | size_t buflen = strlen(subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */ |
1852 | char *buf = OPENSSL_malloc(buflen); | 1852 | char *buf = malloc(buflen); |
1853 | size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */ | 1853 | size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */ |
1854 | char **ne_types = OPENSSL_malloc(max_ne * sizeof (char *)); | 1854 | char **ne_types = malloc(max_ne * sizeof (char *)); |
1855 | char **ne_values = OPENSSL_malloc(max_ne * sizeof (char *)); | 1855 | char **ne_values = malloc(max_ne * sizeof (char *)); |
1856 | int *mval = OPENSSL_malloc (max_ne * sizeof (int)); | 1856 | int *mval = malloc (max_ne * sizeof (int)); |
1857 | 1857 | ||
1858 | char *sp = subject, *bp = buf; | 1858 | char *sp = subject, *bp = buf; |
1859 | int i, ne_num = 0; | 1859 | int i, ne_num = 0; |
@@ -1942,22 +1942,22 @@ parse_name(char *subject, long chtype, int multirdn) | |||
1942 | goto error; | 1942 | goto error; |
1943 | } | 1943 | } |
1944 | 1944 | ||
1945 | OPENSSL_free(ne_values); | 1945 | free(ne_values); |
1946 | OPENSSL_free(ne_types); | 1946 | free(ne_types); |
1947 | OPENSSL_free(buf); | 1947 | free(buf); |
1948 | OPENSSL_free(mval); | 1948 | free(mval); |
1949 | return n; | 1949 | return n; |
1950 | 1950 | ||
1951 | error: | 1951 | error: |
1952 | X509_NAME_free(n); | 1952 | X509_NAME_free(n); |
1953 | if (ne_values) | 1953 | if (ne_values) |
1954 | OPENSSL_free(ne_values); | 1954 | free(ne_values); |
1955 | if (ne_types) | 1955 | if (ne_types) |
1956 | OPENSSL_free(ne_types); | 1956 | free(ne_types); |
1957 | if (mval) | 1957 | if (mval) |
1958 | OPENSSL_free(mval); | 1958 | free(mval); |
1959 | if (buf) | 1959 | if (buf) |
1960 | OPENSSL_free(buf); | 1960 | free(buf); |
1961 | return NULL; | 1961 | return NULL; |
1962 | } | 1962 | } |
1963 | 1963 | ||
@@ -2141,7 +2141,7 @@ pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value) | |||
2141 | vtmp++; | 2141 | vtmp++; |
2142 | } | 2142 | } |
2143 | rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); | 2143 | rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); |
2144 | OPENSSL_free(stmp); | 2144 | free(stmp); |
2145 | return rv; | 2145 | return rv; |
2146 | } | 2146 | } |
2147 | 2147 | ||
@@ -2437,14 +2437,14 @@ next_protos_parse(unsigned short *outlen, const char *in) | |||
2437 | if (len >= 65535) | 2437 | if (len >= 65535) |
2438 | return NULL; | 2438 | return NULL; |
2439 | 2439 | ||
2440 | out = OPENSSL_malloc(strlen(in) + 1); | 2440 | out = malloc(strlen(in) + 1); |
2441 | if (!out) | 2441 | if (!out) |
2442 | return NULL; | 2442 | return NULL; |
2443 | 2443 | ||
2444 | for (i = 0; i <= len; ++i) { | 2444 | for (i = 0; i <= len; ++i) { |
2445 | if (i == len || in[i] == ',') { | 2445 | if (i == len || in[i] == ',') { |
2446 | if (i - start > 255) { | 2446 | if (i - start > 255) { |
2447 | OPENSSL_free(out); | 2447 | free(out); |
2448 | return NULL; | 2448 | return NULL; |
2449 | } | 2449 | } |
2450 | out[start] = i - start; | 2450 | out[start] = i - start; |
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c index cca54aebce..9c75e1a4f4 100644 --- a/src/lib/libssl/src/apps/ca.c +++ b/src/lib/libssl/src/apps/ca.c | |||
@@ -543,7 +543,7 @@ bad: | |||
543 | size_t len; | 543 | size_t len; |
544 | 544 | ||
545 | len = strlen(s) + sizeof(CONFIG_FILE) + 1; | 545 | len = strlen(s) + sizeof(CONFIG_FILE) + 1; |
546 | tofree = OPENSSL_malloc(len); | 546 | tofree = malloc(len); |
547 | BUF_strlcpy(tofree, s, len); | 547 | BUF_strlcpy(tofree, s, len); |
548 | BUF_strlcat(tofree, "/", len); | 548 | BUF_strlcat(tofree, "/", len); |
549 | BUF_strlcat(tofree, CONFIG_FILE, len); | 549 | BUF_strlcat(tofree, CONFIG_FILE, len); |
@@ -562,7 +562,7 @@ bad: | |||
562 | goto err; | 562 | goto err; |
563 | } | 563 | } |
564 | if (tofree) { | 564 | if (tofree) { |
565 | OPENSSL_free(tofree); | 565 | free(tofree); |
566 | tofree = NULL; | 566 | tofree = NULL; |
567 | } | 567 | } |
568 | 568 | ||
@@ -1028,7 +1028,7 @@ bad: | |||
1028 | if ((f = BN_bn2hex(serial)) == NULL) | 1028 | if ((f = BN_bn2hex(serial)) == NULL) |
1029 | goto err; | 1029 | goto err; |
1030 | BIO_printf(bio_err, "next serial number is %s\n", f); | 1030 | BIO_printf(bio_err, "next serial number is %s\n", f); |
1031 | OPENSSL_free(f); | 1031 | free(f); |
1032 | } | 1032 | } |
1033 | } | 1033 | } |
1034 | 1034 | ||
@@ -1384,7 +1384,7 @@ bad: | |||
1384 | ret = 0; | 1384 | ret = 0; |
1385 | err: | 1385 | err: |
1386 | if (tofree) | 1386 | if (tofree) |
1387 | OPENSSL_free(tofree); | 1387 | free(tofree); |
1388 | BIO_free_all(Cout); | 1388 | BIO_free_all(Cout); |
1389 | BIO_free_all(Sout); | 1389 | BIO_free_all(Sout); |
1390 | BIO_free_all(out); | 1390 | BIO_free_all(out); |
@@ -1397,7 +1397,7 @@ err: | |||
1397 | ERR_print_errors(bio_err); | 1397 | ERR_print_errors(bio_err); |
1398 | app_RAND_write_file(randfile, bio_err); | 1398 | app_RAND_write_file(randfile, bio_err); |
1399 | if (free_key && key) | 1399 | if (free_key && key) |
1400 | OPENSSL_free(key); | 1400 | free(key); |
1401 | BN_free(serial); | 1401 | BN_free(serial); |
1402 | BN_free(crlnumber); | 1402 | BN_free(crlnumber); |
1403 | free_index(db); | 1403 | free_index(db); |
@@ -1973,17 +1973,17 @@ again2: | |||
1973 | goto err; | 1973 | goto err; |
1974 | 1974 | ||
1975 | /* We now just add it to the database */ | 1975 | /* We now just add it to the database */ |
1976 | row[DB_type] = (char *)OPENSSL_malloc(2); | 1976 | row[DB_type] = (char *)malloc(2); |
1977 | 1977 | ||
1978 | tm = X509_get_notAfter(ret); | 1978 | tm = X509_get_notAfter(ret); |
1979 | row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1); | 1979 | row[DB_exp_date] = (char *)malloc(tm->length + 1); |
1980 | memcpy(row[DB_exp_date], tm->data, tm->length); | 1980 | memcpy(row[DB_exp_date], tm->data, tm->length); |
1981 | row[DB_exp_date][tm->length] = '\0'; | 1981 | row[DB_exp_date][tm->length] = '\0'; |
1982 | 1982 | ||
1983 | row[DB_rev_date] = NULL; | 1983 | row[DB_rev_date] = NULL; |
1984 | 1984 | ||
1985 | /* row[DB_serial] done already */ | 1985 | /* row[DB_serial] done already */ |
1986 | row[DB_file] = (char *)OPENSSL_malloc(8); | 1986 | row[DB_file] = (char *)malloc(8); |
1987 | row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0); | 1987 | row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0); |
1988 | 1988 | ||
1989 | if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) || | 1989 | if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) || |
@@ -1995,7 +1995,7 @@ again2: | |||
1995 | row[DB_type][0] = 'V'; | 1995 | row[DB_type][0] = 'V'; |
1996 | row[DB_type][1] = '\0'; | 1996 | row[DB_type][1] = '\0'; |
1997 | 1997 | ||
1998 | if ((irow = (char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) { | 1998 | if ((irow = (char **)malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) { |
1999 | BIO_printf(bio_err, "Memory allocation failure\n"); | 1999 | BIO_printf(bio_err, "Memory allocation failure\n"); |
2000 | goto err; | 2000 | goto err; |
2001 | } | 2001 | } |
@@ -2015,7 +2015,7 @@ again2: | |||
2015 | err: | 2015 | err: |
2016 | for (i = 0; i < DB_NUMBER; i++) | 2016 | for (i = 0; i < DB_NUMBER; i++) |
2017 | if (row[i] != NULL) | 2017 | if (row[i] != NULL) |
2018 | OPENSSL_free(row[i]); | 2018 | free(row[i]); |
2019 | 2019 | ||
2020 | if (CAname != NULL) | 2020 | if (CAname != NULL) |
2021 | X509_NAME_free(CAname); | 2021 | X509_NAME_free(CAname); |
@@ -2233,17 +2233,17 @@ do_revoke(X509 *x509, CA_DB *db, int type, char *value) | |||
2233 | BIO_printf(bio_err, "Adding Entry with serial number %s to DB for %s\n", row[DB_serial], row[DB_name]); | 2233 | BIO_printf(bio_err, "Adding Entry with serial number %s to DB for %s\n", row[DB_serial], row[DB_name]); |
2234 | 2234 | ||
2235 | /* We now just add it to the database */ | 2235 | /* We now just add it to the database */ |
2236 | row[DB_type] = (char *)OPENSSL_malloc(2); | 2236 | row[DB_type] = (char *)malloc(2); |
2237 | 2237 | ||
2238 | tm = X509_get_notAfter(x509); | 2238 | tm = X509_get_notAfter(x509); |
2239 | row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1); | 2239 | row[DB_exp_date] = (char *)malloc(tm->length + 1); |
2240 | memcpy(row[DB_exp_date], tm->data, tm->length); | 2240 | memcpy(row[DB_exp_date], tm->data, tm->length); |
2241 | row[DB_exp_date][tm->length] = '\0'; | 2241 | row[DB_exp_date][tm->length] = '\0'; |
2242 | 2242 | ||
2243 | row[DB_rev_date] = NULL; | 2243 | row[DB_rev_date] = NULL; |
2244 | 2244 | ||
2245 | /* row[DB_serial] done already */ | 2245 | /* row[DB_serial] done already */ |
2246 | row[DB_file] = (char *)OPENSSL_malloc(8); | 2246 | row[DB_file] = (char *)malloc(8); |
2247 | 2247 | ||
2248 | /* row[DB_name] done already */ | 2248 | /* row[DB_name] done already */ |
2249 | 2249 | ||
@@ -2256,7 +2256,7 @@ do_revoke(X509 *x509, CA_DB *db, int type, char *value) | |||
2256 | row[DB_type][0] = 'V'; | 2256 | row[DB_type][0] = 'V'; |
2257 | row[DB_type][1] = '\0'; | 2257 | row[DB_type][1] = '\0'; |
2258 | 2258 | ||
2259 | if ((irow = (char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) { | 2259 | if ((irow = (char **)malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) { |
2260 | BIO_printf(bio_err, "Memory allocation failure\n"); | 2260 | BIO_printf(bio_err, "Memory allocation failure\n"); |
2261 | goto err; | 2261 | goto err; |
2262 | } | 2262 | } |
@@ -2301,7 +2301,7 @@ do_revoke(X509 *x509, CA_DB *db, int type, char *value) | |||
2301 | err: | 2301 | err: |
2302 | for (i = 0; i < DB_NUMBER; i++) { | 2302 | for (i = 0; i < DB_NUMBER; i++) { |
2303 | if (row[i] != NULL) | 2303 | if (row[i] != NULL) |
2304 | OPENSSL_free(row[i]); | 2304 | free(row[i]); |
2305 | } | 2305 | } |
2306 | return (ok); | 2306 | return (ok); |
2307 | } | 2307 | } |
@@ -2317,7 +2317,7 @@ get_certificate_status(const char *serial, CA_DB *db) | |||
2317 | row[i] = NULL; | 2317 | row[i] = NULL; |
2318 | 2318 | ||
2319 | /* Malloc needed char spaces */ | 2319 | /* Malloc needed char spaces */ |
2320 | row[DB_serial] = OPENSSL_malloc(strlen(serial) + 2); | 2320 | row[DB_serial] = malloc(strlen(serial) + 2); |
2321 | if (row[DB_serial] == NULL) { | 2321 | if (row[DB_serial] == NULL) { |
2322 | BIO_printf(bio_err, "Malloc failure\n"); | 2322 | BIO_printf(bio_err, "Malloc failure\n"); |
2323 | goto err; | 2323 | goto err; |
@@ -2374,7 +2374,7 @@ get_certificate_status(const char *serial, CA_DB *db) | |||
2374 | err: | 2374 | err: |
2375 | for (i = 0; i < DB_NUMBER; i++) { | 2375 | for (i = 0; i < DB_NUMBER; i++) { |
2376 | if (row[i] != NULL) | 2376 | if (row[i] != NULL) |
2377 | OPENSSL_free(row[i]); | 2377 | free(row[i]); |
2378 | } | 2378 | } |
2379 | return (ok); | 2379 | return (ok); |
2380 | } | 2380 | } |
@@ -2390,7 +2390,7 @@ static int do_updatedb (CA_DB *db) | |||
2390 | 2390 | ||
2391 | /* get actual time and make a string */ | 2391 | /* get actual time and make a string */ |
2392 | a_tm = X509_gmtime_adj(a_tm, 0); | 2392 | a_tm = X509_gmtime_adj(a_tm, 0); |
2393 | a_tm_s = (char *) OPENSSL_malloc(a_tm->length + 1); | 2393 | a_tm_s = (char *) malloc(a_tm->length + 1); |
2394 | if (a_tm_s == NULL) { | 2394 | if (a_tm_s == NULL) { |
2395 | cnt = -1; | 2395 | cnt = -1; |
2396 | goto err; | 2396 | goto err; |
@@ -2438,7 +2438,7 @@ static int do_updatedb (CA_DB *db) | |||
2438 | 2438 | ||
2439 | err: | 2439 | err: |
2440 | ASN1_UTCTIME_free(a_tm); | 2440 | ASN1_UTCTIME_free(a_tm); |
2441 | OPENSSL_free(a_tm_s); | 2441 | free(a_tm_s); |
2442 | 2442 | ||
2443 | return (cnt); | 2443 | return (cnt); |
2444 | } | 2444 | } |
@@ -2536,7 +2536,7 @@ make_revocation_str(int rev_type, char *rev_arg) | |||
2536 | if (other) i += strlen(other) | 2536 | if (other) i += strlen(other) |
2537 | + 1; | 2537 | + 1; |
2538 | 2538 | ||
2539 | str = OPENSSL_malloc(i); | 2539 | str = malloc(i); |
2540 | 2540 | ||
2541 | if (!str) | 2541 | if (!str) |
2542 | return NULL; | 2542 | return NULL; |
@@ -2606,7 +2606,7 @@ make_revoked(X509_REVOKED *rev, const char *str) | |||
2606 | err: | 2606 | err: |
2607 | 2607 | ||
2608 | if (tmp) | 2608 | if (tmp) |
2609 | OPENSSL_free(tmp); | 2609 | free(tmp); |
2610 | ASN1_OBJECT_free(hold); | 2610 | ASN1_OBJECT_free(hold); |
2611 | ASN1_GENERALIZEDTIME_free(comp_time); | 2611 | ASN1_GENERALIZEDTIME_free(comp_time); |
2612 | ASN1_ENUMERATED_free(rtmp); | 2612 | ASN1_ENUMERATED_free(rtmp); |
@@ -2747,7 +2747,7 @@ unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, | |||
2747 | 2747 | ||
2748 | err: | 2748 | err: |
2749 | if (tmp) | 2749 | if (tmp) |
2750 | OPENSSL_free(tmp); | 2750 | free(tmp); |
2751 | if (!phold) | 2751 | if (!phold) |
2752 | ASN1_OBJECT_free(hold); | 2752 | ASN1_OBJECT_free(hold); |
2753 | if (!pinvtm) | 2753 | if (!pinvtm) |
diff --git a/src/lib/libssl/src/apps/cms.c b/src/lib/libssl/src/apps/cms.c index 553b6de76e..eda3ccbdf0 100644 --- a/src/lib/libssl/src/apps/cms.c +++ b/src/lib/libssl/src/apps/cms.c | |||
@@ -1023,11 +1023,11 @@ end: | |||
1023 | if (skkeys) | 1023 | if (skkeys) |
1024 | sk_OPENSSL_STRING_free(skkeys); | 1024 | sk_OPENSSL_STRING_free(skkeys); |
1025 | if (secret_key) | 1025 | if (secret_key) |
1026 | OPENSSL_free(secret_key); | 1026 | free(secret_key); |
1027 | if (secret_keyid) | 1027 | if (secret_keyid) |
1028 | OPENSSL_free(secret_keyid); | 1028 | free(secret_keyid); |
1029 | if (pwri_tmp) | 1029 | if (pwri_tmp) |
1030 | OPENSSL_free(pwri_tmp); | 1030 | free(pwri_tmp); |
1031 | if (econtent_type) | 1031 | if (econtent_type) |
1032 | ASN1_OBJECT_free(econtent_type); | 1032 | ASN1_OBJECT_free(econtent_type); |
1033 | if (rr) | 1033 | if (rr) |
@@ -1048,7 +1048,7 @@ end: | |||
1048 | BIO_free(indata); | 1048 | BIO_free(indata); |
1049 | BIO_free_all(out); | 1049 | BIO_free_all(out); |
1050 | if (passin) | 1050 | if (passin) |
1051 | OPENSSL_free(passin); | 1051 | free(passin); |
1052 | return (ret); | 1052 | return (ret); |
1053 | } | 1053 | } |
1054 | 1054 | ||
diff --git a/src/lib/libssl/src/apps/crl2p7.c b/src/lib/libssl/src/apps/crl2p7.c index b85ef51cfb..bfd2d81e88 100644 --- a/src/lib/libssl/src/apps/crl2p7.c +++ b/src/lib/libssl/src/apps/crl2p7.c | |||
@@ -209,7 +209,7 @@ bad: | |||
209 | p7s->crl = crl_stack; | 209 | p7s->crl = crl_stack; |
210 | if (crl != NULL) { | 210 | if (crl != NULL) { |
211 | sk_X509_CRL_push(crl_stack, crl); | 211 | sk_X509_CRL_push(crl_stack, crl); |
212 | crl=NULL; /* now part of p7 for OPENSSL_freeing */ | 212 | crl=NULL; /* now part of p7 for freeing */ |
213 | } | 213 | } |
214 | 214 | ||
215 | if ((cert_stack = sk_X509_new_null()) == NULL) | 215 | if ((cert_stack = sk_X509_new_null()) == NULL) |
@@ -311,7 +311,7 @@ add_certs_from_file(STACK_OF(X509) *stack, char *certfile) | |||
311 | ret = count; | 311 | ret = count; |
312 | 312 | ||
313 | end: | 313 | end: |
314 | /* never need to OPENSSL_free x */ | 314 | /* never need to free x */ |
315 | if (in != NULL) | 315 | if (in != NULL) |
316 | BIO_free(in); | 316 | BIO_free(in); |
317 | if (sk != NULL) | 317 | if (sk != NULL) |
diff --git a/src/lib/libssl/src/apps/dgst.c b/src/lib/libssl/src/apps/dgst.c index 388c95e5ec..7336023b30 100644 --- a/src/lib/libssl/src/apps/dgst.c +++ b/src/lib/libssl/src/apps/dgst.c | |||
@@ -133,7 +133,7 @@ MAIN(int argc, char **argv) | |||
133 | 133 | ||
134 | apps_startup(); | 134 | apps_startup(); |
135 | 135 | ||
136 | if ((buf = (unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL) { | 136 | if ((buf = (unsigned char *)malloc(BUFSIZE)) == NULL) { |
137 | BIO_printf(bio_err, "out of memory\n"); | 137 | BIO_printf(bio_err, "out of memory\n"); |
138 | goto end; | 138 | goto end; |
139 | } | 139 | } |
@@ -428,7 +428,7 @@ MAIN(int argc, char **argv) | |||
428 | BIO *sigbio; | 428 | BIO *sigbio; |
429 | sigbio = BIO_new_file(sigfile, "rb"); | 429 | sigbio = BIO_new_file(sigfile, "rb"); |
430 | siglen = EVP_PKEY_size(sigkey); | 430 | siglen = EVP_PKEY_size(sigkey); |
431 | sigbuf = OPENSSL_malloc(siglen); | 431 | sigbuf = malloc(siglen); |
432 | if (!sigbio) { | 432 | if (!sigbio) { |
433 | BIO_printf(bio_err, "Error opening signature file %s\n", | 433 | BIO_printf(bio_err, "Error opening signature file %s\n", |
434 | sigfile); | 434 | sigfile); |
@@ -488,19 +488,19 @@ MAIN(int argc, char **argv) | |||
488 | end: | 488 | end: |
489 | if (buf != NULL) { | 489 | if (buf != NULL) { |
490 | OPENSSL_cleanse(buf, BUFSIZE); | 490 | OPENSSL_cleanse(buf, BUFSIZE); |
491 | OPENSSL_free(buf); | 491 | free(buf); |
492 | } | 492 | } |
493 | if (in != NULL) | 493 | if (in != NULL) |
494 | BIO_free(in); | 494 | BIO_free(in); |
495 | if (passin) | 495 | if (passin) |
496 | OPENSSL_free(passin); | 496 | free(passin); |
497 | BIO_free_all(out); | 497 | BIO_free_all(out); |
498 | EVP_PKEY_free(sigkey); | 498 | EVP_PKEY_free(sigkey); |
499 | if (sigopts) | 499 | if (sigopts) |
500 | sk_OPENSSL_STRING_free(sigopts); | 500 | sk_OPENSSL_STRING_free(sigopts); |
501 | if (macopts) | 501 | if (macopts) |
502 | sk_OPENSSL_STRING_free(macopts); | 502 | sk_OPENSSL_STRING_free(macopts); |
503 | if (sigbuf) OPENSSL_free(sigbuf); | 503 | if (sigbuf) free(sigbuf); |
504 | if (bmd != NULL) | 504 | if (bmd != NULL) |
505 | BIO_free(bmd); | 505 | BIO_free(bmd); |
506 | apps_shutdown(); | 506 | apps_shutdown(); |
diff --git a/src/lib/libssl/src/apps/dh.c b/src/lib/libssl/src/apps/dh.c index 0ad7121b37..f362c5aedd 100644 --- a/src/lib/libssl/src/apps/dh.c +++ b/src/lib/libssl/src/apps/dh.c | |||
@@ -261,9 +261,9 @@ bad: | |||
261 | 261 | ||
262 | len = BN_num_bytes(dh->p); | 262 | len = BN_num_bytes(dh->p); |
263 | bits = BN_num_bits(dh->p); | 263 | bits = BN_num_bits(dh->p); |
264 | data = (unsigned char *)OPENSSL_malloc(len); | 264 | data = (unsigned char *)malloc(len); |
265 | if (data == NULL) { | 265 | if (data == NULL) { |
266 | perror("OPENSSL_malloc"); | 266 | perror("malloc"); |
267 | goto end; | 267 | goto end; |
268 | } | 268 | } |
269 | l = BN_bn2bin(dh->p, data); | 269 | l = BN_bn2bin(dh->p, data); |
@@ -294,7 +294,7 @@ bad: | |||
294 | printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n"); | 294 | printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n"); |
295 | printf("\t\treturn(NULL);\n"); | 295 | printf("\t\treturn(NULL);\n"); |
296 | printf("\treturn(dh);\n\t}\n"); | 296 | printf("\treturn(dh);\n\t}\n"); |
297 | OPENSSL_free(data); | 297 | free(data); |
298 | } | 298 | } |
299 | 299 | ||
300 | if (!noout) { | 300 | if (!noout) { |
diff --git a/src/lib/libssl/src/apps/dhparam.c b/src/lib/libssl/src/apps/dhparam.c index 718c744722..d8fb930cb3 100644 --- a/src/lib/libssl/src/apps/dhparam.c +++ b/src/lib/libssl/src/apps/dhparam.c | |||
@@ -426,9 +426,9 @@ bad: | |||
426 | 426 | ||
427 | len = BN_num_bytes(dh->p); | 427 | len = BN_num_bytes(dh->p); |
428 | bits = BN_num_bits(dh->p); | 428 | bits = BN_num_bits(dh->p); |
429 | data = (unsigned char *)OPENSSL_malloc(len); | 429 | data = (unsigned char *)malloc(len); |
430 | if (data == NULL) { | 430 | if (data == NULL) { |
431 | perror("OPENSSL_malloc"); | 431 | perror("malloc"); |
432 | goto end; | 432 | goto end; |
433 | } | 433 | } |
434 | printf("#ifndef HEADER_DH_H\n" | 434 | printf("#ifndef HEADER_DH_H\n" |
@@ -465,7 +465,7 @@ bad: | |||
465 | if (dh->length) | 465 | if (dh->length) |
466 | printf("\tdh->length = %ld;\n", dh->length); | 466 | printf("\tdh->length = %ld;\n", dh->length); |
467 | printf("\treturn(dh);\n\t}\n"); | 467 | printf("\treturn(dh);\n\t}\n"); |
468 | OPENSSL_free(data); | 468 | free(data); |
469 | } | 469 | } |
470 | 470 | ||
471 | if (!noout) { | 471 | if (!noout) { |
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c index b2c58d03c1..af5702cf72 100644 --- a/src/lib/libssl/src/apps/dsa.c +++ b/src/lib/libssl/src/apps/dsa.c | |||
@@ -341,8 +341,8 @@ end: | |||
341 | if (in != NULL) BIO_free(in); | 341 | if (in != NULL) BIO_free(in); |
342 | if (out != NULL) BIO_free_all(out); | 342 | if (out != NULL) BIO_free_all(out); |
343 | if (dsa != NULL) DSA_free(dsa); | 343 | if (dsa != NULL) DSA_free(dsa); |
344 | if (passin) OPENSSL_free(passin); | 344 | if (passin) free(passin); |
345 | if (passout) OPENSSL_free(passout); | 345 | if (passout) free(passout); |
346 | apps_shutdown(); | 346 | apps_shutdown(); |
347 | OPENSSL_EXIT(ret); | 347 | OPENSSL_EXIT(ret); |
348 | } | 348 | } |
diff --git a/src/lib/libssl/src/apps/dsaparam.c b/src/lib/libssl/src/apps/dsaparam.c index 9cd81ff4f7..81ac16b717 100644 --- a/src/lib/libssl/src/apps/dsaparam.c +++ b/src/lib/libssl/src/apps/dsaparam.c | |||
@@ -325,9 +325,9 @@ bad: | |||
325 | 325 | ||
326 | len = BN_num_bytes(dsa->p); | 326 | len = BN_num_bytes(dsa->p); |
327 | bits_p = BN_num_bits(dsa->p); | 327 | bits_p = BN_num_bits(dsa->p); |
328 | data = (unsigned char *)OPENSSL_malloc(len + 20); | 328 | data = (unsigned char *)malloc(len + 20); |
329 | if (data == NULL) { | 329 | if (data == NULL) { |
330 | perror("OPENSSL_malloc"); | 330 | perror("malloc"); |
331 | goto end; | 331 | goto end; |
332 | } | 332 | } |
333 | l = BN_bn2bin(dsa->p, data); | 333 | l = BN_bn2bin(dsa->p, data); |
diff --git a/src/lib/libssl/src/apps/ec.c b/src/lib/libssl/src/apps/ec.c index dd3bb9d4a1..b9be5d74fc 100644 --- a/src/lib/libssl/src/apps/ec.c +++ b/src/lib/libssl/src/apps/ec.c | |||
@@ -385,9 +385,9 @@ end: | |||
385 | if (eckey) | 385 | if (eckey) |
386 | EC_KEY_free(eckey); | 386 | EC_KEY_free(eckey); |
387 | if (passin) | 387 | if (passin) |
388 | OPENSSL_free(passin); | 388 | free(passin); |
389 | if (passout) | 389 | if (passout) |
390 | OPENSSL_free(passout); | 390 | free(passout); |
391 | apps_shutdown(); | 391 | apps_shutdown(); |
392 | OPENSSL_EXIT(ret); | 392 | OPENSSL_EXIT(ret); |
393 | } | 393 | } |
diff --git a/src/lib/libssl/src/apps/ecparam.c b/src/lib/libssl/src/apps/ecparam.c index 17e28cf1d6..e2b3beee6f 100644 --- a/src/lib/libssl/src/apps/ecparam.c +++ b/src/lib/libssl/src/apps/ecparam.c | |||
@@ -342,14 +342,14 @@ bad: | |||
342 | 342 | ||
343 | crv_len = EC_get_builtin_curves(NULL, 0); | 343 | crv_len = EC_get_builtin_curves(NULL, 0); |
344 | 344 | ||
345 | curves = OPENSSL_malloc((int)(sizeof(EC_builtin_curve) * crv_len)); | 345 | curves = malloc((int)(sizeof(EC_builtin_curve) * crv_len)); |
346 | 346 | ||
347 | if (curves == NULL) | 347 | if (curves == NULL) |
348 | goto end; | 348 | goto end; |
349 | 349 | ||
350 | if (!EC_get_builtin_curves(curves, crv_len)) | 350 | if (!EC_get_builtin_curves(curves, crv_len)) |
351 | { | 351 | { |
352 | OPENSSL_free(curves); | 352 | free(curves); |
353 | goto end; | 353 | goto end; |
354 | } | 354 | } |
355 | 355 | ||
@@ -369,7 +369,7 @@ bad: | |||
369 | BIO_printf(out, "%s\n", comment); | 369 | BIO_printf(out, "%s\n", comment); |
370 | } | 370 | } |
371 | 371 | ||
372 | OPENSSL_free(curves); | 372 | free(curves); |
373 | ret = 0; | 373 | ret = 0; |
374 | goto end; | 374 | goto end; |
375 | } | 375 | } |
@@ -480,7 +480,7 @@ bad: | |||
480 | (ec_order = BN_new()) == NULL || | 480 | (ec_order = BN_new()) == NULL || |
481 | (ec_cofactor = BN_new()) == NULL ) | 481 | (ec_cofactor = BN_new()) == NULL ) |
482 | { | 482 | { |
483 | perror("OPENSSL_malloc"); | 483 | perror("malloc"); |
484 | goto end; | 484 | goto end; |
485 | } | 485 | } |
486 | 486 | ||
@@ -529,11 +529,11 @@ bad: | |||
529 | if ((tmp_len = (size_t)BN_num_bytes(ec_cofactor)) > buf_len) | 529 | if ((tmp_len = (size_t)BN_num_bytes(ec_cofactor)) > buf_len) |
530 | buf_len = tmp_len; | 530 | buf_len = tmp_len; |
531 | 531 | ||
532 | buffer = (unsigned char *)OPENSSL_malloc(buf_len); | 532 | buffer = (unsigned char *)malloc(buf_len); |
533 | 533 | ||
534 | if (buffer == NULL) | 534 | if (buffer == NULL) |
535 | { | 535 | { |
536 | perror("OPENSSL_malloc"); | 536 | perror("malloc"); |
537 | goto end; | 537 | goto end; |
538 | } | 538 | } |
539 | 539 | ||
@@ -681,7 +681,7 @@ end: | |||
681 | if (ec_cofactor) | 681 | if (ec_cofactor) |
682 | BN_free(ec_cofactor); | 682 | BN_free(ec_cofactor); |
683 | if (buffer) | 683 | if (buffer) |
684 | OPENSSL_free(buffer); | 684 | free(buffer); |
685 | if (in != NULL) | 685 | if (in != NULL) |
686 | BIO_free(in); | 686 | BIO_free(in); |
687 | if (out != NULL) | 687 | if (out != NULL) |
diff --git a/src/lib/libssl/src/apps/enc.c b/src/lib/libssl/src/apps/enc.c index 16e98b8e53..22f431ff1a 100644 --- a/src/lib/libssl/src/apps/enc.c +++ b/src/lib/libssl/src/apps/enc.c | |||
@@ -371,11 +371,11 @@ bad: | |||
371 | if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize); | 371 | if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize); |
372 | } | 372 | } |
373 | 373 | ||
374 | strbuf=OPENSSL_malloc(SIZE); | 374 | strbuf=malloc(SIZE); |
375 | buff=(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize)); | 375 | buff=(unsigned char *)malloc(EVP_ENCODE_LENGTH(bsize)); |
376 | if ((buff == NULL) || (strbuf == NULL)) | 376 | if ((buff == NULL) || (strbuf == NULL)) |
377 | { | 377 | { |
378 | BIO_printf(bio_err,"OPENSSL_malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize)); | 378 | BIO_printf(bio_err,"malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize)); |
379 | goto end; | 379 | goto end; |
380 | } | 380 | } |
381 | 381 | ||
@@ -675,8 +675,8 @@ bad: | |||
675 | } | 675 | } |
676 | end: | 676 | end: |
677 | ERR_print_errors(bio_err); | 677 | ERR_print_errors(bio_err); |
678 | if (strbuf != NULL) OPENSSL_free(strbuf); | 678 | if (strbuf != NULL) free(strbuf); |
679 | if (buff != NULL) OPENSSL_free(buff); | 679 | if (buff != NULL) free(buff); |
680 | if (in != NULL) BIO_free(in); | 680 | if (in != NULL) BIO_free(in); |
681 | if (out != NULL) BIO_free_all(out); | 681 | if (out != NULL) BIO_free_all(out); |
682 | if (benc != NULL) BIO_free(benc); | 682 | if (benc != NULL) BIO_free(benc); |
@@ -684,7 +684,7 @@ end: | |||
684 | #ifdef ZLIB | 684 | #ifdef ZLIB |
685 | if (bzl != NULL) BIO_free(bzl); | 685 | if (bzl != NULL) BIO_free(bzl); |
686 | #endif | 686 | #endif |
687 | if(pass) OPENSSL_free(pass); | 687 | if(pass) free(pass); |
688 | apps_shutdown(); | 688 | apps_shutdown(); |
689 | OPENSSL_EXIT(ret); | 689 | OPENSSL_EXIT(ret); |
690 | } | 690 | } |
diff --git a/src/lib/libssl/src/apps/engine.c b/src/lib/libssl/src/apps/engine.c index 33eeaf9f59..be07889d60 100644 --- a/src/lib/libssl/src/apps/engine.c +++ b/src/lib/libssl/src/apps/engine.c | |||
@@ -104,7 +104,7 @@ static int append_buf(char **buf, const char *s, int *size, int step) | |||
104 | if (*buf == NULL) | 104 | if (*buf == NULL) |
105 | { | 105 | { |
106 | *size = step; | 106 | *size = step; |
107 | *buf = OPENSSL_malloc(*size); | 107 | *buf = malloc(*size); |
108 | if (*buf == NULL) | 108 | if (*buf == NULL) |
109 | return 0; | 109 | return 0; |
110 | **buf = '\0'; | 110 | **buf = '\0'; |
@@ -116,7 +116,7 @@ static int append_buf(char **buf, const char *s, int *size, int step) | |||
116 | if (strlen(*buf) + strlen(s) >= (unsigned int)*size) | 116 | if (strlen(*buf) + strlen(s) >= (unsigned int)*size) |
117 | { | 117 | { |
118 | *size += step; | 118 | *size += step; |
119 | *buf = OPENSSL_realloc(*buf, *size); | 119 | *buf = realloc(*buf, *size); |
120 | } | 120 | } |
121 | 121 | ||
122 | if (*buf == NULL) | 122 | if (*buf == NULL) |
@@ -227,7 +227,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent | |||
227 | if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num, | 227 | if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num, |
228 | NULL, NULL)) <= 0) | 228 | NULL, NULL)) <= 0) |
229 | goto err; | 229 | goto err; |
230 | if((name = OPENSSL_malloc(len + 1)) == NULL) | 230 | if((name = malloc(len + 1)) == NULL) |
231 | goto err; | 231 | goto err; |
232 | if(ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name, | 232 | if(ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name, |
233 | NULL) <= 0) | 233 | NULL) <= 0) |
@@ -238,7 +238,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent | |||
238 | goto err; | 238 | goto err; |
239 | if(len > 0) | 239 | if(len > 0) |
240 | { | 240 | { |
241 | if((desc = OPENSSL_malloc(len + 1)) == NULL) | 241 | if((desc = malloc(len + 1)) == NULL) |
242 | goto err; | 242 | goto err; |
243 | if(ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc, | 243 | if(ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc, |
244 | NULL) <= 0) | 244 | NULL) <= 0) |
@@ -274,8 +274,8 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent | |||
274 | xpos = 0; | 274 | xpos = 0; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | OPENSSL_free(name); name = NULL; | 277 | free(name); name = NULL; |
278 | if(desc) { OPENSSL_free(desc); desc = NULL; } | 278 | if(desc) { free(desc); desc = NULL; } |
279 | /* Move to the next command */ | 279 | /* Move to the next command */ |
280 | num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE, | 280 | num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE, |
281 | num, NULL, NULL); | 281 | num, NULL, NULL); |
@@ -285,8 +285,8 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent | |||
285 | ret = 1; | 285 | ret = 1; |
286 | err: | 286 | err: |
287 | if(cmds) sk_OPENSSL_STRING_pop_free(cmds, identity); | 287 | if(cmds) sk_OPENSSL_STRING_pop_free(cmds, identity); |
288 | if(name) OPENSSL_free(name); | 288 | if(name) free(name); |
289 | if(desc) OPENSSL_free(desc); | 289 | if(desc) free(desc); |
290 | return ret; | 290 | return ret; |
291 | } | 291 | } |
292 | 292 | ||
@@ -496,7 +496,7 @@ skip_pmeths: | |||
496 | if (cap_buf && (*cap_buf != '\0')) | 496 | if (cap_buf && (*cap_buf != '\0')) |
497 | BIO_printf(bio_out, " [%s]\n", cap_buf); | 497 | BIO_printf(bio_out, " [%s]\n", cap_buf); |
498 | 498 | ||
499 | OPENSSL_free(cap_buf); | 499 | free(cap_buf); |
500 | } | 500 | } |
501 | if(test_avail) | 501 | if(test_avail) |
502 | { | 502 | { |
diff --git a/src/lib/libssl/src/apps/gendsa.c b/src/lib/libssl/src/apps/gendsa.c index 612bdfbc1d..5c9ec7d24b 100644 --- a/src/lib/libssl/src/apps/gendsa.c +++ b/src/lib/libssl/src/apps/gendsa.c | |||
@@ -266,7 +266,7 @@ end: | |||
266 | if (in != NULL) BIO_free(in); | 266 | if (in != NULL) BIO_free(in); |
267 | if (out != NULL) BIO_free_all(out); | 267 | if (out != NULL) BIO_free_all(out); |
268 | if (dsa != NULL) DSA_free(dsa); | 268 | if (dsa != NULL) DSA_free(dsa); |
269 | if(passout) OPENSSL_free(passout); | 269 | if(passout) free(passout); |
270 | apps_shutdown(); | 270 | apps_shutdown(); |
271 | OPENSSL_EXIT(ret); | 271 | OPENSSL_EXIT(ret); |
272 | } | 272 | } |
diff --git a/src/lib/libssl/src/apps/genpkey.c b/src/lib/libssl/src/apps/genpkey.c index 24b623a1bb..f6b23ac5a6 100644 --- a/src/lib/libssl/src/apps/genpkey.c +++ b/src/lib/libssl/src/apps/genpkey.c | |||
@@ -301,7 +301,7 @@ int MAIN(int argc, char **argv) | |||
301 | BIO_free_all(out); | 301 | BIO_free_all(out); |
302 | BIO_free(in); | 302 | BIO_free(in); |
303 | if (pass) | 303 | if (pass) |
304 | OPENSSL_free(pass); | 304 | free(pass); |
305 | 305 | ||
306 | return ret; | 306 | return ret; |
307 | } | 307 | } |
diff --git a/src/lib/libssl/src/apps/genrsa.c b/src/lib/libssl/src/apps/genrsa.c index bdc8778b1d..1be17d9ac6 100644 --- a/src/lib/libssl/src/apps/genrsa.c +++ b/src/lib/libssl/src/apps/genrsa.c | |||
@@ -298,7 +298,7 @@ err: | |||
298 | if (bn) BN_free(bn); | 298 | if (bn) BN_free(bn); |
299 | if (rsa) RSA_free(rsa); | 299 | if (rsa) RSA_free(rsa); |
300 | if (out) BIO_free_all(out); | 300 | if (out) BIO_free_all(out); |
301 | if(passout) OPENSSL_free(passout); | 301 | if(passout) free(passout); |
302 | if (ret != 0) | 302 | if (ret != 0) |
303 | ERR_print_errors(bio_err); | 303 | ERR_print_errors(bio_err); |
304 | apps_shutdown(); | 304 | apps_shutdown(); |
diff --git a/src/lib/libssl/src/apps/ocsp.c b/src/lib/libssl/src/apps/ocsp.c index e5edc3017d..dff47ba41b 100644 --- a/src/lib/libssl/src/apps/ocsp.c +++ b/src/lib/libssl/src/apps/ocsp.c | |||
@@ -917,9 +917,9 @@ end: | |||
917 | 917 | ||
918 | if (use_ssl != -1) | 918 | if (use_ssl != -1) |
919 | { | 919 | { |
920 | OPENSSL_free(host); | 920 | free(host); |
921 | OPENSSL_free(port); | 921 | free(port); |
922 | OPENSSL_free(path); | 922 | free(path); |
923 | } | 923 | } |
924 | 924 | ||
925 | OPENSSL_EXIT(ret); | 925 | OPENSSL_EXIT(ret); |
@@ -1165,7 +1165,7 @@ static char **lookup_serial(CA_DB *db, ASN1_INTEGER *ser) | |||
1165 | row[DB_serial] = itmp; | 1165 | row[DB_serial] = itmp; |
1166 | BN_free(bn); | 1166 | BN_free(bn); |
1167 | rrow=TXT_DB_get_by_index(db->db,DB_serial,row); | 1167 | rrow=TXT_DB_get_by_index(db->db,DB_serial,row); |
1168 | OPENSSL_free(itmp); | 1168 | free(itmp); |
1169 | return rrow; | 1169 | return rrow; |
1170 | } | 1170 | } |
1171 | 1171 | ||
diff --git a/src/lib/libssl/src/apps/openssl.c b/src/lib/libssl/src/apps/openssl.c index 8bd7108222..fd730ce97e 100644 --- a/src/lib/libssl/src/apps/openssl.c +++ b/src/lib/libssl/src/apps/openssl.c | |||
@@ -374,14 +374,14 @@ int main(int Argc, char *ARGV[]) | |||
374 | ret=1; | 374 | ret=1; |
375 | end: | 375 | end: |
376 | if (to_free) | 376 | if (to_free) |
377 | OPENSSL_free(to_free); | 377 | free(to_free); |
378 | if (config != NULL) | 378 | if (config != NULL) |
379 | { | 379 | { |
380 | NCONF_free(config); | 380 | NCONF_free(config); |
381 | config=NULL; | 381 | config=NULL; |
382 | } | 382 | } |
383 | if (prog != NULL) lh_FUNCTION_free(prog); | 383 | if (prog != NULL) lh_FUNCTION_free(prog); |
384 | if (arg.data != NULL) OPENSSL_free(arg.data); | 384 | if (arg.data != NULL) free(arg.data); |
385 | 385 | ||
386 | apps_shutdown(); | 386 | apps_shutdown(); |
387 | 387 | ||
diff --git a/src/lib/libssl/src/apps/passwd.c b/src/lib/libssl/src/apps/passwd.c index cb30f810c8..b26bdbf4c7 100644 --- a/src/lib/libssl/src/apps/passwd.c +++ b/src/lib/libssl/src/apps/passwd.c | |||
@@ -211,7 +211,7 @@ int MAIN(int argc, char **argv) | |||
211 | 211 | ||
212 | passwd_malloc_size = pw_maxlen + 2; | 212 | passwd_malloc_size = pw_maxlen + 2; |
213 | /* longer than necessary so that we can warn about truncation */ | 213 | /* longer than necessary so that we can warn about truncation */ |
214 | passwd = passwd_malloc = OPENSSL_malloc(passwd_malloc_size); | 214 | passwd = passwd_malloc = malloc(passwd_malloc_size); |
215 | if (passwd_malloc == NULL) | 215 | if (passwd_malloc == NULL) |
216 | goto err; | 216 | goto err; |
217 | } | 217 | } |
@@ -278,9 +278,9 @@ int MAIN(int argc, char **argv) | |||
278 | err: | 278 | err: |
279 | ERR_print_errors(bio_err); | 279 | ERR_print_errors(bio_err); |
280 | if (salt_malloc) | 280 | if (salt_malloc) |
281 | OPENSSL_free(salt_malloc); | 281 | free(salt_malloc); |
282 | if (passwd_malloc) | 282 | if (passwd_malloc) |
283 | OPENSSL_free(passwd_malloc); | 283 | free(passwd_malloc); |
284 | if (in) | 284 | if (in) |
285 | BIO_free(in); | 285 | BIO_free(in); |
286 | if (out) | 286 | if (out) |
@@ -425,7 +425,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, | |||
425 | { | 425 | { |
426 | if (*salt_malloc_p == NULL) | 426 | if (*salt_malloc_p == NULL) |
427 | { | 427 | { |
428 | *salt_p = *salt_malloc_p = OPENSSL_malloc(3); | 428 | *salt_p = *salt_malloc_p = malloc(3); |
429 | if (*salt_malloc_p == NULL) | 429 | if (*salt_malloc_p == NULL) |
430 | goto err; | 430 | goto err; |
431 | } | 431 | } |
@@ -444,7 +444,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, | |||
444 | 444 | ||
445 | if (*salt_malloc_p == NULL) | 445 | if (*salt_malloc_p == NULL) |
446 | { | 446 | { |
447 | *salt_p = *salt_malloc_p = OPENSSL_malloc(9); | 447 | *salt_p = *salt_malloc_p = malloc(9); |
448 | if (*salt_malloc_p == NULL) | 448 | if (*salt_malloc_p == NULL) |
449 | goto err; | 449 | goto err; |
450 | } | 450 | } |
diff --git a/src/lib/libssl/src/apps/pkcs12.c b/src/lib/libssl/src/apps/pkcs12.c index f099e8f618..9794718675 100644 --- a/src/lib/libssl/src/apps/pkcs12.c +++ b/src/lib/libssl/src/apps/pkcs12.c | |||
@@ -689,8 +689,8 @@ int MAIN(int argc, char **argv) | |||
689 | BIO_free(in); | 689 | BIO_free(in); |
690 | BIO_free_all(out); | 690 | BIO_free_all(out); |
691 | if (canames) sk_OPENSSL_STRING_free(canames); | 691 | if (canames) sk_OPENSSL_STRING_free(canames); |
692 | if(passin) OPENSSL_free(passin); | 692 | if(passin) free(passin); |
693 | if(passout) OPENSSL_free(passout); | 693 | if(passout) free(passout); |
694 | apps_shutdown(); | 694 | apps_shutdown(); |
695 | OPENSSL_EXIT(ret); | 695 | OPENSSL_EXIT(ret); |
696 | } | 696 | } |
@@ -927,7 +927,7 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name) | |||
927 | value = OPENSSL_uni2asc(av->value.bmpstring->data, | 927 | value = OPENSSL_uni2asc(av->value.bmpstring->data, |
928 | av->value.bmpstring->length); | 928 | av->value.bmpstring->length); |
929 | BIO_printf(out, "%s\n", value); | 929 | BIO_printf(out, "%s\n", value); |
930 | OPENSSL_free(value); | 930 | free(value); |
931 | break; | 931 | break; |
932 | 932 | ||
933 | case V_ASN1_OCTET_STRING: | 933 | case V_ASN1_OCTET_STRING: |
diff --git a/src/lib/libssl/src/apps/pkcs8.c b/src/lib/libssl/src/apps/pkcs8.c index 90b2ebe3ef..74fe9a1b3d 100644 --- a/src/lib/libssl/src/apps/pkcs8.c +++ b/src/lib/libssl/src/apps/pkcs8.c | |||
@@ -425,9 +425,9 @@ int MAIN(int argc, char **argv) | |||
425 | BIO_free_all(out); | 425 | BIO_free_all(out); |
426 | BIO_free(in); | 426 | BIO_free(in); |
427 | if (passin) | 427 | if (passin) |
428 | OPENSSL_free(passin); | 428 | free(passin); |
429 | if (passout) | 429 | if (passout) |
430 | OPENSSL_free(passout); | 430 | free(passout); |
431 | 431 | ||
432 | return ret; | 432 | return ret; |
433 | } | 433 | } |
diff --git a/src/lib/libssl/src/apps/pkey.c b/src/lib/libssl/src/apps/pkey.c index a55714d0ce..82c67b732b 100644 --- a/src/lib/libssl/src/apps/pkey.c +++ b/src/lib/libssl/src/apps/pkey.c | |||
@@ -270,9 +270,9 @@ int MAIN(int argc, char **argv) | |||
270 | BIO_free_all(out); | 270 | BIO_free_all(out); |
271 | BIO_free(in); | 271 | BIO_free(in); |
272 | if (passin) | 272 | if (passin) |
273 | OPENSSL_free(passin); | 273 | free(passin); |
274 | if (passout) | 274 | if (passout) |
275 | OPENSSL_free(passout); | 275 | free(passout); |
276 | 276 | ||
277 | return ret; | 277 | return ret; |
278 | } | 278 | } |
diff --git a/src/lib/libssl/src/apps/pkeyutl.c b/src/lib/libssl/src/apps/pkeyutl.c index 8b260caae0..3627839e05 100644 --- a/src/lib/libssl/src/apps/pkeyutl.c +++ b/src/lib/libssl/src/apps/pkeyutl.c | |||
@@ -338,7 +338,7 @@ int MAIN(int argc, char **argv) | |||
338 | buf_in, (size_t)buf_inlen); | 338 | buf_in, (size_t)buf_inlen); |
339 | if (rv > 0) | 339 | if (rv > 0) |
340 | { | 340 | { |
341 | buf_out = OPENSSL_malloc(buf_outlen); | 341 | buf_out = malloc(buf_outlen); |
342 | if (!buf_out) | 342 | if (!buf_out) |
343 | rv = -1; | 343 | rv = -1; |
344 | else | 344 | else |
@@ -371,11 +371,11 @@ int MAIN(int argc, char **argv) | |||
371 | BIO_free(in); | 371 | BIO_free(in); |
372 | BIO_free_all(out); | 372 | BIO_free_all(out); |
373 | if (buf_in) | 373 | if (buf_in) |
374 | OPENSSL_free(buf_in); | 374 | free(buf_in); |
375 | if (buf_out) | 375 | if (buf_out) |
376 | OPENSSL_free(buf_out); | 376 | free(buf_out); |
377 | if (sig) | 377 | if (sig) |
378 | OPENSSL_free(sig); | 378 | free(sig); |
379 | return ret; | 379 | return ret; |
380 | } | 380 | } |
381 | 381 | ||
@@ -497,7 +497,7 @@ static EVP_PKEY_CTX *init_ctx(int *pkeysize, | |||
497 | end: | 497 | end: |
498 | 498 | ||
499 | if (passin) | 499 | if (passin) |
500 | OPENSSL_free(passin); | 500 | free(passin); |
501 | 501 | ||
502 | return ctx; | 502 | return ctx; |
503 | 503 | ||
diff --git a/src/lib/libssl/src/apps/prime.c b/src/lib/libssl/src/apps/prime.c index 031906a792..690f03ef32 100644 --- a/src/lib/libssl/src/apps/prime.c +++ b/src/lib/libssl/src/apps/prime.c | |||
@@ -127,7 +127,7 @@ int MAIN(int argc, char **argv) | |||
127 | BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL); | 127 | BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL); |
128 | s=hex ? BN_bn2hex(bn) : BN_bn2dec(bn); | 128 | s=hex ? BN_bn2hex(bn) : BN_bn2dec(bn); |
129 | BIO_printf(bio_out,"%s\n",s); | 129 | BIO_printf(bio_out,"%s\n",s); |
130 | OPENSSL_free(s); | 130 | free(s); |
131 | } | 131 | } |
132 | else | 132 | else |
133 | { | 133 | { |
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c index 66038905a2..3374626e63 100644 --- a/src/lib/libssl/src/apps/req.c +++ b/src/lib/libssl/src/apps/req.c | |||
@@ -1068,7 +1068,7 @@ loop: | |||
1068 | end: | 1068 | end: |
1069 | #ifndef MONOLITH | 1069 | #ifndef MONOLITH |
1070 | if(to_free) | 1070 | if(to_free) |
1071 | OPENSSL_free(to_free); | 1071 | free(to_free); |
1072 | #endif | 1072 | #endif |
1073 | if (ex) | 1073 | if (ex) |
1074 | { | 1074 | { |
@@ -1089,12 +1089,12 @@ end: | |||
1089 | ENGINE_free(gen_eng); | 1089 | ENGINE_free(gen_eng); |
1090 | #endif | 1090 | #endif |
1091 | if (keyalgstr) | 1091 | if (keyalgstr) |
1092 | OPENSSL_free(keyalgstr); | 1092 | free(keyalgstr); |
1093 | X509_REQ_free(req); | 1093 | X509_REQ_free(req); |
1094 | X509_free(x509ss); | 1094 | X509_free(x509ss); |
1095 | ASN1_INTEGER_free(serial); | 1095 | ASN1_INTEGER_free(serial); |
1096 | if(passargin && passin) OPENSSL_free(passin); | 1096 | if(passargin && passin) free(passin); |
1097 | if(passargout && passout) OPENSSL_free(passout); | 1097 | if(passargout && passout) free(passout); |
1098 | OBJ_cleanup(); | 1098 | OBJ_cleanup(); |
1099 | apps_shutdown(); | 1099 | apps_shutdown(); |
1100 | OPENSSL_EXIT(ex); | 1100 | OPENSSL_EXIT(ex); |
diff --git a/src/lib/libssl/src/apps/rsa.c b/src/lib/libssl/src/apps/rsa.c index 579c2e276a..6352267671 100644 --- a/src/lib/libssl/src/apps/rsa.c +++ b/src/lib/libssl/src/apps/rsa.c | |||
@@ -382,7 +382,7 @@ bad: | |||
382 | 382 | ||
383 | i=1; | 383 | i=1; |
384 | size=i2d_RSA_NET(rsa,NULL,NULL, sgckey); | 384 | size=i2d_RSA_NET(rsa,NULL,NULL, sgckey); |
385 | if ((p=(unsigned char *)OPENSSL_malloc(size)) == NULL) | 385 | if ((p=(unsigned char *)malloc(size)) == NULL) |
386 | { | 386 | { |
387 | BIO_printf(bio_err,"Memory allocation failure\n"); | 387 | BIO_printf(bio_err,"Memory allocation failure\n"); |
388 | goto end; | 388 | goto end; |
@@ -390,7 +390,7 @@ bad: | |||
390 | pp=p; | 390 | pp=p; |
391 | i2d_RSA_NET(rsa,&p,NULL, sgckey); | 391 | i2d_RSA_NET(rsa,&p,NULL, sgckey); |
392 | BIO_write(out,(char *)pp,size); | 392 | BIO_write(out,(char *)pp,size); |
393 | OPENSSL_free(pp); | 393 | free(pp); |
394 | } | 394 | } |
395 | #endif | 395 | #endif |
396 | else if (outformat == FORMAT_PEM) { | 396 | else if (outformat == FORMAT_PEM) { |
@@ -430,8 +430,8 @@ bad: | |||
430 | end: | 430 | end: |
431 | if(out != NULL) BIO_free_all(out); | 431 | if(out != NULL) BIO_free_all(out); |
432 | if(rsa != NULL) RSA_free(rsa); | 432 | if(rsa != NULL) RSA_free(rsa); |
433 | if(passin) OPENSSL_free(passin); | 433 | if(passin) free(passin); |
434 | if(passout) OPENSSL_free(passout); | 434 | if(passout) free(passout); |
435 | apps_shutdown(); | 435 | apps_shutdown(); |
436 | OPENSSL_EXIT(ret); | 436 | OPENSSL_EXIT(ret); |
437 | } | 437 | } |
diff --git a/src/lib/libssl/src/apps/rsautl.c b/src/lib/libssl/src/apps/rsautl.c index 49903496f5..ba9758c94b 100644 --- a/src/lib/libssl/src/apps/rsautl.c +++ b/src/lib/libssl/src/apps/rsautl.c | |||
@@ -251,8 +251,8 @@ int MAIN(int argc, char **argv) | |||
251 | 251 | ||
252 | keysize = RSA_size(rsa); | 252 | keysize = RSA_size(rsa); |
253 | 253 | ||
254 | rsa_in = OPENSSL_malloc(keysize * 2); | 254 | rsa_in = malloc(keysize * 2); |
255 | rsa_out = OPENSSL_malloc(keysize); | 255 | rsa_out = malloc(keysize); |
256 | 256 | ||
257 | /* Read the input data */ | 257 | /* Read the input data */ |
258 | rsa_inlen = BIO_read(in, rsa_in, keysize * 2); | 258 | rsa_inlen = BIO_read(in, rsa_in, keysize * 2); |
@@ -305,9 +305,9 @@ int MAIN(int argc, char **argv) | |||
305 | RSA_free(rsa); | 305 | RSA_free(rsa); |
306 | BIO_free(in); | 306 | BIO_free(in); |
307 | BIO_free_all(out); | 307 | BIO_free_all(out); |
308 | if(rsa_in) OPENSSL_free(rsa_in); | 308 | if(rsa_in) free(rsa_in); |
309 | if(rsa_out) OPENSSL_free(rsa_out); | 309 | if(rsa_out) free(rsa_out); |
310 | if(passin) OPENSSL_free(passin); | 310 | if(passin) free(passin); |
311 | return ret; | 311 | return ret; |
312 | } | 312 | } |
313 | 313 | ||
diff --git a/src/lib/libssl/src/apps/s_cb.c b/src/lib/libssl/src/apps/s_cb.c index 1d6a5183c4..8e702075e0 100644 --- a/src/lib/libssl/src/apps/s_cb.c +++ b/src/lib/libssl/src/apps/s_cb.c | |||
@@ -784,7 +784,7 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cook | |||
784 | OPENSSL_assert(0); | 784 | OPENSSL_assert(0); |
785 | break; | 785 | break; |
786 | } | 786 | } |
787 | buffer = OPENSSL_malloc(length); | 787 | buffer = malloc(length); |
788 | 788 | ||
789 | if (buffer == NULL) | 789 | if (buffer == NULL) |
790 | { | 790 | { |
@@ -820,7 +820,7 @@ int generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cook | |||
820 | /* Calculate HMAC of buffer using the secret */ | 820 | /* Calculate HMAC of buffer using the secret */ |
821 | HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, | 821 | HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, |
822 | buffer, length, result, &resultlength); | 822 | buffer, length, result, &resultlength); |
823 | OPENSSL_free(buffer); | 823 | free(buffer); |
824 | 824 | ||
825 | memcpy(cookie, result, resultlength); | 825 | memcpy(cookie, result, resultlength); |
826 | *cookie_len = resultlength; | 826 | *cookie_len = resultlength; |
@@ -865,7 +865,7 @@ int verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int cookie_ | |||
865 | OPENSSL_assert(0); | 865 | OPENSSL_assert(0); |
866 | break; | 866 | break; |
867 | } | 867 | } |
868 | buffer = OPENSSL_malloc(length); | 868 | buffer = malloc(length); |
869 | 869 | ||
870 | if (buffer == NULL) | 870 | if (buffer == NULL) |
871 | { | 871 | { |
@@ -901,7 +901,7 @@ int verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int cookie_ | |||
901 | /* Calculate HMAC of buffer using the secret */ | 901 | /* Calculate HMAC of buffer using the secret */ |
902 | HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, | 902 | HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, |
903 | buffer, length, result, &resultlength); | 903 | buffer, length, result, &resultlength); |
904 | OPENSSL_free(buffer); | 904 | free(buffer); |
905 | 905 | ||
906 | if (cookie_len == resultlength && memcmp(result, cookie, resultlength) == 0) | 906 | if (cookie_len == resultlength && memcmp(result, cookie, resultlength) == 0) |
907 | return 1; | 907 | return 1; |
diff --git a/src/lib/libssl/src/apps/s_client.c b/src/lib/libssl/src/apps/s_client.c index 637e85e570..a163ac9904 100644 --- a/src/lib/libssl/src/apps/s_client.c +++ b/src/lib/libssl/src/apps/s_client.c | |||
@@ -475,7 +475,7 @@ static int ssl_srp_verify_param_cb(SSL *s, void *arg) | |||
475 | static char * ssl_give_srp_client_pwd_cb(SSL *s, void *arg) | 475 | static char * ssl_give_srp_client_pwd_cb(SSL *s, void *arg) |
476 | { | 476 | { |
477 | SRP_ARG *srp_arg = (SRP_ARG *)arg; | 477 | SRP_ARG *srp_arg = (SRP_ARG *)arg; |
478 | char *pass = (char *)OPENSSL_malloc(PWD_STRLEN+1); | 478 | char *pass = (char *)malloc(PWD_STRLEN+1); |
479 | PW_CB_DATA cb_tmp; | 479 | PW_CB_DATA cb_tmp; |
480 | int l; | 480 | int l; |
481 | 481 | ||
@@ -484,7 +484,7 @@ static char * ssl_give_srp_client_pwd_cb(SSL *s, void *arg) | |||
484 | if ((l = password_callback(pass, PWD_STRLEN, 0, &cb_tmp))<0) | 484 | if ((l = password_callback(pass, PWD_STRLEN, 0, &cb_tmp))<0) |
485 | { | 485 | { |
486 | BIO_printf (bio_err, "Can't read Password\n"); | 486 | BIO_printf (bio_err, "Can't read Password\n"); |
487 | OPENSSL_free(pass); | 487 | free(pass); |
488 | return NULL; | 488 | return NULL; |
489 | } | 489 | } |
490 | *(pass+l)= '\0'; | 490 | *(pass+l)= '\0'; |
@@ -628,9 +628,9 @@ int MAIN(int argc, char **argv) | |||
628 | if (!load_config(bio_err, NULL)) | 628 | if (!load_config(bio_err, NULL)) |
629 | goto end; | 629 | goto end; |
630 | 630 | ||
631 | if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) || | 631 | if ( ((cbuf=malloc(BUFSIZZ)) == NULL) || |
632 | ((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) || | 632 | ((sbuf=malloc(BUFSIZZ)) == NULL) || |
633 | ((mbuf=OPENSSL_malloc(BUFSIZZ + 1)) == NULL)) /* NUL byte */ | 633 | ((mbuf=malloc(BUFSIZZ + 1)) == NULL)) /* NUL byte */ |
634 | { | 634 | { |
635 | BIO_printf(bio_err,"out of memory\n"); | 635 | BIO_printf(bio_err,"out of memory\n"); |
636 | goto end; | 636 | goto end; |
@@ -1842,7 +1842,7 @@ end: | |||
1842 | } | 1842 | } |
1843 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 1843 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
1844 | if (next_proto.data) | 1844 | if (next_proto.data) |
1845 | OPENSSL_free(next_proto.data); | 1845 | free(next_proto.data); |
1846 | #endif | 1846 | #endif |
1847 | if (ctx != NULL) SSL_CTX_free(ctx); | 1847 | if (ctx != NULL) SSL_CTX_free(ctx); |
1848 | if (cert) | 1848 | if (cert) |
@@ -1850,12 +1850,12 @@ end: | |||
1850 | if (key) | 1850 | if (key) |
1851 | EVP_PKEY_free(key); | 1851 | EVP_PKEY_free(key); |
1852 | if (pass) | 1852 | if (pass) |
1853 | OPENSSL_free(pass); | 1853 | free(pass); |
1854 | if (vpm) | 1854 | if (vpm) |
1855 | X509_VERIFY_PARAM_free(vpm); | 1855 | X509_VERIFY_PARAM_free(vpm); |
1856 | if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); } | 1856 | if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); free(cbuf); } |
1857 | if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); } | 1857 | if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); free(sbuf); } |
1858 | if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); } | 1858 | if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); free(mbuf); } |
1859 | if (bio_c_out != NULL) | 1859 | if (bio_c_out != NULL) |
1860 | { | 1860 | { |
1861 | BIO_free(bio_c_out); | 1861 | BIO_free(bio_c_out); |
@@ -2033,7 +2033,7 @@ static void print_stuff(BIO *bio, SSL *s, int full) | |||
2033 | BIO_printf(bio, "Keying material exporter:\n"); | 2033 | BIO_printf(bio, "Keying material exporter:\n"); |
2034 | BIO_printf(bio, " Label: '%s'\n", keymatexportlabel); | 2034 | BIO_printf(bio, " Label: '%s'\n", keymatexportlabel); |
2035 | BIO_printf(bio, " Length: %i bytes\n", keymatexportlen); | 2035 | BIO_printf(bio, " Length: %i bytes\n", keymatexportlen); |
2036 | exportedkeymat = OPENSSL_malloc(keymatexportlen); | 2036 | exportedkeymat = malloc(keymatexportlen); |
2037 | if (exportedkeymat != NULL) | 2037 | if (exportedkeymat != NULL) |
2038 | { | 2038 | { |
2039 | if (!SSL_export_keying_material(s, exportedkeymat, | 2039 | if (!SSL_export_keying_material(s, exportedkeymat, |
@@ -2052,7 +2052,7 @@ static void print_stuff(BIO *bio, SSL *s, int full) | |||
2052 | exportedkeymat[i]); | 2052 | exportedkeymat[i]); |
2053 | BIO_printf(bio, "\n"); | 2053 | BIO_printf(bio, "\n"); |
2054 | } | 2054 | } |
2055 | OPENSSL_free(exportedkeymat); | 2055 | free(exportedkeymat); |
2056 | } | 2056 | } |
2057 | } | 2057 | } |
2058 | BIO_printf(bio,"---\n"); | 2058 | BIO_printf(bio,"---\n"); |
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c index 74cd2c83b3..1a2b9804ef 100644 --- a/src/lib/libssl/src/apps/s_server.c +++ b/src/lib/libssl/src/apps/s_server.c | |||
@@ -710,9 +710,9 @@ BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); | |||
710 | ERR_print_errors(err); | 710 | ERR_print_errors(err); |
711 | if (aia) | 711 | if (aia) |
712 | { | 712 | { |
713 | OPENSSL_free(host); | 713 | free(host); |
714 | OPENSSL_free(path); | 714 | free(path); |
715 | OPENSSL_free(port); | 715 | free(port); |
716 | X509_email_free(aia); | 716 | X509_email_free(aia); |
717 | } | 717 | } |
718 | if (id) | 718 | if (id) |
@@ -1720,18 +1720,18 @@ end: | |||
1720 | if (s_dkey) | 1720 | if (s_dkey) |
1721 | EVP_PKEY_free(s_dkey); | 1721 | EVP_PKEY_free(s_dkey); |
1722 | if (pass) | 1722 | if (pass) |
1723 | OPENSSL_free(pass); | 1723 | free(pass); |
1724 | if (dpass) | 1724 | if (dpass) |
1725 | OPENSSL_free(dpass); | 1725 | free(dpass); |
1726 | if (vpm) | 1726 | if (vpm) |
1727 | X509_VERIFY_PARAM_free(vpm); | 1727 | X509_VERIFY_PARAM_free(vpm); |
1728 | #ifndef OPENSSL_NO_TLSEXT | 1728 | #ifndef OPENSSL_NO_TLSEXT |
1729 | if (tlscstatp.host) | 1729 | if (tlscstatp.host) |
1730 | OPENSSL_free(tlscstatp.host); | 1730 | free(tlscstatp.host); |
1731 | if (tlscstatp.port) | 1731 | if (tlscstatp.port) |
1732 | OPENSSL_free(tlscstatp.port); | 1732 | free(tlscstatp.port); |
1733 | if (tlscstatp.path) | 1733 | if (tlscstatp.path) |
1734 | OPENSSL_free(tlscstatp.path); | 1734 | free(tlscstatp.path); |
1735 | if (ctx2 != NULL) SSL_CTX_free(ctx2); | 1735 | if (ctx2 != NULL) SSL_CTX_free(ctx2); |
1736 | if (s_cert2) | 1736 | if (s_cert2) |
1737 | X509_free(s_cert2); | 1737 | X509_free(s_cert2); |
@@ -1791,7 +1791,7 @@ static int sv_body(char *hostname, int s, unsigned char *context) | |||
1791 | struct timeval *timeoutp; | 1791 | struct timeval *timeoutp; |
1792 | #endif | 1792 | #endif |
1793 | 1793 | ||
1794 | if ((buf=OPENSSL_malloc(bufsize)) == NULL) | 1794 | if ((buf=malloc(bufsize)) == NULL) |
1795 | { | 1795 | { |
1796 | BIO_printf(bio_err,"out of memory\n"); | 1796 | BIO_printf(bio_err,"out of memory\n"); |
1797 | goto err; | 1797 | goto err; |
@@ -2162,7 +2162,7 @@ err: | |||
2162 | if (buf != NULL) | 2162 | if (buf != NULL) |
2163 | { | 2163 | { |
2164 | OPENSSL_cleanse(buf,bufsize); | 2164 | OPENSSL_cleanse(buf,bufsize); |
2165 | OPENSSL_free(buf); | 2165 | free(buf); |
2166 | } | 2166 | } |
2167 | if (ret >= 0) | 2167 | if (ret >= 0) |
2168 | BIO_printf(bio_s_out,"ACCEPT\n"); | 2168 | BIO_printf(bio_s_out,"ACCEPT\n"); |
@@ -2288,7 +2288,7 @@ static int init_ssl_connection(SSL *con) | |||
2288 | BIO_printf(bio_s_out, " Label: '%s'\n", keymatexportlabel); | 2288 | BIO_printf(bio_s_out, " Label: '%s'\n", keymatexportlabel); |
2289 | BIO_printf(bio_s_out, " Length: %i bytes\n", | 2289 | BIO_printf(bio_s_out, " Length: %i bytes\n", |
2290 | keymatexportlen); | 2290 | keymatexportlen); |
2291 | exportedkeymat = OPENSSL_malloc(keymatexportlen); | 2291 | exportedkeymat = malloc(keymatexportlen); |
2292 | if (exportedkeymat != NULL) | 2292 | if (exportedkeymat != NULL) |
2293 | { | 2293 | { |
2294 | if (!SSL_export_keying_material(con, exportedkeymat, | 2294 | if (!SSL_export_keying_material(con, exportedkeymat, |
@@ -2307,7 +2307,7 @@ static int init_ssl_connection(SSL *con) | |||
2307 | exportedkeymat[i]); | 2307 | exportedkeymat[i]); |
2308 | BIO_printf(bio_s_out, "\n"); | 2308 | BIO_printf(bio_s_out, "\n"); |
2309 | } | 2309 | } |
2310 | OPENSSL_free(exportedkeymat); | 2310 | free(exportedkeymat); |
2311 | } | 2311 | } |
2312 | } | 2312 | } |
2313 | 2313 | ||
@@ -2365,7 +2365,7 @@ static int www_body(char *hostname, int s, unsigned char *context) | |||
2365 | KSSL_CTX *kctx; | 2365 | KSSL_CTX *kctx; |
2366 | #endif | 2366 | #endif |
2367 | 2367 | ||
2368 | buf=OPENSSL_malloc(bufsize); | 2368 | buf=malloc(bufsize); |
2369 | if (buf == NULL) return(0); | 2369 | if (buf == NULL) return(0); |
2370 | io=BIO_new(BIO_f_buffer()); | 2370 | io=BIO_new(BIO_f_buffer()); |
2371 | ssl_bio=BIO_new(BIO_f_ssl()); | 2371 | ssl_bio=BIO_new(BIO_f_ssl()); |
@@ -2743,7 +2743,7 @@ err: | |||
2743 | if (ret >= 0) | 2743 | if (ret >= 0) |
2744 | BIO_printf(bio_s_out,"ACCEPT\n"); | 2744 | BIO_printf(bio_s_out,"ACCEPT\n"); |
2745 | 2745 | ||
2746 | if (buf != NULL) OPENSSL_free(buf); | 2746 | if (buf != NULL) free(buf); |
2747 | if (io != NULL) BIO_free_all(io); | 2747 | if (io != NULL) BIO_free_all(io); |
2748 | /* if (ssl_bio != NULL) BIO_free(ssl_bio);*/ | 2748 | /* if (ssl_bio != NULL) BIO_free(ssl_bio);*/ |
2749 | return(ret); | 2749 | return(ret); |
diff --git a/src/lib/libssl/src/apps/s_socket.c b/src/lib/libssl/src/apps/s_socket.c index 73dcdfd0a3..07f9934b32 100644 --- a/src/lib/libssl/src/apps/s_socket.c +++ b/src/lib/libssl/src/apps/s_socket.c | |||
@@ -222,7 +222,7 @@ int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, uns | |||
222 | else | 222 | else |
223 | sock = accept_socket; | 223 | sock = accept_socket; |
224 | i=(*cb)(name,sock, context); | 224 | i=(*cb)(name,sock, context); |
225 | if (name != NULL) OPENSSL_free(name); | 225 | if (name != NULL) free(name); |
226 | if (type==SOCK_STREAM) { | 226 | if (type==SOCK_STREAM) { |
227 | shutdown(sock, SHUT_RDWR); | 227 | shutdown(sock, SHUT_RDWR); |
228 | close(sock); | 228 | close(sock); |
@@ -358,9 +358,9 @@ redoit: | |||
358 | } | 358 | } |
359 | else | 359 | else |
360 | { | 360 | { |
361 | if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL) | 361 | if ((*host=(char *)malloc(strlen(h1->h_name)+1)) == NULL) |
362 | { | 362 | { |
363 | perror("OPENSSL_malloc"); | 363 | perror("malloc"); |
364 | return(0); | 364 | return(0); |
365 | } | 365 | } |
366 | BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1); | 366 | BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1); |
diff --git a/src/lib/libssl/src/apps/smime.c b/src/lib/libssl/src/apps/smime.c index cd08fe4464..4421e948bb 100644 --- a/src/lib/libssl/src/apps/smime.c +++ b/src/lib/libssl/src/apps/smime.c | |||
@@ -813,7 +813,7 @@ end: | |||
813 | BIO_free(in); | 813 | BIO_free(in); |
814 | BIO_free(indata); | 814 | BIO_free(indata); |
815 | BIO_free_all(out); | 815 | BIO_free_all(out); |
816 | if (passin) OPENSSL_free(passin); | 816 | if (passin) free(passin); |
817 | return (ret); | 817 | return (ret); |
818 | } | 818 | } |
819 | 819 | ||
diff --git a/src/lib/libssl/src/apps/speed.c b/src/lib/libssl/src/apps/speed.c index 72aa867ae4..acae09e95e 100644 --- a/src/lib/libssl/src/apps/speed.c +++ b/src/lib/libssl/src/apps/speed.c | |||
@@ -618,12 +618,12 @@ int MAIN(int argc, char **argv) | |||
618 | rsa_key[i]=NULL; | 618 | rsa_key[i]=NULL; |
619 | #endif | 619 | #endif |
620 | 620 | ||
621 | if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) | 621 | if ((buf=(unsigned char *)malloc((int)BUFSIZE)) == NULL) |
622 | { | 622 | { |
623 | BIO_printf(bio_err,"out of memory\n"); | 623 | BIO_printf(bio_err,"out of memory\n"); |
624 | goto end; | 624 | goto end; |
625 | } | 625 | } |
626 | if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) | 626 | if ((buf2=(unsigned char *)malloc((int)BUFSIZE)) == NULL) |
627 | { | 627 | { |
628 | BIO_printf(bio_err,"out of memory\n"); | 628 | BIO_printf(bio_err,"out of memory\n"); |
629 | goto end; | 629 | goto end; |
@@ -2493,8 +2493,8 @@ show_res: | |||
2493 | 2493 | ||
2494 | end: | 2494 | end: |
2495 | ERR_print_errors(bio_err); | 2495 | ERR_print_errors(bio_err); |
2496 | if (buf != NULL) OPENSSL_free(buf); | 2496 | if (buf != NULL) free(buf); |
2497 | if (buf2 != NULL) OPENSSL_free(buf2); | 2497 | if (buf2 != NULL) free(buf2); |
2498 | #ifndef OPENSSL_NO_RSA | 2498 | #ifndef OPENSSL_NO_RSA |
2499 | for (i=0; i<RSA_NUM; i++) | 2499 | for (i=0; i<RSA_NUM; i++) |
2500 | if (rsa_key[i] != NULL) | 2500 | if (rsa_key[i] != NULL) |
diff --git a/src/lib/libssl/src/apps/spkac.c b/src/lib/libssl/src/apps/spkac.c index 7b90825b21..8d29dce907 100644 --- a/src/lib/libssl/src/apps/spkac.c +++ b/src/lib/libssl/src/apps/spkac.c | |||
@@ -217,7 +217,7 @@ bad: | |||
217 | goto end; | 217 | goto end; |
218 | } | 218 | } |
219 | BIO_printf(out, "SPKAC=%s\n", spkstr); | 219 | BIO_printf(out, "SPKAC=%s\n", spkstr); |
220 | OPENSSL_free(spkstr); | 220 | free(spkstr); |
221 | ret = 0; | 221 | ret = 0; |
222 | goto end; | 222 | goto end; |
223 | } | 223 | } |
@@ -290,7 +290,7 @@ end: | |||
290 | BIO_free(in); | 290 | BIO_free(in); |
291 | BIO_free_all(out); | 291 | BIO_free_all(out); |
292 | EVP_PKEY_free(pkey); | 292 | EVP_PKEY_free(pkey); |
293 | if(passin) OPENSSL_free(passin); | 293 | if(passin) free(passin); |
294 | apps_shutdown(); | 294 | apps_shutdown(); |
295 | OPENSSL_EXIT(ret); | 295 | OPENSSL_EXIT(ret); |
296 | } | 296 | } |
diff --git a/src/lib/libssl/src/apps/srp.c b/src/lib/libssl/src/apps/srp.c index 7004fea7ff..15f3315c18 100644 --- a/src/lib/libssl/src/apps/srp.c +++ b/src/lib/libssl/src/apps/srp.c | |||
@@ -179,7 +179,7 @@ static int update_index(CA_DB *db, BIO *bio, char **row) | |||
179 | char ** irow; | 179 | char ** irow; |
180 | int i; | 180 | int i; |
181 | 181 | ||
182 | if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL) | 182 | if ((irow=(char **)malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL) |
183 | { | 183 | { |
184 | BIO_printf(bio_err,"Memory allocation failure\n"); | 184 | BIO_printf(bio_err,"Memory allocation failure\n"); |
185 | return 0; | 185 | return 0; |
@@ -196,7 +196,7 @@ static int update_index(CA_DB *db, BIO *bio, char **row) | |||
196 | { | 196 | { |
197 | BIO_printf(bio,"failed to update srpvfile\n"); | 197 | BIO_printf(bio,"failed to update srpvfile\n"); |
198 | BIO_printf(bio,"TXT_DB error number %ld\n",db->db->error); | 198 | BIO_printf(bio,"TXT_DB error number %ld\n",db->db->error); |
199 | OPENSSL_free(irow); | 199 | free(irow); |
200 | return 0; | 200 | return 0; |
201 | } | 201 | } |
202 | return 1; | 202 | return 1; |
@@ -233,7 +233,7 @@ static char *srp_verify_user(const char *user, const char *srp_verifier, | |||
233 | { | 233 | { |
234 | if (strcmp(verifier, srp_verifier)) | 234 | if (strcmp(verifier, srp_verifier)) |
235 | gNid = NULL; | 235 | gNid = NULL; |
236 | OPENSSL_free(verifier); | 236 | free(verifier); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | return gNid; | 239 | return gNid; |
@@ -444,7 +444,7 @@ bad: | |||
444 | size_t len; | 444 | size_t len; |
445 | 445 | ||
446 | len = strlen(s)+sizeof(CONFIG_FILE)+1; | 446 | len = strlen(s)+sizeof(CONFIG_FILE)+1; |
447 | tofree=OPENSSL_malloc(len); | 447 | tofree=malloc(len); |
448 | BUF_strlcpy(tofree,s,len); | 448 | BUF_strlcpy(tofree,s,len); |
449 | BUF_strlcat(tofree,"/",len); | 449 | BUF_strlcat(tofree,"/",len); |
450 | BUF_strlcat(tofree,CONFIG_FILE,len); | 450 | BUF_strlcat(tofree,CONFIG_FILE,len); |
@@ -465,7 +465,7 @@ bad: | |||
465 | } | 465 | } |
466 | if(tofree) | 466 | if(tofree) |
467 | { | 467 | { |
468 | OPENSSL_free(tofree); | 468 | free(tofree); |
469 | tofree = NULL; | 469 | tofree = NULL; |
470 | } | 470 | } |
471 | 471 | ||
@@ -607,12 +607,12 @@ bad: | |||
607 | (userinfo && (!(row[DB_srpinfo] = BUF_strdup(userinfo)))) || | 607 | (userinfo && (!(row[DB_srpinfo] = BUF_strdup(userinfo)))) || |
608 | !update_index(db, bio_err, row)) | 608 | !update_index(db, bio_err, row)) |
609 | { | 609 | { |
610 | if (row[DB_srpid]) OPENSSL_free(row[DB_srpid]); | 610 | if (row[DB_srpid]) free(row[DB_srpid]); |
611 | if (row[DB_srpgN]) OPENSSL_free(row[DB_srpgN]); | 611 | if (row[DB_srpgN]) free(row[DB_srpgN]); |
612 | if (row[DB_srpinfo]) OPENSSL_free(row[DB_srpinfo]); | 612 | if (row[DB_srpinfo]) free(row[DB_srpinfo]); |
613 | if (row[DB_srptype]) OPENSSL_free(row[DB_srptype]); | 613 | if (row[DB_srptype]) free(row[DB_srptype]); |
614 | if (row[DB_srpverifier]) OPENSSL_free(row[DB_srpverifier]); | 614 | if (row[DB_srpverifier]) free(row[DB_srpverifier]); |
615 | if (row[DB_srpsalt]) OPENSSL_free(row[DB_srpsalt]); | 615 | if (row[DB_srpsalt]) free(row[DB_srpsalt]); |
616 | goto err; | 616 | goto err; |
617 | } | 617 | } |
618 | doupdatedb = 1; | 618 | doupdatedb = 1; |
@@ -733,7 +733,7 @@ err: | |||
733 | 733 | ||
734 | VERBOSE BIO_printf(bio_err,"SRP terminating with code %d.\n",ret); | 734 | VERBOSE BIO_printf(bio_err,"SRP terminating with code %d.\n",ret); |
735 | if(tofree) | 735 | if(tofree) |
736 | OPENSSL_free(tofree); | 736 | free(tofree); |
737 | if (ret) ERR_print_errors(bio_err); | 737 | if (ret) ERR_print_errors(bio_err); |
738 | if (randfile) app_RAND_write_file(randfile, bio_err); | 738 | if (randfile) app_RAND_write_file(randfile, bio_err); |
739 | if (conf) NCONF_free(conf); | 739 | if (conf) NCONF_free(conf); |
diff --git a/src/lib/libssl/src/apps/ts.c b/src/lib/libssl/src/apps/ts.c index e066a497ca..9528631e92 100644 --- a/src/lib/libssl/src/apps/ts.c +++ b/src/lib/libssl/src/apps/ts.c | |||
@@ -389,7 +389,7 @@ int MAIN(int argc, char **argv) | |||
389 | /* Clean up. */ | 389 | /* Clean up. */ |
390 | app_RAND_write_file(NULL, bio_err); | 390 | app_RAND_write_file(NULL, bio_err); |
391 | NCONF_free(conf); | 391 | NCONF_free(conf); |
392 | OPENSSL_free(password); | 392 | free(password); |
393 | OBJ_cleanup(); | 393 | OBJ_cleanup(); |
394 | if (free_bio_err) | 394 | if (free_bio_err) |
395 | { | 395 | { |
@@ -589,7 +589,7 @@ static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md, | |||
589 | } | 589 | } |
590 | TS_MSG_IMPRINT_free(msg_imprint); | 590 | TS_MSG_IMPRINT_free(msg_imprint); |
591 | X509_ALGOR_free(algo); | 591 | X509_ALGOR_free(algo); |
592 | OPENSSL_free(data); | 592 | free(data); |
593 | ASN1_OBJECT_free(policy_obj); | 593 | ASN1_OBJECT_free(policy_obj); |
594 | ASN1_INTEGER_free(nonce_asn1); | 594 | ASN1_INTEGER_free(nonce_asn1); |
595 | return ts_req; | 595 | return ts_req; |
@@ -610,7 +610,7 @@ static int create_digest(BIO *input, char *digest, const EVP_MD *md, | |||
610 | unsigned char buffer[4096]; | 610 | unsigned char buffer[4096]; |
611 | int length; | 611 | int length; |
612 | 612 | ||
613 | *md_value = OPENSSL_malloc(md_value_len); | 613 | *md_value = malloc(md_value_len); |
614 | if (*md_value == 0) goto err; | 614 | if (*md_value == 0) goto err; |
615 | 615 | ||
616 | EVP_DigestInit(&md_ctx, md); | 616 | EVP_DigestInit(&md_ctx, md); |
@@ -627,7 +627,7 @@ static int create_digest(BIO *input, char *digest, const EVP_MD *md, | |||
627 | *md_value = string_to_hex(digest, &digest_len); | 627 | *md_value = string_to_hex(digest, &digest_len); |
628 | if (!*md_value || md_value_len != digest_len) | 628 | if (!*md_value || md_value_len != digest_len) |
629 | { | 629 | { |
630 | OPENSSL_free(*md_value); | 630 | free(*md_value); |
631 | *md_value = NULL; | 631 | *md_value = NULL; |
632 | BIO_printf(bio_err, "bad digest, %d bytes " | 632 | BIO_printf(bio_err, "bad digest, %d bytes " |
633 | "must be specified\n", md_value_len); | 633 | "must be specified\n", md_value_len); |
@@ -654,10 +654,10 @@ static ASN1_INTEGER *create_nonce(int bits) | |||
654 | /* Find the first non-zero byte and creating ASN1_INTEGER object. */ | 654 | /* Find the first non-zero byte and creating ASN1_INTEGER object. */ |
655 | for (i = 0; i < len && !buf[i]; ++i); | 655 | for (i = 0; i < len && !buf[i]; ++i); |
656 | if (!(nonce = ASN1_INTEGER_new())) goto err; | 656 | if (!(nonce = ASN1_INTEGER_new())) goto err; |
657 | OPENSSL_free(nonce->data); | 657 | free(nonce->data); |
658 | /* Allocate at least one byte. */ | 658 | /* Allocate at least one byte. */ |
659 | nonce->length = len - i; | 659 | nonce->length = len - i; |
660 | if (!(nonce->data = OPENSSL_malloc(nonce->length + 1))) goto err; | 660 | if (!(nonce->data = malloc(nonce->length + 1))) goto err; |
661 | memcpy(nonce->data, buf + i, nonce->length); | 661 | memcpy(nonce->data, buf + i, nonce->length); |
662 | 662 | ||
663 | return nonce; | 663 | return nonce; |
diff --git a/src/lib/libssl/src/apps/x509.c b/src/lib/libssl/src/apps/x509.c index 2ed3f13327..4e5ce37750 100644 --- a/src/lib/libssl/src/apps/x509.c +++ b/src/lib/libssl/src/apps/x509.c | |||
@@ -858,7 +858,7 @@ bad: | |||
858 | BIO_printf(STDout,"/* issuer :%s */\n",buf); | 858 | BIO_printf(STDout,"/* issuer :%s */\n",buf); |
859 | 859 | ||
860 | z=i2d_X509(x,NULL); | 860 | z=i2d_X509(x,NULL); |
861 | m=OPENSSL_malloc(z); | 861 | m=malloc(z); |
862 | 862 | ||
863 | d=(unsigned char *)m; | 863 | d=(unsigned char *)m; |
864 | z=i2d_X509_NAME(X509_get_subject_name(x),&d); | 864 | z=i2d_X509_NAME(X509_get_subject_name(x),&d); |
@@ -896,7 +896,7 @@ bad: | |||
896 | if (y%16 != 0) BIO_printf(STDout,"\n"); | 896 | if (y%16 != 0) BIO_printf(STDout,"\n"); |
897 | BIO_printf(STDout,"};\n"); | 897 | BIO_printf(STDout,"};\n"); |
898 | 898 | ||
899 | OPENSSL_free(m); | 899 | free(m); |
900 | } | 900 | } |
901 | else if (text == i) | 901 | else if (text == i) |
902 | { | 902 | { |
@@ -1087,7 +1087,7 @@ end: | |||
1087 | ASN1_INTEGER_free(sno); | 1087 | ASN1_INTEGER_free(sno); |
1088 | sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); | 1088 | sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); |
1089 | sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); | 1089 | sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); |
1090 | if (passin) OPENSSL_free(passin); | 1090 | if (passin) free(passin); |
1091 | apps_shutdown(); | 1091 | apps_shutdown(); |
1092 | OPENSSL_EXIT(ret); | 1092 | OPENSSL_EXIT(ret); |
1093 | } | 1093 | } |
@@ -1102,7 +1102,7 @@ static ASN1_INTEGER *x509_load_serial(char *CAfile, char *serialfile, int create | |||
1102 | len = ((serialfile == NULL) | 1102 | len = ((serialfile == NULL) |
1103 | ?(strlen(CAfile)+strlen(POSTFIX)+1) | 1103 | ?(strlen(CAfile)+strlen(POSTFIX)+1) |
1104 | :(strlen(serialfile)))+1; | 1104 | :(strlen(serialfile)))+1; |
1105 | buf=OPENSSL_malloc(len); | 1105 | buf=malloc(len); |
1106 | if (buf == NULL) { BIO_printf(bio_err,"out of mem\n"); goto end; } | 1106 | if (buf == NULL) { BIO_printf(bio_err,"out of mem\n"); goto end; } |
1107 | if (serialfile == NULL) | 1107 | if (serialfile == NULL) |
1108 | { | 1108 | { |
@@ -1127,7 +1127,7 @@ static ASN1_INTEGER *x509_load_serial(char *CAfile, char *serialfile, int create | |||
1127 | if (!save_serial(buf, NULL, serial, &bs)) goto end; | 1127 | if (!save_serial(buf, NULL, serial, &bs)) goto end; |
1128 | 1128 | ||
1129 | end: | 1129 | end: |
1130 | if (buf) OPENSSL_free(buf); | 1130 | if (buf) free(buf); |
1131 | BN_free(serial); | 1131 | BN_free(serial); |
1132 | return bs; | 1132 | return bs; |
1133 | } | 1133 | } |
diff --git a/src/lib/libssl/src/crypto/aes/aes_wrap.c b/src/lib/libssl/src/crypto/aes/aes_wrap.c index 198b0be333..668978425a 100644 --- a/src/lib/libssl/src/crypto/aes/aes_wrap.c +++ b/src/lib/libssl/src/crypto/aes/aes_wrap.c | |||
@@ -141,8 +141,8 @@ AES_wrap_unwrap_test(const unsigned char *kek, int keybits, | |||
141 | unsigned char *otmp = NULL, *ptmp = NULL; | 141 | unsigned char *otmp = NULL, *ptmp = NULL; |
142 | int r, ret = 0; | 142 | int r, ret = 0; |
143 | AES_KEY wctx; | 143 | AES_KEY wctx; |
144 | otmp = OPENSSL_malloc(keylen + 8); | 144 | otmp = malloc(keylen + 8); |
145 | ptmp = OPENSSL_malloc(keylen); | 145 | ptmp = malloc(keylen); |
146 | if (!otmp || !ptmp) | 146 | if (!otmp || !ptmp) |
147 | return 0; | 147 | return 0; |
148 | if (AES_set_encrypt_key(kek, keybits, &wctx)) | 148 | if (AES_set_encrypt_key(kek, keybits, &wctx)) |
@@ -165,9 +165,9 @@ AES_wrap_unwrap_test(const unsigned char *kek, int keybits, | |||
165 | 165 | ||
166 | err: | 166 | err: |
167 | if (otmp) | 167 | if (otmp) |
168 | OPENSSL_free(otmp); | 168 | free(otmp); |
169 | if (ptmp) | 169 | if (ptmp) |
170 | OPENSSL_free(ptmp); | 170 | free(ptmp); |
171 | 171 | ||
172 | return ret; | 172 | return ret; |
173 | } | 173 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_bitstr.c b/src/lib/libssl/src/crypto/asn1/a_bitstr.c index 34179960b8..e2b65bf2ac 100644 --- a/src/lib/libssl/src/crypto/asn1/a_bitstr.c +++ b/src/lib/libssl/src/crypto/asn1/a_bitstr.c | |||
@@ -144,7 +144,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, | |||
144 | 144 | ||
145 | if (len-- > 1) /* using one because of the bits left byte */ | 145 | if (len-- > 1) /* using one because of the bits left byte */ |
146 | { | 146 | { |
147 | s=(unsigned char *)OPENSSL_malloc((int)len); | 147 | s=(unsigned char *)malloc((int)len); |
148 | if (s == NULL) | 148 | if (s == NULL) |
149 | { | 149 | { |
150 | i=ERR_R_MALLOC_FAILURE; | 150 | i=ERR_R_MALLOC_FAILURE; |
@@ -158,7 +158,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, | |||
158 | s=NULL; | 158 | s=NULL; |
159 | 159 | ||
160 | ret->length=(int)len; | 160 | ret->length=(int)len; |
161 | if (ret->data != NULL) OPENSSL_free(ret->data); | 161 | if (ret->data != NULL) free(ret->data); |
162 | ret->data=s; | 162 | ret->data=s; |
163 | ret->type=V_ASN1_BIT_STRING; | 163 | ret->type=V_ASN1_BIT_STRING; |
164 | if (a != NULL) (*a)=ret; | 164 | if (a != NULL) (*a)=ret; |
@@ -192,7 +192,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) | |||
192 | { | 192 | { |
193 | if (!value) return(1); /* Don't need to set */ | 193 | if (!value) return(1); /* Don't need to set */ |
194 | if (a->data == NULL) | 194 | if (a->data == NULL) |
195 | c=(unsigned char *)OPENSSL_malloc(w+1); | 195 | c=(unsigned char *)malloc(w+1); |
196 | else | 196 | else |
197 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, | 197 | c=(unsigned char *)OPENSSL_realloc_clean(a->data, |
198 | a->length, | 198 | a->length, |
diff --git a/src/lib/libssl/src/crypto/asn1/a_bytes.c b/src/lib/libssl/src/crypto/asn1/a_bytes.c index 92d630cdba..8431d89edf 100644 --- a/src/lib/libssl/src/crypto/asn1/a_bytes.c +++ b/src/lib/libssl/src/crypto/asn1/a_bytes.c | |||
@@ -101,7 +101,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
101 | 101 | ||
102 | if (len != 0) | 102 | if (len != 0) |
103 | { | 103 | { |
104 | s=(unsigned char *)OPENSSL_malloc((int)len+1); | 104 | s=(unsigned char *)malloc((int)len+1); |
105 | if (s == NULL) | 105 | if (s == NULL) |
106 | { | 106 | { |
107 | i=ERR_R_MALLOC_FAILURE; | 107 | i=ERR_R_MALLOC_FAILURE; |
@@ -114,7 +114,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
114 | else | 114 | else |
115 | s=NULL; | 115 | s=NULL; |
116 | 116 | ||
117 | if (ret->data != NULL) OPENSSL_free(ret->data); | 117 | if (ret->data != NULL) free(ret->data); |
118 | ret->length=(int)len; | 118 | ret->length=(int)len; |
119 | ret->data=s; | 119 | ret->data=s; |
120 | ret->type=tag; | 120 | ret->type=tag; |
@@ -209,8 +209,8 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
209 | { | 209 | { |
210 | if ((ret->length < len) || (ret->data == NULL)) | 210 | if ((ret->length < len) || (ret->data == NULL)) |
211 | { | 211 | { |
212 | if (ret->data != NULL) OPENSSL_free(ret->data); | 212 | if (ret->data != NULL) free(ret->data); |
213 | s=(unsigned char *)OPENSSL_malloc((int)len + 1); | 213 | s=(unsigned char *)malloc((int)len + 1); |
214 | if (s == NULL) | 214 | if (s == NULL) |
215 | { | 215 | { |
216 | i=ERR_R_MALLOC_FAILURE; | 216 | i=ERR_R_MALLOC_FAILURE; |
@@ -226,7 +226,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
226 | else | 226 | else |
227 | { | 227 | { |
228 | s=NULL; | 228 | s=NULL; |
229 | if (ret->data != NULL) OPENSSL_free(ret->data); | 229 | if (ret->data != NULL) free(ret->data); |
230 | } | 230 | } |
231 | 231 | ||
232 | ret->length=(int)len; | 232 | ret->length=(int)len; |
@@ -301,14 +301,14 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) | |||
301 | if (!asn1_const_Finish(c)) goto err; | 301 | if (!asn1_const_Finish(c)) goto err; |
302 | 302 | ||
303 | a->length=num; | 303 | a->length=num; |
304 | if (a->data != NULL) OPENSSL_free(a->data); | 304 | if (a->data != NULL) free(a->data); |
305 | a->data=(unsigned char *)b.data; | 305 | a->data=(unsigned char *)b.data; |
306 | if (os != NULL) ASN1_STRING_free(os); | 306 | if (os != NULL) ASN1_STRING_free(os); |
307 | return(1); | 307 | return(1); |
308 | err: | 308 | err: |
309 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error); | 309 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error); |
310 | if (os != NULL) ASN1_STRING_free(os); | 310 | if (os != NULL) ASN1_STRING_free(os); |
311 | if (b.data != NULL) OPENSSL_free(b.data); | 311 | if (b.data != NULL) free(b.data); |
312 | return(0); | 312 | return(0); |
313 | } | 313 | } |
314 | 314 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_digest.c b/src/lib/libssl/src/crypto/asn1/a_digest.c index 8a4b24a06b..0d463d409b 100644 --- a/src/lib/libssl/src/crypto/asn1/a_digest.c +++ b/src/lib/libssl/src/crypto/asn1/a_digest.c | |||
@@ -81,6 +81,6 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, | |||
81 | 81 | ||
82 | if (!EVP_Digest(str, i, md, len, type, NULL)) | 82 | if (!EVP_Digest(str, i, md, len, type, NULL)) |
83 | return 0; | 83 | return 0; |
84 | OPENSSL_free(str); | 84 | free(str); |
85 | return(1); | 85 | return(1); |
86 | } | 86 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_dup.c b/src/lib/libssl/src/crypto/asn1/a_dup.c index d98992548a..e825b9c2d4 100644 --- a/src/lib/libssl/src/crypto/asn1/a_dup.c +++ b/src/lib/libssl/src/crypto/asn1/a_dup.c | |||
@@ -72,14 +72,14 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x) | |||
72 | if (x == NULL) return(NULL); | 72 | if (x == NULL) return(NULL); |
73 | 73 | ||
74 | i=i2d(x,NULL); | 74 | i=i2d(x,NULL); |
75 | b=OPENSSL_malloc(i+10); | 75 | b=malloc(i+10); |
76 | if (b == NULL) | 76 | if (b == NULL) |
77 | { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } | 77 | { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } |
78 | p= b; | 78 | p= b; |
79 | i=i2d(x,&p); | 79 | i=i2d(x,&p); |
80 | p2= b; | 80 | p2= b; |
81 | ret=d2i(NULL,&p2,i); | 81 | ret=d2i(NULL,&p2,i); |
82 | OPENSSL_free(b); | 82 | free(b); |
83 | return(ret); | 83 | return(ret); |
84 | } | 84 | } |
85 | 85 | ||
@@ -104,6 +104,6 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x) | |||
104 | { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } | 104 | { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } |
105 | p= b; | 105 | p= b; |
106 | ret=ASN1_item_d2i(NULL,&p,i, it); | 106 | ret=ASN1_item_d2i(NULL,&p,i, it); |
107 | OPENSSL_free(b); | 107 | free(b); |
108 | return(ret); | 108 | return(ret); |
109 | } | 109 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_enum.c b/src/lib/libssl/src/crypto/asn1/a_enum.c index fe9aa13b9c..c1154dde0a 100644 --- a/src/lib/libssl/src/crypto/asn1/a_enum.c +++ b/src/lib/libssl/src/crypto/asn1/a_enum.c | |||
@@ -77,8 +77,8 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) | |||
77 | if (a->length < (int)(sizeof(long)+1)) | 77 | if (a->length < (int)(sizeof(long)+1)) |
78 | { | 78 | { |
79 | if (a->data != NULL) | 79 | if (a->data != NULL) |
80 | OPENSSL_free(a->data); | 80 | free(a->data); |
81 | if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL) | 81 | if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL) |
82 | memset((char *)a->data,0,sizeof(long)+1); | 82 | memset((char *)a->data,0,sizeof(long)+1); |
83 | } | 83 | } |
84 | if (a->data == NULL) | 84 | if (a->data == NULL) |
@@ -155,7 +155,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) | |||
155 | len=((j == 0)?0:((j/8)+1)); | 155 | len=((j == 0)?0:((j/8)+1)); |
156 | if (ret->length < len+4) | 156 | if (ret->length < len+4) |
157 | { | 157 | { |
158 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); | 158 | unsigned char *new_data=realloc(ret->data, len+4); |
159 | if (!new_data) | 159 | if (!new_data) |
160 | { | 160 | { |
161 | ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); | 161 | ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/asn1/a_gentm.c b/src/lib/libssl/src/crypto/asn1/a_gentm.c index 4f312ee6c9..86666e7a20 100644 --- a/src/lib/libssl/src/crypto/asn1/a_gentm.c +++ b/src/lib/libssl/src/crypto/asn1/a_gentm.c | |||
@@ -225,7 +225,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | |||
225 | p=(char *)s->data; | 225 | p=(char *)s->data; |
226 | if ((p == NULL) || ((size_t)s->length < len)) | 226 | if ((p == NULL) || ((size_t)s->length < len)) |
227 | { | 227 | { |
228 | p=OPENSSL_malloc(len); | 228 | p=malloc(len); |
229 | if (p == NULL) | 229 | if (p == NULL) |
230 | { | 230 | { |
231 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, | 231 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, |
@@ -233,7 +233,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | |||
233 | return(NULL); | 233 | return(NULL); |
234 | } | 234 | } |
235 | if (s->data != NULL) | 235 | if (s->data != NULL) |
236 | OPENSSL_free(s->data); | 236 | free(s->data); |
237 | s->data=(unsigned char *)p; | 237 | s->data=(unsigned char *)p; |
238 | } | 238 | } |
239 | 239 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_i2d_fp.c b/src/lib/libssl/src/crypto/asn1/a_i2d_fp.c index a3ad76d356..484bcd66eb 100644 --- a/src/lib/libssl/src/crypto/asn1/a_i2d_fp.c +++ b/src/lib/libssl/src/crypto/asn1/a_i2d_fp.c | |||
@@ -88,7 +88,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) | |||
88 | int i,j=0,n,ret=1; | 88 | int i,j=0,n,ret=1; |
89 | 89 | ||
90 | n=i2d(x,NULL); | 90 | n=i2d(x,NULL); |
91 | b=(char *)OPENSSL_malloc(n); | 91 | b=(char *)malloc(n); |
92 | if (b == NULL) | 92 | if (b == NULL) |
93 | { | 93 | { |
94 | ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); | 94 | ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); |
@@ -110,7 +110,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) | |||
110 | j+=i; | 110 | j+=i; |
111 | n-=i; | 111 | n-=i; |
112 | } | 112 | } |
113 | OPENSSL_free(b); | 113 | free(b); |
114 | return(ret); | 114 | return(ret); |
115 | } | 115 | } |
116 | 116 | ||
@@ -158,6 +158,6 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x) | |||
158 | j+=i; | 158 | j+=i; |
159 | n-=i; | 159 | n-=i; |
160 | } | 160 | } |
161 | OPENSSL_free(b); | 161 | free(b); |
162 | return(ret); | 162 | return(ret); |
163 | } | 163 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_int.c b/src/lib/libssl/src/crypto/asn1/a_int.c index 297c45a9ff..6c38ace8f9 100644 --- a/src/lib/libssl/src/crypto/asn1/a_int.c +++ b/src/lib/libssl/src/crypto/asn1/a_int.c | |||
@@ -194,9 +194,9 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
194 | p= *pp; | 194 | p= *pp; |
195 | pend = p + len; | 195 | pend = p + len; |
196 | 196 | ||
197 | /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it | 197 | /* We must malloc stuff, even for 0 bytes otherwise it |
198 | * signifies a missing NULL parameter. */ | 198 | * signifies a missing NULL parameter. */ |
199 | s=(unsigned char *)OPENSSL_malloc((int)len+1); | 199 | s=(unsigned char *)malloc((int)len+1); |
200 | if (s == NULL) | 200 | if (s == NULL) |
201 | { | 201 | { |
202 | i=ERR_R_MALLOC_FAILURE; | 202 | i=ERR_R_MALLOC_FAILURE; |
@@ -249,7 +249,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
249 | memcpy(s,p,(int)len); | 249 | memcpy(s,p,(int)len); |
250 | } | 250 | } |
251 | 251 | ||
252 | if (ret->data != NULL) OPENSSL_free(ret->data); | 252 | if (ret->data != NULL) free(ret->data); |
253 | ret->data=s; | 253 | ret->data=s; |
254 | ret->length=(int)len; | 254 | ret->length=(int)len; |
255 | if (a != NULL) (*a)=ret; | 255 | if (a != NULL) (*a)=ret; |
@@ -300,9 +300,9 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
300 | goto err; | 300 | goto err; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it | 303 | /* We must malloc stuff, even for 0 bytes otherwise it |
304 | * signifies a missing NULL parameter. */ | 304 | * signifies a missing NULL parameter. */ |
305 | s=(unsigned char *)OPENSSL_malloc((int)len+1); | 305 | s=(unsigned char *)malloc((int)len+1); |
306 | if (s == NULL) | 306 | if (s == NULL) |
307 | { | 307 | { |
308 | i=ERR_R_MALLOC_FAILURE; | 308 | i=ERR_R_MALLOC_FAILURE; |
@@ -319,7 +319,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
319 | p+=len; | 319 | p+=len; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (ret->data != NULL) OPENSSL_free(ret->data); | 322 | if (ret->data != NULL) free(ret->data); |
323 | ret->data=s; | 323 | ret->data=s; |
324 | ret->length=(int)len; | 324 | ret->length=(int)len; |
325 | if (a != NULL) (*a)=ret; | 325 | if (a != NULL) (*a)=ret; |
@@ -343,8 +343,8 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) | |||
343 | if (a->length < (int)(sizeof(long)+1)) | 343 | if (a->length < (int)(sizeof(long)+1)) |
344 | { | 344 | { |
345 | if (a->data != NULL) | 345 | if (a->data != NULL) |
346 | OPENSSL_free(a->data); | 346 | free(a->data); |
347 | if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL) | 347 | if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL) |
348 | memset((char *)a->data,0,sizeof(long)+1); | 348 | memset((char *)a->data,0,sizeof(long)+1); |
349 | } | 349 | } |
350 | if (a->data == NULL) | 350 | if (a->data == NULL) |
@@ -422,7 +422,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) | |||
422 | len=((j == 0)?0:((j/8)+1)); | 422 | len=((j == 0)?0:((j/8)+1)); |
423 | if (ret->length < len+4) | 423 | if (ret->length < len+4) |
424 | { | 424 | { |
425 | unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); | 425 | unsigned char *new_data=realloc(ret->data, len+4); |
426 | if (!new_data) | 426 | if (!new_data) |
427 | { | 427 | { |
428 | ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); | 428 | ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/asn1/a_mbstr.c b/src/lib/libssl/src/crypto/asn1/a_mbstr.c index dc953c8325..f6d8da8b3c 100644 --- a/src/lib/libssl/src/crypto/asn1/a_mbstr.c +++ b/src/lib/libssl/src/crypto/asn1/a_mbstr.c | |||
@@ -185,7 +185,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
185 | dest = *out; | 185 | dest = *out; |
186 | if(dest->data) { | 186 | if(dest->data) { |
187 | dest->length = 0; | 187 | dest->length = 0; |
188 | OPENSSL_free(dest->data); | 188 | free(dest->data); |
189 | dest->data = NULL; | 189 | dest->data = NULL; |
190 | } | 190 | } |
191 | dest->type = str_type; | 191 | dest->type = str_type; |
@@ -231,7 +231,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
231 | cpyfunc = cpy_utf8; | 231 | cpyfunc = cpy_utf8; |
232 | break; | 232 | break; |
233 | } | 233 | } |
234 | if(!(p = OPENSSL_malloc(outlen + 1))) { | 234 | if(!(p = malloc(outlen + 1))) { |
235 | if(free_out) ASN1_STRING_free(dest); | 235 | if(free_out) ASN1_STRING_free(dest); |
236 | ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE); | 236 | ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE); |
237 | return -1; | 237 | return -1; |
diff --git a/src/lib/libssl/src/crypto/asn1/a_object.c b/src/lib/libssl/src/crypto/asn1/a_object.c index 3978c9150d..c30f32442d 100644 --- a/src/lib/libssl/src/crypto/asn1/a_object.c +++ b/src/lib/libssl/src/crypto/asn1/a_object.c | |||
@@ -180,9 +180,9 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) | |||
180 | if (blsize > tmpsize) | 180 | if (blsize > tmpsize) |
181 | { | 181 | { |
182 | if (tmp != ftmp) | 182 | if (tmp != ftmp) |
183 | OPENSSL_free(tmp); | 183 | free(tmp); |
184 | tmpsize = blsize + 32; | 184 | tmpsize = blsize + 32; |
185 | tmp = OPENSSL_malloc(tmpsize); | 185 | tmp = malloc(tmpsize); |
186 | if (!tmp) | 186 | if (!tmp) |
187 | goto err; | 187 | goto err; |
188 | } | 188 | } |
@@ -215,13 +215,13 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) | |||
215 | len+=i; | 215 | len+=i; |
216 | } | 216 | } |
217 | if (tmp != ftmp) | 217 | if (tmp != ftmp) |
218 | OPENSSL_free(tmp); | 218 | free(tmp); |
219 | if (bl) | 219 | if (bl) |
220 | BN_free(bl); | 220 | BN_free(bl); |
221 | return(len); | 221 | return(len); |
222 | err: | 222 | err: |
223 | if (tmp != ftmp) | 223 | if (tmp != ftmp) |
224 | OPENSSL_free(tmp); | 224 | free(tmp); |
225 | if (bl) | 225 | if (bl) |
226 | BN_free(bl); | 226 | BN_free(bl); |
227 | return(0); | 227 | return(0); |
@@ -242,7 +242,7 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) | |||
242 | i=i2t_ASN1_OBJECT(buf,sizeof buf,a); | 242 | i=i2t_ASN1_OBJECT(buf,sizeof buf,a); |
243 | if (i > (int)(sizeof(buf) - 1)) | 243 | if (i > (int)(sizeof(buf) - 1)) |
244 | { | 244 | { |
245 | p = OPENSSL_malloc(i + 1); | 245 | p = malloc(i + 1); |
246 | if (!p) | 246 | if (!p) |
247 | return -1; | 247 | return -1; |
248 | i2t_ASN1_OBJECT(p,i + 1,a); | 248 | i2t_ASN1_OBJECT(p,i + 1,a); |
@@ -251,7 +251,7 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) | |||
251 | return BIO_write(bp, "<INVALID>", 9); | 251 | return BIO_write(bp, "<INVALID>", 9); |
252 | BIO_write(bp,p,i); | 252 | BIO_write(bp,p,i); |
253 | if (p != buf) | 253 | if (p != buf) |
254 | OPENSSL_free(p); | 254 | free(p); |
255 | return(i); | 255 | return(i); |
256 | } | 256 | } |
257 | 257 | ||
@@ -319,8 +319,8 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | |||
319 | if ((data == NULL) || (ret->length < len)) | 319 | if ((data == NULL) || (ret->length < len)) |
320 | { | 320 | { |
321 | ret->length=0; | 321 | ret->length=0; |
322 | if (data != NULL) OPENSSL_free(data); | 322 | if (data != NULL) free(data); |
323 | data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); | 323 | data=(unsigned char *)malloc(len ? (int)len : 1); |
324 | if (data == NULL) | 324 | if (data == NULL) |
325 | { i=ERR_R_MALLOC_FAILURE; goto err; } | 325 | { i=ERR_R_MALLOC_FAILURE; goto err; } |
326 | ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; | 326 | ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; |
@@ -348,7 +348,7 @@ ASN1_OBJECT *ASN1_OBJECT_new(void) | |||
348 | { | 348 | { |
349 | ASN1_OBJECT *ret; | 349 | ASN1_OBJECT *ret; |
350 | 350 | ||
351 | ret=(ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT)); | 351 | ret=(ASN1_OBJECT *)malloc(sizeof(ASN1_OBJECT)); |
352 | if (ret == NULL) | 352 | if (ret == NULL) |
353 | { | 353 | { |
354 | ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE); | 354 | ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE); |
@@ -369,19 +369,19 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a) | |||
369 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) | 369 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) |
370 | { | 370 | { |
371 | #ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */ | 371 | #ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */ |
372 | if (a->sn != NULL) OPENSSL_free((void *)a->sn); | 372 | if (a->sn != NULL) free((void *)a->sn); |
373 | if (a->ln != NULL) OPENSSL_free((void *)a->ln); | 373 | if (a->ln != NULL) free((void *)a->ln); |
374 | #endif | 374 | #endif |
375 | a->sn=a->ln=NULL; | 375 | a->sn=a->ln=NULL; |
376 | } | 376 | } |
377 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) | 377 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) |
378 | { | 378 | { |
379 | if (a->data != NULL) OPENSSL_free((void *)a->data); | 379 | if (a->data != NULL) free((void *)a->data); |
380 | a->data=NULL; | 380 | a->data=NULL; |
381 | a->length=0; | 381 | a->length=0; |
382 | } | 382 | } |
383 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) | 383 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) |
384 | OPENSSL_free(a); | 384 | free(a); |
385 | } | 385 | } |
386 | 386 | ||
387 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, | 387 | ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, |
diff --git a/src/lib/libssl/src/crypto/asn1/a_sign.c b/src/lib/libssl/src/crypto/asn1/a_sign.c index 01b6292b65..0433b49a64 100644 --- a/src/lib/libssl/src/crypto/asn1/a_sign.c +++ b/src/lib/libssl/src/crypto/asn1/a_sign.c | |||
@@ -211,7 +211,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, | |||
211 | 211 | ||
212 | inl=ASN1_item_i2d(asn,&buf_in, it); | 212 | inl=ASN1_item_i2d(asn,&buf_in, it); |
213 | outll=outl=EVP_PKEY_size(pkey); | 213 | outll=outl=EVP_PKEY_size(pkey); |
214 | buf_out=OPENSSL_malloc((unsigned int)outl); | 214 | buf_out=malloc((unsigned int)outl); |
215 | if ((buf_in == NULL) || (buf_out == NULL)) | 215 | if ((buf_in == NULL) || (buf_out == NULL)) |
216 | { | 216 | { |
217 | outl=0; | 217 | outl=0; |
@@ -226,7 +226,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, | |||
226 | ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB); | 226 | ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB); |
227 | goto err; | 227 | goto err; |
228 | } | 228 | } |
229 | if (signature->data != NULL) OPENSSL_free(signature->data); | 229 | if (signature->data != NULL) free(signature->data); |
230 | signature->data=buf_out; | 230 | signature->data=buf_out; |
231 | buf_out=NULL; | 231 | buf_out=NULL; |
232 | signature->length=outl; | 232 | signature->length=outl; |
@@ -238,8 +238,8 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, | |||
238 | err: | 238 | err: |
239 | EVP_MD_CTX_cleanup(ctx); | 239 | EVP_MD_CTX_cleanup(ctx); |
240 | if (buf_in != NULL) | 240 | if (buf_in != NULL) |
241 | { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); } | 241 | { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); free(buf_in); } |
242 | if (buf_out != NULL) | 242 | if (buf_out != NULL) |
243 | { OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); } | 243 | { OPENSSL_cleanse((char *)buf_out,outll); free(buf_out); } |
244 | return(outl); | 244 | return(outl); |
245 | } | 245 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_strex.c b/src/lib/libssl/src/crypto/asn1/a_strex.c index d1a587ccc1..713b3cb028 100644 --- a/src/lib/libssl/src/crypto/asn1/a_strex.c +++ b/src/lib/libssl/src/crypto/asn1/a_strex.c | |||
@@ -278,12 +278,12 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING | |||
278 | t.type = str->type; | 278 | t.type = str->type; |
279 | t.value.ptr = (char *)str; | 279 | t.value.ptr = (char *)str; |
280 | der_len = i2d_ASN1_TYPE(&t, NULL); | 280 | der_len = i2d_ASN1_TYPE(&t, NULL); |
281 | der_buf = OPENSSL_malloc(der_len); | 281 | der_buf = malloc(der_len); |
282 | if(!der_buf) return -1; | 282 | if(!der_buf) return -1; |
283 | p = der_buf; | 283 | p = der_buf; |
284 | i2d_ASN1_TYPE(&t, &p); | 284 | i2d_ASN1_TYPE(&t, &p); |
285 | outlen = do_hex_dump(io_ch, arg, der_buf, der_len); | 285 | outlen = do_hex_dump(io_ch, arg, der_buf, der_len); |
286 | OPENSSL_free(der_buf); | 286 | free(der_buf); |
287 | if(outlen < 0) return -1; | 287 | if(outlen < 0) return -1; |
288 | return outlen + 1; | 288 | return outlen + 1; |
289 | } | 289 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/a_strnid.c b/src/lib/libssl/src/crypto/asn1/a_strnid.c index 2fc48c1551..74bc7b316c 100644 --- a/src/lib/libssl/src/crypto/asn1/a_strnid.c +++ b/src/lib/libssl/src/crypto/asn1/a_strnid.c | |||
@@ -222,7 +222,7 @@ int ASN1_STRING_TABLE_add(int nid, | |||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | if(!(tmp = ASN1_STRING_TABLE_get(nid))) { | 224 | if(!(tmp = ASN1_STRING_TABLE_get(nid))) { |
225 | tmp = OPENSSL_malloc(sizeof(ASN1_STRING_TABLE)); | 225 | tmp = malloc(sizeof(ASN1_STRING_TABLE)); |
226 | if(!tmp) { | 226 | if(!tmp) { |
227 | ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, | 227 | ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, |
228 | ERR_R_MALLOC_FAILURE); | 228 | ERR_R_MALLOC_FAILURE); |
@@ -250,7 +250,7 @@ void ASN1_STRING_TABLE_cleanup(void) | |||
250 | 250 | ||
251 | static void st_free(ASN1_STRING_TABLE *tbl) | 251 | static void st_free(ASN1_STRING_TABLE *tbl) |
252 | { | 252 | { |
253 | if(tbl->flags & STABLE_FLAGS_MALLOC) OPENSSL_free(tbl); | 253 | if(tbl->flags & STABLE_FLAGS_MALLOC) free(tbl); |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_utctm.c b/src/lib/libssl/src/crypto/asn1/a_utctm.c index f2e7de16af..0e7aca90a7 100644 --- a/src/lib/libssl/src/crypto/asn1/a_utctm.c +++ b/src/lib/libssl/src/crypto/asn1/a_utctm.c | |||
@@ -203,14 +203,14 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, | |||
203 | p=(char *)s->data; | 203 | p=(char *)s->data; |
204 | if ((p == NULL) || ((size_t)s->length < len)) | 204 | if ((p == NULL) || ((size_t)s->length < len)) |
205 | { | 205 | { |
206 | p=OPENSSL_malloc(len); | 206 | p=malloc(len); |
207 | if (p == NULL) | 207 | if (p == NULL) |
208 | { | 208 | { |
209 | ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE); | 209 | ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE); |
210 | return(NULL); | 210 | return(NULL); |
211 | } | 211 | } |
212 | if (s->data != NULL) | 212 | if (s->data != NULL) |
213 | OPENSSL_free(s->data); | 213 | free(s->data); |
214 | s->data=(unsigned char *)p; | 214 | s->data=(unsigned char *)p; |
215 | } | 215 | } |
216 | 216 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/a_verify.c b/src/lib/libssl/src/crypto/asn1/a_verify.c index 5eb47d768c..8eca970be3 100644 --- a/src/lib/libssl/src/crypto/asn1/a_verify.c +++ b/src/lib/libssl/src/crypto/asn1/a_verify.c | |||
@@ -154,7 +154,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, | |||
154 | } | 154 | } |
155 | 155 | ||
156 | OPENSSL_cleanse(buf_in,(unsigned int)inl); | 156 | OPENSSL_cleanse(buf_in,(unsigned int)inl); |
157 | OPENSSL_free(buf_in); | 157 | free(buf_in); |
158 | 158 | ||
159 | if (EVP_DigestVerifyFinal(&ctx,signature->data, | 159 | if (EVP_DigestVerifyFinal(&ctx,signature->data, |
160 | (size_t)signature->length) <= 0) | 160 | (size_t)signature->length) <= 0) |
diff --git a/src/lib/libssl/src/crypto/asn1/ameth_lib.c b/src/lib/libssl/src/crypto/asn1/ameth_lib.c index a19e058fca..228392f1e6 100644 --- a/src/lib/libssl/src/crypto/asn1/ameth_lib.c +++ b/src/lib/libssl/src/crypto/asn1/ameth_lib.c | |||
@@ -289,7 +289,7 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | |||
289 | const char *pem_str, const char *info) | 289 | const char *pem_str, const char *info) |
290 | { | 290 | { |
291 | EVP_PKEY_ASN1_METHOD *ameth; | 291 | EVP_PKEY_ASN1_METHOD *ameth; |
292 | ameth = OPENSSL_malloc(sizeof(EVP_PKEY_ASN1_METHOD)); | 292 | ameth = malloc(sizeof(EVP_PKEY_ASN1_METHOD)); |
293 | if (!ameth) | 293 | if (!ameth) |
294 | return NULL; | 294 | return NULL; |
295 | 295 | ||
@@ -393,10 +393,10 @@ void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | |||
393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) | 393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) |
394 | { | 394 | { |
395 | if (ameth->pem_str) | 395 | if (ameth->pem_str) |
396 | OPENSSL_free(ameth->pem_str); | 396 | free(ameth->pem_str); |
397 | if (ameth->info) | 397 | if (ameth->info) |
398 | OPENSSL_free(ameth->info); | 398 | free(ameth->info); |
399 | OPENSSL_free(ameth); | 399 | free(ameth); |
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_gen.c b/src/lib/libssl/src/crypto/asn1/asn1_gen.c index 81a7a38895..8194beeb30 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_gen.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_gen.c | |||
@@ -226,7 +226,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
226 | 226 | ||
227 | /* Allocate buffer for new encoding */ | 227 | /* Allocate buffer for new encoding */ |
228 | 228 | ||
229 | new_der = OPENSSL_malloc(len); | 229 | new_der = malloc(len); |
230 | if (!new_der) | 230 | if (!new_der) |
231 | goto err; | 231 | goto err; |
232 | 232 | ||
@@ -266,9 +266,9 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
266 | 266 | ||
267 | err: | 267 | err: |
268 | if (orig_der) | 268 | if (orig_der) |
269 | OPENSSL_free(orig_der); | 269 | free(orig_der); |
270 | if (new_der) | 270 | if (new_der) |
271 | OPENSSL_free(new_der); | 271 | free(new_der); |
272 | 272 | ||
273 | return ret; | 273 | return ret; |
274 | 274 | ||
@@ -499,7 +499,7 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | |||
499 | bad: | 499 | bad: |
500 | 500 | ||
501 | if (der) | 501 | if (der) |
502 | OPENSSL_free(der); | 502 | free(der); |
503 | 503 | ||
504 | if (sk) | 504 | if (sk) |
505 | sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); | 505 | sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_lib.c b/src/lib/libssl/src/crypto/asn1/asn1_lib.c index 4d1d6af18d..7b06b6fdc8 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_lib.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_lib.c | |||
@@ -383,9 +383,9 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
383 | { | 383 | { |
384 | c=str->data; | 384 | c=str->data; |
385 | if (c == NULL) | 385 | if (c == NULL) |
386 | str->data=OPENSSL_malloc(len+1); | 386 | str->data=malloc(len+1); |
387 | else | 387 | else |
388 | str->data=OPENSSL_realloc(c,len+1); | 388 | str->data=realloc(c,len+1); |
389 | 389 | ||
390 | if (str->data == NULL) | 390 | if (str->data == NULL) |
391 | { | 391 | { |
@@ -407,7 +407,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
407 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | 407 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) |
408 | { | 408 | { |
409 | if (str->data) | 409 | if (str->data) |
410 | OPENSSL_free(str->data); | 410 | free(str->data); |
411 | str->data = data; | 411 | str->data = data; |
412 | str->length = len; | 412 | str->length = len; |
413 | } | 413 | } |
@@ -422,7 +422,7 @@ ASN1_STRING *ASN1_STRING_type_new(int type) | |||
422 | { | 422 | { |
423 | ASN1_STRING *ret; | 423 | ASN1_STRING *ret; |
424 | 424 | ||
425 | ret=(ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING)); | 425 | ret=(ASN1_STRING *)malloc(sizeof(ASN1_STRING)); |
426 | if (ret == NULL) | 426 | if (ret == NULL) |
427 | { | 427 | { |
428 | ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE); | 428 | ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE); |
@@ -439,8 +439,8 @@ void ASN1_STRING_free(ASN1_STRING *a) | |||
439 | { | 439 | { |
440 | if (a == NULL) return; | 440 | if (a == NULL) return; |
441 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) | 441 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) |
442 | OPENSSL_free(a->data); | 442 | free(a->data); |
443 | OPENSSL_free(a); | 443 | free(a); |
444 | } | 444 | } |
445 | 445 | ||
446 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | 446 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_mac.h b/src/lib/libssl/src/crypto/asn1/asn1_mac.h index c60b197552..ecc2c77228 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_mac.h +++ b/src/lib/libssl/src/crypto/asn1/asn1_mac.h | |||
@@ -289,7 +289,7 @@ err:\ | |||
289 | 289 | ||
290 | /* New macros */ | 290 | /* New macros */ |
291 | #define M_ASN1_New_Malloc(ret,type) \ | 291 | #define M_ASN1_New_Malloc(ret,type) \ |
292 | if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ | 292 | if ((ret=(type *)malloc(sizeof(type))) == NULL) \ |
293 | { c.line=__LINE__; goto err2; } | 293 | { c.line=__LINE__; goto err2; } |
294 | 294 | ||
295 | #define M_ASN1_New(arg,func) \ | 295 | #define M_ASN1_New(arg,func) \ |
diff --git a/src/lib/libssl/src/crypto/asn1/asn_mime.c b/src/lib/libssl/src/crypto/asn1/asn_mime.c index 54a704a969..d94b3cd6f8 100644 --- a/src/lib/libssl/src/crypto/asn1/asn_mime.c +++ b/src/lib/libssl/src/crypto/asn1/asn_mime.c | |||
@@ -220,7 +220,7 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) | |||
220 | if (rv > 0) | 220 | if (rv > 0) |
221 | { | 221 | { |
222 | BIO_puts(out, micstr); | 222 | BIO_puts(out, micstr); |
223 | OPENSSL_free(micstr); | 223 | free(micstr); |
224 | continue; | 224 | continue; |
225 | } | 225 | } |
226 | if (rv != -2) | 226 | if (rv != -2) |
@@ -822,7 +822,7 @@ static MIME_HEADER *mime_hdr_new(char *name, char *value) | |||
822 | } | 822 | } |
823 | } | 823 | } |
824 | } else tmpval = NULL; | 824 | } else tmpval = NULL; |
825 | mhdr = (MIME_HEADER *) OPENSSL_malloc(sizeof(MIME_HEADER)); | 825 | mhdr = (MIME_HEADER *) malloc(sizeof(MIME_HEADER)); |
826 | if(!mhdr) return NULL; | 826 | if(!mhdr) return NULL; |
827 | mhdr->name = tmpname; | 827 | mhdr->name = tmpname; |
828 | mhdr->value = tmpval; | 828 | mhdr->value = tmpval; |
@@ -851,7 +851,7 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value) | |||
851 | if(!tmpval) return 0; | 851 | if(!tmpval) return 0; |
852 | } else tmpval = NULL; | 852 | } else tmpval = NULL; |
853 | /* Parameter values are case sensitive so leave as is */ | 853 | /* Parameter values are case sensitive so leave as is */ |
854 | mparam = (MIME_PARAM *) OPENSSL_malloc(sizeof(MIME_PARAM)); | 854 | mparam = (MIME_PARAM *) malloc(sizeof(MIME_PARAM)); |
855 | if(!mparam) return 0; | 855 | if(!mparam) return 0; |
856 | mparam->param_name = tmpname; | 856 | mparam->param_name = tmpname; |
857 | mparam->param_value = tmpval; | 857 | mparam->param_value = tmpval; |
@@ -900,17 +900,17 @@ static MIME_PARAM *mime_param_find(MIME_HEADER *hdr, char *name) | |||
900 | 900 | ||
901 | static void mime_hdr_free(MIME_HEADER *hdr) | 901 | static void mime_hdr_free(MIME_HEADER *hdr) |
902 | { | 902 | { |
903 | if(hdr->name) OPENSSL_free(hdr->name); | 903 | if(hdr->name) free(hdr->name); |
904 | if(hdr->value) OPENSSL_free(hdr->value); | 904 | if(hdr->value) free(hdr->value); |
905 | if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); | 905 | if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); |
906 | OPENSSL_free(hdr); | 906 | free(hdr); |
907 | } | 907 | } |
908 | 908 | ||
909 | static void mime_param_free(MIME_PARAM *param) | 909 | static void mime_param_free(MIME_PARAM *param) |
910 | { | 910 | { |
911 | if(param->param_name) OPENSSL_free(param->param_name); | 911 | if(param->param_name) free(param->param_name); |
912 | if(param->param_value) OPENSSL_free(param->param_value); | 912 | if(param->param_value) free(param->param_value); |
913 | OPENSSL_free(param); | 913 | free(param); |
914 | } | 914 | } |
915 | 915 | ||
916 | /* Check for a multipart boundary. Returns: | 916 | /* Check for a multipart boundary. Returns: |
diff --git a/src/lib/libssl/src/crypto/asn1/asn_moid.c b/src/lib/libssl/src/crypto/asn1/asn_moid.c index 1ea6a59248..fd04d11459 100644 --- a/src/lib/libssl/src/crypto/asn1/asn_moid.c +++ b/src/lib/libssl/src/crypto/asn1/asn_moid.c | |||
@@ -145,7 +145,7 @@ static int do_create(char *value, char *name) | |||
145 | p--; | 145 | p--; |
146 | } | 146 | } |
147 | p++; | 147 | p++; |
148 | lntmp = OPENSSL_malloc((p - ln) + 1); | 148 | lntmp = malloc((p - ln) + 1); |
149 | if (lntmp == NULL) | 149 | if (lntmp == NULL) |
150 | return 0; | 150 | return 0; |
151 | memcpy(lntmp, ln, p - ln); | 151 | memcpy(lntmp, ln, p - ln); |
diff --git a/src/lib/libssl/src/crypto/asn1/asn_pack.c b/src/lib/libssl/src/crypto/asn1/asn_pack.c index 1886508654..13dc5d4665 100644 --- a/src/lib/libssl/src/crypto/asn1/asn_pack.c +++ b/src/lib/libssl/src/crypto/asn1/asn_pack.c | |||
@@ -75,7 +75,7 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct) | |||
75 | } else octmp = *oct; | 75 | } else octmp = *oct; |
76 | 76 | ||
77 | if(octmp->data) { | 77 | if(octmp->data) { |
78 | OPENSSL_free(octmp->data); | 78 | free(octmp->data); |
79 | octmp->data = NULL; | 79 | octmp->data = NULL; |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/bio_asn1.c b/src/lib/libssl/src/crypto/asn1/bio_asn1.c index dc7efd551c..fa98dba728 100644 --- a/src/lib/libssl/src/crypto/asn1/bio_asn1.c +++ b/src/lib/libssl/src/crypto/asn1/bio_asn1.c | |||
@@ -150,7 +150,7 @@ BIO_METHOD *BIO_f_asn1(void) | |||
150 | static int asn1_bio_new(BIO *b) | 150 | static int asn1_bio_new(BIO *b) |
151 | { | 151 | { |
152 | BIO_ASN1_BUF_CTX *ctx; | 152 | BIO_ASN1_BUF_CTX *ctx; |
153 | ctx = OPENSSL_malloc(sizeof(BIO_ASN1_BUF_CTX)); | 153 | ctx = malloc(sizeof(BIO_ASN1_BUF_CTX)); |
154 | if (!ctx) | 154 | if (!ctx) |
155 | return 0; | 155 | return 0; |
156 | if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) | 156 | if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) |
@@ -163,7 +163,7 @@ static int asn1_bio_new(BIO *b) | |||
163 | 163 | ||
164 | static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size) | 164 | static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size) |
165 | { | 165 | { |
166 | ctx->buf = OPENSSL_malloc(size); | 166 | ctx->buf = malloc(size); |
167 | if (!ctx->buf) | 167 | if (!ctx->buf) |
168 | return 0; | 168 | return 0; |
169 | ctx->bufsize = size; | 169 | ctx->bufsize = size; |
@@ -186,8 +186,8 @@ static int asn1_bio_free(BIO *b) | |||
186 | if (ctx == NULL) | 186 | if (ctx == NULL) |
187 | return 0; | 187 | return 0; |
188 | if (ctx->buf) | 188 | if (ctx->buf) |
189 | OPENSSL_free(ctx->buf); | 189 | free(ctx->buf); |
190 | OPENSSL_free(ctx); | 190 | free(ctx); |
191 | b->init = 0; | 191 | b->init = 0; |
192 | b->ptr = NULL; | 192 | b->ptr = NULL; |
193 | b->flags = 0; | 193 | b->flags = 0; |
diff --git a/src/lib/libssl/src/crypto/asn1/bio_ndef.c b/src/lib/libssl/src/crypto/asn1/bio_ndef.c index b91f97a1b1..60f324bdae 100644 --- a/src/lib/libssl/src/crypto/asn1/bio_ndef.c +++ b/src/lib/libssl/src/crypto/asn1/bio_ndef.c | |||
@@ -110,7 +110,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
110 | ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED); | 110 | ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED); |
111 | return NULL; | 111 | return NULL; |
112 | } | 112 | } |
113 | ndef_aux = OPENSSL_malloc(sizeof(NDEF_SUPPORT)); | 113 | ndef_aux = malloc(sizeof(NDEF_SUPPORT)); |
114 | asn_bio = BIO_new(BIO_f_asn1()); | 114 | asn_bio = BIO_new(BIO_f_asn1()); |
115 | 115 | ||
116 | /* ASN1 bio needs to be next to output BIO */ | 116 | /* ASN1 bio needs to be next to output BIO */ |
@@ -148,7 +148,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
148 | if (asn_bio) | 148 | if (asn_bio) |
149 | BIO_free(asn_bio); | 149 | BIO_free(asn_bio); |
150 | if (ndef_aux) | 150 | if (ndef_aux) |
151 | OPENSSL_free(ndef_aux); | 151 | free(ndef_aux); |
152 | return NULL; | 152 | return NULL; |
153 | } | 153 | } |
154 | 154 | ||
@@ -164,7 +164,7 @@ static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
164 | ndef_aux = *(NDEF_SUPPORT **)parg; | 164 | ndef_aux = *(NDEF_SUPPORT **)parg; |
165 | 165 | ||
166 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); | 166 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); |
167 | p = OPENSSL_malloc(derlen); | 167 | p = malloc(derlen); |
168 | ndef_aux->derbuf = p; | 168 | ndef_aux->derbuf = p; |
169 | *pbuf = p; | 169 | *pbuf = p; |
170 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); | 170 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); |
@@ -187,7 +187,7 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
187 | ndef_aux = *(NDEF_SUPPORT **)parg; | 187 | ndef_aux = *(NDEF_SUPPORT **)parg; |
188 | 188 | ||
189 | if (ndef_aux->derbuf) | 189 | if (ndef_aux->derbuf) |
190 | OPENSSL_free(ndef_aux->derbuf); | 190 | free(ndef_aux->derbuf); |
191 | 191 | ||
192 | ndef_aux->derbuf = NULL; | 192 | ndef_aux->derbuf = NULL; |
193 | *pbuf = NULL; | 193 | *pbuf = NULL; |
@@ -200,7 +200,7 @@ static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
200 | NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; | 200 | NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg; |
201 | if (!ndef_prefix_free(b, pbuf, plen, parg)) | 201 | if (!ndef_prefix_free(b, pbuf, plen, parg)) |
202 | return 0; | 202 | return 0; |
203 | OPENSSL_free(*pndef_aux); | 203 | free(*pndef_aux); |
204 | *pndef_aux = NULL; | 204 | *pndef_aux = NULL; |
205 | return 1; | 205 | return 1; |
206 | } | 206 | } |
@@ -229,7 +229,7 @@ static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
229 | return 0; | 229 | return 0; |
230 | 230 | ||
231 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); | 231 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it); |
232 | p = OPENSSL_malloc(derlen); | 232 | p = malloc(derlen); |
233 | ndef_aux->derbuf = p; | 233 | ndef_aux->derbuf = p; |
234 | *pbuf = p; | 234 | *pbuf = p; |
235 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); | 235 | derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it); |
diff --git a/src/lib/libssl/src/crypto/asn1/f_enum.c b/src/lib/libssl/src/crypto/asn1/f_enum.c index 56e3cc8df2..caf34ee97e 100644 --- a/src/lib/libssl/src/crypto/asn1/f_enum.c +++ b/src/lib/libssl/src/crypto/asn1/f_enum.c | |||
@@ -153,15 +153,15 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | |||
153 | if (num+i > slen) | 153 | if (num+i > slen) |
154 | { | 154 | { |
155 | if (s == NULL) | 155 | if (s == NULL) |
156 | sp=(unsigned char *)OPENSSL_malloc( | 156 | sp=(unsigned char *)malloc( |
157 | (unsigned int)num+i*2); | 157 | (unsigned int)num+i*2); |
158 | else | 158 | else |
159 | sp=(unsigned char *)OPENSSL_realloc(s, | 159 | sp=(unsigned char *)realloc(s, |
160 | (unsigned int)num+i*2); | 160 | (unsigned int)num+i*2); |
161 | if (sp == NULL) | 161 | if (sp == NULL) |
162 | { | 162 | { |
163 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); | 163 | ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); |
164 | if (s != NULL) OPENSSL_free(s); | 164 | if (s != NULL) free(s); |
165 | goto err; | 165 | goto err; |
166 | } | 166 | } |
167 | s=sp; | 167 | s=sp; |
diff --git a/src/lib/libssl/src/crypto/asn1/f_int.c b/src/lib/libssl/src/crypto/asn1/f_int.c index 8b92fad9df..977e3d01b7 100644 --- a/src/lib/libssl/src/crypto/asn1/f_int.c +++ b/src/lib/libssl/src/crypto/asn1/f_int.c | |||
@@ -157,14 +157,14 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) | |||
157 | if (num+i > slen) | 157 | if (num+i > slen) |
158 | { | 158 | { |
159 | if (s == NULL) | 159 | if (s == NULL) |
160 | sp=(unsigned char *)OPENSSL_malloc( | 160 | sp=(unsigned char *)malloc( |
161 | (unsigned int)num+i*2); | 161 | (unsigned int)num+i*2); |
162 | else | 162 | else |
163 | sp=OPENSSL_realloc_clean(s,slen,num+i*2); | 163 | sp=OPENSSL_realloc_clean(s,slen,num+i*2); |
164 | if (sp == NULL) | 164 | if (sp == NULL) |
165 | { | 165 | { |
166 | ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); | 166 | ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); |
167 | if (s != NULL) OPENSSL_free(s); | 167 | if (s != NULL) free(s); |
168 | goto err; | 168 | goto err; |
169 | } | 169 | } |
170 | s=sp; | 170 | s=sp; |
diff --git a/src/lib/libssl/src/crypto/asn1/f_string.c b/src/lib/libssl/src/crypto/asn1/f_string.c index f7d36adac7..f4bee15335 100644 --- a/src/lib/libssl/src/crypto/asn1/f_string.c +++ b/src/lib/libssl/src/crypto/asn1/f_string.c | |||
@@ -149,15 +149,15 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
149 | if (num+i > slen) | 149 | if (num+i > slen) |
150 | { | 150 | { |
151 | if (s == NULL) | 151 | if (s == NULL) |
152 | sp=(unsigned char *)OPENSSL_malloc( | 152 | sp=(unsigned char *)malloc( |
153 | (unsigned int)num+i*2); | 153 | (unsigned int)num+i*2); |
154 | else | 154 | else |
155 | sp=(unsigned char *)OPENSSL_realloc(s, | 155 | sp=(unsigned char *)realloc(s, |
156 | (unsigned int)num+i*2); | 156 | (unsigned int)num+i*2); |
157 | if (sp == NULL) | 157 | if (sp == NULL) |
158 | { | 158 | { |
159 | ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE); | 159 | ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE); |
160 | if (s != NULL) OPENSSL_free(s); | 160 | if (s != NULL) free(s); |
161 | goto err; | 161 | goto err; |
162 | } | 162 | } |
163 | s=sp; | 163 | s=sp; |
diff --git a/src/lib/libssl/src/crypto/asn1/n_pkey.c b/src/lib/libssl/src/crypto/asn1/n_pkey.c index e251739933..97647d17e1 100644 --- a/src/lib/libssl/src/crypto/asn1/n_pkey.c +++ b/src/lib/libssl/src/crypto/asn1/n_pkey.c | |||
@@ -169,7 +169,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, | |||
169 | 169 | ||
170 | 170 | ||
171 | /* Since its RC4 encrypted length is actual length */ | 171 | /* Since its RC4 encrypted length is actual length */ |
172 | if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL) | 172 | if ((zz=(unsigned char *)malloc(rsalen)) == NULL) |
173 | { | 173 | { |
174 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); | 174 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); |
175 | goto err; | 175 | goto err; |
@@ -179,7 +179,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, | |||
179 | /* Write out private key encoding */ | 179 | /* Write out private key encoding */ |
180 | i2d_RSAPrivateKey(a,&zz); | 180 | i2d_RSAPrivateKey(a,&zz); |
181 | 181 | ||
182 | if ((zz=OPENSSL_malloc(pkeylen)) == NULL) | 182 | if ((zz=malloc(pkeylen)) == NULL) |
183 | { | 183 | { |
184 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); | 184 | ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); |
185 | goto err; | 185 | goto err; |
diff --git a/src/lib/libssl/src/crypto/asn1/p5_pbev2.c b/src/lib/libssl/src/crypto/asn1/p5_pbev2.c index 4ea683036b..2d80334e01 100644 --- a/src/lib/libssl/src/crypto/asn1/p5_pbev2.c +++ b/src/lib/libssl/src/crypto/asn1/p5_pbev2.c | |||
@@ -214,7 +214,7 @@ X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, | |||
214 | 214 | ||
215 | if (!saltlen) | 215 | if (!saltlen) |
216 | saltlen = PKCS5_SALT_LEN; | 216 | saltlen = PKCS5_SALT_LEN; |
217 | if (!(osalt->data = OPENSSL_malloc (saltlen))) | 217 | if (!(osalt->data = malloc (saltlen))) |
218 | goto merr; | 218 | goto merr; |
219 | 219 | ||
220 | osalt->length = saltlen; | 220 | osalt->length = saltlen; |
diff --git a/src/lib/libssl/src/crypto/asn1/t_crl.c b/src/lib/libssl/src/crypto/asn1/t_crl.c index c61169208a..f6550b2b04 100644 --- a/src/lib/libssl/src/crypto/asn1/t_crl.c +++ b/src/lib/libssl/src/crypto/asn1/t_crl.c | |||
@@ -97,7 +97,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x) | |||
97 | X509_signature_print(out, x->sig_alg, NULL); | 97 | X509_signature_print(out, x->sig_alg, NULL); |
98 | p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); | 98 | p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); |
99 | BIO_printf(out,"%8sIssuer: %s\n","",p); | 99 | BIO_printf(out,"%8sIssuer: %s\n","",p); |
100 | OPENSSL_free(p); | 100 | free(p); |
101 | BIO_printf(out,"%8sLast Update: ",""); | 101 | BIO_printf(out,"%8sLast Update: ",""); |
102 | ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); | 102 | ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); |
103 | BIO_printf(out,"\n%8sNext Update: ",""); | 103 | BIO_printf(out,"\n%8sNext Update: ",""); |
diff --git a/src/lib/libssl/src/crypto/asn1/t_x509.c b/src/lib/libssl/src/crypto/asn1/t_x509.c index bbf00c7a29..8dfda07b92 100644 --- a/src/lib/libssl/src/crypto/asn1/t_x509.c +++ b/src/lib/libssl/src/crypto/asn1/t_x509.c | |||
@@ -239,7 +239,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
239 | } | 239 | } |
240 | ret=1; | 240 | ret=1; |
241 | err: | 241 | err: |
242 | if (m != NULL) OPENSSL_free(m); | 242 | if (m != NULL) free(m); |
243 | return(ret); | 243 | return(ret); |
244 | } | 244 | } |
245 | 245 | ||
@@ -256,7 +256,7 @@ int X509_ocspid_print (BIO *bp, X509 *x) | |||
256 | if (BIO_printf(bp," Subject OCSP hash: ") <= 0) | 256 | if (BIO_printf(bp," Subject OCSP hash: ") <= 0) |
257 | goto err; | 257 | goto err; |
258 | derlen = i2d_X509_NAME(x->cert_info->subject, NULL); | 258 | derlen = i2d_X509_NAME(x->cert_info->subject, NULL); |
259 | if ((der = dertmp = (unsigned char *)OPENSSL_malloc (derlen)) == NULL) | 259 | if ((der = dertmp = (unsigned char *)malloc (derlen)) == NULL) |
260 | goto err; | 260 | goto err; |
261 | i2d_X509_NAME(x->cert_info->subject, &dertmp); | 261 | i2d_X509_NAME(x->cert_info->subject, &dertmp); |
262 | 262 | ||
@@ -266,7 +266,7 @@ int X509_ocspid_print (BIO *bp, X509 *x) | |||
266 | { | 266 | { |
267 | if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err; | 267 | if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err; |
268 | } | 268 | } |
269 | OPENSSL_free (der); | 269 | free (der); |
270 | der=NULL; | 270 | der=NULL; |
271 | 271 | ||
272 | /* display the hash of the public key as it would appear | 272 | /* display the hash of the public key as it would appear |
@@ -287,7 +287,7 @@ int X509_ocspid_print (BIO *bp, X509 *x) | |||
287 | 287 | ||
288 | return (1); | 288 | return (1); |
289 | err: | 289 | err: |
290 | if (der != NULL) OPENSSL_free(der); | 290 | if (der != NULL) free(der); |
291 | return(0); | 291 | return(0); |
292 | } | 292 | } |
293 | 293 | ||
@@ -477,7 +477,7 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) | |||
477 | b=X509_NAME_oneline(name,NULL,0); | 477 | b=X509_NAME_oneline(name,NULL,0); |
478 | if (!*b) | 478 | if (!*b) |
479 | { | 479 | { |
480 | OPENSSL_free(b); | 480 | free(b); |
481 | return 1; | 481 | return 1; |
482 | } | 482 | } |
483 | s=b+1; /* skip the first slash */ | 483 | s=b+1; /* skip the first slash */ |
@@ -513,6 +513,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) | |||
513 | err: | 513 | err: |
514 | X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB); | 514 | X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB); |
515 | } | 515 | } |
516 | OPENSSL_free(b); | 516 | free(b); |
517 | return(ret); | 517 | return(ret); |
518 | } | 518 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_dec.c b/src/lib/libssl/src/crypto/asn1/tasn_dec.c index 87d7dfdf5c..c594db9140 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_dec.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_dec.c | |||
@@ -910,7 +910,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, | |||
910 | *in = p; | 910 | *in = p; |
911 | ret = 1; | 911 | ret = 1; |
912 | err: | 912 | err: |
913 | if (free_cont && buf.data) OPENSSL_free(buf.data); | 913 | if (free_cont && buf.data) free(buf.data); |
914 | return ret; | 914 | return ret; |
915 | } | 915 | } |
916 | 916 | ||
@@ -1046,7 +1046,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | |||
1046 | if (*free_cont) | 1046 | if (*free_cont) |
1047 | { | 1047 | { |
1048 | if (stmp->data) | 1048 | if (stmp->data) |
1049 | OPENSSL_free(stmp->data); | 1049 | free(stmp->data); |
1050 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ | 1050 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ |
1051 | stmp->length = len; | 1051 | stmp->length = len; |
1052 | *free_cont = 0; | 1052 | *free_cont = 0; |
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_enc.c b/src/lib/libssl/src/crypto/asn1/tasn_enc.c index 936ad1f767..9ab0473d73 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_enc.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_enc.c | |||
@@ -110,7 +110,7 @@ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, | |||
110 | len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); | 110 | len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); |
111 | if (len <= 0) | 111 | if (len <= 0) |
112 | return len; | 112 | return len; |
113 | buf = OPENSSL_malloc(len); | 113 | buf = malloc(len); |
114 | if (!buf) | 114 | if (!buf) |
115 | return -1; | 115 | return -1; |
116 | p = buf; | 116 | p = buf; |
@@ -451,9 +451,9 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, | |||
451 | do_sort = 0; | 451 | do_sort = 0; |
452 | else | 452 | else |
453 | { | 453 | { |
454 | derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk) | 454 | derlst = malloc(sk_ASN1_VALUE_num(sk) |
455 | * sizeof(*derlst)); | 455 | * sizeof(*derlst)); |
456 | tmpdat = OPENSSL_malloc(skcontlen); | 456 | tmpdat = malloc(skcontlen); |
457 | if (!derlst || !tmpdat) | 457 | if (!derlst || !tmpdat) |
458 | return 0; | 458 | return 0; |
459 | } | 459 | } |
@@ -496,8 +496,8 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, | |||
496 | i++, tder++) | 496 | i++, tder++) |
497 | (void)sk_ASN1_VALUE_set(sk, i, tder->field); | 497 | (void)sk_ASN1_VALUE_set(sk, i, tder->field); |
498 | } | 498 | } |
499 | OPENSSL_free(derlst); | 499 | free(derlst); |
500 | OPENSSL_free(tmpdat); | 500 | free(tmpdat); |
501 | return 1; | 501 | return 1; |
502 | } | 502 | } |
503 | 503 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_fre.c b/src/lib/libssl/src/crypto/asn1/tasn_fre.c index 77d3092d31..b04034ba4c 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_fre.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_fre.c | |||
@@ -126,7 +126,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
126 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); | 126 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); |
127 | if (!combine) | 127 | if (!combine) |
128 | { | 128 | { |
129 | OPENSSL_free(*pval); | 129 | free(*pval); |
130 | *pval = NULL; | 130 | *pval = NULL; |
131 | } | 131 | } |
132 | break; | 132 | break; |
@@ -173,7 +173,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
173 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); | 173 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); |
174 | if (!combine) | 174 | if (!combine) |
175 | { | 175 | { |
176 | OPENSSL_free(*pval); | 176 | free(*pval); |
177 | *pval = NULL; | 177 | *pval = NULL; |
178 | } | 178 | } |
179 | break; | 179 | break; |
@@ -254,7 +254,7 @@ void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
254 | 254 | ||
255 | case V_ASN1_ANY: | 255 | case V_ASN1_ANY: |
256 | ASN1_primitive_free(pval, NULL); | 256 | ASN1_primitive_free(pval, NULL); |
257 | OPENSSL_free(*pval); | 257 | free(*pval); |
258 | break; | 258 | break; |
259 | 259 | ||
260 | default: | 260 | default: |
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_new.c b/src/lib/libssl/src/crypto/asn1/tasn_new.c index 0d9e78cc7c..aab9ef08c4 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_new.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_new.c | |||
@@ -160,7 +160,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
160 | } | 160 | } |
161 | if (!combine) | 161 | if (!combine) |
162 | { | 162 | { |
163 | *pval = OPENSSL_malloc(it->size); | 163 | *pval = malloc(it->size); |
164 | if (!*pval) | 164 | if (!*pval) |
165 | goto memerr; | 165 | goto memerr; |
166 | memset(*pval, 0, it->size); | 166 | memset(*pval, 0, it->size); |
@@ -188,7 +188,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
188 | } | 188 | } |
189 | if (!combine) | 189 | if (!combine) |
190 | { | 190 | { |
191 | *pval = OPENSSL_malloc(it->size); | 191 | *pval = malloc(it->size); |
192 | if (!*pval) | 192 | if (!*pval) |
193 | goto memerr; | 193 | goto memerr; |
194 | memset(*pval, 0, it->size); | 194 | memset(*pval, 0, it->size); |
@@ -354,7 +354,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
354 | return 1; | 354 | return 1; |
355 | 355 | ||
356 | case V_ASN1_ANY: | 356 | case V_ASN1_ANY: |
357 | typ = OPENSSL_malloc(sizeof(ASN1_TYPE)); | 357 | typ = malloc(sizeof(ASN1_TYPE)); |
358 | if (!typ) | 358 | if (!typ) |
359 | return 0; | 359 | return 0; |
360 | typ->value.ptr = NULL; | 360 | typ->value.ptr = NULL; |
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_prn.c b/src/lib/libssl/src/crypto/asn1/tasn_prn.c index 542a091a66..ec524edac8 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_prn.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_prn.c | |||
@@ -85,7 +85,7 @@ ASN1_PCTX default_pctx = | |||
85 | ASN1_PCTX *ASN1_PCTX_new(void) | 85 | ASN1_PCTX *ASN1_PCTX_new(void) |
86 | { | 86 | { |
87 | ASN1_PCTX *ret; | 87 | ASN1_PCTX *ret; |
88 | ret = OPENSSL_malloc(sizeof(ASN1_PCTX)); | 88 | ret = malloc(sizeof(ASN1_PCTX)); |
89 | if (ret == NULL) | 89 | if (ret == NULL) |
90 | { | 90 | { |
91 | ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE); | 91 | ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE); |
@@ -101,7 +101,7 @@ ASN1_PCTX *ASN1_PCTX_new(void) | |||
101 | 101 | ||
102 | void ASN1_PCTX_free(ASN1_PCTX *p) | 102 | void ASN1_PCTX_free(ASN1_PCTX *p) |
103 | { | 103 | { |
104 | OPENSSL_free(p); | 104 | free(p); |
105 | } | 105 | } |
106 | 106 | ||
107 | unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p) | 107 | unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p) |
@@ -480,7 +480,7 @@ static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, | |||
480 | s = i2s_ASN1_INTEGER(NULL, str); | 480 | s = i2s_ASN1_INTEGER(NULL, str); |
481 | if (BIO_puts(out, s) <= 0) | 481 | if (BIO_puts(out, s) <= 0) |
482 | ret = 0; | 482 | ret = 0; |
483 | OPENSSL_free(s); | 483 | free(s); |
484 | return ret; | 484 | return ret; |
485 | } | 485 | } |
486 | 486 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_utl.c b/src/lib/libssl/src/crypto/asn1/tasn_utl.c index ca9ec7a32f..dfa63fb2bc 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_utl.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_utl.c | |||
@@ -155,7 +155,7 @@ void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
155 | if (enc) | 155 | if (enc) |
156 | { | 156 | { |
157 | if (enc->enc) | 157 | if (enc->enc) |
158 | OPENSSL_free(enc->enc); | 158 | free(enc->enc); |
159 | enc->enc = NULL; | 159 | enc->enc = NULL; |
160 | enc->len = 0; | 160 | enc->len = 0; |
161 | enc->modified = 1; | 161 | enc->modified = 1; |
@@ -171,8 +171,8 @@ int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, | |||
171 | return 1; | 171 | return 1; |
172 | 172 | ||
173 | if (enc->enc) | 173 | if (enc->enc) |
174 | OPENSSL_free(enc->enc); | 174 | free(enc->enc); |
175 | enc->enc = OPENSSL_malloc(inlen); | 175 | enc->enc = malloc(inlen); |
176 | if (!enc->enc) | 176 | if (!enc->enc) |
177 | return 0; | 177 | return 0; |
178 | memcpy(enc->enc, in, inlen); | 178 | memcpy(enc->enc, in, inlen); |
diff --git a/src/lib/libssl/src/crypto/asn1/x_crl.c b/src/lib/libssl/src/crypto/asn1/x_crl.c index c51c690ba9..cf7e69aaaf 100644 --- a/src/lib/libssl/src/crypto/asn1/x_crl.c +++ b/src/lib/libssl/src/crypto/asn1/x_crl.c | |||
@@ -493,7 +493,7 @@ X509_CRL_METHOD *X509_CRL_METHOD_new( | |||
493 | int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)) | 493 | int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)) |
494 | { | 494 | { |
495 | X509_CRL_METHOD *m; | 495 | X509_CRL_METHOD *m; |
496 | m = OPENSSL_malloc(sizeof(X509_CRL_METHOD)); | 496 | m = malloc(sizeof(X509_CRL_METHOD)); |
497 | if (!m) | 497 | if (!m) |
498 | return NULL; | 498 | return NULL; |
499 | m->crl_init = crl_init; | 499 | m->crl_init = crl_init; |
@@ -508,7 +508,7 @@ void X509_CRL_METHOD_free(X509_CRL_METHOD *m) | |||
508 | { | 508 | { |
509 | if (!(m->flags & X509_CRL_METHOD_DYNAMIC)) | 509 | if (!(m->flags & X509_CRL_METHOD_DYNAMIC)) |
510 | return; | 510 | return; |
511 | OPENSSL_free(m); | 511 | free(m); |
512 | } | 512 | } |
513 | 513 | ||
514 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) | 514 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) |
diff --git a/src/lib/libssl/src/crypto/asn1/x_info.c b/src/lib/libssl/src/crypto/asn1/x_info.c index d44f6cdb01..c13fad056f 100644 --- a/src/lib/libssl/src/crypto/asn1/x_info.c +++ b/src/lib/libssl/src/crypto/asn1/x_info.c | |||
@@ -66,7 +66,7 @@ X509_INFO *X509_INFO_new(void) | |||
66 | { | 66 | { |
67 | X509_INFO *ret=NULL; | 67 | X509_INFO *ret=NULL; |
68 | 68 | ||
69 | ret=(X509_INFO *)OPENSSL_malloc(sizeof(X509_INFO)); | 69 | ret=(X509_INFO *)malloc(sizeof(X509_INFO)); |
70 | if (ret == NULL) | 70 | if (ret == NULL) |
71 | { | 71 | { |
72 | ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE); | 72 | ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE); |
@@ -106,8 +106,8 @@ void X509_INFO_free(X509_INFO *x) | |||
106 | if (x->x509 != NULL) X509_free(x->x509); | 106 | if (x->x509 != NULL) X509_free(x->x509); |
107 | if (x->crl != NULL) X509_CRL_free(x->crl); | 107 | if (x->crl != NULL) X509_CRL_free(x->crl); |
108 | if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey); | 108 | if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey); |
109 | if (x->enc_data != NULL) OPENSSL_free(x->enc_data); | 109 | if (x->enc_data != NULL) free(x->enc_data); |
110 | OPENSSL_free(x); | 110 | free(x); |
111 | } | 111 | } |
112 | 112 | ||
113 | IMPLEMENT_STACK_OF(X509_INFO) | 113 | IMPLEMENT_STACK_OF(X509_INFO) |
diff --git a/src/lib/libssl/src/crypto/asn1/x_name.c b/src/lib/libssl/src/crypto/asn1/x_name.c index d7c2318693..e14d329639 100644 --- a/src/lib/libssl/src/crypto/asn1/x_name.c +++ b/src/lib/libssl/src/crypto/asn1/x_name.c | |||
@@ -132,7 +132,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME) | |||
132 | static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) | 132 | static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) |
133 | { | 133 | { |
134 | X509_NAME *ret = NULL; | 134 | X509_NAME *ret = NULL; |
135 | ret = OPENSSL_malloc(sizeof(X509_NAME)); | 135 | ret = malloc(sizeof(X509_NAME)); |
136 | if(!ret) goto memerr; | 136 | if(!ret) goto memerr; |
137 | if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) | 137 | if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) |
138 | goto memerr; | 138 | goto memerr; |
@@ -149,7 +149,7 @@ static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) | |||
149 | { | 149 | { |
150 | if (ret->entries) | 150 | if (ret->entries) |
151 | sk_X509_NAME_ENTRY_free(ret->entries); | 151 | sk_X509_NAME_ENTRY_free(ret->entries); |
152 | OPENSSL_free(ret); | 152 | free(ret); |
153 | } | 153 | } |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
@@ -164,8 +164,8 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
164 | BUF_MEM_free(a->bytes); | 164 | BUF_MEM_free(a->bytes); |
165 | sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); | 165 | sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); |
166 | if (a->canon_enc) | 166 | if (a->canon_enc) |
167 | OPENSSL_free(a->canon_enc); | 167 | free(a->canon_enc); |
168 | OPENSSL_free(a); | 168 | free(a); |
169 | *pval = NULL; | 169 | *pval = NULL; |
170 | } | 170 | } |
171 | 171 | ||
@@ -325,7 +325,7 @@ static int x509_name_canon(X509_NAME *a) | |||
325 | 325 | ||
326 | if (a->canon_enc) | 326 | if (a->canon_enc) |
327 | { | 327 | { |
328 | OPENSSL_free(a->canon_enc); | 328 | free(a->canon_enc); |
329 | a->canon_enc = NULL; | 329 | a->canon_enc = NULL; |
330 | } | 330 | } |
331 | /* Special case: empty X509_NAME => null encoding */ | 331 | /* Special case: empty X509_NAME => null encoding */ |
@@ -362,7 +362,7 @@ static int x509_name_canon(X509_NAME *a) | |||
362 | 362 | ||
363 | a->canon_enclen = i2d_name_canon(intname, NULL); | 363 | a->canon_enclen = i2d_name_canon(intname, NULL); |
364 | 364 | ||
365 | p = OPENSSL_malloc(a->canon_enclen); | 365 | p = malloc(a->canon_enclen); |
366 | 366 | ||
367 | if (!p) | 367 | if (!p) |
368 | goto err; | 368 | goto err; |
diff --git a/src/lib/libssl/src/crypto/asn1/x_pkey.c b/src/lib/libssl/src/crypto/asn1/x_pkey.c index 8453618426..3bf2f5e915 100644 --- a/src/lib/libssl/src/crypto/asn1/x_pkey.c +++ b/src/lib/libssl/src/crypto/asn1/x_pkey.c | |||
@@ -146,6 +146,6 @@ void X509_PKEY_free(X509_PKEY *x) | |||
146 | if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); | 146 | if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); |
147 | if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey); | 147 | if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey); |
148 | if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey); | 148 | if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey); |
149 | if ((x->key_data != NULL) && (x->key_free)) OPENSSL_free(x->key_data); | 149 | if ((x->key_data != NULL) && (x->key_free)) free(x->key_data); |
150 | OPENSSL_free(x); | 150 | free(x); |
151 | } | 151 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/x_pubkey.c b/src/lib/libssl/src/crypto/asn1/x_pubkey.c index b649e1fcf9..684f40899f 100644 --- a/src/lib/libssl/src/crypto/asn1/x_pubkey.c +++ b/src/lib/libssl/src/crypto/asn1/x_pubkey.c | |||
@@ -357,7 +357,7 @@ int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, | |||
357 | if (penc) | 357 | if (penc) |
358 | { | 358 | { |
359 | if (pub->public_key->data) | 359 | if (pub->public_key->data) |
360 | OPENSSL_free(pub->public_key->data); | 360 | free(pub->public_key->data); |
361 | pub->public_key->data = penc; | 361 | pub->public_key->data = penc; |
362 | pub->public_key->length = penclen; | 362 | pub->public_key->length = penclen; |
363 | /* Set number of unused bits to zero */ | 363 | /* Set number of unused bits to zero */ |
diff --git a/src/lib/libssl/src/crypto/asn1/x_x509.c b/src/lib/libssl/src/crypto/asn1/x_x509.c index de3df9eb51..5734f2b069 100644 --- a/src/lib/libssl/src/crypto/asn1/x_x509.c +++ b/src/lib/libssl/src/crypto/asn1/x_x509.c | |||
@@ -105,7 +105,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
105 | break; | 105 | break; |
106 | 106 | ||
107 | case ASN1_OP_D2I_POST: | 107 | case ASN1_OP_D2I_POST: |
108 | if (ret->name != NULL) OPENSSL_free(ret->name); | 108 | if (ret->name != NULL) free(ret->name); |
109 | ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); | 109 | ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); |
110 | break; | 110 | break; |
111 | 111 | ||
@@ -123,7 +123,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
123 | ASIdentifiers_free(ret->rfc3779_asid); | 123 | ASIdentifiers_free(ret->rfc3779_asid); |
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | if (ret->name != NULL) OPENSSL_free(ret->name); | 126 | if (ret->name != NULL) free(ret->name); |
127 | break; | 127 | break; |
128 | 128 | ||
129 | } | 129 | } |
diff --git a/src/lib/libssl/src/crypto/bio/b_print.c b/src/lib/libssl/src/crypto/bio/b_print.c index 55a5ca1a32..ff0089e82e 100644 --- a/src/lib/libssl/src/crypto/bio/b_print.c +++ b/src/lib/libssl/src/crypto/bio/b_print.c | |||
@@ -706,7 +706,7 @@ doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, | |||
706 | if (*buffer == NULL) { | 706 | if (*buffer == NULL) { |
707 | if (*maxlen == 0) | 707 | if (*maxlen == 0) |
708 | *maxlen = 1024; | 708 | *maxlen = 1024; |
709 | *buffer = OPENSSL_malloc(*maxlen); | 709 | *buffer = malloc(*maxlen); |
710 | if (*currlen > 0) { | 710 | if (*currlen > 0) { |
711 | assert(*sbuffer != NULL); | 711 | assert(*sbuffer != NULL); |
712 | memcpy(*buffer, *sbuffer, *currlen); | 712 | memcpy(*buffer, *sbuffer, *currlen); |
@@ -714,7 +714,7 @@ doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, | |||
714 | *sbuffer = NULL; | 714 | *sbuffer = NULL; |
715 | } else { | 715 | } else { |
716 | *maxlen += 1024; | 716 | *maxlen += 1024; |
717 | *buffer = OPENSSL_realloc(*buffer, *maxlen); | 717 | *buffer = realloc(*buffer, *maxlen); |
718 | } | 718 | } |
719 | } | 719 | } |
720 | /* What to do if *buffer is NULL? */ | 720 | /* What to do if *buffer is NULL? */ |
@@ -764,7 +764,7 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
764 | format, args); | 764 | format, args); |
765 | if (dynbuf) { | 765 | if (dynbuf) { |
766 | ret = BIO_write(bio, dynbuf, (int)retlen); | 766 | ret = BIO_write(bio, dynbuf, (int)retlen); |
767 | OPENSSL_free(dynbuf); | 767 | free(dynbuf); |
768 | } else { | 768 | } else { |
769 | ret = BIO_write(bio, hugebuf, (int)retlen); | 769 | ret = BIO_write(bio, hugebuf, (int)retlen); |
770 | } | 770 | } |
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index b08226d52b..1ae9d96577 100644 --- a/src/lib/libssl/src/crypto/bio/b_sock.c +++ b/src/lib/libssl/src/crypto/bio/b_sock.c | |||
@@ -490,7 +490,7 @@ again: | |||
490 | ret = 1; | 490 | ret = 1; |
491 | err: | 491 | err: |
492 | if (str != NULL) | 492 | if (str != NULL) |
493 | OPENSSL_free(str); | 493 | free(str); |
494 | if ((ret == 0) && (s != -1)) { | 494 | if ((ret == 0) && (s != -1)) { |
495 | close(s); | 495 | close(s); |
496 | s = -1; | 496 | s = -1; |
@@ -591,9 +591,9 @@ BIO_accept(int sock, char **addr) | |||
591 | p = *addr; | 591 | p = *addr; |
592 | if (p) { | 592 | if (p) { |
593 | *p = '\0'; | 593 | *p = '\0'; |
594 | p = OPENSSL_realloc(p, nl); | 594 | p = realloc(p, nl); |
595 | } else { | 595 | } else { |
596 | p = OPENSSL_malloc(nl); | 596 | p = malloc(nl); |
597 | } | 597 | } |
598 | if (p == NULL) { | 598 | if (p == NULL) { |
599 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 599 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); |
@@ -609,7 +609,7 @@ BIO_accept(int sock, char **addr) | |||
609 | l = ntohl(sa.from.sa_in.sin_addr.s_addr); | 609 | l = ntohl(sa.from.sa_in.sin_addr.s_addr); |
610 | port = ntohs(sa.from.sa_in.sin_port); | 610 | port = ntohs(sa.from.sa_in.sin_port); |
611 | if (*addr == NULL) { | 611 | if (*addr == NULL) { |
612 | if ((p = OPENSSL_malloc(24)) == NULL) { | 612 | if ((p = malloc(24)) == NULL) { |
613 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 613 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); |
614 | goto end; | 614 | goto end; |
615 | } | 615 | } |
diff --git a/src/lib/libssl/src/crypto/bio/bf_buff.c b/src/lib/libssl/src/crypto/bio/bf_buff.c index 937a1c58d5..be2ebab148 100644 --- a/src/lib/libssl/src/crypto/bio/bf_buff.c +++ b/src/lib/libssl/src/crypto/bio/bf_buff.c | |||
@@ -95,18 +95,18 @@ buffer_new(BIO *bi) | |||
95 | { | 95 | { |
96 | BIO_F_BUFFER_CTX *ctx; | 96 | BIO_F_BUFFER_CTX *ctx; |
97 | 97 | ||
98 | ctx = (BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX)); | 98 | ctx = (BIO_F_BUFFER_CTX *)malloc(sizeof(BIO_F_BUFFER_CTX)); |
99 | if (ctx == NULL) | 99 | if (ctx == NULL) |
100 | return (0); | 100 | return (0); |
101 | ctx->ibuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); | 101 | ctx->ibuf = (char *)malloc(DEFAULT_BUFFER_SIZE); |
102 | if (ctx->ibuf == NULL) { | 102 | if (ctx->ibuf == NULL) { |
103 | OPENSSL_free(ctx); | 103 | free(ctx); |
104 | return (0); | 104 | return (0); |
105 | } | 105 | } |
106 | ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); | 106 | ctx->obuf = (char *)malloc(DEFAULT_BUFFER_SIZE); |
107 | if (ctx->obuf == NULL) { | 107 | if (ctx->obuf == NULL) { |
108 | OPENSSL_free(ctx->ibuf); | 108 | free(ctx->ibuf); |
109 | OPENSSL_free(ctx); | 109 | free(ctx); |
110 | return (0); | 110 | return (0); |
111 | } | 111 | } |
112 | ctx->ibuf_size = DEFAULT_BUFFER_SIZE; | 112 | ctx->ibuf_size = DEFAULT_BUFFER_SIZE; |
@@ -131,10 +131,10 @@ buffer_free(BIO *a) | |||
131 | return (0); | 131 | return (0); |
132 | b = (BIO_F_BUFFER_CTX *)a->ptr; | 132 | b = (BIO_F_BUFFER_CTX *)a->ptr; |
133 | if (b->ibuf != NULL) | 133 | if (b->ibuf != NULL) |
134 | OPENSSL_free(b->ibuf); | 134 | free(b->ibuf); |
135 | if (b->obuf != NULL) | 135 | if (b->obuf != NULL) |
136 | OPENSSL_free(b->obuf); | 136 | free(b->obuf); |
137 | OPENSSL_free(a->ptr); | 137 | free(a->ptr); |
138 | a->ptr = NULL; | 138 | a->ptr = NULL; |
139 | a->init = 0; | 139 | a->init = 0; |
140 | a->flags = 0; | 140 | a->flags = 0; |
@@ -339,11 +339,11 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
339 | break; | 339 | break; |
340 | case BIO_C_SET_BUFF_READ_DATA: | 340 | case BIO_C_SET_BUFF_READ_DATA: |
341 | if (num > ctx->ibuf_size) { | 341 | if (num > ctx->ibuf_size) { |
342 | p1 = OPENSSL_malloc((int)num); | 342 | p1 = malloc((int)num); |
343 | if (p1 == NULL) | 343 | if (p1 == NULL) |
344 | goto malloc_error; | 344 | goto malloc_error; |
345 | if (ctx->ibuf != NULL) | 345 | if (ctx->ibuf != NULL) |
346 | OPENSSL_free(ctx->ibuf); | 346 | free(ctx->ibuf); |
347 | ctx->ibuf = p1; | 347 | ctx->ibuf = p1; |
348 | } | 348 | } |
349 | ctx->ibuf_off = 0; | 349 | ctx->ibuf_off = 0; |
@@ -370,27 +370,27 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
370 | p1 = ctx->ibuf; | 370 | p1 = ctx->ibuf; |
371 | p2 = ctx->obuf; | 371 | p2 = ctx->obuf; |
372 | if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) { | 372 | if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) { |
373 | p1 = (char *)OPENSSL_malloc((int)num); | 373 | p1 = (char *)malloc((int)num); |
374 | if (p1 == NULL) | 374 | if (p1 == NULL) |
375 | goto malloc_error; | 375 | goto malloc_error; |
376 | } | 376 | } |
377 | if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) { | 377 | if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) { |
378 | p2 = (char *)OPENSSL_malloc((int)num); | 378 | p2 = (char *)malloc((int)num); |
379 | if (p2 == NULL) { | 379 | if (p2 == NULL) { |
380 | if (p1 != ctx->ibuf) | 380 | if (p1 != ctx->ibuf) |
381 | OPENSSL_free(p1); | 381 | free(p1); |
382 | goto malloc_error; | 382 | goto malloc_error; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | if (ctx->ibuf != p1) { | 385 | if (ctx->ibuf != p1) { |
386 | OPENSSL_free(ctx->ibuf); | 386 | free(ctx->ibuf); |
387 | ctx->ibuf = p1; | 387 | ctx->ibuf = p1; |
388 | ctx->ibuf_off = 0; | 388 | ctx->ibuf_off = 0; |
389 | ctx->ibuf_len = 0; | 389 | ctx->ibuf_len = 0; |
390 | ctx->ibuf_size = ibs; | 390 | ctx->ibuf_size = ibs; |
391 | } | 391 | } |
392 | if (ctx->obuf != p2) { | 392 | if (ctx->obuf != p2) { |
393 | OPENSSL_free(ctx->obuf); | 393 | free(ctx->obuf); |
394 | ctx->obuf = p2; | 394 | ctx->obuf = p2; |
395 | ctx->obuf_off = 0; | 395 | ctx->obuf_off = 0; |
396 | ctx->obuf_len = 0; | 396 | ctx->obuf_len = 0; |
diff --git a/src/lib/libssl/src/crypto/bio/bf_lbuf.c b/src/lib/libssl/src/crypto/bio/bf_lbuf.c index 006ed9d91c..5020795ded 100644 --- a/src/lib/libssl/src/crypto/bio/bf_lbuf.c +++ b/src/lib/libssl/src/crypto/bio/bf_lbuf.c | |||
@@ -106,12 +106,12 @@ linebuffer_new(BIO *bi) | |||
106 | { | 106 | { |
107 | BIO_LINEBUFFER_CTX *ctx; | 107 | BIO_LINEBUFFER_CTX *ctx; |
108 | 108 | ||
109 | ctx = (BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX)); | 109 | ctx = (BIO_LINEBUFFER_CTX *)malloc(sizeof(BIO_LINEBUFFER_CTX)); |
110 | if (ctx == NULL) | 110 | if (ctx == NULL) |
111 | return (0); | 111 | return (0); |
112 | ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE); | 112 | ctx->obuf = (char *)malloc(DEFAULT_LINEBUFFER_SIZE); |
113 | if (ctx->obuf == NULL) { | 113 | if (ctx->obuf == NULL) { |
114 | OPENSSL_free(ctx); | 114 | free(ctx); |
115 | return (0); | 115 | return (0); |
116 | } | 116 | } |
117 | ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE; | 117 | ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE; |
@@ -132,8 +132,8 @@ linebuffer_free(BIO *a) | |||
132 | return (0); | 132 | return (0); |
133 | b = (BIO_LINEBUFFER_CTX *)a->ptr; | 133 | b = (BIO_LINEBUFFER_CTX *)a->ptr; |
134 | if (b->obuf != NULL) | 134 | if (b->obuf != NULL) |
135 | OPENSSL_free(b->obuf); | 135 | free(b->obuf); |
136 | OPENSSL_free(a->ptr); | 136 | free(a->ptr); |
137 | a->ptr = NULL; | 137 | a->ptr = NULL; |
138 | a->init = 0; | 138 | a->init = 0; |
139 | a->flags = 0; | 139 | a->flags = 0; |
@@ -299,7 +299,7 @@ linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
299 | obs = (int)num; | 299 | obs = (int)num; |
300 | p = ctx->obuf; | 300 | p = ctx->obuf; |
301 | if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) { | 301 | if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) { |
302 | p = (char *)OPENSSL_malloc((int)num); | 302 | p = (char *)malloc((int)num); |
303 | if (p == NULL) | 303 | if (p == NULL) |
304 | goto malloc_error; | 304 | goto malloc_error; |
305 | } | 305 | } |
@@ -308,7 +308,7 @@ linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
308 | ctx->obuf_len = obs; | 308 | ctx->obuf_len = obs; |
309 | } | 309 | } |
310 | memcpy(p, ctx->obuf, ctx->obuf_len); | 310 | memcpy(p, ctx->obuf, ctx->obuf_len); |
311 | OPENSSL_free(ctx->obuf); | 311 | free(ctx->obuf); |
312 | ctx->obuf = p; | 312 | ctx->obuf = p; |
313 | ctx->obuf_size = obs; | 313 | ctx->obuf_size = obs; |
314 | } | 314 | } |
diff --git a/src/lib/libssl/src/crypto/bio/bf_nbio.c b/src/lib/libssl/src/crypto/bio/bf_nbio.c index d181f518ec..200ca706ff 100644 --- a/src/lib/libssl/src/crypto/bio/bf_nbio.c +++ b/src/lib/libssl/src/crypto/bio/bf_nbio.c | |||
@@ -104,7 +104,7 @@ nbiof_new(BIO *bi) | |||
104 | { | 104 | { |
105 | NBIO_TEST *nt; | 105 | NBIO_TEST *nt; |
106 | 106 | ||
107 | if (!(nt = (NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST)))) | 107 | if (!(nt = (NBIO_TEST *)malloc(sizeof(NBIO_TEST)))) |
108 | return (0); | 108 | return (0); |
109 | nt->lrn = -1; | 109 | nt->lrn = -1; |
110 | nt->lwn = -1; | 110 | nt->lwn = -1; |
@@ -120,7 +120,7 @@ nbiof_free(BIO *a) | |||
120 | if (a == NULL) | 120 | if (a == NULL) |
121 | return (0); | 121 | return (0); |
122 | if (a->ptr != NULL) | 122 | if (a->ptr != NULL) |
123 | OPENSSL_free(a->ptr); | 123 | free(a->ptr); |
124 | a->ptr = NULL; | 124 | a->ptr = NULL; |
125 | a->init = 0; | 125 | a->init = 0; |
126 | a->flags = 0; | 126 | a->flags = 0; |
diff --git a/src/lib/libssl/src/crypto/bio/bio_lib.c b/src/lib/libssl/src/crypto/bio/bio_lib.c index 90f1b1c1ef..c226d943af 100644 --- a/src/lib/libssl/src/crypto/bio/bio_lib.c +++ b/src/lib/libssl/src/crypto/bio/bio_lib.c | |||
@@ -68,13 +68,13 @@ BIO | |||
68 | { | 68 | { |
69 | BIO *ret = NULL; | 69 | BIO *ret = NULL; |
70 | 70 | ||
71 | ret = (BIO *)OPENSSL_malloc(sizeof(BIO)); | 71 | ret = (BIO *)malloc(sizeof(BIO)); |
72 | if (ret == NULL) { | 72 | if (ret == NULL) { |
73 | BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); | 73 | BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); |
74 | return (NULL); | 74 | return (NULL); |
75 | } | 75 | } |
76 | if (!BIO_set(ret, method)) { | 76 | if (!BIO_set(ret, method)) { |
77 | OPENSSL_free(ret); | 77 | free(ret); |
78 | ret = NULL; | 78 | ret = NULL; |
79 | } | 79 | } |
80 | return (ret); | 80 | return (ret); |
@@ -136,7 +136,7 @@ BIO_free(BIO *a) | |||
136 | if ((a->method == NULL) || (a->method->destroy == NULL)) | 136 | if ((a->method == NULL) || (a->method->destroy == NULL)) |
137 | return (1); | 137 | return (1); |
138 | a->method->destroy(a); | 138 | a->method->destroy(a); |
139 | OPENSSL_free(a); | 139 | free(a); |
140 | return (1); | 140 | return (1); |
141 | } | 141 | } |
142 | 142 | ||
diff --git a/src/lib/libssl/src/crypto/bio/bss_acpt.c b/src/lib/libssl/src/crypto/bio/bss_acpt.c index d7c151eaaa..161b5d01f8 100644 --- a/src/lib/libssl/src/crypto/bio/bss_acpt.c +++ b/src/lib/libssl/src/crypto/bio/bss_acpt.c | |||
@@ -137,7 +137,7 @@ static BIO_ACCEPT | |||
137 | { | 137 | { |
138 | BIO_ACCEPT *ret; | 138 | BIO_ACCEPT *ret; |
139 | 139 | ||
140 | if ((ret = (BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL) | 140 | if ((ret = (BIO_ACCEPT *)malloc(sizeof(BIO_ACCEPT))) == NULL) |
141 | return (NULL); | 141 | return (NULL); |
142 | 142 | ||
143 | memset(ret, 0, sizeof(BIO_ACCEPT)); | 143 | memset(ret, 0, sizeof(BIO_ACCEPT)); |
@@ -153,12 +153,12 @@ BIO_ACCEPT_free(BIO_ACCEPT *a) | |||
153 | return; | 153 | return; |
154 | 154 | ||
155 | if (a->param_addr != NULL) | 155 | if (a->param_addr != NULL) |
156 | OPENSSL_free(a->param_addr); | 156 | free(a->param_addr); |
157 | if (a->addr != NULL) | 157 | if (a->addr != NULL) |
158 | OPENSSL_free(a->addr); | 158 | free(a->addr); |
159 | if (a->bio_chain != NULL) | 159 | if (a->bio_chain != NULL) |
160 | BIO_free(a->bio_chain); | 160 | BIO_free(a->bio_chain); |
161 | OPENSSL_free(a); | 161 | free(a); |
162 | } | 162 | } |
163 | 163 | ||
164 | static void | 164 | static void |
@@ -357,7 +357,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
357 | if (num == 0) { | 357 | if (num == 0) { |
358 | b->init = 1; | 358 | b->init = 1; |
359 | if (data->param_addr != NULL) | 359 | if (data->param_addr != NULL) |
360 | OPENSSL_free(data->param_addr); | 360 | free(data->param_addr); |
361 | data->param_addr = BUF_strdup(ptr); | 361 | data->param_addr = BUF_strdup(ptr); |
362 | } else if (num == 1) { | 362 | } else if (num == 1) { |
363 | data->accept_nbio = (ptr != NULL); | 363 | data->accept_nbio = (ptr != NULL); |
diff --git a/src/lib/libssl/src/crypto/bio/bss_bio.c b/src/lib/libssl/src/crypto/bio/bss_bio.c index a74fcfdabc..4d93aba0a4 100644 --- a/src/lib/libssl/src/crypto/bio/bss_bio.c +++ b/src/lib/libssl/src/crypto/bio/bss_bio.c | |||
@@ -146,7 +146,7 @@ bio_new(BIO *bio) | |||
146 | { | 146 | { |
147 | struct bio_bio_st *b; | 147 | struct bio_bio_st *b; |
148 | 148 | ||
149 | b = OPENSSL_malloc(sizeof *b); | 149 | b = malloc(sizeof *b); |
150 | if (b == NULL) | 150 | if (b == NULL) |
151 | return 0; | 151 | return 0; |
152 | 152 | ||
@@ -173,10 +173,10 @@ bio_free(BIO *bio) | |||
173 | bio_destroy_pair(bio); | 173 | bio_destroy_pair(bio); |
174 | 174 | ||
175 | if (b->buf != NULL) { | 175 | if (b->buf != NULL) { |
176 | OPENSSL_free(b->buf); | 176 | free(b->buf); |
177 | } | 177 | } |
178 | 178 | ||
179 | OPENSSL_free(b); | 179 | free(b); |
180 | 180 | ||
181 | return 1; | 181 | return 1; |
182 | } | 182 | } |
@@ -516,7 +516,7 @@ bio_ctrl(BIO *bio, int cmd, long num, void *ptr) | |||
516 | 516 | ||
517 | if (b->size != new_size) { | 517 | if (b->size != new_size) { |
518 | if (b->buf) { | 518 | if (b->buf) { |
519 | OPENSSL_free(b->buf); | 519 | free(b->buf); |
520 | b->buf = NULL; | 520 | b->buf = NULL; |
521 | } | 521 | } |
522 | b->size = new_size; | 522 | b->size = new_size; |
@@ -701,7 +701,7 @@ bio_make_pair(BIO *bio1, BIO *bio2) | |||
701 | } | 701 | } |
702 | 702 | ||
703 | if (b1->buf == NULL) { | 703 | if (b1->buf == NULL) { |
704 | b1->buf = OPENSSL_malloc(b1->size); | 704 | b1->buf = malloc(b1->size); |
705 | if (b1->buf == NULL) { | 705 | if (b1->buf == NULL) { |
706 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); | 706 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); |
707 | return 0; | 707 | return 0; |
@@ -711,7 +711,7 @@ bio_make_pair(BIO *bio1, BIO *bio2) | |||
711 | } | 711 | } |
712 | 712 | ||
713 | if (b2->buf == NULL) { | 713 | if (b2->buf == NULL) { |
714 | b2->buf = OPENSSL_malloc(b2->size); | 714 | b2->buf = malloc(b2->size); |
715 | if (b2->buf == NULL) { | 715 | if (b2->buf == NULL) { |
716 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); | 716 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); |
717 | return 0; | 717 | return 0; |
diff --git a/src/lib/libssl/src/crypto/bio/bss_conn.c b/src/lib/libssl/src/crypto/bio/bss_conn.c index db877b140b..78ce240648 100644 --- a/src/lib/libssl/src/crypto/bio/bss_conn.c +++ b/src/lib/libssl/src/crypto/bio/bss_conn.c | |||
@@ -147,7 +147,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
147 | break; | 147 | break; |
148 | } | 148 | } |
149 | if (c->param_port != NULL) | 149 | if (c->param_port != NULL) |
150 | OPENSSL_free(c->param_port); | 150 | free(c->param_port); |
151 | c->param_port = BUF_strdup(p); | 151 | c->param_port = BUF_strdup(p); |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -293,7 +293,7 @@ BIO_CONNECT | |||
293 | { | 293 | { |
294 | BIO_CONNECT *ret; | 294 | BIO_CONNECT *ret; |
295 | 295 | ||
296 | if ((ret = (BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL) | 296 | if ((ret = (BIO_CONNECT *)malloc(sizeof(BIO_CONNECT))) == NULL) |
297 | return (NULL); | 297 | return (NULL); |
298 | ret->state = BIO_CONN_S_BEFORE; | 298 | ret->state = BIO_CONN_S_BEFORE; |
299 | ret->param_hostname = NULL; | 299 | ret->param_hostname = NULL; |
@@ -316,10 +316,10 @@ BIO_CONNECT_free(BIO_CONNECT *a) | |||
316 | return; | 316 | return; |
317 | 317 | ||
318 | if (a->param_hostname != NULL) | 318 | if (a->param_hostname != NULL) |
319 | OPENSSL_free(a->param_hostname); | 319 | free(a->param_hostname); |
320 | if (a->param_port != NULL) | 320 | if (a->param_port != NULL) |
321 | OPENSSL_free(a->param_port); | 321 | free(a->param_port); |
322 | OPENSSL_free(a); | 322 | free(a); |
323 | } | 323 | } |
324 | 324 | ||
325 | BIO_METHOD | 325 | BIO_METHOD |
@@ -470,11 +470,11 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
470 | b->init = 1; | 470 | b->init = 1; |
471 | if (num == 0) { | 471 | if (num == 0) { |
472 | if (data->param_hostname != NULL) | 472 | if (data->param_hostname != NULL) |
473 | OPENSSL_free(data->param_hostname); | 473 | free(data->param_hostname); |
474 | data->param_hostname = BUF_strdup(ptr); | 474 | data->param_hostname = BUF_strdup(ptr); |
475 | } else if (num == 1) { | 475 | } else if (num == 1) { |
476 | if (data->param_port != NULL) | 476 | if (data->param_port != NULL) |
477 | OPENSSL_free(data->param_port); | 477 | free(data->param_port); |
478 | data->param_port = BUF_strdup(ptr); | 478 | data->param_port = BUF_strdup(ptr); |
479 | } else if (num == 2) { | 479 | } else if (num == 2) { |
480 | char buf[16]; | 480 | char buf[16]; |
@@ -483,7 +483,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
483 | (void) snprintf(buf, sizeof buf, "%d.%d.%d.%d", | 483 | (void) snprintf(buf, sizeof buf, "%d.%d.%d.%d", |
484 | p[0], p[1], p[2], p[3]); | 484 | p[0], p[1], p[2], p[3]); |
485 | if (data->param_hostname != NULL) | 485 | if (data->param_hostname != NULL) |
486 | OPENSSL_free(data->param_hostname); | 486 | free(data->param_hostname); |
487 | data->param_hostname = BUF_strdup(buf); | 487 | data->param_hostname = BUF_strdup(buf); |
488 | memcpy(&(data->ip[0]), ptr, 4); | 488 | memcpy(&(data->ip[0]), ptr, 4); |
489 | } else if (num == 3) { | 489 | } else if (num == 3) { |
@@ -492,7 +492,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
492 | (void) snprintf(buf, sizeof buf, "%d", | 492 | (void) snprintf(buf, sizeof buf, "%d", |
493 | *(int *)ptr); | 493 | *(int *)ptr); |
494 | if (data->param_port != NULL) | 494 | if (data->param_port != NULL) |
495 | OPENSSL_free(data->param_port); | 495 | free(data->param_port); |
496 | data->param_port = BUF_strdup(buf); | 496 | data->param_port = BUF_strdup(buf); |
497 | data->port= *(int *)ptr; | 497 | data->port= *(int *)ptr; |
498 | } | 498 | } |
diff --git a/src/lib/libssl/src/crypto/bio/bss_dgram.c b/src/lib/libssl/src/crypto/bio/bss_dgram.c index 478c765399..e0445fc97e 100644 --- a/src/lib/libssl/src/crypto/bio/bss_dgram.c +++ b/src/lib/libssl/src/crypto/bio/bss_dgram.c | |||
@@ -212,7 +212,7 @@ dgram_new(BIO *bi) | |||
212 | 212 | ||
213 | bi->init = 0; | 213 | bi->init = 0; |
214 | bi->num = 0; | 214 | bi->num = 0; |
215 | data = OPENSSL_malloc(sizeof(bio_dgram_data)); | 215 | data = malloc(sizeof(bio_dgram_data)); |
216 | if (data == NULL) | 216 | if (data == NULL) |
217 | return 0; | 217 | return 0; |
218 | memset(data, 0x00, sizeof(bio_dgram_data)); | 218 | memset(data, 0x00, sizeof(bio_dgram_data)); |
@@ -234,7 +234,7 @@ dgram_free(BIO *a) | |||
234 | 234 | ||
235 | data = (bio_dgram_data *)a->ptr; | 235 | data = (bio_dgram_data *)a->ptr; |
236 | if (data != NULL) | 236 | if (data != NULL) |
237 | OPENSSL_free(data); | 237 | free(data); |
238 | 238 | ||
239 | return (1); | 239 | return (1); |
240 | } | 240 | } |
@@ -805,7 +805,7 @@ BIO | |||
805 | * SCTP-AUTH has to be activated for the listening socket | 805 | * SCTP-AUTH has to be activated for the listening socket |
806 | * already, otherwise the connected socket won't use it. */ | 806 | * already, otherwise the connected socket won't use it. */ |
807 | sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); | 807 | sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); |
808 | authchunks = OPENSSL_malloc(sockopt_len); | 808 | authchunks = malloc(sockopt_len); |
809 | memset(authchunks, 0, sizeof(sockopt_len)); | 809 | memset(authchunks, 0, sizeof(sockopt_len)); |
810 | ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); | 810 | ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); |
811 | OPENSSL_assert(ret >= 0); | 811 | OPENSSL_assert(ret >= 0); |
@@ -819,7 +819,7 @@ BIO | |||
819 | auth_forward = 1; | 819 | auth_forward = 1; |
820 | } | 820 | } |
821 | 821 | ||
822 | OPENSSL_free(authchunks); | 822 | free(authchunks); |
823 | 823 | ||
824 | OPENSSL_assert(auth_data); | 824 | OPENSSL_assert(auth_data); |
825 | OPENSSL_assert(auth_forward); | 825 | OPENSSL_assert(auth_forward); |
@@ -866,7 +866,7 @@ dgram_sctp_new(BIO *bi) | |||
866 | 866 | ||
867 | bi->init = 0; | 867 | bi->init = 0; |
868 | bi->num = 0; | 868 | bi->num = 0; |
869 | data = OPENSSL_malloc(sizeof(bio_dgram_sctp_data)); | 869 | data = malloc(sizeof(bio_dgram_sctp_data)); |
870 | if (data == NULL) | 870 | if (data == NULL) |
871 | return 0; | 871 | return 0; |
872 | memset(data, 0x00, sizeof(bio_dgram_sctp_data)); | 872 | memset(data, 0x00, sizeof(bio_dgram_sctp_data)); |
@@ -891,7 +891,7 @@ dgram_sctp_free(BIO *a) | |||
891 | 891 | ||
892 | data = (bio_dgram_sctp_data *)a->ptr; | 892 | data = (bio_dgram_sctp_data *)a->ptr; |
893 | if (data != NULL) | 893 | if (data != NULL) |
894 | OPENSSL_free(data); | 894 | free(data); |
895 | 895 | ||
896 | return (1); | 896 | return (1); |
897 | } | 897 | } |
@@ -998,7 +998,7 @@ dgram_sctp_read(BIO *b, char *out, int outl) | |||
998 | if (data->saved_message.length > 0) { | 998 | if (data->saved_message.length > 0) { |
999 | dgram_sctp_write(data->saved_message.bio, data->saved_message.data, | 999 | dgram_sctp_write(data->saved_message.bio, data->saved_message.data, |
1000 | data->saved_message.length); | 1000 | data->saved_message.length); |
1001 | OPENSSL_free(data->saved_message.data); | 1001 | free(data->saved_message.data); |
1002 | data->saved_message.length = 0; | 1002 | data->saved_message.length = 0; |
1003 | } | 1003 | } |
1004 | 1004 | ||
@@ -1087,7 +1087,7 @@ dgram_sctp_read(BIO *b, char *out, int outl) | |||
1087 | struct sctp_authchunks *authchunks; | 1087 | struct sctp_authchunks *authchunks; |
1088 | 1088 | ||
1089 | optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); | 1089 | optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); |
1090 | authchunks = OPENSSL_malloc(optlen); | 1090 | authchunks = malloc(optlen); |
1091 | memset(authchunks, 0, sizeof(optlen)); | 1091 | memset(authchunks, 0, sizeof(optlen)); |
1092 | ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); | 1092 | ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); |
1093 | OPENSSL_assert(ii >= 0); | 1093 | OPENSSL_assert(ii >= 0); |
@@ -1101,7 +1101,7 @@ dgram_sctp_read(BIO *b, char *out, int outl) | |||
1101 | auth_forward = 1; | 1101 | auth_forward = 1; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | OPENSSL_free(authchunks); | 1104 | free(authchunks); |
1105 | 1105 | ||
1106 | if (!auth_data || !auth_forward) { | 1106 | if (!auth_data || !auth_forward) { |
1107 | BIOerr(BIO_F_DGRAM_SCTP_READ, BIO_R_CONNECT_ERROR); | 1107 | BIOerr(BIO_F_DGRAM_SCTP_READ, BIO_R_CONNECT_ERROR); |
@@ -1154,7 +1154,7 @@ dgram_sctp_write(BIO *b, const char *in, int inl) | |||
1154 | if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) { | 1154 | if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) { |
1155 | data->saved_message.bio = b; | 1155 | data->saved_message.bio = b; |
1156 | data->saved_message.length = inl; | 1156 | data->saved_message.length = inl; |
1157 | data->saved_message.data = OPENSSL_malloc(inl); | 1157 | data->saved_message.data = malloc(inl); |
1158 | memcpy(data->saved_message.data, in, inl); | 1158 | memcpy(data->saved_message.data, in, inl); |
1159 | return inl; | 1159 | return inl; |
1160 | } | 1160 | } |
@@ -1282,7 +1282,7 @@ dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
1282 | 1282 | ||
1283 | /* Add new key */ | 1283 | /* Add new key */ |
1284 | sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t); | 1284 | sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t); |
1285 | authkey = OPENSSL_malloc(sockopt_len); | 1285 | authkey = malloc(sockopt_len); |
1286 | memset(authkey, 0x00, sockopt_len); | 1286 | memset(authkey, 0x00, sockopt_len); |
1287 | authkey->sca_keynumber = authkeyid.scact_keynumber + 1; | 1287 | authkey->sca_keynumber = authkeyid.scact_keynumber + 1; |
1288 | #ifndef __FreeBSD__ | 1288 | #ifndef __FreeBSD__ |
diff --git a/src/lib/libssl/src/crypto/bio/bss_log.c b/src/lib/libssl/src/crypto/bio/bss_log.c index 2d38837f9e..cde3c858f1 100644 --- a/src/lib/libssl/src/crypto/bio/bss_log.c +++ b/src/lib/libssl/src/crypto/bio/bss_log.c | |||
@@ -157,7 +157,7 @@ slg_write(BIO *b, const char *in, int inl) | |||
157 | { 0, "", LOG_ERR } /* The default */ | 157 | { 0, "", LOG_ERR } /* The default */ |
158 | }; | 158 | }; |
159 | 159 | ||
160 | if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) { | 160 | if ((buf = (char *)malloc(inl + 1)) == NULL) { |
161 | return (0); | 161 | return (0); |
162 | } | 162 | } |
163 | strlcpy(buf, in, inl + 1); | 163 | strlcpy(buf, in, inl + 1); |
@@ -169,7 +169,7 @@ slg_write(BIO *b, const char *in, int inl) | |||
169 | 169 | ||
170 | xsyslog(b, priority, pp); | 170 | xsyslog(b, priority, pp); |
171 | 171 | ||
172 | OPENSSL_free(buf); | 172 | free(buf); |
173 | return (ret); | 173 | return (ret); |
174 | } | 174 | } |
175 | 175 | ||
diff --git a/src/lib/libssl/src/crypto/bn/bn_blind.c b/src/lib/libssl/src/crypto/bn/bn_blind.c index 9ed8bc2b40..264531013e 100644 --- a/src/lib/libssl/src/crypto/bn/bn_blind.c +++ b/src/lib/libssl/src/crypto/bn/bn_blind.c | |||
@@ -140,7 +140,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) | |||
140 | 140 | ||
141 | bn_check_top(mod); | 141 | bn_check_top(mod); |
142 | 142 | ||
143 | if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL) | 143 | if ((ret=(BN_BLINDING *)malloc(sizeof(BN_BLINDING))) == NULL) |
144 | { | 144 | { |
145 | BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE); | 145 | BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE); |
146 | return(NULL); | 146 | return(NULL); |
@@ -180,7 +180,7 @@ void BN_BLINDING_free(BN_BLINDING *r) | |||
180 | if (r->Ai != NULL) BN_free(r->Ai); | 180 | if (r->Ai != NULL) BN_free(r->Ai); |
181 | if (r->e != NULL) BN_free(r->e ); | 181 | if (r->e != NULL) BN_free(r->e ); |
182 | if (r->mod != NULL) BN_free(r->mod); | 182 | if (r->mod != NULL) BN_free(r->mod); |
183 | OPENSSL_free(r); | 183 | free(r); |
184 | } | 184 | } |
185 | 185 | ||
186 | int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) | 186 | int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) |
diff --git a/src/lib/libssl/src/crypto/bn/bn_ctx.c b/src/lib/libssl/src/crypto/bn/bn_ctx.c index 3f2256f675..ef67f4781c 100644 --- a/src/lib/libssl/src/crypto/bn/bn_ctx.c +++ b/src/lib/libssl/src/crypto/bn/bn_ctx.c | |||
@@ -213,7 +213,7 @@ void BN_CTX_init(BN_CTX *ctx) | |||
213 | 213 | ||
214 | BN_CTX *BN_CTX_new(void) | 214 | BN_CTX *BN_CTX_new(void) |
215 | { | 215 | { |
216 | BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX)); | 216 | BN_CTX *ret = malloc(sizeof(BN_CTX)); |
217 | if(!ret) | 217 | if(!ret) |
218 | { | 218 | { |
219 | BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE); | 219 | BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE); |
@@ -249,7 +249,7 @@ void BN_CTX_free(BN_CTX *ctx) | |||
249 | #endif | 249 | #endif |
250 | BN_STACK_finish(&ctx->stack); | 250 | BN_STACK_finish(&ctx->stack); |
251 | BN_POOL_finish(&ctx->pool); | 251 | BN_POOL_finish(&ctx->pool); |
252 | OPENSSL_free(ctx); | 252 | free(ctx); |
253 | } | 253 | } |
254 | 254 | ||
255 | void BN_CTX_start(BN_CTX *ctx) | 255 | void BN_CTX_start(BN_CTX *ctx) |
@@ -317,7 +317,7 @@ static void BN_STACK_init(BN_STACK *st) | |||
317 | 317 | ||
318 | static void BN_STACK_finish(BN_STACK *st) | 318 | static void BN_STACK_finish(BN_STACK *st) |
319 | { | 319 | { |
320 | if(st->size) OPENSSL_free(st->indexes); | 320 | if(st->size) free(st->indexes); |
321 | } | 321 | } |
322 | 322 | ||
323 | #ifndef OPENSSL_NO_DEPRECATED | 323 | #ifndef OPENSSL_NO_DEPRECATED |
@@ -334,13 +334,13 @@ static int BN_STACK_push(BN_STACK *st, unsigned int idx) | |||
334 | { | 334 | { |
335 | unsigned int newsize = (st->size ? | 335 | unsigned int newsize = (st->size ? |
336 | (st->size * 3 / 2) : BN_CTX_START_FRAMES); | 336 | (st->size * 3 / 2) : BN_CTX_START_FRAMES); |
337 | unsigned int *newitems = OPENSSL_malloc(newsize * | 337 | unsigned int *newitems = malloc(newsize * |
338 | sizeof(unsigned int)); | 338 | sizeof(unsigned int)); |
339 | if(!newitems) return 0; | 339 | if(!newitems) return 0; |
340 | if(st->depth) | 340 | if(st->depth) |
341 | memcpy(newitems, st->indexes, st->depth * | 341 | memcpy(newitems, st->indexes, st->depth * |
342 | sizeof(unsigned int)); | 342 | sizeof(unsigned int)); |
343 | if(st->size) OPENSSL_free(st->indexes); | 343 | if(st->size) free(st->indexes); |
344 | st->indexes = newitems; | 344 | st->indexes = newitems; |
345 | st->size = newsize; | 345 | st->size = newsize; |
346 | } | 346 | } |
@@ -375,7 +375,7 @@ static void BN_POOL_finish(BN_POOL *p) | |||
375 | bn++; | 375 | bn++; |
376 | } | 376 | } |
377 | p->current = p->head->next; | 377 | p->current = p->head->next; |
378 | OPENSSL_free(p->head); | 378 | free(p->head); |
379 | p->head = p->current; | 379 | p->head = p->current; |
380 | } | 380 | } |
381 | } | 381 | } |
@@ -406,7 +406,7 @@ static BIGNUM *BN_POOL_get(BN_POOL *p) | |||
406 | { | 406 | { |
407 | BIGNUM *bn; | 407 | BIGNUM *bn; |
408 | unsigned int loop = 0; | 408 | unsigned int loop = 0; |
409 | BN_POOL_ITEM *item = OPENSSL_malloc(sizeof(BN_POOL_ITEM)); | 409 | BN_POOL_ITEM *item = malloc(sizeof(BN_POOL_ITEM)); |
410 | if(!item) return NULL; | 410 | if(!item) return NULL; |
411 | /* Initialise the structure */ | 411 | /* Initialise the structure */ |
412 | bn = item->vals; | 412 | bn = item->vals; |
diff --git a/src/lib/libssl/src/crypto/bn/bn_exp.c b/src/lib/libssl/src/crypto/bn/bn_exp.c index 2abf6fd678..2047e1cc3f 100644 --- a/src/lib/libssl/src/crypto/bn/bn_exp.c +++ b/src/lib/libssl/src/crypto/bn/bn_exp.c | |||
@@ -636,7 +636,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, | |||
636 | powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH); | 636 | powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH); |
637 | else | 637 | else |
638 | #endif | 638 | #endif |
639 | if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL) | 639 | if ((powerbufFree=(unsigned char*)malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL) |
640 | goto err; | 640 | goto err; |
641 | 641 | ||
642 | powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree); | 642 | powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree); |
@@ -823,7 +823,7 @@ err: | |||
823 | if (powerbuf!=NULL) | 823 | if (powerbuf!=NULL) |
824 | { | 824 | { |
825 | OPENSSL_cleanse(powerbuf,powerbufLen); | 825 | OPENSSL_cleanse(powerbuf,powerbufLen); |
826 | if (powerbufFree) OPENSSL_free(powerbufFree); | 826 | if (powerbufFree) free(powerbufFree); |
827 | } | 827 | } |
828 | BN_CTX_end(ctx); | 828 | BN_CTX_end(ctx); |
829 | return(ret); | 829 | return(ret); |
diff --git a/src/lib/libssl/src/crypto/bn/bn_gf2m.c b/src/lib/libssl/src/crypto/bn/bn_gf2m.c index 8a4dc20ad9..68a5faa52d 100644 --- a/src/lib/libssl/src/crypto/bn/bn_gf2m.c +++ b/src/lib/libssl/src/crypto/bn/bn_gf2m.c | |||
@@ -444,7 +444,7 @@ int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
444 | bn_check_top(a); | 444 | bn_check_top(a); |
445 | bn_check_top(b); | 445 | bn_check_top(b); |
446 | bn_check_top(p); | 446 | bn_check_top(p); |
447 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 447 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
448 | ret = BN_GF2m_poly2arr(p, arr, max); | 448 | ret = BN_GF2m_poly2arr(p, arr, max); |
449 | if (!ret || ret > max) | 449 | if (!ret || ret > max) |
450 | { | 450 | { |
@@ -454,7 +454,7 @@ int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
454 | ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); | 454 | ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); |
455 | bn_check_top(r); | 455 | bn_check_top(r); |
456 | err: | 456 | err: |
457 | if (arr) OPENSSL_free(arr); | 457 | if (arr) free(arr); |
458 | return ret; | 458 | return ret; |
459 | } | 459 | } |
460 | 460 | ||
@@ -500,7 +500,7 @@ int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
500 | 500 | ||
501 | bn_check_top(a); | 501 | bn_check_top(a); |
502 | bn_check_top(p); | 502 | bn_check_top(p); |
503 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 503 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
504 | ret = BN_GF2m_poly2arr(p, arr, max); | 504 | ret = BN_GF2m_poly2arr(p, arr, max); |
505 | if (!ret || ret > max) | 505 | if (!ret || ret > max) |
506 | { | 506 | { |
@@ -510,7 +510,7 @@ int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
510 | ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); | 510 | ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); |
511 | bn_check_top(r); | 511 | bn_check_top(r); |
512 | err: | 512 | err: |
513 | if (arr) OPENSSL_free(arr); | 513 | if (arr) free(arr); |
514 | return ret; | 514 | return ret; |
515 | } | 515 | } |
516 | 516 | ||
@@ -861,7 +861,7 @@ int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
861 | bn_check_top(a); | 861 | bn_check_top(a); |
862 | bn_check_top(b); | 862 | bn_check_top(b); |
863 | bn_check_top(p); | 863 | bn_check_top(p); |
864 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 864 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
865 | ret = BN_GF2m_poly2arr(p, arr, max); | 865 | ret = BN_GF2m_poly2arr(p, arr, max); |
866 | if (!ret || ret > max) | 866 | if (!ret || ret > max) |
867 | { | 867 | { |
@@ -871,7 +871,7 @@ int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p | |||
871 | ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx); | 871 | ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx); |
872 | bn_check_top(r); | 872 | bn_check_top(r); |
873 | err: | 873 | err: |
874 | if (arr) OPENSSL_free(arr); | 874 | if (arr) free(arr); |
875 | return ret; | 875 | return ret; |
876 | } | 876 | } |
877 | 877 | ||
@@ -919,7 +919,7 @@ int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
919 | int *arr=NULL; | 919 | int *arr=NULL; |
920 | bn_check_top(a); | 920 | bn_check_top(a); |
921 | bn_check_top(p); | 921 | bn_check_top(p); |
922 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; | 922 | if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err; |
923 | ret = BN_GF2m_poly2arr(p, arr, max); | 923 | ret = BN_GF2m_poly2arr(p, arr, max); |
924 | if (!ret || ret > max) | 924 | if (!ret || ret > max) |
925 | { | 925 | { |
@@ -929,7 +929,7 @@ int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
929 | ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); | 929 | ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); |
930 | bn_check_top(r); | 930 | bn_check_top(r); |
931 | err: | 931 | err: |
932 | if (arr) OPENSSL_free(arr); | 932 | if (arr) free(arr); |
933 | return ret; | 933 | return ret; |
934 | } | 934 | } |
935 | 935 | ||
@@ -1037,7 +1037,7 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX * | |||
1037 | int *arr=NULL; | 1037 | int *arr=NULL; |
1038 | bn_check_top(a); | 1038 | bn_check_top(a); |
1039 | bn_check_top(p); | 1039 | bn_check_top(p); |
1040 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * | 1040 | if ((arr = (int *)malloc(sizeof(int) * |
1041 | max)) == NULL) goto err; | 1041 | max)) == NULL) goto err; |
1042 | ret = BN_GF2m_poly2arr(p, arr, max); | 1042 | ret = BN_GF2m_poly2arr(p, arr, max); |
1043 | if (!ret || ret > max) | 1043 | if (!ret || ret > max) |
@@ -1048,7 +1048,7 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX * | |||
1048 | ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); | 1048 | ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); |
1049 | bn_check_top(r); | 1049 | bn_check_top(r); |
1050 | err: | 1050 | err: |
1051 | if (arr) OPENSSL_free(arr); | 1051 | if (arr) free(arr); |
1052 | return ret; | 1052 | return ret; |
1053 | } | 1053 | } |
1054 | 1054 | ||
diff --git a/src/lib/libssl/src/crypto/bn/bn_lib.c b/src/lib/libssl/src/crypto/bn/bn_lib.c index 5461e6ee7d..b491c785d4 100644 --- a/src/lib/libssl/src/crypto/bn/bn_lib.c +++ b/src/lib/libssl/src/crypto/bn/bn_lib.c | |||
@@ -245,12 +245,12 @@ void BN_clear_free(BIGNUM *a) | |||
245 | { | 245 | { |
246 | OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0])); | 246 | OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0])); |
247 | if (!(BN_get_flags(a,BN_FLG_STATIC_DATA))) | 247 | if (!(BN_get_flags(a,BN_FLG_STATIC_DATA))) |
248 | OPENSSL_free(a->d); | 248 | free(a->d); |
249 | } | 249 | } |
250 | i=BN_get_flags(a,BN_FLG_MALLOCED); | 250 | i=BN_get_flags(a,BN_FLG_MALLOCED); |
251 | OPENSSL_cleanse(a,sizeof(BIGNUM)); | 251 | OPENSSL_cleanse(a,sizeof(BIGNUM)); |
252 | if (i) | 252 | if (i) |
253 | OPENSSL_free(a); | 253 | free(a); |
254 | } | 254 | } |
255 | 255 | ||
256 | void BN_free(BIGNUM *a) | 256 | void BN_free(BIGNUM *a) |
@@ -258,9 +258,9 @@ void BN_free(BIGNUM *a) | |||
258 | if (a == NULL) return; | 258 | if (a == NULL) return; |
259 | bn_check_top(a); | 259 | bn_check_top(a); |
260 | if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) | 260 | if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) |
261 | OPENSSL_free(a->d); | 261 | free(a->d); |
262 | if (a->flags & BN_FLG_MALLOCED) | 262 | if (a->flags & BN_FLG_MALLOCED) |
263 | OPENSSL_free(a); | 263 | free(a); |
264 | else | 264 | else |
265 | { | 265 | { |
266 | #ifndef OPENSSL_NO_DEPRECATED | 266 | #ifndef OPENSSL_NO_DEPRECATED |
@@ -280,7 +280,7 @@ BIGNUM *BN_new(void) | |||
280 | { | 280 | { |
281 | BIGNUM *ret; | 281 | BIGNUM *ret; |
282 | 282 | ||
283 | if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL) | 283 | if ((ret=(BIGNUM *)malloc(sizeof(BIGNUM))) == NULL) |
284 | { | 284 | { |
285 | BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); | 285 | BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); |
286 | return(NULL); | 286 | return(NULL); |
@@ -314,7 +314,7 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) | |||
314 | BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); | 314 | BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); |
315 | return(NULL); | 315 | return(NULL); |
316 | } | 316 | } |
317 | a=A=(BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG)*words); | 317 | a=A=(BN_ULONG *)malloc(sizeof(BN_ULONG)*words); |
318 | if (A == NULL) | 318 | if (A == NULL) |
319 | { | 319 | { |
320 | BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE); | 320 | BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE); |
@@ -401,7 +401,7 @@ BIGNUM *bn_dup_expand(const BIGNUM *b, int words) | |||
401 | else | 401 | else |
402 | { | 402 | { |
403 | /* r == NULL, BN_new failure */ | 403 | /* r == NULL, BN_new failure */ |
404 | OPENSSL_free(a); | 404 | free(a); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | /* If a == NULL, there was an error in allocation in | 407 | /* If a == NULL, there was an error in allocation in |
@@ -431,7 +431,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words) | |||
431 | { | 431 | { |
432 | BN_ULONG *a = bn_expand_internal(b, words); | 432 | BN_ULONG *a = bn_expand_internal(b, words); |
433 | if(!a) return NULL; | 433 | if(!a) return NULL; |
434 | if(b->d) OPENSSL_free(b->d); | 434 | if(b->d) free(b->d); |
435 | b->d=a; | 435 | b->d=a; |
436 | b->dmax=words; | 436 | b->dmax=words; |
437 | } | 437 | } |
diff --git a/src/lib/libssl/src/crypto/bn/bn_mont.c b/src/lib/libssl/src/crypto/bn/bn_mont.c index a6713ae5b1..133c597c33 100644 --- a/src/lib/libssl/src/crypto/bn/bn_mont.c +++ b/src/lib/libssl/src/crypto/bn/bn_mont.c | |||
@@ -322,7 +322,7 @@ BN_MONT_CTX *BN_MONT_CTX_new(void) | |||
322 | { | 322 | { |
323 | BN_MONT_CTX *ret; | 323 | BN_MONT_CTX *ret; |
324 | 324 | ||
325 | if ((ret=(BN_MONT_CTX *)OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL) | 325 | if ((ret=(BN_MONT_CTX *)malloc(sizeof(BN_MONT_CTX))) == NULL) |
326 | return(NULL); | 326 | return(NULL); |
327 | 327 | ||
328 | BN_MONT_CTX_init(ret); | 328 | BN_MONT_CTX_init(ret); |
@@ -349,7 +349,7 @@ void BN_MONT_CTX_free(BN_MONT_CTX *mont) | |||
349 | BN_free(&(mont->N)); | 349 | BN_free(&(mont->N)); |
350 | BN_free(&(mont->Ni)); | 350 | BN_free(&(mont->Ni)); |
351 | if (mont->flags & BN_FLG_MALLOCED) | 351 | if (mont->flags & BN_FLG_MALLOCED) |
352 | OPENSSL_free(mont); | 352 | free(mont); |
353 | } | 353 | } |
354 | 354 | ||
355 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | 355 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) |
diff --git a/src/lib/libssl/src/crypto/bn/bn_print.c b/src/lib/libssl/src/crypto/bn/bn_print.c index c7c407e494..e2cab2497f 100644 --- a/src/lib/libssl/src/crypto/bn/bn_print.c +++ b/src/lib/libssl/src/crypto/bn/bn_print.c | |||
@@ -64,14 +64,14 @@ | |||
64 | 64 | ||
65 | static const char Hex[]="0123456789ABCDEF"; | 65 | static const char Hex[]="0123456789ABCDEF"; |
66 | 66 | ||
67 | /* Must 'OPENSSL_free' the returned data */ | 67 | /* Must 'free' the returned data */ |
68 | char *BN_bn2hex(const BIGNUM *a) | 68 | char *BN_bn2hex(const BIGNUM *a) |
69 | { | 69 | { |
70 | int i,j,v,z=0; | 70 | int i,j,v,z=0; |
71 | char *buf; | 71 | char *buf; |
72 | char *p; | 72 | char *p; |
73 | 73 | ||
74 | buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2); | 74 | buf=(char *)malloc(a->top*BN_BYTES*2+2); |
75 | if (buf == NULL) | 75 | if (buf == NULL) |
76 | { | 76 | { |
77 | BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); | 77 | BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); |
@@ -99,7 +99,7 @@ err: | |||
99 | return(buf); | 99 | return(buf); |
100 | } | 100 | } |
101 | 101 | ||
102 | /* Must 'OPENSSL_free' the returned data */ | 102 | /* Must 'free' the returned data */ |
103 | char *BN_bn2dec(const BIGNUM *a) | 103 | char *BN_bn2dec(const BIGNUM *a) |
104 | { | 104 | { |
105 | int i=0,num, ok = 0; | 105 | int i=0,num, ok = 0; |
@@ -115,8 +115,8 @@ char *BN_bn2dec(const BIGNUM *a) | |||
115 | */ | 115 | */ |
116 | i=BN_num_bits(a)*3; | 116 | i=BN_num_bits(a)*3; |
117 | num=(i/10+i/1000+1)+1; | 117 | num=(i/10+i/1000+1)+1; |
118 | bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); | 118 | bn_data=(BN_ULONG *)malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); |
119 | buf=(char *)OPENSSL_malloc(num+3); | 119 | buf=(char *)malloc(num+3); |
120 | if ((buf == NULL) || (bn_data == NULL)) | 120 | if ((buf == NULL) || (bn_data == NULL)) |
121 | { | 121 | { |
122 | BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); | 122 | BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); |
@@ -158,11 +158,11 @@ char *BN_bn2dec(const BIGNUM *a) | |||
158 | } | 158 | } |
159 | ok = 1; | 159 | ok = 1; |
160 | err: | 160 | err: |
161 | if (bn_data != NULL) OPENSSL_free(bn_data); | 161 | if (bn_data != NULL) free(bn_data); |
162 | if (t != NULL) BN_free(t); | 162 | if (t != NULL) BN_free(t); |
163 | if (!ok && buf) | 163 | if (!ok && buf) |
164 | { | 164 | { |
165 | OPENSSL_free(buf); | 165 | free(buf); |
166 | buf = NULL; | 166 | buf = NULL; |
167 | } | 167 | } |
168 | 168 | ||
diff --git a/src/lib/libssl/src/crypto/bn/bn_rand.c b/src/lib/libssl/src/crypto/bn/bn_rand.c index 5cbb1f33c1..baa62d584c 100644 --- a/src/lib/libssl/src/crypto/bn/bn_rand.c +++ b/src/lib/libssl/src/crypto/bn/bn_rand.c | |||
@@ -130,7 +130,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) | |||
130 | bit=(bits-1)%8; | 130 | bit=(bits-1)%8; |
131 | mask=0xff<<(bit+1); | 131 | mask=0xff<<(bit+1); |
132 | 132 | ||
133 | buf=(unsigned char *)OPENSSL_malloc(bytes); | 133 | buf=(unsigned char *)malloc(bytes); |
134 | if (buf == NULL) | 134 | if (buf == NULL) |
135 | { | 135 | { |
136 | BNerr(BN_F_BNRAND,ERR_R_MALLOC_FAILURE); | 136 | BNerr(BN_F_BNRAND,ERR_R_MALLOC_FAILURE); |
@@ -199,7 +199,7 @@ err: | |||
199 | if (buf != NULL) | 199 | if (buf != NULL) |
200 | { | 200 | { |
201 | OPENSSL_cleanse(buf,bytes); | 201 | OPENSSL_cleanse(buf,bytes); |
202 | OPENSSL_free(buf); | 202 | free(buf); |
203 | } | 203 | } |
204 | bn_check_top(rnd); | 204 | bn_check_top(rnd); |
205 | return(ret); | 205 | return(ret); |
diff --git a/src/lib/libssl/src/crypto/bn/bn_recp.c b/src/lib/libssl/src/crypto/bn/bn_recp.c index 2e8efb8dae..0f808fca64 100644 --- a/src/lib/libssl/src/crypto/bn/bn_recp.c +++ b/src/lib/libssl/src/crypto/bn/bn_recp.c | |||
@@ -72,7 +72,7 @@ BN_RECP_CTX *BN_RECP_CTX_new(void) | |||
72 | { | 72 | { |
73 | BN_RECP_CTX *ret; | 73 | BN_RECP_CTX *ret; |
74 | 74 | ||
75 | if ((ret=(BN_RECP_CTX *)OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL) | 75 | if ((ret=(BN_RECP_CTX *)malloc(sizeof(BN_RECP_CTX))) == NULL) |
76 | return(NULL); | 76 | return(NULL); |
77 | 77 | ||
78 | BN_RECP_CTX_init(ret); | 78 | BN_RECP_CTX_init(ret); |
@@ -88,7 +88,7 @@ void BN_RECP_CTX_free(BN_RECP_CTX *recp) | |||
88 | BN_free(&(recp->N)); | 88 | BN_free(&(recp->N)); |
89 | BN_free(&(recp->Nr)); | 89 | BN_free(&(recp->Nr)); |
90 | if (recp->flags & BN_FLG_MALLOCED) | 90 | if (recp->flags & BN_FLG_MALLOCED) |
91 | OPENSSL_free(recp); | 91 | free(recp); |
92 | } | 92 | } |
93 | 93 | ||
94 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) | 94 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) |
diff --git a/src/lib/libssl/src/crypto/buffer/buf_str.c b/src/lib/libssl/src/crypto/buffer/buf_str.c index 151f5ea971..ab5535f476 100644 --- a/src/lib/libssl/src/crypto/buffer/buf_str.c +++ b/src/lib/libssl/src/crypto/buffer/buf_str.c | |||
@@ -72,7 +72,7 @@ char *BUF_strndup(const char *str, size_t siz) | |||
72 | 72 | ||
73 | if (str == NULL) return(NULL); | 73 | if (str == NULL) return(NULL); |
74 | 74 | ||
75 | ret=OPENSSL_malloc(siz+1); | 75 | ret=malloc(siz+1); |
76 | if (ret == NULL) | 76 | if (ret == NULL) |
77 | { | 77 | { |
78 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); | 78 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); |
@@ -88,7 +88,7 @@ void *BUF_memdup(const void *data, size_t siz) | |||
88 | 88 | ||
89 | if (data == NULL) return(NULL); | 89 | if (data == NULL) return(NULL); |
90 | 90 | ||
91 | ret=OPENSSL_malloc(siz); | 91 | ret=malloc(siz); |
92 | if (ret == NULL) | 92 | if (ret == NULL) |
93 | { | 93 | { |
94 | BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); | 94 | BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/buffer/buffer.c b/src/lib/libssl/src/crypto/buffer/buffer.c index d4a4ce43b3..b52c59f8a3 100644 --- a/src/lib/libssl/src/crypto/buffer/buffer.c +++ b/src/lib/libssl/src/crypto/buffer/buffer.c | |||
@@ -69,7 +69,7 @@ BUF_MEM *BUF_MEM_new(void) | |||
69 | { | 69 | { |
70 | BUF_MEM *ret; | 70 | BUF_MEM *ret; |
71 | 71 | ||
72 | ret=OPENSSL_malloc(sizeof(BUF_MEM)); | 72 | ret=malloc(sizeof(BUF_MEM)); |
73 | if (ret == NULL) | 73 | if (ret == NULL) |
74 | { | 74 | { |
75 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); | 75 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); |
@@ -89,9 +89,9 @@ void BUF_MEM_free(BUF_MEM *a) | |||
89 | if (a->data != NULL) | 89 | if (a->data != NULL) |
90 | { | 90 | { |
91 | memset(a->data,0,(unsigned int)a->max); | 91 | memset(a->data,0,(unsigned int)a->max); |
92 | OPENSSL_free(a->data); | 92 | free(a->data); |
93 | } | 93 | } |
94 | OPENSSL_free(a); | 94 | free(a); |
95 | } | 95 | } |
96 | 96 | ||
97 | int BUF_MEM_grow(BUF_MEM *str, size_t len) | 97 | int BUF_MEM_grow(BUF_MEM *str, size_t len) |
@@ -118,9 +118,9 @@ int BUF_MEM_grow(BUF_MEM *str, size_t len) | |||
118 | } | 118 | } |
119 | n=(len+3)/3*4; | 119 | n=(len+3)/3*4; |
120 | if (str->data == NULL) | 120 | if (str->data == NULL) |
121 | ret=OPENSSL_malloc(n); | 121 | ret=malloc(n); |
122 | else | 122 | else |
123 | ret=OPENSSL_realloc(str->data,n); | 123 | ret=realloc(str->data,n); |
124 | if (ret == NULL) | 124 | if (ret == NULL) |
125 | { | 125 | { |
126 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | 126 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); |
@@ -161,7 +161,7 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) | |||
161 | } | 161 | } |
162 | n=(len+3)/3*4; | 162 | n=(len+3)/3*4; |
163 | if (str->data == NULL) | 163 | if (str->data == NULL) |
164 | ret=OPENSSL_malloc(n); | 164 | ret=malloc(n); |
165 | else | 165 | else |
166 | ret=OPENSSL_realloc_clean(str->data,str->max,n); | 166 | ret=OPENSSL_realloc_clean(str->data,str->max,n); |
167 | if (ret == NULL) | 167 | if (ret == NULL) |
diff --git a/src/lib/libssl/src/crypto/cmac/cm_pmeth.c b/src/lib/libssl/src/crypto/cmac/cm_pmeth.c index 072228ec7f..00aa4d64d2 100644 --- a/src/lib/libssl/src/crypto/cmac/cm_pmeth.c +++ b/src/lib/libssl/src/crypto/cmac/cm_pmeth.c | |||
@@ -182,7 +182,7 @@ static int pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx, | |||
182 | if (!key) | 182 | if (!key) |
183 | return 0; | 183 | return 0; |
184 | r = pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); | 184 | r = pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); |
185 | OPENSSL_free(key); | 185 | free(key); |
186 | return r; | 186 | return r; |
187 | } | 187 | } |
188 | return -2; | 188 | return -2; |
diff --git a/src/lib/libssl/src/crypto/cmac/cmac.c b/src/lib/libssl/src/crypto/cmac/cmac.c index f92a7bb143..81188c8f5a 100644 --- a/src/lib/libssl/src/crypto/cmac/cmac.c +++ b/src/lib/libssl/src/crypto/cmac/cmac.c | |||
@@ -93,7 +93,7 @@ static void make_kn(unsigned char *k1, unsigned char *l, int bl) | |||
93 | CMAC_CTX *CMAC_CTX_new(void) | 93 | CMAC_CTX *CMAC_CTX_new(void) |
94 | { | 94 | { |
95 | CMAC_CTX *ctx; | 95 | CMAC_CTX *ctx; |
96 | ctx = OPENSSL_malloc(sizeof(CMAC_CTX)); | 96 | ctx = malloc(sizeof(CMAC_CTX)); |
97 | if (!ctx) | 97 | if (!ctx) |
98 | return NULL; | 98 | return NULL; |
99 | EVP_CIPHER_CTX_init(&ctx->cctx); | 99 | EVP_CIPHER_CTX_init(&ctx->cctx); |
@@ -119,7 +119,7 @@ EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx) | |||
119 | void CMAC_CTX_free(CMAC_CTX *ctx) | 119 | void CMAC_CTX_free(CMAC_CTX *ctx) |
120 | { | 120 | { |
121 | CMAC_CTX_cleanup(ctx); | 121 | CMAC_CTX_cleanup(ctx); |
122 | OPENSSL_free(ctx); | 122 | free(ctx); |
123 | } | 123 | } |
124 | 124 | ||
125 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) | 125 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) |
diff --git a/src/lib/libssl/src/crypto/cms/cms_asn1.c b/src/lib/libssl/src/crypto/cms/cms_asn1.c index cfe67fb6c1..bd7466cc1d 100644 --- a/src/lib/libssl/src/crypto/cms/cms_asn1.c +++ b/src/lib/libssl/src/crypto/cms/cms_asn1.c | |||
@@ -234,7 +234,7 @@ static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
234 | if (kekri->key) | 234 | if (kekri->key) |
235 | { | 235 | { |
236 | OPENSSL_cleanse(kekri->key, kekri->keylen); | 236 | OPENSSL_cleanse(kekri->key, kekri->keylen); |
237 | OPENSSL_free(kekri->key); | 237 | free(kekri->key); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | else if (ri->type == CMS_RECIPINFO_PASS) | 240 | else if (ri->type == CMS_RECIPINFO_PASS) |
@@ -243,7 +243,7 @@ static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
243 | if (pwri->pass) | 243 | if (pwri->pass) |
244 | { | 244 | { |
245 | OPENSSL_cleanse(pwri->pass, pwri->passlen); | 245 | OPENSSL_cleanse(pwri->pass, pwri->passlen); |
246 | OPENSSL_free(pwri->pass); | 246 | free(pwri->pass); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } | 249 | } |
diff --git a/src/lib/libssl/src/crypto/cms/cms_enc.c b/src/lib/libssl/src/crypto/cms/cms_enc.c index bebeaf29c7..612fce6dde 100644 --- a/src/lib/libssl/src/crypto/cms/cms_enc.c +++ b/src/lib/libssl/src/crypto/cms/cms_enc.c | |||
@@ -143,7 +143,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
143 | /* Generate random session key */ | 143 | /* Generate random session key */ |
144 | if (!enc || !ec->key) | 144 | if (!enc || !ec->key) |
145 | { | 145 | { |
146 | tkey = OPENSSL_malloc(tkeylen); | 146 | tkey = malloc(tkeylen); |
147 | if (!tkey) | 147 | if (!tkey) |
148 | { | 148 | { |
149 | CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, | 149 | CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, |
@@ -184,7 +184,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
184 | { | 184 | { |
185 | /* Use random key */ | 185 | /* Use random key */ |
186 | OPENSSL_cleanse(ec->key, ec->keylen); | 186 | OPENSSL_cleanse(ec->key, ec->keylen); |
187 | OPENSSL_free(ec->key); | 187 | free(ec->key); |
188 | ec->key = tkey; | 188 | ec->key = tkey; |
189 | ec->keylen = tkeylen; | 189 | ec->keylen = tkeylen; |
190 | tkey = NULL; | 190 | tkey = NULL; |
@@ -222,13 +222,13 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
222 | if (ec->key && !keep_key) | 222 | if (ec->key && !keep_key) |
223 | { | 223 | { |
224 | OPENSSL_cleanse(ec->key, ec->keylen); | 224 | OPENSSL_cleanse(ec->key, ec->keylen); |
225 | OPENSSL_free(ec->key); | 225 | free(ec->key); |
226 | ec->key = NULL; | 226 | ec->key = NULL; |
227 | } | 227 | } |
228 | if (tkey) | 228 | if (tkey) |
229 | { | 229 | { |
230 | OPENSSL_cleanse(tkey, tkeylen); | 230 | OPENSSL_cleanse(tkey, tkeylen); |
231 | OPENSSL_free(tkey); | 231 | free(tkey); |
232 | } | 232 | } |
233 | if (ok) | 233 | if (ok) |
234 | return b; | 234 | return b; |
@@ -243,7 +243,7 @@ int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, | |||
243 | ec->cipher = cipher; | 243 | ec->cipher = cipher; |
244 | if (key) | 244 | if (key) |
245 | { | 245 | { |
246 | ec->key = OPENSSL_malloc(keylen); | 246 | ec->key = malloc(keylen); |
247 | if (!ec->key) | 247 | if (!ec->key) |
248 | return 0; | 248 | return 0; |
249 | memcpy(ec->key, key, keylen); | 249 | memcpy(ec->key, key, keylen); |
diff --git a/src/lib/libssl/src/crypto/cms/cms_env.c b/src/lib/libssl/src/crypto/cms/cms_env.c index be20b1c024..78fa2aa7b7 100644 --- a/src/lib/libssl/src/crypto/cms/cms_env.c +++ b/src/lib/libssl/src/crypto/cms/cms_env.c | |||
@@ -334,7 +334,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, | |||
334 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) | 334 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) |
335 | goto err; | 335 | goto err; |
336 | 336 | ||
337 | ek = OPENSSL_malloc(eklen); | 337 | ek = malloc(eklen); |
338 | 338 | ||
339 | if (ek == NULL) | 339 | if (ek == NULL) |
340 | { | 340 | { |
@@ -355,7 +355,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, | |||
355 | if (pctx) | 355 | if (pctx) |
356 | EVP_PKEY_CTX_free(pctx); | 356 | EVP_PKEY_CTX_free(pctx); |
357 | if (ek) | 357 | if (ek) |
358 | OPENSSL_free(ek); | 358 | free(ek); |
359 | return ret; | 359 | return ret; |
360 | 360 | ||
361 | } | 361 | } |
@@ -399,7 +399,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
399 | ktri->encryptedKey->length) <= 0) | 399 | ktri->encryptedKey->length) <= 0) |
400 | goto err; | 400 | goto err; |
401 | 401 | ||
402 | ek = OPENSSL_malloc(eklen); | 402 | ek = malloc(eklen); |
403 | 403 | ||
404 | if (ek == NULL) | 404 | if (ek == NULL) |
405 | { | 405 | { |
@@ -421,7 +421,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
421 | if (ec->key) | 421 | if (ec->key) |
422 | { | 422 | { |
423 | OPENSSL_cleanse(ec->key, ec->keylen); | 423 | OPENSSL_cleanse(ec->key, ec->keylen); |
424 | OPENSSL_free(ec->key); | 424 | free(ec->key); |
425 | } | 425 | } |
426 | 426 | ||
427 | ec->key = ek; | 427 | ec->key = ek; |
@@ -431,7 +431,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
431 | if (pctx) | 431 | if (pctx) |
432 | EVP_PKEY_CTX_free(pctx); | 432 | EVP_PKEY_CTX_free(pctx); |
433 | if (!ret && ek) | 433 | if (!ret && ek) |
434 | OPENSSL_free(ek); | 434 | free(ek); |
435 | 435 | ||
436 | return ret; | 436 | return ret; |
437 | } | 437 | } |
@@ -671,7 +671,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, | |||
671 | goto err; | 671 | goto err; |
672 | } | 672 | } |
673 | 673 | ||
674 | wkey = OPENSSL_malloc(ec->keylen + 8); | 674 | wkey = malloc(ec->keylen + 8); |
675 | 675 | ||
676 | if (!wkey) | 676 | if (!wkey) |
677 | { | 677 | { |
@@ -695,7 +695,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, | |||
695 | err: | 695 | err: |
696 | 696 | ||
697 | if (!r && wkey) | 697 | if (!r && wkey) |
698 | OPENSSL_free(wkey); | 698 | free(wkey); |
699 | OPENSSL_cleanse(&actx, sizeof(actx)); | 699 | OPENSSL_cleanse(&actx, sizeof(actx)); |
700 | 700 | ||
701 | return r; | 701 | return r; |
@@ -748,7 +748,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, | |||
748 | goto err; | 748 | goto err; |
749 | } | 749 | } |
750 | 750 | ||
751 | ukey = OPENSSL_malloc(kekri->encryptedKey->length - 8); | 751 | ukey = malloc(kekri->encryptedKey->length - 8); |
752 | 752 | ||
753 | if (!ukey) | 753 | if (!ukey) |
754 | { | 754 | { |
@@ -776,7 +776,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, | |||
776 | err: | 776 | err: |
777 | 777 | ||
778 | if (!r && ukey) | 778 | if (!r && ukey) |
779 | OPENSSL_free(ukey); | 779 | free(ukey); |
780 | OPENSSL_cleanse(&actx, sizeof(actx)); | 780 | OPENSSL_cleanse(&actx, sizeof(actx)); |
781 | 781 | ||
782 | return r; | 782 | return r; |
@@ -864,7 +864,7 @@ BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) | |||
864 | if (ec->key) | 864 | if (ec->key) |
865 | { | 865 | { |
866 | OPENSSL_cleanse(ec->key, ec->keylen); | 866 | OPENSSL_cleanse(ec->key, ec->keylen); |
867 | OPENSSL_free(ec->key); | 867 | free(ec->key); |
868 | ec->key = NULL; | 868 | ec->key = NULL; |
869 | ec->keylen = 0; | 869 | ec->keylen = 0; |
870 | } | 870 | } |
diff --git a/src/lib/libssl/src/crypto/cms/cms_ess.c b/src/lib/libssl/src/crypto/cms/cms_ess.c index 90c0b82fb5..99a4da6356 100644 --- a/src/lib/libssl/src/crypto/cms/cms_ess.c +++ b/src/lib/libssl/src/crypto/cms/cms_ess.c | |||
@@ -157,7 +157,7 @@ int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr) | |||
157 | CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); | 157 | CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); |
158 | 158 | ||
159 | if (rrder) | 159 | if (rrder) |
160 | OPENSSL_free(rrder); | 160 | free(rrder); |
161 | 161 | ||
162 | return r; | 162 | return r; |
163 | 163 | ||
diff --git a/src/lib/libssl/src/crypto/cms/cms_pwri.c b/src/lib/libssl/src/crypto/cms/cms_pwri.c index b79612a12d..36a5db04b8 100644 --- a/src/lib/libssl/src/crypto/cms/cms_pwri.c +++ b/src/lib/libssl/src/crypto/cms/cms_pwri.c | |||
@@ -237,7 +237,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen, | |||
237 | /* Invalid size */ | 237 | /* Invalid size */ |
238 | return 0; | 238 | return 0; |
239 | } | 239 | } |
240 | tmp = OPENSSL_malloc(inlen); | 240 | tmp = malloc(inlen); |
241 | /* setup IV by decrypting last two blocks */ | 241 | /* setup IV by decrypting last two blocks */ |
242 | EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, | 242 | EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, |
243 | in + inlen - 2 * blocklen, blocklen * 2); | 243 | in + inlen - 2 * blocklen, blocklen * 2); |
@@ -270,7 +270,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen, | |||
270 | rv = 1; | 270 | rv = 1; |
271 | err: | 271 | err: |
272 | OPENSSL_cleanse(tmp, inlen); | 272 | OPENSSL_cleanse(tmp, inlen); |
273 | OPENSSL_free(tmp); | 273 | free(tmp); |
274 | return rv; | 274 | return rv; |
275 | 275 | ||
276 | } | 276 | } |
@@ -405,7 +405,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
405 | if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx)) | 405 | if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx)) |
406 | goto err; | 406 | goto err; |
407 | 407 | ||
408 | key = OPENSSL_malloc(keylen); | 408 | key = malloc(keylen); |
409 | 409 | ||
410 | if (!key) | 410 | if (!key) |
411 | goto err; | 411 | goto err; |
@@ -417,7 +417,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
417 | } | 417 | } |
418 | else | 418 | else |
419 | { | 419 | { |
420 | key = OPENSSL_malloc(pwri->encryptedKey->length); | 420 | key = malloc(pwri->encryptedKey->length); |
421 | 421 | ||
422 | if (!key) | 422 | if (!key) |
423 | { | 423 | { |
@@ -446,7 +446,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
446 | EVP_CIPHER_CTX_cleanup(&kekctx); | 446 | EVP_CIPHER_CTX_cleanup(&kekctx); |
447 | 447 | ||
448 | if (!r && key) | 448 | if (!r && key) |
449 | OPENSSL_free(key); | 449 | free(key); |
450 | X509_ALGOR_free(kekalg); | 450 | X509_ALGOR_free(kekalg); |
451 | 451 | ||
452 | return r; | 452 | return r; |
diff --git a/src/lib/libssl/src/crypto/cms/cms_sd.c b/src/lib/libssl/src/crypto/cms/cms_sd.c index 77fbd13596..d852af596d 100644 --- a/src/lib/libssl/src/crypto/cms/cms_sd.c +++ b/src/lib/libssl/src/crypto/cms/cms_sd.c | |||
@@ -658,7 +658,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, | |||
658 | { | 658 | { |
659 | unsigned char *sig; | 659 | unsigned char *sig; |
660 | unsigned int siglen; | 660 | unsigned int siglen; |
661 | sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); | 661 | sig = malloc(EVP_PKEY_size(si->pkey)); |
662 | if (!sig) | 662 | if (!sig) |
663 | { | 663 | { |
664 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, | 664 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, |
@@ -669,7 +669,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, | |||
669 | { | 669 | { |
670 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, | 670 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, |
671 | CMS_R_SIGNFINAL_ERROR); | 671 | CMS_R_SIGNFINAL_ERROR); |
672 | OPENSSL_free(sig); | 672 | free(sig); |
673 | goto err; | 673 | goto err; |
674 | } | 674 | } |
675 | ASN1_STRING_set0(si->signature, sig, siglen); | 675 | ASN1_STRING_set0(si->signature, sig, siglen); |
@@ -738,8 +738,8 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
738 | goto err; | 738 | goto err; |
739 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) | 739 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) |
740 | goto err; | 740 | goto err; |
741 | OPENSSL_free(abuf); | 741 | free(abuf); |
742 | abuf = OPENSSL_malloc(siglen); | 742 | abuf = malloc(siglen); |
743 | if(!abuf) | 743 | if(!abuf) |
744 | goto err; | 744 | goto err; |
745 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) | 745 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) |
@@ -760,7 +760,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
760 | 760 | ||
761 | err: | 761 | err: |
762 | if (abuf) | 762 | if (abuf) |
763 | OPENSSL_free(abuf); | 763 | free(abuf); |
764 | EVP_MD_CTX_cleanup(&mctx); | 764 | EVP_MD_CTX_cleanup(&mctx); |
765 | return 0; | 765 | return 0; |
766 | 766 | ||
@@ -792,7 +792,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) | |||
792 | if(!abuf) | 792 | if(!abuf) |
793 | goto err; | 793 | goto err; |
794 | r = EVP_DigestVerifyUpdate(&mctx, abuf, alen); | 794 | r = EVP_DigestVerifyUpdate(&mctx, abuf, alen); |
795 | OPENSSL_free(abuf); | 795 | free(abuf); |
796 | if (r <= 0) | 796 | if (r <= 0) |
797 | { | 797 | { |
798 | r = -1; | 798 | r = -1; |
@@ -917,7 +917,7 @@ int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs) | |||
917 | return 0; | 917 | return 0; |
918 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, | 918 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, |
919 | V_ASN1_SEQUENCE, smder, smderlen); | 919 | V_ASN1_SEQUENCE, smder, smderlen); |
920 | OPENSSL_free(smder); | 920 | free(smder); |
921 | return r; | 921 | return r; |
922 | } | 922 | } |
923 | 923 | ||
diff --git a/src/lib/libssl/src/crypto/comp/c_zlib.c b/src/lib/libssl/src/crypto/comp/c_zlib.c index 8adf35f3fc..2ced7c10cc 100644 --- a/src/lib/libssl/src/crypto/comp/c_zlib.c +++ b/src/lib/libssl/src/crypto/comp/c_zlib.c | |||
@@ -37,7 +37,7 @@ static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | |||
37 | { | 37 | { |
38 | void *p; | 38 | void *p; |
39 | 39 | ||
40 | p=OPENSSL_malloc(no*size); | 40 | p=malloc(no*size); |
41 | if (p) | 41 | if (p) |
42 | memset(p, 0, no*size); | 42 | memset(p, 0, no*size); |
43 | return p; | 43 | return p; |
@@ -46,7 +46,7 @@ static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | |||
46 | 46 | ||
47 | static void zlib_zfree(void* opaque, void* address) | 47 | static void zlib_zfree(void* opaque, void* address) |
48 | { | 48 | { |
49 | OPENSSL_free(address); | 49 | free(address); |
50 | } | 50 | } |
51 | 51 | ||
52 | #if 0 | 52 | #if 0 |
@@ -140,7 +140,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
140 | { | 140 | { |
141 | int err; | 141 | int err; |
142 | struct zlib_state *state = | 142 | struct zlib_state *state = |
143 | (struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state)); | 143 | (struct zlib_state *)malloc(sizeof(struct zlib_state)); |
144 | 144 | ||
145 | if (state == NULL) | 145 | if (state == NULL) |
146 | goto err; | 146 | goto err; |
@@ -173,7 +173,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); | 173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); |
174 | return 1; | 174 | return 1; |
175 | err: | 175 | err: |
176 | if (state) OPENSSL_free(state); | 176 | if (state) free(state); |
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
@@ -184,7 +184,7 @@ static void zlib_stateful_finish(COMP_CTX *ctx) | |||
184 | zlib_stateful_ex_idx); | 184 | zlib_stateful_ex_idx); |
185 | inflateEnd(&state->istream); | 185 | inflateEnd(&state->istream); |
186 | deflateEnd(&state->ostream); | 186 | deflateEnd(&state->ostream); |
187 | OPENSSL_free(state); | 187 | free(state); |
188 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data); | 188 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data); |
189 | } | 189 | } |
190 | 190 | ||
@@ -479,7 +479,7 @@ static int bio_zlib_new(BIO *bi) | |||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | #endif | 481 | #endif |
482 | ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX)); | 482 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); |
483 | if(!ctx) | 483 | if(!ctx) |
484 | { | 484 | { |
485 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); | 485 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); |
@@ -518,15 +518,15 @@ static int bio_zlib_free(BIO *bi) | |||
518 | { | 518 | { |
519 | /* Destroy decompress context */ | 519 | /* Destroy decompress context */ |
520 | inflateEnd(&ctx->zin); | 520 | inflateEnd(&ctx->zin); |
521 | OPENSSL_free(ctx->ibuf); | 521 | free(ctx->ibuf); |
522 | } | 522 | } |
523 | if(ctx->obuf) | 523 | if(ctx->obuf) |
524 | { | 524 | { |
525 | /* Destroy compress context */ | 525 | /* Destroy compress context */ |
526 | deflateEnd(&ctx->zout); | 526 | deflateEnd(&ctx->zout); |
527 | OPENSSL_free(ctx->obuf); | 527 | free(ctx->obuf); |
528 | } | 528 | } |
529 | OPENSSL_free(ctx); | 529 | free(ctx); |
530 | bi->ptr = NULL; | 530 | bi->ptr = NULL; |
531 | bi->init = 0; | 531 | bi->init = 0; |
532 | bi->flags = 0; | 532 | bi->flags = 0; |
@@ -544,7 +544,7 @@ static int bio_zlib_read(BIO *b, char *out, int outl) | |||
544 | BIO_clear_retry_flags(b); | 544 | BIO_clear_retry_flags(b); |
545 | if(!ctx->ibuf) | 545 | if(!ctx->ibuf) |
546 | { | 546 | { |
547 | ctx->ibuf = OPENSSL_malloc(ctx->ibufsize); | 547 | ctx->ibuf = malloc(ctx->ibufsize); |
548 | if(!ctx->ibuf) | 548 | if(!ctx->ibuf) |
549 | { | 549 | { |
550 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); | 550 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); |
@@ -606,7 +606,7 @@ static int bio_zlib_write(BIO *b, const char *in, int inl) | |||
606 | BIO_clear_retry_flags(b); | 606 | BIO_clear_retry_flags(b); |
607 | if(!ctx->obuf) | 607 | if(!ctx->obuf) |
608 | { | 608 | { |
609 | ctx->obuf = OPENSSL_malloc(ctx->obufsize); | 609 | ctx->obuf = malloc(ctx->obufsize); |
610 | /* Need error here */ | 610 | /* Need error here */ |
611 | if(!ctx->obuf) | 611 | if(!ctx->obuf) |
612 | { | 612 | { |
@@ -754,7 +754,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
754 | { | 754 | { |
755 | if (ctx->ibuf) | 755 | if (ctx->ibuf) |
756 | { | 756 | { |
757 | OPENSSL_free(ctx->ibuf); | 757 | free(ctx->ibuf); |
758 | ctx->ibuf = NULL; | 758 | ctx->ibuf = NULL; |
759 | } | 759 | } |
760 | ctx->ibufsize = ibs; | 760 | ctx->ibufsize = ibs; |
@@ -764,7 +764,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
764 | { | 764 | { |
765 | if (ctx->obuf) | 765 | if (ctx->obuf) |
766 | { | 766 | { |
767 | OPENSSL_free(ctx->obuf); | 767 | free(ctx->obuf); |
768 | ctx->obuf = NULL; | 768 | ctx->obuf = NULL; |
769 | } | 769 | } |
770 | ctx->obufsize = obs; | 770 | ctx->obufsize = obs; |
diff --git a/src/lib/libssl/src/crypto/comp/comp_lib.c b/src/lib/libssl/src/crypto/comp/comp_lib.c index b60ae371e8..feb07ea881 100644 --- a/src/lib/libssl/src/crypto/comp/comp_lib.c +++ b/src/lib/libssl/src/crypto/comp/comp_lib.c | |||
@@ -8,7 +8,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) | |||
8 | { | 8 | { |
9 | COMP_CTX *ret; | 9 | COMP_CTX *ret; |
10 | 10 | ||
11 | if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) | 11 | if ((ret=(COMP_CTX *)malloc(sizeof(COMP_CTX))) == NULL) |
12 | { | 12 | { |
13 | /* ZZZZZZZZZZZZZZZZ */ | 13 | /* ZZZZZZZZZZZZZZZZ */ |
14 | return(NULL); | 14 | return(NULL); |
@@ -17,7 +17,7 @@ COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) | |||
17 | ret->meth=meth; | 17 | ret->meth=meth; |
18 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | 18 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) |
19 | { | 19 | { |
20 | OPENSSL_free(ret); | 20 | free(ret); |
21 | ret=NULL; | 21 | ret=NULL; |
22 | } | 22 | } |
23 | return(ret); | 23 | return(ret); |
@@ -31,7 +31,7 @@ void COMP_CTX_free(COMP_CTX *ctx) | |||
31 | if (ctx->meth->finish != NULL) | 31 | if (ctx->meth->finish != NULL) |
32 | ctx->meth->finish(ctx); | 32 | ctx->meth->finish(ctx); |
33 | 33 | ||
34 | OPENSSL_free(ctx); | 34 | free(ctx); |
35 | } | 35 | } |
36 | 36 | ||
37 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, | 37 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, |
diff --git a/src/lib/libssl/src/crypto/conf/conf_api.c b/src/lib/libssl/src/crypto/conf/conf_api.c index f5fcbb9f6b..dc6eb579bf 100644 --- a/src/lib/libssl/src/crypto/conf/conf_api.c +++ b/src/lib/libssl/src/crypto/conf/conf_api.c | |||
@@ -119,9 +119,9 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) | |||
119 | if (v != NULL) | 119 | if (v != NULL) |
120 | { | 120 | { |
121 | (void)sk_CONF_VALUE_delete_ptr(ts,v); | 121 | (void)sk_CONF_VALUE_delete_ptr(ts,v); |
122 | OPENSSL_free(v->name); | 122 | free(v->name); |
123 | OPENSSL_free(v->value); | 123 | free(v->value); |
124 | OPENSSL_free(v); | 124 | free(v); |
125 | } | 125 | } |
126 | return 1; | 126 | return 1; |
127 | } | 127 | } |
@@ -226,7 +226,7 @@ void _CONF_free_data(CONF *conf) | |||
226 | if (conf == NULL || conf->data == NULL) return; | 226 | if (conf == NULL || conf->data == NULL) return; |
227 | 227 | ||
228 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make | 228 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make |
229 | * sure the 'OPENSSL_free()' works as | 229 | * sure the 'free()' works as |
230 | * expected */ | 230 | * expected */ |
231 | lh_CONF_VALUE_doall_arg(conf->data, | 231 | lh_CONF_VALUE_doall_arg(conf->data, |
232 | LHASH_DOALL_ARG_FN(value_free_hash), | 232 | LHASH_DOALL_ARG_FN(value_free_hash), |
@@ -257,13 +257,13 @@ static void value_free_stack_doall(CONF_VALUE *a) | |||
257 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) | 257 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) |
258 | { | 258 | { |
259 | vv=sk_CONF_VALUE_value(sk,i); | 259 | vv=sk_CONF_VALUE_value(sk,i); |
260 | OPENSSL_free(vv->value); | 260 | free(vv->value); |
261 | OPENSSL_free(vv->name); | 261 | free(vv->name); |
262 | OPENSSL_free(vv); | 262 | free(vv); |
263 | } | 263 | } |
264 | if (sk != NULL) sk_CONF_VALUE_free(sk); | 264 | if (sk != NULL) sk_CONF_VALUE_free(sk); |
265 | OPENSSL_free(a->section); | 265 | free(a->section); |
266 | OPENSSL_free(a); | 266 | free(a); |
267 | } | 267 | } |
268 | 268 | ||
269 | /* Up until OpenSSL 0.9.5a, this was new_section */ | 269 | /* Up until OpenSSL 0.9.5a, this was new_section */ |
@@ -275,10 +275,10 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | |||
275 | 275 | ||
276 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) | 276 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) |
277 | goto err; | 277 | goto err; |
278 | if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) | 278 | if ((v=malloc(sizeof(CONF_VALUE))) == NULL) |
279 | goto err; | 279 | goto err; |
280 | i=strlen(section)+1; | 280 | i=strlen(section)+1; |
281 | if ((v->section=OPENSSL_malloc(i)) == NULL) | 281 | if ((v->section=malloc(i)) == NULL) |
282 | goto err; | 282 | goto err; |
283 | 283 | ||
284 | memcpy(v->section,section,i); | 284 | memcpy(v->section,section,i); |
@@ -292,7 +292,7 @@ err: | |||
292 | if (!ok) | 292 | if (!ok) |
293 | { | 293 | { |
294 | if (sk != NULL) sk_CONF_VALUE_free(sk); | 294 | if (sk != NULL) sk_CONF_VALUE_free(sk); |
295 | if (v != NULL) OPENSSL_free(v); | 295 | if (v != NULL) free(v); |
296 | v=NULL; | 296 | v=NULL; |
297 | } | 297 | } |
298 | return(v); | 298 | return(v); |
diff --git a/src/lib/libssl/src/crypto/conf/conf_def.c b/src/lib/libssl/src/crypto/conf/conf_def.c index 15e5613e36..32d47458a0 100644 --- a/src/lib/libssl/src/crypto/conf/conf_def.c +++ b/src/lib/libssl/src/crypto/conf/conf_def.c | |||
@@ -129,11 +129,11 @@ static CONF *def_create(CONF_METHOD *meth) | |||
129 | { | 129 | { |
130 | CONF *ret; | 130 | CONF *ret; |
131 | 131 | ||
132 | ret = OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *)); | 132 | ret = malloc(sizeof(CONF) + sizeof(unsigned short *)); |
133 | if (ret) | 133 | if (ret) |
134 | if (meth->init(ret) == 0) | 134 | if (meth->init(ret) == 0) |
135 | { | 135 | { |
136 | OPENSSL_free(ret); | 136 | free(ret); |
137 | ret = NULL; | 137 | ret = NULL; |
138 | } | 138 | } |
139 | return ret; | 139 | return ret; |
@@ -167,7 +167,7 @@ static int def_destroy(CONF *conf) | |||
167 | { | 167 | { |
168 | if (def_destroy_data(conf)) | 168 | if (def_destroy_data(conf)) |
169 | { | 169 | { |
170 | OPENSSL_free(conf); | 170 | free(conf); |
171 | return 1; | 171 | return 1; |
172 | } | 172 | } |
173 | return 0; | 173 | return 0; |
@@ -228,7 +228,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
228 | goto err; | 228 | goto err; |
229 | } | 229 | } |
230 | 230 | ||
231 | section=(char *)OPENSSL_malloc(10); | 231 | section=(char *)malloc(10); |
232 | if (section == NULL) | 232 | if (section == NULL) |
233 | { | 233 | { |
234 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | 234 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); |
@@ -373,14 +373,14 @@ again: | |||
373 | p++; | 373 | p++; |
374 | *p='\0'; | 374 | *p='\0'; |
375 | 375 | ||
376 | if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) | 376 | if (!(v=(CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) |
377 | { | 377 | { |
378 | CONFerr(CONF_F_DEF_LOAD_BIO, | 378 | CONFerr(CONF_F_DEF_LOAD_BIO, |
379 | ERR_R_MALLOC_FAILURE); | 379 | ERR_R_MALLOC_FAILURE); |
380 | goto err; | 380 | goto err; |
381 | } | 381 | } |
382 | if (psection == NULL) psection=section; | 382 | if (psection == NULL) psection=section; |
383 | v->name=(char *)OPENSSL_malloc(strlen(pname)+1); | 383 | v->name=(char *)malloc(strlen(pname)+1); |
384 | v->value=NULL; | 384 | v->value=NULL; |
385 | if (v->name == NULL) | 385 | if (v->name == NULL) |
386 | { | 386 | { |
@@ -424,20 +424,20 @@ again: | |||
424 | if (vv != NULL) | 424 | if (vv != NULL) |
425 | { | 425 | { |
426 | sk_CONF_VALUE_delete_ptr(ts,vv); | 426 | sk_CONF_VALUE_delete_ptr(ts,vv); |
427 | OPENSSL_free(vv->name); | 427 | free(vv->name); |
428 | OPENSSL_free(vv->value); | 428 | free(vv->value); |
429 | OPENSSL_free(vv); | 429 | free(vv); |
430 | } | 430 | } |
431 | #endif | 431 | #endif |
432 | v=NULL; | 432 | v=NULL; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | if (buff != NULL) BUF_MEM_free(buff); | 435 | if (buff != NULL) BUF_MEM_free(buff); |
436 | if (section != NULL) OPENSSL_free(section); | 436 | if (section != NULL) free(section); |
437 | return(1); | 437 | return(1); |
438 | err: | 438 | err: |
439 | if (buff != NULL) BUF_MEM_free(buff); | 439 | if (buff != NULL) BUF_MEM_free(buff); |
440 | if (section != NULL) OPENSSL_free(section); | 440 | if (section != NULL) free(section); |
441 | if (line != NULL) *line=eline; | 441 | if (line != NULL) *line=eline; |
442 | (void) snprintf(btmp,sizeof btmp,"%ld",eline); | 442 | (void) snprintf(btmp,sizeof btmp,"%ld",eline); |
443 | ERR_add_error_data(2,"line ",btmp); | 443 | ERR_add_error_data(2,"line ",btmp); |
@@ -448,9 +448,9 @@ err: | |||
448 | } | 448 | } |
449 | if (v != NULL) | 449 | if (v != NULL) |
450 | { | 450 | { |
451 | if (v->name != NULL) OPENSSL_free(v->name); | 451 | if (v->name != NULL) free(v->name); |
452 | if (v->value != NULL) OPENSSL_free(v->value); | 452 | if (v->value != NULL) free(v->value); |
453 | if (v != NULL) OPENSSL_free(v); | 453 | if (v != NULL) free(v); |
454 | } | 454 | } |
455 | return(0); | 455 | return(0); |
456 | } | 456 | } |
@@ -637,9 +637,9 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) | |||
637 | buf->data[to++]= *(from++); | 637 | buf->data[to++]= *(from++); |
638 | } | 638 | } |
639 | buf->data[to]='\0'; | 639 | buf->data[to]='\0'; |
640 | if (*pto != NULL) OPENSSL_free(*pto); | 640 | if (*pto != NULL) free(*pto); |
641 | *pto=buf->data; | 641 | *pto=buf->data; |
642 | OPENSSL_free(buf); | 642 | free(buf); |
643 | return(1); | 643 | return(1); |
644 | err: | 644 | err: |
645 | if (buf != NULL) BUF_MEM_free(buf); | 645 | if (buf != NULL) BUF_MEM_free(buf); |
diff --git a/src/lib/libssl/src/crypto/conf/conf_mod.c b/src/lib/libssl/src/crypto/conf/conf_mod.c index 994294f655..652ad6469a 100644 --- a/src/lib/libssl/src/crypto/conf/conf_mod.c +++ b/src/lib/libssl/src/crypto/conf/conf_mod.c | |||
@@ -197,7 +197,7 @@ int CONF_modules_load_file(const char *filename, const char *appname, | |||
197 | 197 | ||
198 | err: | 198 | err: |
199 | if (filename == NULL) | 199 | if (filename == NULL) |
200 | OPENSSL_free(file); | 200 | free(file); |
201 | NCONF_free(conf); | 201 | NCONF_free(conf); |
202 | 202 | ||
203 | return ret; | 203 | return ret; |
@@ -296,7 +296,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, | |||
296 | supported_modules = sk_CONF_MODULE_new_null(); | 296 | supported_modules = sk_CONF_MODULE_new_null(); |
297 | if (supported_modules == NULL) | 297 | if (supported_modules == NULL) |
298 | return NULL; | 298 | return NULL; |
299 | tmod = OPENSSL_malloc(sizeof(CONF_MODULE)); | 299 | tmod = malloc(sizeof(CONF_MODULE)); |
300 | if (tmod == NULL) | 300 | if (tmod == NULL) |
301 | return NULL; | 301 | return NULL; |
302 | 302 | ||
@@ -308,7 +308,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, | |||
308 | 308 | ||
309 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) | 309 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) |
310 | { | 310 | { |
311 | OPENSSL_free(tmod); | 311 | free(tmod); |
312 | return NULL; | 312 | return NULL; |
313 | } | 313 | } |
314 | 314 | ||
@@ -352,7 +352,7 @@ static int module_init(CONF_MODULE *pmod, char *name, char *value, | |||
352 | CONF_IMODULE *imod = NULL; | 352 | CONF_IMODULE *imod = NULL; |
353 | 353 | ||
354 | /* Otherwise add initialized module to list */ | 354 | /* Otherwise add initialized module to list */ |
355 | imod = OPENSSL_malloc(sizeof(CONF_IMODULE)); | 355 | imod = malloc(sizeof(CONF_IMODULE)); |
356 | if (!imod) | 356 | if (!imod) |
357 | goto err; | 357 | goto err; |
358 | 358 | ||
@@ -404,10 +404,10 @@ static int module_init(CONF_MODULE *pmod, char *name, char *value, | |||
404 | if (imod) | 404 | if (imod) |
405 | { | 405 | { |
406 | if (imod->name) | 406 | if (imod->name) |
407 | OPENSSL_free(imod->name); | 407 | free(imod->name); |
408 | if (imod->value) | 408 | if (imod->value) |
409 | OPENSSL_free(imod->value); | 409 | free(imod->value); |
410 | OPENSSL_free(imod); | 410 | free(imod); |
411 | } | 411 | } |
412 | 412 | ||
413 | return -1; | 413 | return -1; |
@@ -447,8 +447,8 @@ static void module_free(CONF_MODULE *md) | |||
447 | { | 447 | { |
448 | if (md->dso) | 448 | if (md->dso) |
449 | DSO_free(md->dso); | 449 | DSO_free(md->dso); |
450 | OPENSSL_free(md->name); | 450 | free(md->name); |
451 | OPENSSL_free(md); | 451 | free(md); |
452 | } | 452 | } |
453 | 453 | ||
454 | /* finish and free up all modules instances */ | 454 | /* finish and free up all modules instances */ |
@@ -472,9 +472,9 @@ static void module_finish(CONF_IMODULE *imod) | |||
472 | if (imod->pmod->finish) | 472 | if (imod->pmod->finish) |
473 | imod->pmod->finish(imod); | 473 | imod->pmod->finish(imod); |
474 | imod->pmod->links--; | 474 | imod->pmod->links--; |
475 | OPENSSL_free(imod->name); | 475 | free(imod->name); |
476 | OPENSSL_free(imod->value); | 476 | free(imod->value); |
477 | OPENSSL_free(imod); | 477 | free(imod); |
478 | } | 478 | } |
479 | 479 | ||
480 | /* Add a static module to OpenSSL */ | 480 | /* Add a static module to OpenSSL */ |
@@ -558,7 +558,7 @@ char *CONF_get1_default_config_file(void) | |||
558 | #endif | 558 | #endif |
559 | len += strlen(OPENSSL_CONF); | 559 | len += strlen(OPENSSL_CONF); |
560 | 560 | ||
561 | file = OPENSSL_malloc(len + 1); | 561 | file = malloc(len + 1); |
562 | 562 | ||
563 | if (!file) | 563 | if (!file) |
564 | return NULL; | 564 | return NULL; |
diff --git a/src/lib/libssl/src/crypto/cryptlib.c b/src/lib/libssl/src/crypto/cryptlib.c index 2bf5def17d..dc3cc2ab02 100644 --- a/src/lib/libssl/src/crypto/cryptlib.c +++ b/src/lib/libssl/src/crypto/cryptlib.c | |||
@@ -211,7 +211,7 @@ CRYPTO_get_new_lockid(char *name) | |||
211 | } | 211 | } |
212 | i = sk_OPENSSL_STRING_push(app_locks, str); | 212 | i = sk_OPENSSL_STRING_push(app_locks, str); |
213 | if (!i) | 213 | if (!i) |
214 | OPENSSL_free(str); | 214 | free(str); |
215 | else | 215 | else |
216 | i += CRYPTO_NUM_LOCKS; /* gap of one :-) */ | 216 | i += CRYPTO_NUM_LOCKS; /* gap of one :-) */ |
217 | return (i); | 217 | return (i); |
@@ -242,7 +242,7 @@ CRYPTO_get_new_dynlockid(void) | |||
242 | } | 242 | } |
243 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | 243 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); |
244 | 244 | ||
245 | pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock)); | 245 | pointer = (CRYPTO_dynlock *)malloc(sizeof(CRYPTO_dynlock)); |
246 | if (pointer == NULL) { | 246 | if (pointer == NULL) { |
247 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); | 247 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); |
248 | return (0); | 248 | return (0); |
@@ -250,7 +250,7 @@ CRYPTO_get_new_dynlockid(void) | |||
250 | pointer->references = 1; | 250 | pointer->references = 1; |
251 | pointer->data = dynlock_create_callback(__FILE__, __LINE__); | 251 | pointer->data = dynlock_create_callback(__FILE__, __LINE__); |
252 | if (pointer->data == NULL) { | 252 | if (pointer->data == NULL) { |
253 | OPENSSL_free(pointer); | 253 | free(pointer); |
254 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); | 254 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); |
255 | return (0); | 255 | return (0); |
256 | } | 256 | } |
@@ -273,7 +273,7 @@ CRYPTO_get_new_dynlockid(void) | |||
273 | 273 | ||
274 | if (i == -1) { | 274 | if (i == -1) { |
275 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); | 275 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); |
276 | OPENSSL_free(pointer); | 276 | free(pointer); |
277 | } else | 277 | } else |
278 | i += 1; /* to avoid 0 */ | 278 | i += 1; /* to avoid 0 */ |
279 | return - i; | 279 | return - i; |
@@ -312,7 +312,7 @@ CRYPTO_destroy_dynlockid(int i) | |||
312 | 312 | ||
313 | if (pointer) { | 313 | if (pointer) { |
314 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); | 314 | dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); |
315 | OPENSSL_free(pointer); | 315 | free(pointer); |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
diff --git a/src/lib/libssl/src/crypto/des/enc_read.c b/src/lib/libssl/src/crypto/des/enc_read.c index edb6620d08..23ad458dcf 100644 --- a/src/lib/libssl/src/crypto/des/enc_read.c +++ b/src/lib/libssl/src/crypto/des/enc_read.c | |||
@@ -106,17 +106,17 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | |||
106 | 106 | ||
107 | if (tmpbuf == NULL) | 107 | if (tmpbuf == NULL) |
108 | { | 108 | { |
109 | tmpbuf=OPENSSL_malloc(BSIZE); | 109 | tmpbuf=malloc(BSIZE); |
110 | if (tmpbuf == NULL) return(-1); | 110 | if (tmpbuf == NULL) return(-1); |
111 | } | 111 | } |
112 | if (net == NULL) | 112 | if (net == NULL) |
113 | { | 113 | { |
114 | net=OPENSSL_malloc(BSIZE); | 114 | net=malloc(BSIZE); |
115 | if (net == NULL) return(-1); | 115 | if (net == NULL) return(-1); |
116 | } | 116 | } |
117 | if (unnet == NULL) | 117 | if (unnet == NULL) |
118 | { | 118 | { |
119 | unnet=OPENSSL_malloc(BSIZE); | 119 | unnet=malloc(BSIZE); |
120 | if (unnet == NULL) return(-1); | 120 | if (unnet == NULL) return(-1); |
121 | } | 121 | } |
122 | /* left over data from last decrypt */ | 122 | /* left over data from last decrypt */ |
diff --git a/src/lib/libssl/src/crypto/des/enc_writ.c b/src/lib/libssl/src/crypto/des/enc_writ.c index 2353ac1e89..8f6b033c87 100644 --- a/src/lib/libssl/src/crypto/des/enc_writ.c +++ b/src/lib/libssl/src/crypto/des/enc_writ.c | |||
@@ -98,7 +98,7 @@ int DES_enc_write(int fd, const void *_buf, int len, | |||
98 | 98 | ||
99 | if (outbuf == NULL) | 99 | if (outbuf == NULL) |
100 | { | 100 | { |
101 | outbuf=OPENSSL_malloc(BSIZE+HDRSIZE); | 101 | outbuf=malloc(BSIZE+HDRSIZE); |
102 | if (outbuf == NULL) return(-1); | 102 | if (outbuf == NULL) return(-1); |
103 | } | 103 | } |
104 | /* If we are sending less than 8 bytes, the same char will look | 104 | /* If we are sending less than 8 bytes, the same char will look |
diff --git a/src/lib/libssl/src/crypto/dh/dh_ameth.c b/src/lib/libssl/src/crypto/dh/dh_ameth.c index 02ec2d47b4..d39f4b373d 100644 --- a/src/lib/libssl/src/crypto/dh/dh_ameth.c +++ b/src/lib/libssl/src/crypto/dh/dh_ameth.c | |||
@@ -168,7 +168,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
168 | 168 | ||
169 | err: | 169 | err: |
170 | if (penc) | 170 | if (penc) |
171 | OPENSSL_free(penc); | 171 | free(penc); |
172 | if (pval) | 172 | if (pval) |
173 | ASN1_STRING_free(pval); | 173 | ASN1_STRING_free(pval); |
174 | 174 | ||
@@ -277,7 +277,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
277 | 277 | ||
278 | err: | 278 | err: |
279 | if (dp != NULL) | 279 | if (dp != NULL) |
280 | OPENSSL_free(dp); | 280 | free(dp); |
281 | if (params != NULL) | 281 | if (params != NULL) |
282 | ASN1_STRING_free(params); | 282 | ASN1_STRING_free(params); |
283 | if (prkey != NULL) | 283 | if (prkey != NULL) |
@@ -353,7 +353,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, | |||
353 | else | 353 | else |
354 | ktype = "PKCS#3 DH Parameters"; | 354 | ktype = "PKCS#3 DH Parameters"; |
355 | 355 | ||
356 | m= OPENSSL_malloc(buf_len+10); | 356 | m= malloc(buf_len+10); |
357 | if (m == NULL) | 357 | if (m == NULL) |
358 | { | 358 | { |
359 | reason=ERR_R_MALLOC_FAILURE; | 359 | reason=ERR_R_MALLOC_FAILURE; |
@@ -384,7 +384,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, | |||
384 | err: | 384 | err: |
385 | DHerr(DH_F_DO_DH_PRINT,reason); | 385 | DHerr(DH_F_DO_DH_PRINT,reason); |
386 | } | 386 | } |
387 | if (m != NULL) OPENSSL_free(m); | 387 | if (m != NULL) free(m); |
388 | return(ret); | 388 | return(ret); |
389 | } | 389 | } |
390 | 390 | ||
diff --git a/src/lib/libssl/src/crypto/dh/dh_lib.c b/src/lib/libssl/src/crypto/dh/dh_lib.c index a40caaf75b..4e3d25b7e5 100644 --- a/src/lib/libssl/src/crypto/dh/dh_lib.c +++ b/src/lib/libssl/src/crypto/dh/dh_lib.c | |||
@@ -110,7 +110,7 @@ DH *DH_new_method(ENGINE *engine) | |||
110 | { | 110 | { |
111 | DH *ret; | 111 | DH *ret; |
112 | 112 | ||
113 | ret=(DH *)OPENSSL_malloc(sizeof(DH)); | 113 | ret=(DH *)malloc(sizeof(DH)); |
114 | if (ret == NULL) | 114 | if (ret == NULL) |
115 | { | 115 | { |
116 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 116 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -124,7 +124,7 @@ DH *DH_new_method(ENGINE *engine) | |||
124 | if (!ENGINE_init(engine)) | 124 | if (!ENGINE_init(engine)) |
125 | { | 125 | { |
126 | DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB); | 126 | DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB); |
127 | OPENSSL_free(ret); | 127 | free(ret); |
128 | return NULL; | 128 | return NULL; |
129 | } | 129 | } |
130 | ret->engine = engine; | 130 | ret->engine = engine; |
@@ -138,7 +138,7 @@ DH *DH_new_method(ENGINE *engine) | |||
138 | { | 138 | { |
139 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_ENGINE_LIB); | 139 | DHerr(DH_F_DH_NEW_METHOD,ERR_R_ENGINE_LIB); |
140 | ENGINE_finish(ret->engine); | 140 | ENGINE_finish(ret->engine); |
141 | OPENSSL_free(ret); | 141 | free(ret); |
142 | return NULL; | 142 | return NULL; |
143 | } | 143 | } |
144 | } | 144 | } |
@@ -167,7 +167,7 @@ DH *DH_new_method(ENGINE *engine) | |||
167 | ENGINE_finish(ret->engine); | 167 | ENGINE_finish(ret->engine); |
168 | #endif | 168 | #endif |
169 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); | 169 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); |
170 | OPENSSL_free(ret); | 170 | free(ret); |
171 | ret=NULL; | 171 | ret=NULL; |
172 | } | 172 | } |
173 | return(ret); | 173 | return(ret); |
@@ -203,11 +203,11 @@ void DH_free(DH *r) | |||
203 | if (r->g != NULL) BN_clear_free(r->g); | 203 | if (r->g != NULL) BN_clear_free(r->g); |
204 | if (r->q != NULL) BN_clear_free(r->q); | 204 | if (r->q != NULL) BN_clear_free(r->q); |
205 | if (r->j != NULL) BN_clear_free(r->j); | 205 | if (r->j != NULL) BN_clear_free(r->j); |
206 | if (r->seed) OPENSSL_free(r->seed); | 206 | if (r->seed) free(r->seed); |
207 | if (r->counter != NULL) BN_clear_free(r->counter); | 207 | if (r->counter != NULL) BN_clear_free(r->counter); |
208 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); | 208 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); |
209 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); | 209 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); |
210 | OPENSSL_free(r); | 210 | free(r); |
211 | } | 211 | } |
212 | 212 | ||
213 | int DH_up_ref(DH *r) | 213 | int DH_up_ref(DH *r) |
diff --git a/src/lib/libssl/src/crypto/dh/dh_pmeth.c b/src/lib/libssl/src/crypto/dh/dh_pmeth.c index 5ae72b7d4c..ec4553c0a8 100644 --- a/src/lib/libssl/src/crypto/dh/dh_pmeth.c +++ b/src/lib/libssl/src/crypto/dh/dh_pmeth.c | |||
@@ -80,7 +80,7 @@ typedef struct | |||
80 | static int pkey_dh_init(EVP_PKEY_CTX *ctx) | 80 | static int pkey_dh_init(EVP_PKEY_CTX *ctx) |
81 | { | 81 | { |
82 | DH_PKEY_CTX *dctx; | 82 | DH_PKEY_CTX *dctx; |
83 | dctx = OPENSSL_malloc(sizeof(DH_PKEY_CTX)); | 83 | dctx = malloc(sizeof(DH_PKEY_CTX)); |
84 | if (!dctx) | 84 | if (!dctx) |
85 | return 0; | 85 | return 0; |
86 | dctx->prime_len = 1024; | 86 | dctx->prime_len = 1024; |
@@ -111,7 +111,7 @@ static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx) | |||
111 | { | 111 | { |
112 | DH_PKEY_CTX *dctx = ctx->data; | 112 | DH_PKEY_CTX *dctx = ctx->data; |
113 | if (dctx) | 113 | if (dctx) |
114 | OPENSSL_free(dctx); | 114 | free(dctx); |
115 | } | 115 | } |
116 | 116 | ||
117 | static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | 117 | static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_ameth.c b/src/lib/libssl/src/crypto/dsa/dsa_ameth.c index 376156ec5e..e9c549802d 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_ameth.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_ameth.c | |||
@@ -176,7 +176,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
176 | 176 | ||
177 | err: | 177 | err: |
178 | if (penc) | 178 | if (penc) |
179 | OPENSSL_free(penc); | 179 | free(penc); |
180 | if (pval) | 180 | if (pval) |
181 | ASN1_STRING_free(pval); | 181 | ASN1_STRING_free(pval); |
182 | 182 | ||
@@ -344,7 +344,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
344 | 344 | ||
345 | err: | 345 | err: |
346 | if (dp != NULL) | 346 | if (dp != NULL) |
347 | OPENSSL_free(dp); | 347 | free(dp); |
348 | if (params != NULL) | 348 | if (params != NULL) |
349 | ASN1_STRING_free(params); | 349 | ASN1_STRING_free(params); |
350 | if (prkey != NULL) | 350 | if (prkey != NULL) |
@@ -459,7 +459,7 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) | |||
459 | update_buflen(priv_key, &buf_len); | 459 | update_buflen(priv_key, &buf_len); |
460 | update_buflen(pub_key, &buf_len); | 460 | update_buflen(pub_key, &buf_len); |
461 | 461 | ||
462 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | 462 | m=(unsigned char *)malloc(buf_len+10); |
463 | if (m == NULL) | 463 | if (m == NULL) |
464 | { | 464 | { |
465 | DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE); | 465 | DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE); |
@@ -483,7 +483,7 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) | |||
483 | if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err; | 483 | if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err; |
484 | ret=1; | 484 | ret=1; |
485 | err: | 485 | err: |
486 | if (m != NULL) OPENSSL_free(m); | 486 | if (m != NULL) free(m); |
487 | return(ret); | 487 | return(ret); |
488 | } | 488 | } |
489 | 489 | ||
@@ -564,7 +564,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, | |||
564 | unsigned char *m=NULL; | 564 | unsigned char *m=NULL; |
565 | update_buflen(dsa_sig->r, &buf_len); | 565 | update_buflen(dsa_sig->r, &buf_len); |
566 | update_buflen(dsa_sig->s, &buf_len); | 566 | update_buflen(dsa_sig->s, &buf_len); |
567 | m = OPENSSL_malloc(buf_len+10); | 567 | m = malloc(buf_len+10); |
568 | if (m == NULL) | 568 | if (m == NULL) |
569 | { | 569 | { |
570 | DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE); | 570 | DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE); |
@@ -581,7 +581,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, | |||
581 | rv = 1; | 581 | rv = 1; |
582 | err: | 582 | err: |
583 | if (m) | 583 | if (m) |
584 | OPENSSL_free(m); | 584 | free(m); |
585 | DSA_SIG_free(dsa_sig); | 585 | DSA_SIG_free(dsa_sig); |
586 | return rv; | 586 | return rv; |
587 | } | 587 | } |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_asn1.c b/src/lib/libssl/src/crypto/dsa/dsa_asn1.c index 19528dcd7a..f8a918d72c 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_asn1.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_asn1.c | |||
@@ -69,7 +69,7 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
69 | { | 69 | { |
70 | if(operation == ASN1_OP_NEW_PRE) { | 70 | if(operation == ASN1_OP_NEW_PRE) { |
71 | DSA_SIG *sig; | 71 | DSA_SIG *sig; |
72 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | 72 | sig = malloc(sizeof(DSA_SIG)); |
73 | if (!sig) | 73 | if (!sig) |
74 | { | 74 | { |
75 | DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); | 75 | DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_lib.c b/src/lib/libssl/src/crypto/dsa/dsa_lib.c index 897c085968..27a4c66618 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_lib.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_lib.c | |||
@@ -116,7 +116,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
116 | { | 116 | { |
117 | DSA *ret; | 117 | DSA *ret; |
118 | 118 | ||
119 | ret=(DSA *)OPENSSL_malloc(sizeof(DSA)); | 119 | ret=(DSA *)malloc(sizeof(DSA)); |
120 | if (ret == NULL) | 120 | if (ret == NULL) |
121 | { | 121 | { |
122 | DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 122 | DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -129,7 +129,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
129 | if (!ENGINE_init(engine)) | 129 | if (!ENGINE_init(engine)) |
130 | { | 130 | { |
131 | DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 131 | DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
132 | OPENSSL_free(ret); | 132 | free(ret); |
133 | return NULL; | 133 | return NULL; |
134 | } | 134 | } |
135 | ret->engine = engine; | 135 | ret->engine = engine; |
@@ -144,7 +144,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
144 | DSAerr(DSA_F_DSA_NEW_METHOD, | 144 | DSAerr(DSA_F_DSA_NEW_METHOD, |
145 | ERR_R_ENGINE_LIB); | 145 | ERR_R_ENGINE_LIB); |
146 | ENGINE_finish(ret->engine); | 146 | ENGINE_finish(ret->engine); |
147 | OPENSSL_free(ret); | 147 | free(ret); |
148 | return NULL; | 148 | return NULL; |
149 | } | 149 | } |
150 | } | 150 | } |
@@ -174,7 +174,7 @@ DSA *DSA_new_method(ENGINE *engine) | |||
174 | ENGINE_finish(ret->engine); | 174 | ENGINE_finish(ret->engine); |
175 | #endif | 175 | #endif |
176 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data); | 176 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data); |
177 | OPENSSL_free(ret); | 177 | free(ret); |
178 | ret=NULL; | 178 | ret=NULL; |
179 | } | 179 | } |
180 | 180 | ||
@@ -216,7 +216,7 @@ void DSA_free(DSA *r) | |||
216 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); | 216 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); |
217 | if (r->kinv != NULL) BN_clear_free(r->kinv); | 217 | if (r->kinv != NULL) BN_clear_free(r->kinv); |
218 | if (r->r != NULL) BN_clear_free(r->r); | 218 | if (r->r != NULL) BN_clear_free(r->r); |
219 | OPENSSL_free(r); | 219 | free(r); |
220 | } | 220 | } |
221 | 221 | ||
222 | int DSA_up_ref(DSA *r) | 222 | int DSA_up_ref(DSA *r) |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_pmeth.c b/src/lib/libssl/src/crypto/dsa/dsa_pmeth.c index 715d8d675b..7076bf7b67 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_pmeth.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_pmeth.c | |||
@@ -81,7 +81,7 @@ typedef struct | |||
81 | static int pkey_dsa_init(EVP_PKEY_CTX *ctx) | 81 | static int pkey_dsa_init(EVP_PKEY_CTX *ctx) |
82 | { | 82 | { |
83 | DSA_PKEY_CTX *dctx; | 83 | DSA_PKEY_CTX *dctx; |
84 | dctx = OPENSSL_malloc(sizeof(DSA_PKEY_CTX)); | 84 | dctx = malloc(sizeof(DSA_PKEY_CTX)); |
85 | if (!dctx) | 85 | if (!dctx) |
86 | return 0; | 86 | return 0; |
87 | dctx->nbits = 1024; | 87 | dctx->nbits = 1024; |
@@ -114,7 +114,7 @@ static void pkey_dsa_cleanup(EVP_PKEY_CTX *ctx) | |||
114 | { | 114 | { |
115 | DSA_PKEY_CTX *dctx = ctx->data; | 115 | DSA_PKEY_CTX *dctx = ctx->data; |
116 | if (dctx) | 116 | if (dctx) |
117 | OPENSSL_free(dctx); | 117 | free(dctx); |
118 | } | 118 | } |
119 | 119 | ||
120 | static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 120 | static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_sign.c b/src/lib/libssl/src/crypto/dsa/dsa_sign.c index e02365a8b1..5f48d6b622 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_sign.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_sign.c | |||
@@ -76,7 +76,7 @@ int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
76 | DSA_SIG *DSA_SIG_new(void) | 76 | DSA_SIG *DSA_SIG_new(void) |
77 | { | 77 | { |
78 | DSA_SIG *sig; | 78 | DSA_SIG *sig; |
79 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | 79 | sig = malloc(sizeof(DSA_SIG)); |
80 | if (!sig) | 80 | if (!sig) |
81 | return NULL; | 81 | return NULL; |
82 | sig->r = NULL; | 82 | sig->r = NULL; |
@@ -92,7 +92,7 @@ void DSA_SIG_free(DSA_SIG *sig) | |||
92 | BN_free(sig->r); | 92 | BN_free(sig->r); |
93 | if (sig->s) | 93 | if (sig->s) |
94 | BN_free(sig->s); | 94 | BN_free(sig->s); |
95 | OPENSSL_free(sig); | 95 | free(sig); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/src/lib/libssl/src/crypto/dso/dso.h b/src/lib/libssl/src/crypto/dso/dso.h index f36f209afd..9010251bbc 100644 --- a/src/lib/libssl/src/crypto/dso/dso.h +++ b/src/lib/libssl/src/crypto/dso/dso.h | |||
@@ -112,7 +112,7 @@ typedef struct dso_st DSO; | |||
112 | * (or NULL if they are to be used independantly of a DSO object) and a | 112 | * (or NULL if they are to be used independantly of a DSO object) and a |
113 | * filename to transform. They should either return NULL (if there is an error | 113 | * filename to transform. They should either return NULL (if there is an error |
114 | * condition) or a newly allocated string containing the transformed form that | 114 | * condition) or a newly allocated string containing the transformed form that |
115 | * the caller will need to free with OPENSSL_free() when done. */ | 115 | * the caller will need to free with free() when done. */ |
116 | typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); | 116 | typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); |
117 | /* The function prototype used for method functions (or caller-provided | 117 | /* The function prototype used for method functions (or caller-provided |
118 | * callbacks) that merge two file specifications. They are passed a | 118 | * callbacks) that merge two file specifications. They are passed a |
@@ -120,7 +120,7 @@ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); | |||
120 | * a DSO object) and two file specifications to merge. They should | 120 | * a DSO object) and two file specifications to merge. They should |
121 | * either return NULL (if there is an error condition) or a newly allocated | 121 | * either return NULL (if there is an error condition) or a newly allocated |
122 | * string containing the result of merging that the caller will need | 122 | * string containing the result of merging that the caller will need |
123 | * to free with OPENSSL_free() when done. | 123 | * to free with free() when done. |
124 | * Here, merging means that bits and pieces are taken from each of the | 124 | * Here, merging means that bits and pieces are taken from each of the |
125 | * file specifications and added together in whatever fashion that is | 125 | * file specifications and added together in whatever fashion that is |
126 | * sensible for the DSO method in question. The only rule that really | 126 | * sensible for the DSO method in question. The only rule that really |
@@ -136,7 +136,7 @@ typedef struct dso_meth_st | |||
136 | const char *name; | 136 | const char *name; |
137 | /* Loads a shared library, NB: new DSO_METHODs must ensure that a | 137 | /* Loads a shared library, NB: new DSO_METHODs must ensure that a |
138 | * successful load populates the loaded_filename field, and likewise a | 138 | * successful load populates the loaded_filename field, and likewise a |
139 | * successful unload OPENSSL_frees and NULLs it out. */ | 139 | * successful unload frees and NULLs it out. */ |
140 | int (*dso_load)(DSO *dso); | 140 | int (*dso_load)(DSO *dso); |
141 | /* Unloads a shared library */ | 141 | /* Unloads a shared library */ |
142 | int (*dso_unload)(DSO *dso); | 142 | int (*dso_unload)(DSO *dso); |
@@ -242,12 +242,12 @@ int DSO_set_filename(DSO *dso, const char *filename); | |||
242 | * simply duplicated. NB: This function is usually called from within a | 242 | * simply duplicated. NB: This function is usually called from within a |
243 | * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that | 243 | * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that |
244 | * caller-created DSO_METHODs can do the same thing. A non-NULL return value | 244 | * caller-created DSO_METHODs can do the same thing. A non-NULL return value |
245 | * will need to be OPENSSL_free()'d. */ | 245 | * will need to be free()'d. */ |
246 | char *DSO_convert_filename(DSO *dso, const char *filename); | 246 | char *DSO_convert_filename(DSO *dso, const char *filename); |
247 | /* This function will invoke the DSO's merger callback to merge two file | 247 | /* This function will invoke the DSO's merger callback to merge two file |
248 | * specifications, or if the callback isn't set it will instead use the | 248 | * specifications, or if the callback isn't set it will instead use the |
249 | * DSO_METHOD's merger. A non-NULL return value will need to be | 249 | * DSO_METHOD's merger. A non-NULL return value will need to be |
250 | * OPENSSL_free()'d. */ | 250 | * free()'d. */ |
251 | char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); | 251 | char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); |
252 | /* If the DSO is currently loaded, this returns the filename that it was loaded | 252 | /* If the DSO is currently loaded, this returns the filename that it was loaded |
253 | * under, otherwise it returns NULL. So it is also useful as a test as to | 253 | * under, otherwise it returns NULL. So it is also useful as a test as to |
diff --git a/src/lib/libssl/src/crypto/dso/dso_dlfcn.c b/src/lib/libssl/src/crypto/dso/dso_dlfcn.c index fe5f0ffdb0..648ddb5ac0 100644 --- a/src/lib/libssl/src/crypto/dso/dso_dlfcn.c +++ b/src/lib/libssl/src/crypto/dso/dso_dlfcn.c | |||
@@ -153,7 +153,7 @@ static int dlfcn_load(DSO *dso) | |||
153 | err: | 153 | err: |
154 | /* Cleanup! */ | 154 | /* Cleanup! */ |
155 | if(filename != NULL) | 155 | if(filename != NULL) |
156 | OPENSSL_free(filename); | 156 | free(filename); |
157 | if(ptr != NULL) | 157 | if(ptr != NULL) |
158 | dlclose(ptr); | 158 | dlclose(ptr); |
159 | return(0); | 159 | return(0); |
@@ -264,7 +264,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
264 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) | 264 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) |
265 | { | 265 | { |
266 | len = strlen(filespec1) + 1; | 266 | len = strlen(filespec1) + 1; |
267 | merged = OPENSSL_malloc(len); | 267 | merged = malloc(len); |
268 | if(!merged) | 268 | if(!merged) |
269 | { | 269 | { |
270 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 270 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); |
@@ -276,7 +276,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
276 | else if (!filespec1) | 276 | else if (!filespec1) |
277 | { | 277 | { |
278 | len = strlen(filespec2) + 1; | 278 | len = strlen(filespec2) + 1; |
279 | merged = OPENSSL_malloc(strlen(filespec2) + 1); | 279 | merged = malloc(strlen(filespec2) + 1); |
280 | if(!merged) | 280 | if(!merged) |
281 | { | 281 | { |
282 | DSOerr(DSO_F_DLFCN_MERGER, | 282 | DSOerr(DSO_F_DLFCN_MERGER, |
@@ -302,7 +302,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
302 | spec2len--; | 302 | spec2len--; |
303 | len--; | 303 | len--; |
304 | } | 304 | } |
305 | merged = OPENSSL_malloc(len + 2); | 305 | merged = malloc(len + 2); |
306 | if(!merged) | 306 | if(!merged) |
307 | { | 307 | { |
308 | DSOerr(DSO_F_DLFCN_MERGER, | 308 | DSOerr(DSO_F_DLFCN_MERGER, |
@@ -334,7 +334,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) | |||
334 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | 334 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) |
335 | rsize += 3; /* The length of "lib" */ | 335 | rsize += 3; /* The length of "lib" */ |
336 | } | 336 | } |
337 | translated = OPENSSL_malloc(rsize); | 337 | translated = malloc(rsize); |
338 | if(translated == NULL) | 338 | if(translated == NULL) |
339 | { | 339 | { |
340 | DSOerr(DSO_F_DLFCN_NAME_CONVERTER, | 340 | DSOerr(DSO_F_DLFCN_NAME_CONVERTER, |
diff --git a/src/lib/libssl/src/crypto/dso/dso_lib.c b/src/lib/libssl/src/crypto/dso/dso_lib.c index 8a15b794ab..68f5430ea8 100644 --- a/src/lib/libssl/src/crypto/dso/dso_lib.c +++ b/src/lib/libssl/src/crypto/dso/dso_lib.c | |||
@@ -100,7 +100,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
100 | * to stealing the "best available" method. Will fallback | 100 | * to stealing the "best available" method. Will fallback |
101 | * to DSO_METH_null() in the worst case. */ | 101 | * to DSO_METH_null() in the worst case. */ |
102 | default_DSO_meth = DSO_METHOD_openssl(); | 102 | default_DSO_meth = DSO_METHOD_openssl(); |
103 | ret = (DSO *)OPENSSL_malloc(sizeof(DSO)); | 103 | ret = (DSO *)malloc(sizeof(DSO)); |
104 | if(ret == NULL) | 104 | if(ret == NULL) |
105 | { | 105 | { |
106 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 106 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -112,7 +112,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
112 | { | 112 | { |
113 | /* sk_new doesn't generate any errors so we do */ | 113 | /* sk_new doesn't generate any errors so we do */ |
114 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 114 | DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
115 | OPENSSL_free(ret); | 115 | free(ret); |
116 | return(NULL); | 116 | return(NULL); |
117 | } | 117 | } |
118 | if(meth == NULL) | 118 | if(meth == NULL) |
@@ -122,7 +122,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
122 | ret->references = 1; | 122 | ret->references = 1; |
123 | if((ret->meth->init != NULL) && !ret->meth->init(ret)) | 123 | if((ret->meth->init != NULL) && !ret->meth->init(ret)) |
124 | { | 124 | { |
125 | OPENSSL_free(ret); | 125 | free(ret); |
126 | ret=NULL; | 126 | ret=NULL; |
127 | } | 127 | } |
128 | return(ret); | 128 | return(ret); |
@@ -165,11 +165,11 @@ int DSO_free(DSO *dso) | |||
165 | 165 | ||
166 | sk_void_free(dso->meth_data); | 166 | sk_void_free(dso->meth_data); |
167 | if(dso->filename != NULL) | 167 | if(dso->filename != NULL) |
168 | OPENSSL_free(dso->filename); | 168 | free(dso->filename); |
169 | if(dso->loaded_filename != NULL) | 169 | if(dso->loaded_filename != NULL) |
170 | OPENSSL_free(dso->loaded_filename); | 170 | free(dso->loaded_filename); |
171 | 171 | ||
172 | OPENSSL_free(dso); | 172 | free(dso); |
173 | return(1); | 173 | return(1); |
174 | } | 174 | } |
175 | 175 | ||
@@ -377,7 +377,7 @@ int DSO_set_filename(DSO *dso, const char *filename) | |||
377 | return(0); | 377 | return(0); |
378 | } | 378 | } |
379 | /* We'll duplicate filename */ | 379 | /* We'll duplicate filename */ |
380 | copied = OPENSSL_malloc(strlen(filename) + 1); | 380 | copied = malloc(strlen(filename) + 1); |
381 | if(copied == NULL) | 381 | if(copied == NULL) |
382 | { | 382 | { |
383 | DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); | 383 | DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); |
@@ -385,7 +385,7 @@ int DSO_set_filename(DSO *dso, const char *filename) | |||
385 | } | 385 | } |
386 | BUF_strlcpy(copied, filename, strlen(filename) + 1); | 386 | BUF_strlcpy(copied, filename, strlen(filename) + 1); |
387 | if(dso->filename) | 387 | if(dso->filename) |
388 | OPENSSL_free(dso->filename); | 388 | free(dso->filename); |
389 | dso->filename = copied; | 389 | dso->filename = copied; |
390 | return(1); | 390 | return(1); |
391 | } | 391 | } |
@@ -435,7 +435,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename) | |||
435 | } | 435 | } |
436 | if(result == NULL) | 436 | if(result == NULL) |
437 | { | 437 | { |
438 | result = OPENSSL_malloc(strlen(filename) + 1); | 438 | result = malloc(strlen(filename) + 1); |
439 | if(result == NULL) | 439 | if(result == NULL) |
440 | { | 440 | { |
441 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, | 441 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, |
diff --git a/src/lib/libssl/src/crypto/ec/ec_ameth.c b/src/lib/libssl/src/crypto/ec/ec_ameth.c index 0ce4524076..6331903141 100644 --- a/src/lib/libssl/src/crypto/ec/ec_ameth.c +++ b/src/lib/libssl/src/crypto/ec/ec_ameth.c | |||
@@ -116,7 +116,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
116 | penclen = i2o_ECPublicKey(ec_key, NULL); | 116 | penclen = i2o_ECPublicKey(ec_key, NULL); |
117 | if (penclen <= 0) | 117 | if (penclen <= 0) |
118 | goto err; | 118 | goto err; |
119 | penc = OPENSSL_malloc(penclen); | 119 | penc = malloc(penclen); |
120 | if (!penc) | 120 | if (!penc) |
121 | goto err; | 121 | goto err; |
122 | p = penc; | 122 | p = penc; |
@@ -132,7 +132,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
132 | else | 132 | else |
133 | ASN1_STRING_free(pval); | 133 | ASN1_STRING_free(pval); |
134 | if (penc) | 134 | if (penc) |
135 | OPENSSL_free(penc); | 135 | free(penc); |
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
@@ -339,7 +339,7 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
339 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); | 339 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); |
340 | return 0; | 340 | return 0; |
341 | } | 341 | } |
342 | ep = (unsigned char *) OPENSSL_malloc(eplen); | 342 | ep = (unsigned char *) malloc(eplen); |
343 | if (!ep) | 343 | if (!ep) |
344 | { | 344 | { |
345 | EC_KEY_set_enc_flags(ec_key, old_flags); | 345 | EC_KEY_set_enc_flags(ec_key, old_flags); |
@@ -350,7 +350,7 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
350 | if (!i2d_ECPrivateKey(ec_key, &p)) | 350 | if (!i2d_ECPrivateKey(ec_key, &p)) |
351 | { | 351 | { |
352 | EC_KEY_set_enc_flags(ec_key, old_flags); | 352 | EC_KEY_set_enc_flags(ec_key, old_flags); |
353 | OPENSSL_free(ep); | 353 | free(ep); |
354 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); | 354 | ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB); |
355 | } | 355 | } |
356 | /* restore old encoding flags */ | 356 | /* restore old encoding flags */ |
@@ -474,7 +474,7 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype) | |||
474 | if (ktype > 0) | 474 | if (ktype > 0) |
475 | { | 475 | { |
476 | buf_len += 10; | 476 | buf_len += 10; |
477 | if ((buffer = OPENSSL_malloc(buf_len)) == NULL) | 477 | if ((buffer = malloc(buf_len)) == NULL) |
478 | { | 478 | { |
479 | reason = ERR_R_MALLOC_FAILURE; | 479 | reason = ERR_R_MALLOC_FAILURE; |
480 | goto err; | 480 | goto err; |
@@ -515,7 +515,7 @@ err: | |||
515 | if (ctx) | 515 | if (ctx) |
516 | BN_CTX_free(ctx); | 516 | BN_CTX_free(ctx); |
517 | if (buffer != NULL) | 517 | if (buffer != NULL) |
518 | OPENSSL_free(buffer); | 518 | free(buffer); |
519 | return(ret); | 519 | return(ret); |
520 | } | 520 | } |
521 | 521 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ec_asn1.c b/src/lib/libssl/src/crypto/ec/ec_asn1.c index 145807b611..2bde9a6a3c 100644 --- a/src/lib/libssl/src/crypto/ec/ec_asn1.c +++ b/src/lib/libssl/src/crypto/ec/ec_asn1.c | |||
@@ -485,7 +485,7 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | |||
485 | } | 485 | } |
486 | else | 486 | else |
487 | { | 487 | { |
488 | if ((buffer_1 = OPENSSL_malloc(len_1)) == NULL) | 488 | if ((buffer_1 = malloc(len_1)) == NULL) |
489 | { | 489 | { |
490 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, | 490 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, |
491 | ERR_R_MALLOC_FAILURE); | 491 | ERR_R_MALLOC_FAILURE); |
@@ -507,7 +507,7 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | |||
507 | } | 507 | } |
508 | else | 508 | else |
509 | { | 509 | { |
510 | if ((buffer_2 = OPENSSL_malloc(len_2)) == NULL) | 510 | if ((buffer_2 = malloc(len_2)) == NULL) |
511 | { | 511 | { |
512 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, | 512 | ECerr(EC_F_EC_ASN1_GROUP2CURVE, |
513 | ERR_R_MALLOC_FAILURE); | 513 | ERR_R_MALLOC_FAILURE); |
@@ -559,9 +559,9 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | |||
559 | ok = 1; | 559 | ok = 1; |
560 | 560 | ||
561 | err: if (buffer_1) | 561 | err: if (buffer_1) |
562 | OPENSSL_free(buffer_1); | 562 | free(buffer_1); |
563 | if (buffer_2) | 563 | if (buffer_2) |
564 | OPENSSL_free(buffer_2); | 564 | free(buffer_2); |
565 | if (tmp_1) | 565 | if (tmp_1) |
566 | BN_free(tmp_1); | 566 | BN_free(tmp_1); |
567 | if (tmp_2) | 567 | if (tmp_2) |
@@ -630,7 +630,7 @@ static ECPARAMETERS *ec_asn1_group2parameters(const EC_GROUP *group, | |||
630 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_EC_LIB); | 630 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_EC_LIB); |
631 | goto err; | 631 | goto err; |
632 | } | 632 | } |
633 | if ((buffer = OPENSSL_malloc(len)) == NULL) | 633 | if ((buffer = malloc(len)) == NULL) |
634 | { | 634 | { |
635 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_MALLOC_FAILURE); | 635 | ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_MALLOC_FAILURE); |
636 | goto err; | 636 | goto err; |
@@ -686,7 +686,7 @@ err : if(!ok) | |||
686 | if (tmp) | 686 | if (tmp) |
687 | BN_free(tmp); | 687 | BN_free(tmp); |
688 | if (buffer) | 688 | if (buffer) |
689 | OPENSSL_free(buffer); | 689 | free(buffer); |
690 | return(ret); | 690 | return(ret); |
691 | } | 691 | } |
692 | 692 | ||
@@ -925,8 +925,8 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params) | |||
925 | if (params->curve->seed != NULL) | 925 | if (params->curve->seed != NULL) |
926 | { | 926 | { |
927 | if (ret->seed != NULL) | 927 | if (ret->seed != NULL) |
928 | OPENSSL_free(ret->seed); | 928 | free(ret->seed); |
929 | if (!(ret->seed = OPENSSL_malloc(params->curve->seed->length))) | 929 | if (!(ret->seed = malloc(params->curve->seed->length))) |
930 | { | 930 | { |
931 | ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, | 931 | ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, |
932 | ERR_R_MALLOC_FAILURE); | 932 | ERR_R_MALLOC_FAILURE); |
@@ -1247,7 +1247,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | |||
1247 | priv_key->version = a->version; | 1247 | priv_key->version = a->version; |
1248 | 1248 | ||
1249 | buf_len = (size_t)BN_num_bytes(a->priv_key); | 1249 | buf_len = (size_t)BN_num_bytes(a->priv_key); |
1250 | buffer = OPENSSL_malloc(buf_len); | 1250 | buffer = malloc(buf_len); |
1251 | if (buffer == NULL) | 1251 | if (buffer == NULL) |
1252 | { | 1252 | { |
1253 | ECerr(EC_F_I2D_ECPRIVATEKEY, | 1253 | ECerr(EC_F_I2D_ECPRIVATEKEY, |
@@ -1292,7 +1292,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | |||
1292 | 1292 | ||
1293 | if (tmp_len > buf_len) | 1293 | if (tmp_len > buf_len) |
1294 | { | 1294 | { |
1295 | unsigned char *tmp_buffer = OPENSSL_realloc(buffer, tmp_len); | 1295 | unsigned char *tmp_buffer = realloc(buffer, tmp_len); |
1296 | if (!tmp_buffer) | 1296 | if (!tmp_buffer) |
1297 | { | 1297 | { |
1298 | ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE); | 1298 | ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE); |
@@ -1327,7 +1327,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | |||
1327 | ok=1; | 1327 | ok=1; |
1328 | err: | 1328 | err: |
1329 | if (buffer) | 1329 | if (buffer) |
1330 | OPENSSL_free(buffer); | 1330 | free(buffer); |
1331 | if (priv_key) | 1331 | if (priv_key) |
1332 | EC_PRIVATEKEY_free(priv_key); | 1332 | EC_PRIVATEKEY_free(priv_key); |
1333 | return(ok?ret:0); | 1333 | return(ok?ret:0); |
@@ -1424,7 +1424,7 @@ int i2o_ECPublicKey(EC_KEY *a, unsigned char **out) | |||
1424 | 1424 | ||
1425 | if (*out == NULL) | 1425 | if (*out == NULL) |
1426 | { | 1426 | { |
1427 | if ((*out = OPENSSL_malloc(buf_len)) == NULL) | 1427 | if ((*out = malloc(buf_len)) == NULL) |
1428 | { | 1428 | { |
1429 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE); | 1429 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE); |
1430 | return 0; | 1430 | return 0; |
@@ -1435,7 +1435,7 @@ int i2o_ECPublicKey(EC_KEY *a, unsigned char **out) | |||
1435 | *out, buf_len, NULL)) | 1435 | *out, buf_len, NULL)) |
1436 | { | 1436 | { |
1437 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB); | 1437 | ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB); |
1438 | OPENSSL_free(*out); | 1438 | free(*out); |
1439 | *out = NULL; | 1439 | *out = NULL; |
1440 | return 0; | 1440 | return 0; |
1441 | } | 1441 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ec_key.c b/src/lib/libssl/src/crypto/ec/ec_key.c index d528601036..4375514ef5 100644 --- a/src/lib/libssl/src/crypto/ec/ec_key.c +++ b/src/lib/libssl/src/crypto/ec/ec_key.c | |||
@@ -69,7 +69,7 @@ EC_KEY *EC_KEY_new(void) | |||
69 | { | 69 | { |
70 | EC_KEY *ret; | 70 | EC_KEY *ret; |
71 | 71 | ||
72 | ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY)); | 72 | ret=(EC_KEY *)malloc(sizeof(EC_KEY)); |
73 | if (ret == NULL) | 73 | if (ret == NULL) |
74 | { | 74 | { |
75 | ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE); | 75 | ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE); |
@@ -132,7 +132,7 @@ void EC_KEY_free(EC_KEY *r) | |||
132 | 132 | ||
133 | OPENSSL_cleanse((void *)r, sizeof(EC_KEY)); | 133 | OPENSSL_cleanse((void *)r, sizeof(EC_KEY)); |
134 | 134 | ||
135 | OPENSSL_free(r); | 135 | free(r); |
136 | } | 136 | } |
137 | 137 | ||
138 | EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) | 138 | EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) |
diff --git a/src/lib/libssl/src/crypto/ec/ec_lib.c b/src/lib/libssl/src/crypto/ec/ec_lib.c index e2c4741b5b..546fd08e38 100644 --- a/src/lib/libssl/src/crypto/ec/ec_lib.c +++ b/src/lib/libssl/src/crypto/ec/ec_lib.c | |||
@@ -88,7 +88,7 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | |||
88 | return NULL; | 88 | return NULL; |
89 | } | 89 | } |
90 | 90 | ||
91 | ret = OPENSSL_malloc(sizeof *ret); | 91 | ret = malloc(sizeof *ret); |
92 | if (ret == NULL) | 92 | if (ret == NULL) |
93 | { | 93 | { |
94 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); | 94 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -112,7 +112,7 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | |||
112 | 112 | ||
113 | if (!meth->group_init(ret)) | 113 | if (!meth->group_init(ret)) |
114 | { | 114 | { |
115 | OPENSSL_free(ret); | 115 | free(ret); |
116 | return NULL; | 116 | return NULL; |
117 | } | 117 | } |
118 | 118 | ||
@@ -135,9 +135,9 @@ void EC_GROUP_free(EC_GROUP *group) | |||
135 | BN_free(&group->cofactor); | 135 | BN_free(&group->cofactor); |
136 | 136 | ||
137 | if (group->seed) | 137 | if (group->seed) |
138 | OPENSSL_free(group->seed); | 138 | free(group->seed); |
139 | 139 | ||
140 | OPENSSL_free(group); | 140 | free(group); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
@@ -160,11 +160,11 @@ void EC_GROUP_clear_free(EC_GROUP *group) | |||
160 | if (group->seed) | 160 | if (group->seed) |
161 | { | 161 | { |
162 | OPENSSL_cleanse(group->seed, group->seed_len); | 162 | OPENSSL_cleanse(group->seed, group->seed_len); |
163 | OPENSSL_free(group->seed); | 163 | free(group->seed); |
164 | } | 164 | } |
165 | 165 | ||
166 | OPENSSL_cleanse(group, sizeof *group); | 166 | OPENSSL_cleanse(group, sizeof *group); |
167 | OPENSSL_free(group); | 167 | free(group); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
@@ -226,8 +226,8 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
226 | if (src->seed) | 226 | if (src->seed) |
227 | { | 227 | { |
228 | if (dest->seed) | 228 | if (dest->seed) |
229 | OPENSSL_free(dest->seed); | 229 | free(dest->seed); |
230 | dest->seed = OPENSSL_malloc(src->seed_len); | 230 | dest->seed = malloc(src->seed_len); |
231 | if (dest->seed == NULL) | 231 | if (dest->seed == NULL) |
232 | return 0; | 232 | return 0; |
233 | if (!memcpy(dest->seed, src->seed, src->seed_len)) | 233 | if (!memcpy(dest->seed, src->seed, src->seed_len)) |
@@ -237,7 +237,7 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
237 | else | 237 | else |
238 | { | 238 | { |
239 | if (dest->seed) | 239 | if (dest->seed) |
240 | OPENSSL_free(dest->seed); | 240 | free(dest->seed); |
241 | dest->seed = NULL; | 241 | dest->seed = NULL; |
242 | dest->seed_len = 0; | 242 | dest->seed_len = 0; |
243 | } | 243 | } |
@@ -375,7 +375,7 @@ size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) | |||
375 | { | 375 | { |
376 | if (group->seed) | 376 | if (group->seed) |
377 | { | 377 | { |
378 | OPENSSL_free(group->seed); | 378 | free(group->seed); |
379 | group->seed = NULL; | 379 | group->seed = NULL; |
380 | group->seed_len = 0; | 380 | group->seed_len = 0; |
381 | } | 381 | } |
@@ -383,7 +383,7 @@ size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) | |||
383 | if (!len || !p) | 383 | if (!len || !p) |
384 | return 1; | 384 | return 1; |
385 | 385 | ||
386 | if ((group->seed = OPENSSL_malloc(len)) == NULL) | 386 | if ((group->seed = malloc(len)) == NULL) |
387 | return 0; | 387 | return 0; |
388 | memcpy(group->seed, p, len); | 388 | memcpy(group->seed, p, len); |
389 | group->seed_len = len; | 389 | group->seed_len = len; |
@@ -567,7 +567,7 @@ int EC_EX_DATA_set_data(EC_EXTRA_DATA **ex_data, void *data, | |||
567 | /* no explicit entry needed */ | 567 | /* no explicit entry needed */ |
568 | return 1; | 568 | return 1; |
569 | 569 | ||
570 | d = OPENSSL_malloc(sizeof *d); | 570 | d = malloc(sizeof *d); |
571 | if (d == NULL) | 571 | if (d == NULL) |
572 | return 0; | 572 | return 0; |
573 | 573 | ||
@@ -613,7 +613,7 @@ void EC_EX_DATA_free_data(EC_EXTRA_DATA **ex_data, | |||
613 | EC_EXTRA_DATA *next = (*p)->next; | 613 | EC_EXTRA_DATA *next = (*p)->next; |
614 | 614 | ||
615 | (*p)->free_func((*p)->data); | 615 | (*p)->free_func((*p)->data); |
616 | OPENSSL_free(*p); | 616 | free(*p); |
617 | 617 | ||
618 | *p = next; | 618 | *p = next; |
619 | return; | 619 | return; |
@@ -637,7 +637,7 @@ void EC_EX_DATA_clear_free_data(EC_EXTRA_DATA **ex_data, | |||
637 | EC_EXTRA_DATA *next = (*p)->next; | 637 | EC_EXTRA_DATA *next = (*p)->next; |
638 | 638 | ||
639 | (*p)->clear_free_func((*p)->data); | 639 | (*p)->clear_free_func((*p)->data); |
640 | OPENSSL_free(*p); | 640 | free(*p); |
641 | 641 | ||
642 | *p = next; | 642 | *p = next; |
643 | return; | 643 | return; |
@@ -659,7 +659,7 @@ void EC_EX_DATA_free_all_data(EC_EXTRA_DATA **ex_data) | |||
659 | EC_EXTRA_DATA *next = d->next; | 659 | EC_EXTRA_DATA *next = d->next; |
660 | 660 | ||
661 | d->free_func(d->data); | 661 | d->free_func(d->data); |
662 | OPENSSL_free(d); | 662 | free(d); |
663 | 663 | ||
664 | d = next; | 664 | d = next; |
665 | } | 665 | } |
@@ -680,7 +680,7 @@ void EC_EX_DATA_clear_free_all_data(EC_EXTRA_DATA **ex_data) | |||
680 | EC_EXTRA_DATA *next = d->next; | 680 | EC_EXTRA_DATA *next = d->next; |
681 | 681 | ||
682 | d->clear_free_func(d->data); | 682 | d->clear_free_func(d->data); |
683 | OPENSSL_free(d); | 683 | free(d); |
684 | 684 | ||
685 | d = next; | 685 | d = next; |
686 | } | 686 | } |
@@ -705,7 +705,7 @@ EC_POINT *EC_POINT_new(const EC_GROUP *group) | |||
705 | return NULL; | 705 | return NULL; |
706 | } | 706 | } |
707 | 707 | ||
708 | ret = OPENSSL_malloc(sizeof *ret); | 708 | ret = malloc(sizeof *ret); |
709 | if (ret == NULL) | 709 | if (ret == NULL) |
710 | { | 710 | { |
711 | ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); | 711 | ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); |
@@ -716,7 +716,7 @@ EC_POINT *EC_POINT_new(const EC_GROUP *group) | |||
716 | 716 | ||
717 | if (!ret->meth->point_init(ret)) | 717 | if (!ret->meth->point_init(ret)) |
718 | { | 718 | { |
719 | OPENSSL_free(ret); | 719 | free(ret); |
720 | return NULL; | 720 | return NULL; |
721 | } | 721 | } |
722 | 722 | ||
@@ -730,7 +730,7 @@ void EC_POINT_free(EC_POINT *point) | |||
730 | 730 | ||
731 | if (point->meth->point_finish != 0) | 731 | if (point->meth->point_finish != 0) |
732 | point->meth->point_finish(point); | 732 | point->meth->point_finish(point); |
733 | OPENSSL_free(point); | 733 | free(point); |
734 | } | 734 | } |
735 | 735 | ||
736 | 736 | ||
@@ -743,7 +743,7 @@ void EC_POINT_clear_free(EC_POINT *point) | |||
743 | else if (point->meth->point_finish != 0) | 743 | else if (point->meth->point_finish != 0) |
744 | point->meth->point_finish(point); | 744 | point->meth->point_finish(point); |
745 | OPENSSL_cleanse(point, sizeof *point); | 745 | OPENSSL_cleanse(point, sizeof *point); |
746 | OPENSSL_free(point); | 746 | free(point); |
747 | } | 747 | } |
748 | 748 | ||
749 | 749 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ec_mult.c b/src/lib/libssl/src/crypto/ec/ec_mult.c index 19f21675fb..b48c888048 100644 --- a/src/lib/libssl/src/crypto/ec/ec_mult.c +++ b/src/lib/libssl/src/crypto/ec/ec_mult.c | |||
@@ -102,7 +102,7 @@ static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group) | |||
102 | if (!group) | 102 | if (!group) |
103 | return NULL; | 103 | return NULL; |
104 | 104 | ||
105 | ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP)); | 105 | ret = (EC_PRE_COMP *)malloc(sizeof(EC_PRE_COMP)); |
106 | if (!ret) | 106 | if (!ret) |
107 | { | 107 | { |
108 | ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 108 | ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -147,9 +147,9 @@ static void ec_pre_comp_free(void *pre_) | |||
147 | 147 | ||
148 | for (p = pre->points; *p != NULL; p++) | 148 | for (p = pre->points; *p != NULL; p++) |
149 | EC_POINT_free(*p); | 149 | EC_POINT_free(*p); |
150 | OPENSSL_free(pre->points); | 150 | free(pre->points); |
151 | } | 151 | } |
152 | OPENSSL_free(pre); | 152 | free(pre); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void ec_pre_comp_clear_free(void *pre_) | 155 | static void ec_pre_comp_clear_free(void *pre_) |
@@ -173,10 +173,10 @@ static void ec_pre_comp_clear_free(void *pre_) | |||
173 | EC_POINT_clear_free(*p); | 173 | EC_POINT_clear_free(*p); |
174 | OPENSSL_cleanse(p, sizeof *p); | 174 | OPENSSL_cleanse(p, sizeof *p); |
175 | } | 175 | } |
176 | OPENSSL_free(pre->points); | 176 | free(pre->points); |
177 | } | 177 | } |
178 | OPENSSL_cleanse(pre, sizeof *pre); | 178 | OPENSSL_cleanse(pre, sizeof *pre); |
179 | OPENSSL_free(pre); | 179 | free(pre); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
@@ -201,7 +201,7 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
201 | 201 | ||
202 | if (BN_is_zero(scalar)) | 202 | if (BN_is_zero(scalar)) |
203 | { | 203 | { |
204 | r = OPENSSL_malloc(1); | 204 | r = malloc(1); |
205 | if (!r) | 205 | if (!r) |
206 | { | 206 | { |
207 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE); | 207 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE); |
@@ -233,7 +233,7 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | len = BN_num_bits(scalar); | 235 | len = BN_num_bits(scalar); |
236 | r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation | 236 | r = malloc(len + 1); /* modified wNAF may be one digit longer than binary representation |
237 | * (*ret_len will be set to the actual length, i.e. at most | 237 | * (*ret_len will be set to the actual length, i.e. at most |
238 | * BN_num_bits(scalar) + 1) */ | 238 | * BN_num_bits(scalar) + 1) */ |
239 | if (r == NULL) | 239 | if (r == NULL) |
@@ -315,7 +315,7 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
315 | err: | 315 | err: |
316 | if (!ok) | 316 | if (!ok) |
317 | { | 317 | { |
318 | OPENSSL_free(r); | 318 | free(r); |
319 | r = NULL; | 319 | r = NULL; |
320 | } | 320 | } |
321 | if (ok) | 321 | if (ok) |
@@ -441,10 +441,10 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
441 | 441 | ||
442 | totalnum = num + numblocks; | 442 | totalnum = num + numblocks; |
443 | 443 | ||
444 | wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]); | 444 | wsize = malloc(totalnum * sizeof wsize[0]); |
445 | wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]); | 445 | wNAF_len = malloc(totalnum * sizeof wNAF_len[0]); |
446 | wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */ | 446 | wNAF = malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */ |
447 | val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]); | 447 | val_sub = malloc(totalnum * sizeof val_sub[0]); |
448 | 448 | ||
449 | if (!wsize || !wNAF_len || !wNAF || !val_sub) | 449 | if (!wsize || !wNAF_len || !wNAF || !val_sub) |
450 | { | 450 | { |
@@ -560,11 +560,11 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
560 | wNAF_len[i] = tmp_len; | 560 | wNAF_len[i] = tmp_len; |
561 | 561 | ||
562 | wNAF[i + 1] = NULL; | 562 | wNAF[i + 1] = NULL; |
563 | wNAF[i] = OPENSSL_malloc(wNAF_len[i]); | 563 | wNAF[i] = malloc(wNAF_len[i]); |
564 | if (wNAF[i] == NULL) | 564 | if (wNAF[i] == NULL) |
565 | { | 565 | { |
566 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); | 566 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); |
567 | OPENSSL_free(tmp_wNAF); | 567 | free(tmp_wNAF); |
568 | goto err; | 568 | goto err; |
569 | } | 569 | } |
570 | memcpy(wNAF[i], pp, wNAF_len[i]); | 570 | memcpy(wNAF[i], pp, wNAF_len[i]); |
@@ -574,14 +574,14 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
574 | if (*tmp_points == NULL) | 574 | if (*tmp_points == NULL) |
575 | { | 575 | { |
576 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); | 576 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); |
577 | OPENSSL_free(tmp_wNAF); | 577 | free(tmp_wNAF); |
578 | goto err; | 578 | goto err; |
579 | } | 579 | } |
580 | val_sub[i] = tmp_points; | 580 | val_sub[i] = tmp_points; |
581 | tmp_points += pre_points_per_block; | 581 | tmp_points += pre_points_per_block; |
582 | pp += blocksize; | 582 | pp += blocksize; |
583 | } | 583 | } |
584 | OPENSSL_free(tmp_wNAF); | 584 | free(tmp_wNAF); |
585 | } | 585 | } |
586 | } | 586 | } |
587 | } | 587 | } |
@@ -589,7 +589,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
589 | /* All points we precompute now go into a single array 'val'. | 589 | /* All points we precompute now go into a single array 'val'. |
590 | * 'val_sub[i]' is a pointer to the subarray for the i-th point, | 590 | * 'val_sub[i]' is a pointer to the subarray for the i-th point, |
591 | * or to a subarray of 'pre_comp->points' if we already have precomputation. */ | 591 | * or to a subarray of 'pre_comp->points' if we already have precomputation. */ |
592 | val = OPENSSL_malloc((num_val + 1) * sizeof val[0]); | 592 | val = malloc((num_val + 1) * sizeof val[0]); |
593 | if (val == NULL) | 593 | if (val == NULL) |
594 | { | 594 | { |
595 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); | 595 | ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); |
@@ -716,28 +716,28 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
716 | if (tmp != NULL) | 716 | if (tmp != NULL) |
717 | EC_POINT_free(tmp); | 717 | EC_POINT_free(tmp); |
718 | if (wsize != NULL) | 718 | if (wsize != NULL) |
719 | OPENSSL_free(wsize); | 719 | free(wsize); |
720 | if (wNAF_len != NULL) | 720 | if (wNAF_len != NULL) |
721 | OPENSSL_free(wNAF_len); | 721 | free(wNAF_len); |
722 | if (wNAF != NULL) | 722 | if (wNAF != NULL) |
723 | { | 723 | { |
724 | signed char **w; | 724 | signed char **w; |
725 | 725 | ||
726 | for (w = wNAF; *w != NULL; w++) | 726 | for (w = wNAF; *w != NULL; w++) |
727 | OPENSSL_free(*w); | 727 | free(*w); |
728 | 728 | ||
729 | OPENSSL_free(wNAF); | 729 | free(wNAF); |
730 | } | 730 | } |
731 | if (val != NULL) | 731 | if (val != NULL) |
732 | { | 732 | { |
733 | for (v = val; *v != NULL; v++) | 733 | for (v = val; *v != NULL; v++) |
734 | EC_POINT_clear_free(*v); | 734 | EC_POINT_clear_free(*v); |
735 | 735 | ||
736 | OPENSSL_free(val); | 736 | free(val); |
737 | } | 737 | } |
738 | if (val_sub != NULL) | 738 | if (val_sub != NULL) |
739 | { | 739 | { |
740 | OPENSSL_free(val_sub); | 740 | free(val_sub); |
741 | } | 741 | } |
742 | return ret; | 742 | return ret; |
743 | } | 743 | } |
@@ -825,7 +825,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) | |||
825 | pre_points_per_block = (size_t)1 << (w - 1); | 825 | pre_points_per_block = (size_t)1 << (w - 1); |
826 | num = pre_points_per_block * numblocks; /* number of points to compute and store */ | 826 | num = pre_points_per_block * numblocks; /* number of points to compute and store */ |
827 | 827 | ||
828 | points = OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1)); | 828 | points = malloc(sizeof (EC_POINT*)*(num + 1)); |
829 | if (!points) | 829 | if (!points) |
830 | { | 830 | { |
831 | ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); | 831 | ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE); |
@@ -921,7 +921,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) | |||
921 | 921 | ||
922 | for (p = points; *p != NULL; p++) | 922 | for (p = points; *p != NULL; p++) |
923 | EC_POINT_free(*p); | 923 | EC_POINT_free(*p); |
924 | OPENSSL_free(points); | 924 | free(points); |
925 | } | 925 | } |
926 | if (tmp_point) | 926 | if (tmp_point) |
927 | EC_POINT_free(tmp_point); | 927 | EC_POINT_free(tmp_point); |
diff --git a/src/lib/libssl/src/crypto/ec/ec_pmeth.c b/src/lib/libssl/src/crypto/ec/ec_pmeth.c index 66ee397d86..dfc8ace27b 100644 --- a/src/lib/libssl/src/crypto/ec/ec_pmeth.c +++ b/src/lib/libssl/src/crypto/ec/ec_pmeth.c | |||
@@ -77,7 +77,7 @@ typedef struct | |||
77 | static int pkey_ec_init(EVP_PKEY_CTX *ctx) | 77 | static int pkey_ec_init(EVP_PKEY_CTX *ctx) |
78 | { | 78 | { |
79 | EC_PKEY_CTX *dctx; | 79 | EC_PKEY_CTX *dctx; |
80 | dctx = OPENSSL_malloc(sizeof(EC_PKEY_CTX)); | 80 | dctx = malloc(sizeof(EC_PKEY_CTX)); |
81 | if (!dctx) | 81 | if (!dctx) |
82 | return 0; | 82 | return 0; |
83 | dctx->gen_group = NULL; | 83 | dctx->gen_group = NULL; |
@@ -112,7 +112,7 @@ static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx) | |||
112 | { | 112 | { |
113 | if (dctx->gen_group) | 113 | if (dctx->gen_group) |
114 | EC_GROUP_free(dctx->gen_group); | 114 | EC_GROUP_free(dctx->gen_group); |
115 | OPENSSL_free(dctx); | 115 | free(dctx); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ec_print.c b/src/lib/libssl/src/crypto/ec/ec_print.c index f7c8a303ac..1655332c3c 100644 --- a/src/lib/libssl/src/crypto/ec/ec_print.c +++ b/src/lib/libssl/src/crypto/ec/ec_print.c | |||
@@ -70,18 +70,18 @@ BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, | |||
70 | if (buf_len == 0) | 70 | if (buf_len == 0) |
71 | return NULL; | 71 | return NULL; |
72 | 72 | ||
73 | if ((buf = OPENSSL_malloc(buf_len)) == NULL) | 73 | if ((buf = malloc(buf_len)) == NULL) |
74 | return NULL; | 74 | return NULL; |
75 | 75 | ||
76 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) | 76 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) |
77 | { | 77 | { |
78 | OPENSSL_free(buf); | 78 | free(buf); |
79 | return NULL; | 79 | return NULL; |
80 | } | 80 | } |
81 | 81 | ||
82 | ret = BN_bin2bn(buf, buf_len, ret); | 82 | ret = BN_bin2bn(buf, buf_len, ret); |
83 | 83 | ||
84 | OPENSSL_free(buf); | 84 | free(buf); |
85 | 85 | ||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
@@ -96,13 +96,13 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, | |||
96 | EC_POINT *ret; | 96 | EC_POINT *ret; |
97 | 97 | ||
98 | if ((buf_len = BN_num_bytes(bn)) == 0) return NULL; | 98 | if ((buf_len = BN_num_bytes(bn)) == 0) return NULL; |
99 | buf = OPENSSL_malloc(buf_len); | 99 | buf = malloc(buf_len); |
100 | if (buf == NULL) | 100 | if (buf == NULL) |
101 | return NULL; | 101 | return NULL; |
102 | 102 | ||
103 | if (!BN_bn2bin(bn, buf)) | 103 | if (!BN_bn2bin(bn, buf)) |
104 | { | 104 | { |
105 | OPENSSL_free(buf); | 105 | free(buf); |
106 | return NULL; | 106 | return NULL; |
107 | } | 107 | } |
108 | 108 | ||
@@ -110,7 +110,7 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, | |||
110 | { | 110 | { |
111 | if ((ret = EC_POINT_new(group)) == NULL) | 111 | if ((ret = EC_POINT_new(group)) == NULL) |
112 | { | 112 | { |
113 | OPENSSL_free(buf); | 113 | free(buf); |
114 | return NULL; | 114 | return NULL; |
115 | } | 115 | } |
116 | } | 116 | } |
@@ -121,17 +121,17 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, | |||
121 | { | 121 | { |
122 | if (point == NULL) | 122 | if (point == NULL) |
123 | EC_POINT_clear_free(ret); | 123 | EC_POINT_clear_free(ret); |
124 | OPENSSL_free(buf); | 124 | free(buf); |
125 | return NULL; | 125 | return NULL; |
126 | } | 126 | } |
127 | 127 | ||
128 | OPENSSL_free(buf); | 128 | free(buf); |
129 | return ret; | 129 | return ret; |
130 | } | 130 | } |
131 | 131 | ||
132 | static const char *HEX_DIGITS = "0123456789ABCDEF"; | 132 | static const char *HEX_DIGITS = "0123456789ABCDEF"; |
133 | 133 | ||
134 | /* the return value must be freed (using OPENSSL_free()) */ | 134 | /* the return value must be freed (using free()) */ |
135 | char *EC_POINT_point2hex(const EC_GROUP *group, | 135 | char *EC_POINT_point2hex(const EC_GROUP *group, |
136 | const EC_POINT *point, | 136 | const EC_POINT *point, |
137 | point_conversion_form_t form, | 137 | point_conversion_form_t form, |
@@ -146,19 +146,19 @@ char *EC_POINT_point2hex(const EC_GROUP *group, | |||
146 | if (buf_len == 0) | 146 | if (buf_len == 0) |
147 | return NULL; | 147 | return NULL; |
148 | 148 | ||
149 | if ((buf = OPENSSL_malloc(buf_len)) == NULL) | 149 | if ((buf = malloc(buf_len)) == NULL) |
150 | return NULL; | 150 | return NULL; |
151 | 151 | ||
152 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) | 152 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) |
153 | { | 153 | { |
154 | OPENSSL_free(buf); | 154 | free(buf); |
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | ret = (char *)OPENSSL_malloc(buf_len*2+2); | 158 | ret = (char *)malloc(buf_len*2+2); |
159 | if (ret == NULL) | 159 | if (ret == NULL) |
160 | { | 160 | { |
161 | OPENSSL_free(buf); | 161 | free(buf); |
162 | return NULL; | 162 | return NULL; |
163 | } | 163 | } |
164 | p = ret; | 164 | p = ret; |
@@ -171,7 +171,7 @@ char *EC_POINT_point2hex(const EC_GROUP *group, | |||
171 | } | 171 | } |
172 | *p='\0'; | 172 | *p='\0'; |
173 | 173 | ||
174 | OPENSSL_free(buf); | 174 | free(buf); |
175 | 175 | ||
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
diff --git a/src/lib/libssl/src/crypto/ec/eck_prn.c b/src/lib/libssl/src/crypto/ec/eck_prn.c index 06de8f3959..4e8c748bbc 100644 --- a/src/lib/libssl/src/crypto/ec/eck_prn.c +++ b/src/lib/libssl/src/crypto/ec/eck_prn.c | |||
@@ -263,7 +263,7 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | |||
263 | seed_len = EC_GROUP_get_seed_len(x); | 263 | seed_len = EC_GROUP_get_seed_len(x); |
264 | 264 | ||
265 | buf_len += 10; | 265 | buf_len += 10; |
266 | if ((buffer = OPENSSL_malloc(buf_len)) == NULL) | 266 | if ((buffer = malloc(buf_len)) == NULL) |
267 | { | 267 | { |
268 | reason = ERR_R_MALLOC_FAILURE; | 268 | reason = ERR_R_MALLOC_FAILURE; |
269 | goto err; | 269 | goto err; |
@@ -349,7 +349,7 @@ err: | |||
349 | if (ctx) | 349 | if (ctx) |
350 | BN_CTX_free(ctx); | 350 | BN_CTX_free(ctx); |
351 | if (buffer != NULL) | 351 | if (buffer != NULL) |
352 | OPENSSL_free(buffer); | 352 | free(buffer); |
353 | return(ret); | 353 | return(ret); |
354 | } | 354 | } |
355 | 355 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ecp_nistp224.c b/src/lib/libssl/src/crypto/ec/ecp_nistp224.c index b5ff56c252..03f2d9c1d7 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_nistp224.c +++ b/src/lib/libssl/src/crypto/ec/ecp_nistp224.c | |||
@@ -1148,7 +1148,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out, | |||
1148 | static NISTP224_PRE_COMP *nistp224_pre_comp_new() | 1148 | static NISTP224_PRE_COMP *nistp224_pre_comp_new() |
1149 | { | 1149 | { |
1150 | NISTP224_PRE_COMP *ret = NULL; | 1150 | NISTP224_PRE_COMP *ret = NULL; |
1151 | ret = (NISTP224_PRE_COMP *) OPENSSL_malloc(sizeof *ret); | 1151 | ret = (NISTP224_PRE_COMP *) malloc(sizeof *ret); |
1152 | if (!ret) | 1152 | if (!ret) |
1153 | { | 1153 | { |
1154 | ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 1154 | ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -1181,7 +1181,7 @@ static void nistp224_pre_comp_free(void *pre_) | |||
1181 | if (i > 0) | 1181 | if (i > 0) |
1182 | return; | 1182 | return; |
1183 | 1183 | ||
1184 | OPENSSL_free(pre); | 1184 | free(pre); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | static void nistp224_pre_comp_clear_free(void *pre_) | 1187 | static void nistp224_pre_comp_clear_free(void *pre_) |
@@ -1197,7 +1197,7 @@ static void nistp224_pre_comp_clear_free(void *pre_) | |||
1197 | return; | 1197 | return; |
1198 | 1198 | ||
1199 | OPENSSL_cleanse(pre, sizeof *pre); | 1199 | OPENSSL_cleanse(pre, sizeof *pre); |
1200 | OPENSSL_free(pre); | 1200 | free(pre); |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | /******************************************************************************/ | 1203 | /******************************************************************************/ |
@@ -1382,10 +1382,10 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
1382 | * converting those into affine form is time well spent */ | 1382 | * converting those into affine form is time well spent */ |
1383 | mixed = 1; | 1383 | mixed = 1; |
1384 | } | 1384 | } |
1385 | secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); | 1385 | secrets = malloc(num_points * sizeof(felem_bytearray)); |
1386 | pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem)); | 1386 | pre_comp = malloc(num_points * 17 * 3 * sizeof(felem)); |
1387 | if (mixed) | 1387 | if (mixed) |
1388 | tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem)); | 1388 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); |
1389 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) | 1389 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) |
1390 | { | 1390 | { |
1391 | ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE); | 1391 | ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE); |
@@ -1506,11 +1506,11 @@ err: | |||
1506 | if (new_ctx != NULL) | 1506 | if (new_ctx != NULL) |
1507 | BN_CTX_free(new_ctx); | 1507 | BN_CTX_free(new_ctx); |
1508 | if (secrets != NULL) | 1508 | if (secrets != NULL) |
1509 | OPENSSL_free(secrets); | 1509 | free(secrets); |
1510 | if (pre_comp != NULL) | 1510 | if (pre_comp != NULL) |
1511 | OPENSSL_free(pre_comp); | 1511 | free(pre_comp); |
1512 | if (tmp_felems != NULL) | 1512 | if (tmp_felems != NULL) |
1513 | OPENSSL_free(tmp_felems); | 1513 | free(tmp_felems); |
1514 | return ret; | 1514 | return ret; |
1515 | } | 1515 | } |
1516 | 1516 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ecp_nistp256.c b/src/lib/libssl/src/crypto/ec/ecp_nistp256.c index 4bc0f5dce0..947fb7eee0 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_nistp256.c +++ b/src/lib/libssl/src/crypto/ec/ecp_nistp256.c | |||
@@ -1666,7 +1666,7 @@ const EC_METHOD *EC_GFp_nistp256_method(void) | |||
1666 | static NISTP256_PRE_COMP *nistp256_pre_comp_new() | 1666 | static NISTP256_PRE_COMP *nistp256_pre_comp_new() |
1667 | { | 1667 | { |
1668 | NISTP256_PRE_COMP *ret = NULL; | 1668 | NISTP256_PRE_COMP *ret = NULL; |
1669 | ret = (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret); | 1669 | ret = (NISTP256_PRE_COMP *) malloc(sizeof *ret); |
1670 | if (!ret) | 1670 | if (!ret) |
1671 | { | 1671 | { |
1672 | ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 1672 | ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -1699,7 +1699,7 @@ static void nistp256_pre_comp_free(void *pre_) | |||
1699 | if (i > 0) | 1699 | if (i > 0) |
1700 | return; | 1700 | return; |
1701 | 1701 | ||
1702 | OPENSSL_free(pre); | 1702 | free(pre); |
1703 | } | 1703 | } |
1704 | 1704 | ||
1705 | static void nistp256_pre_comp_clear_free(void *pre_) | 1705 | static void nistp256_pre_comp_clear_free(void *pre_) |
@@ -1715,7 +1715,7 @@ static void nistp256_pre_comp_clear_free(void *pre_) | |||
1715 | return; | 1715 | return; |
1716 | 1716 | ||
1717 | OPENSSL_cleanse(pre, sizeof *pre); | 1717 | OPENSSL_cleanse(pre, sizeof *pre); |
1718 | OPENSSL_free(pre); | 1718 | free(pre); |
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | /******************************************************************************/ | 1721 | /******************************************************************************/ |
@@ -1901,10 +1901,10 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
1901 | * converting those into affine form is time well spent */ | 1901 | * converting those into affine form is time well spent */ |
1902 | mixed = 1; | 1902 | mixed = 1; |
1903 | } | 1903 | } |
1904 | secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); | 1904 | secrets = malloc(num_points * sizeof(felem_bytearray)); |
1905 | pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem)); | 1905 | pre_comp = malloc(num_points * 17 * 3 * sizeof(smallfelem)); |
1906 | if (mixed) | 1906 | if (mixed) |
1907 | tmp_smallfelems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(smallfelem)); | 1907 | tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem)); |
1908 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) | 1908 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) |
1909 | { | 1909 | { |
1910 | ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE); | 1910 | ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE); |
@@ -2026,11 +2026,11 @@ err: | |||
2026 | if (new_ctx != NULL) | 2026 | if (new_ctx != NULL) |
2027 | BN_CTX_free(new_ctx); | 2027 | BN_CTX_free(new_ctx); |
2028 | if (secrets != NULL) | 2028 | if (secrets != NULL) |
2029 | OPENSSL_free(secrets); | 2029 | free(secrets); |
2030 | if (pre_comp != NULL) | 2030 | if (pre_comp != NULL) |
2031 | OPENSSL_free(pre_comp); | 2031 | free(pre_comp); |
2032 | if (tmp_smallfelems != NULL) | 2032 | if (tmp_smallfelems != NULL) |
2033 | OPENSSL_free(tmp_smallfelems); | 2033 | free(tmp_smallfelems); |
2034 | return ret; | 2034 | return ret; |
2035 | } | 2035 | } |
2036 | 2036 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ecp_nistp521.c b/src/lib/libssl/src/crypto/ec/ecp_nistp521.c index 178b655f7f..24eb032951 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_nistp521.c +++ b/src/lib/libssl/src/crypto/ec/ecp_nistp521.c | |||
@@ -1533,7 +1533,7 @@ const EC_METHOD *EC_GFp_nistp521_method(void) | |||
1533 | static NISTP521_PRE_COMP *nistp521_pre_comp_new() | 1533 | static NISTP521_PRE_COMP *nistp521_pre_comp_new() |
1534 | { | 1534 | { |
1535 | NISTP521_PRE_COMP *ret = NULL; | 1535 | NISTP521_PRE_COMP *ret = NULL; |
1536 | ret = (NISTP521_PRE_COMP *)OPENSSL_malloc(sizeof(NISTP521_PRE_COMP)); | 1536 | ret = (NISTP521_PRE_COMP *)malloc(sizeof(NISTP521_PRE_COMP)); |
1537 | if (!ret) | 1537 | if (!ret) |
1538 | { | 1538 | { |
1539 | ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); | 1539 | ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); |
@@ -1566,7 +1566,7 @@ static void nistp521_pre_comp_free(void *pre_) | |||
1566 | if (i > 0) | 1566 | if (i > 0) |
1567 | return; | 1567 | return; |
1568 | 1568 | ||
1569 | OPENSSL_free(pre); | 1569 | free(pre); |
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | static void nistp521_pre_comp_clear_free(void *pre_) | 1572 | static void nistp521_pre_comp_clear_free(void *pre_) |
@@ -1582,7 +1582,7 @@ static void nistp521_pre_comp_clear_free(void *pre_) | |||
1582 | return; | 1582 | return; |
1583 | 1583 | ||
1584 | OPENSSL_cleanse(pre, sizeof(*pre)); | 1584 | OPENSSL_cleanse(pre, sizeof(*pre)); |
1585 | OPENSSL_free(pre); | 1585 | free(pre); |
1586 | } | 1586 | } |
1587 | 1587 | ||
1588 | /******************************************************************************/ | 1588 | /******************************************************************************/ |
@@ -1766,10 +1766,10 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
1766 | * converting those into affine form is time well spent */ | 1766 | * converting those into affine form is time well spent */ |
1767 | mixed = 1; | 1767 | mixed = 1; |
1768 | } | 1768 | } |
1769 | secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); | 1769 | secrets = malloc(num_points * sizeof(felem_bytearray)); |
1770 | pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem)); | 1770 | pre_comp = malloc(num_points * 17 * 3 * sizeof(felem)); |
1771 | if (mixed) | 1771 | if (mixed) |
1772 | tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem)); | 1772 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); |
1773 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) | 1773 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) |
1774 | { | 1774 | { |
1775 | ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE); | 1775 | ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE); |
@@ -1891,11 +1891,11 @@ err: | |||
1891 | if (new_ctx != NULL) | 1891 | if (new_ctx != NULL) |
1892 | BN_CTX_free(new_ctx); | 1892 | BN_CTX_free(new_ctx); |
1893 | if (secrets != NULL) | 1893 | if (secrets != NULL) |
1894 | OPENSSL_free(secrets); | 1894 | free(secrets); |
1895 | if (pre_comp != NULL) | 1895 | if (pre_comp != NULL) |
1896 | OPENSSL_free(pre_comp); | 1896 | free(pre_comp); |
1897 | if (tmp_felems != NULL) | 1897 | if (tmp_felems != NULL) |
1898 | OPENSSL_free(tmp_felems); | 1898 | free(tmp_felems); |
1899 | return ret; | 1899 | return ret; |
1900 | } | 1900 | } |
1901 | 1901 | ||
diff --git a/src/lib/libssl/src/crypto/ec/ecp_smpl.c b/src/lib/libssl/src/crypto/ec/ecp_smpl.c index bf0ad998dd..a146752817 100644 --- a/src/lib/libssl/src/crypto/ec/ecp_smpl.c +++ b/src/lib/libssl/src/crypto/ec/ecp_smpl.c | |||
@@ -1205,7 +1205,7 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT | |||
1205 | * We need twice that. */ | 1205 | * We need twice that. */ |
1206 | pow2 <<= 1; | 1206 | pow2 <<= 1; |
1207 | 1207 | ||
1208 | heap = OPENSSL_malloc(pow2 * sizeof heap[0]); | 1208 | heap = malloc(pow2 * sizeof heap[0]); |
1209 | if (heap == NULL) goto err; | 1209 | if (heap == NULL) goto err; |
1210 | 1210 | ||
1211 | /* The array is used as a binary tree, exactly as in heapsort: | 1211 | /* The array is used as a binary tree, exactly as in heapsort: |
@@ -1333,7 +1333,7 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT | |||
1333 | if (heap[i] != NULL) | 1333 | if (heap[i] != NULL) |
1334 | BN_clear_free(heap[i]); | 1334 | BN_clear_free(heap[i]); |
1335 | } | 1335 | } |
1336 | OPENSSL_free(heap); | 1336 | free(heap); |
1337 | } | 1337 | } |
1338 | return ret; | 1338 | return ret; |
1339 | } | 1339 | } |
diff --git a/src/lib/libssl/src/crypto/ecdh/ech_lib.c b/src/lib/libssl/src/crypto/ecdh/ech_lib.c index ddf226b166..51fb7d6afb 100644 --- a/src/lib/libssl/src/crypto/ecdh/ech_lib.c +++ b/src/lib/libssl/src/crypto/ecdh/ech_lib.c | |||
@@ -129,7 +129,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine) | |||
129 | { | 129 | { |
130 | ECDH_DATA *ret; | 130 | ECDH_DATA *ret; |
131 | 131 | ||
132 | ret=(ECDH_DATA *)OPENSSL_malloc(sizeof(ECDH_DATA)); | 132 | ret=(ECDH_DATA *)malloc(sizeof(ECDH_DATA)); |
133 | if (ret == NULL) | 133 | if (ret == NULL) |
134 | { | 134 | { |
135 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 135 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); |
@@ -150,7 +150,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine) | |||
150 | { | 150 | { |
151 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); | 151 | ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); |
152 | ENGINE_finish(ret->engine); | 152 | ENGINE_finish(ret->engine); |
153 | OPENSSL_free(ret); | 153 | free(ret); |
154 | return NULL; | 154 | return NULL; |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -162,7 +162,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine) | |||
162 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | 162 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) |
163 | { | 163 | { |
164 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data); | 164 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data); |
165 | OPENSSL_free(ret); | 165 | free(ret); |
166 | ret=NULL; | 166 | ret=NULL; |
167 | } | 167 | } |
168 | #endif | 168 | #endif |
@@ -198,7 +198,7 @@ void ecdh_data_free(void *data) | |||
198 | 198 | ||
199 | OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA)); | 199 | OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA)); |
200 | 200 | ||
201 | OPENSSL_free(r); | 201 | free(r); |
202 | } | 202 | } |
203 | 203 | ||
204 | ECDH_DATA *ecdh_check(EC_KEY *key) | 204 | ECDH_DATA *ecdh_check(EC_KEY *key) |
diff --git a/src/lib/libssl/src/crypto/ecdh/ech_ossl.c b/src/lib/libssl/src/crypto/ecdh/ech_ossl.c index 4a30628fbc..a63eb4922d 100644 --- a/src/lib/libssl/src/crypto/ecdh/ech_ossl.c +++ b/src/lib/libssl/src/crypto/ecdh/ech_ossl.c | |||
@@ -175,7 +175,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | |||
175 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR); | 175 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR); |
176 | goto err; | 176 | goto err; |
177 | } | 177 | } |
178 | if ((buf = OPENSSL_malloc(buflen)) == NULL) | 178 | if ((buf = malloc(buflen)) == NULL) |
179 | { | 179 | { |
180 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); | 180 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); |
181 | goto err; | 181 | goto err; |
@@ -210,6 +210,6 @@ err: | |||
210 | if (tmp) EC_POINT_free(tmp); | 210 | if (tmp) EC_POINT_free(tmp); |
211 | if (ctx) BN_CTX_end(ctx); | 211 | if (ctx) BN_CTX_end(ctx); |
212 | if (ctx) BN_CTX_free(ctx); | 212 | if (ctx) BN_CTX_free(ctx); |
213 | if (buf) OPENSSL_free(buf); | 213 | if (buf) free(buf); |
214 | return(ret); | 214 | return(ret); |
215 | } | 215 | } |
diff --git a/src/lib/libssl/src/crypto/ecdsa/ecs_lib.c b/src/lib/libssl/src/crypto/ecdsa/ecs_lib.c index 7b53969ffd..81842a11a6 100644 --- a/src/lib/libssl/src/crypto/ecdsa/ecs_lib.c +++ b/src/lib/libssl/src/crypto/ecdsa/ecs_lib.c | |||
@@ -108,7 +108,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine) | |||
108 | { | 108 | { |
109 | ECDSA_DATA *ret; | 109 | ECDSA_DATA *ret; |
110 | 110 | ||
111 | ret=(ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA)); | 111 | ret=(ECDSA_DATA *)malloc(sizeof(ECDSA_DATA)); |
112 | if (ret == NULL) | 112 | if (ret == NULL) |
113 | { | 113 | { |
114 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 114 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE); |
@@ -129,7 +129,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine) | |||
129 | { | 129 | { |
130 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); | 130 | ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB); |
131 | ENGINE_finish(ret->engine); | 131 | ENGINE_finish(ret->engine); |
132 | OPENSSL_free(ret); | 132 | free(ret); |
133 | return NULL; | 133 | return NULL; |
134 | } | 134 | } |
135 | } | 135 | } |
@@ -141,7 +141,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine) | |||
141 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | 141 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) |
142 | { | 142 | { |
143 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data); | 143 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data); |
144 | OPENSSL_free(ret); | 144 | free(ret); |
145 | ret=NULL; | 145 | ret=NULL; |
146 | } | 146 | } |
147 | #endif | 147 | #endif |
@@ -176,7 +176,7 @@ static void ecdsa_data_free(void *data) | |||
176 | 176 | ||
177 | OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA)); | 177 | OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA)); |
178 | 178 | ||
179 | OPENSSL_free(r); | 179 | free(r); |
180 | } | 180 | } |
181 | 181 | ||
182 | ECDSA_DATA *ecdsa_check(EC_KEY *key) | 182 | ECDSA_DATA *ecdsa_check(EC_KEY *key) |
diff --git a/src/lib/libssl/src/crypto/engine/eng_dyn.c b/src/lib/libssl/src/crypto/engine/eng_dyn.c index 807da7a5eb..7878bd802e 100644 --- a/src/lib/libssl/src/crypto/engine/eng_dyn.c +++ b/src/lib/libssl/src/crypto/engine/eng_dyn.c | |||
@@ -153,7 +153,7 @@ struct st_dynamic_data_ctx | |||
153 | * structure. */ | 153 | * structure. */ |
154 | static int dynamic_ex_data_idx = -1; | 154 | static int dynamic_ex_data_idx = -1; |
155 | 155 | ||
156 | static void int_free_str(char *s) { OPENSSL_free(s); } | 156 | static void int_free_str(char *s) { free(s); } |
157 | /* Because our ex_data element may or may not get allocated depending on whether | 157 | /* Because our ex_data element may or may not get allocated depending on whether |
158 | * a "first-use" occurs before the ENGINE is freed, we have a memory leak | 158 | * a "first-use" occurs before the ENGINE is freed, we have a memory leak |
159 | * problem to solve. We can't declare a "new" handler for the ex_data as we | 159 | * problem to solve. We can't declare a "new" handler for the ex_data as we |
@@ -170,12 +170,12 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
170 | if(ctx->dynamic_dso) | 170 | if(ctx->dynamic_dso) |
171 | DSO_free(ctx->dynamic_dso); | 171 | DSO_free(ctx->dynamic_dso); |
172 | if(ctx->DYNAMIC_LIBNAME) | 172 | if(ctx->DYNAMIC_LIBNAME) |
173 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); | 173 | free((void*)ctx->DYNAMIC_LIBNAME); |
174 | if(ctx->engine_id) | 174 | if(ctx->engine_id) |
175 | OPENSSL_free((void*)ctx->engine_id); | 175 | free((void*)ctx->engine_id); |
176 | if(ctx->dirs) | 176 | if(ctx->dirs) |
177 | sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); | 177 | sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); |
178 | OPENSSL_free(ctx); | 178 | free(ctx); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
@@ -186,7 +186,7 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
186 | static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | 186 | static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) |
187 | { | 187 | { |
188 | dynamic_data_ctx *c; | 188 | dynamic_data_ctx *c; |
189 | c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); | 189 | c = malloc(sizeof(dynamic_data_ctx)); |
190 | if(!c) | 190 | if(!c) |
191 | { | 191 | { |
192 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 192 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
@@ -207,7 +207,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
207 | if(!c->dirs) | 207 | if(!c->dirs) |
208 | { | 208 | { |
209 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 209 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
210 | OPENSSL_free(c); | 210 | free(c); |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 213 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
@@ -223,7 +223,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
223 | /* If we lost the race to set the context, c is non-NULL and *ctx is the | 223 | /* If we lost the race to set the context, c is non-NULL and *ctx is the |
224 | * context of the thread that won. */ | 224 | * context of the thread that won. */ |
225 | if(c) | 225 | if(c) |
226 | OPENSSL_free(c); | 226 | free(c); |
227 | return 1; | 227 | return 1; |
228 | } | 228 | } |
229 | 229 | ||
@@ -337,7 +337,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) | |||
337 | if(p && (strlen((const char *)p) < 1)) | 337 | if(p && (strlen((const char *)p) < 1)) |
338 | p = NULL; | 338 | p = NULL; |
339 | if(ctx->DYNAMIC_LIBNAME) | 339 | if(ctx->DYNAMIC_LIBNAME) |
340 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); | 340 | free((void*)ctx->DYNAMIC_LIBNAME); |
341 | if(p) | 341 | if(p) |
342 | ctx->DYNAMIC_LIBNAME = BUF_strdup(p); | 342 | ctx->DYNAMIC_LIBNAME = BUF_strdup(p); |
343 | else | 343 | else |
@@ -351,7 +351,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) | |||
351 | if(p && (strlen((const char *)p) < 1)) | 351 | if(p && (strlen((const char *)p) < 1)) |
352 | p = NULL; | 352 | p = NULL; |
353 | if(ctx->engine_id) | 353 | if(ctx->engine_id) |
354 | OPENSSL_free((void*)ctx->engine_id); | 354 | free((void*)ctx->engine_id); |
355 | if(p) | 355 | if(p) |
356 | ctx->engine_id = BUF_strdup(p); | 356 | ctx->engine_id = BUF_strdup(p); |
357 | else | 357 | else |
@@ -422,10 +422,10 @@ static int int_load(dynamic_data_ctx *ctx) | |||
422 | if(DSO_load(ctx->dynamic_dso, merge, NULL, 0)) | 422 | if(DSO_load(ctx->dynamic_dso, merge, NULL, 0)) |
423 | { | 423 | { |
424 | /* Found what we're looking for */ | 424 | /* Found what we're looking for */ |
425 | OPENSSL_free(merge); | 425 | free(merge); |
426 | return 1; | 426 | return 1; |
427 | } | 427 | } |
428 | OPENSSL_free(merge); | 428 | free(merge); |
429 | } | 429 | } |
430 | return 0; | 430 | return 0; |
431 | } | 431 | } |
diff --git a/src/lib/libssl/src/crypto/engine/eng_lib.c b/src/lib/libssl/src/crypto/engine/eng_lib.c index 18a6664645..126bc02296 100644 --- a/src/lib/libssl/src/crypto/engine/eng_lib.c +++ b/src/lib/libssl/src/crypto/engine/eng_lib.c | |||
@@ -65,7 +65,7 @@ ENGINE *ENGINE_new(void) | |||
65 | { | 65 | { |
66 | ENGINE *ret; | 66 | ENGINE *ret; |
67 | 67 | ||
68 | ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE)); | 68 | ret = (ENGINE *)malloc(sizeof(ENGINE)); |
69 | if(ret == NULL) | 69 | if(ret == NULL) |
70 | { | 70 | { |
71 | ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE); | 71 | ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE); |
@@ -133,7 +133,7 @@ int engine_free_util(ENGINE *e, int locked) | |||
133 | if(e->destroy) | 133 | if(e->destroy) |
134 | e->destroy(e); | 134 | e->destroy(e); |
135 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); | 135 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); |
136 | OPENSSL_free(e); | 136 | free(e); |
137 | return 1; | 137 | return 1; |
138 | } | 138 | } |
139 | 139 | ||
@@ -158,7 +158,7 @@ static int int_cleanup_check(int create) | |||
158 | } | 158 | } |
159 | static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) | 159 | static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) |
160 | { | 160 | { |
161 | ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof( | 161 | ENGINE_CLEANUP_ITEM *item = malloc(sizeof( |
162 | ENGINE_CLEANUP_ITEM)); | 162 | ENGINE_CLEANUP_ITEM)); |
163 | if(!item) return NULL; | 163 | if(!item) return NULL; |
164 | item->cb = cb; | 164 | item->cb = cb; |
@@ -184,7 +184,7 @@ void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) | |||
184 | static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) | 184 | static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) |
185 | { | 185 | { |
186 | (*(item->cb))(); | 186 | (*(item->cb))(); |
187 | OPENSSL_free(item); | 187 | free(item); |
188 | } | 188 | } |
189 | void ENGINE_cleanup(void) | 189 | void ENGINE_cleanup(void) |
190 | { | 190 | { |
diff --git a/src/lib/libssl/src/crypto/engine/eng_rsax.c b/src/lib/libssl/src/crypto/engine/eng_rsax.c index 96e63477ee..fa9159499d 100644 --- a/src/lib/libssl/src/crypto/engine/eng_rsax.c +++ b/src/lib/libssl/src/crypto/engine/eng_rsax.c | |||
@@ -282,7 +282,7 @@ static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m) | |||
282 | 282 | ||
283 | hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); | 283 | hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); |
284 | if (!hptr) { | 284 | if (!hptr) { |
285 | hptr = OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX)); | 285 | hptr = malloc(3*sizeof(E_RSAX_MOD_CTX)); |
286 | if (!hptr) return NULL; | 286 | if (!hptr) return NULL; |
287 | hptr[2].type = hptr[1].type= hptr[0].type = 0; | 287 | hptr[2].type = hptr[1].type= hptr[0].type = 0; |
288 | RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr); | 288 | RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr); |
@@ -307,7 +307,7 @@ static int e_rsax_rsa_finish(RSA *rsa) | |||
307 | E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); | 307 | E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); |
308 | if(hptr) | 308 | if(hptr) |
309 | { | 309 | { |
310 | OPENSSL_free(hptr); | 310 | free(hptr); |
311 | RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); | 311 | RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); |
312 | } | 312 | } |
313 | if (rsa->_method_mod_n) | 313 | if (rsa->_method_mod_n) |
diff --git a/src/lib/libssl/src/crypto/engine/eng_table.c b/src/lib/libssl/src/crypto/engine/eng_table.c index 4fde948185..b7e77f7625 100644 --- a/src/lib/libssl/src/crypto/engine/eng_table.c +++ b/src/lib/libssl/src/crypto/engine/eng_table.c | |||
@@ -146,14 +146,14 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, | |||
146 | fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); | 146 | fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); |
147 | if(!fnd) | 147 | if(!fnd) |
148 | { | 148 | { |
149 | fnd = OPENSSL_malloc(sizeof(ENGINE_PILE)); | 149 | fnd = malloc(sizeof(ENGINE_PILE)); |
150 | if(!fnd) goto end; | 150 | if(!fnd) goto end; |
151 | fnd->uptodate = 1; | 151 | fnd->uptodate = 1; |
152 | fnd->nid = *nids; | 152 | fnd->nid = *nids; |
153 | fnd->sk = sk_ENGINE_new_null(); | 153 | fnd->sk = sk_ENGINE_new_null(); |
154 | if(!fnd->sk) | 154 | if(!fnd->sk) |
155 | { | 155 | { |
156 | OPENSSL_free(fnd); | 156 | free(fnd); |
157 | goto end; | 157 | goto end; |
158 | } | 158 | } |
159 | fnd->funct = NULL; | 159 | fnd->funct = NULL; |
@@ -218,7 +218,7 @@ static void int_cleanup_cb_doall(ENGINE_PILE *p) | |||
218 | sk_ENGINE_free(p->sk); | 218 | sk_ENGINE_free(p->sk); |
219 | if(p->funct) | 219 | if(p->funct) |
220 | engine_unlocked_finish(p->funct, 0); | 220 | engine_unlocked_finish(p->funct, 0); |
221 | OPENSSL_free(p); | 221 | free(p); |
222 | } | 222 | } |
223 | static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE) | 223 | static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE) |
224 | 224 | ||
diff --git a/src/lib/libssl/src/crypto/err/err.c b/src/lib/libssl/src/crypto/err/err.c index f6f9d2c080..93ed1da943 100644 --- a/src/lib/libssl/src/crypto/err/err.c +++ b/src/lib/libssl/src/crypto/err/err.c | |||
@@ -572,7 +572,7 @@ static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1]; | |||
572 | 572 | ||
573 | static void build_SYS_str_reasons(void) | 573 | static void build_SYS_str_reasons(void) |
574 | { | 574 | { |
575 | /* OPENSSL_malloc cannot be used here, use static storage instead */ | 575 | /* malloc cannot be used here, use static storage instead */ |
576 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; | 576 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; |
577 | int i; | 577 | int i; |
578 | static int init = 1; | 578 | static int init = 1; |
@@ -625,7 +625,7 @@ static void build_SYS_str_reasons(void) | |||
625 | if (((p)->err_data[i] != NULL) && \ | 625 | if (((p)->err_data[i] != NULL) && \ |
626 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ | 626 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ |
627 | { \ | 627 | { \ |
628 | OPENSSL_free((p)->err_data[i]); \ | 628 | free((p)->err_data[i]); \ |
629 | (p)->err_data[i]=NULL; \ | 629 | (p)->err_data[i]=NULL; \ |
630 | } \ | 630 | } \ |
631 | (p)->err_data_flags[i]=0; \ | 631 | (p)->err_data_flags[i]=0; \ |
@@ -651,7 +651,7 @@ static void ERR_STATE_free(ERR_STATE *s) | |||
651 | { | 651 | { |
652 | err_clear_data(s,i); | 652 | err_clear_data(s,i); |
653 | } | 653 | } |
654 | OPENSSL_free(s); | 654 | free(s); |
655 | } | 655 | } |
656 | 656 | ||
657 | void ERR_load_ERR_strings(void) | 657 | void ERR_load_ERR_strings(void) |
@@ -1015,7 +1015,7 @@ ERR_STATE *ERR_get_state(void) | |||
1015 | /* ret == the error state, if NULL, make a new one */ | 1015 | /* ret == the error state, if NULL, make a new one */ |
1016 | if (ret == NULL) | 1016 | if (ret == NULL) |
1017 | { | 1017 | { |
1018 | ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE)); | 1018 | ret=(ERR_STATE *)malloc(sizeof(ERR_STATE)); |
1019 | if (ret == NULL) return(&fallback); | 1019 | if (ret == NULL) return(&fallback); |
1020 | CRYPTO_THREADID_cpy(&ret->tid, &tid); | 1020 | CRYPTO_THREADID_cpy(&ret->tid, &tid); |
1021 | ret->top=0; | 1021 | ret->top=0; |
@@ -1076,7 +1076,7 @@ void ERR_add_error_vdata(int num, va_list args) | |||
1076 | char *str,*p,*a; | 1076 | char *str,*p,*a; |
1077 | 1077 | ||
1078 | s=80; | 1078 | s=80; |
1079 | str=OPENSSL_malloc(s+1); | 1079 | str=malloc(s+1); |
1080 | if (str == NULL) return; | 1080 | if (str == NULL) return; |
1081 | str[0]='\0'; | 1081 | str[0]='\0'; |
1082 | 1082 | ||
@@ -1091,10 +1091,10 @@ void ERR_add_error_vdata(int num, va_list args) | |||
1091 | if (n > s) | 1091 | if (n > s) |
1092 | { | 1092 | { |
1093 | s=n+20; | 1093 | s=n+20; |
1094 | p=OPENSSL_realloc(str,s+1); | 1094 | p=realloc(str,s+1); |
1095 | if (p == NULL) | 1095 | if (p == NULL) |
1096 | { | 1096 | { |
1097 | OPENSSL_free(str); | 1097 | free(str); |
1098 | return; | 1098 | return; |
1099 | } | 1099 | } |
1100 | else | 1100 | else |
diff --git a/src/lib/libssl/src/crypto/evp/bio_b64.c b/src/lib/libssl/src/crypto/evp/bio_b64.c index ac6d441aad..27fc587ca8 100644 --- a/src/lib/libssl/src/crypto/evp/bio_b64.c +++ b/src/lib/libssl/src/crypto/evp/bio_b64.c | |||
@@ -113,7 +113,7 @@ static int b64_new(BIO *bi) | |||
113 | { | 113 | { |
114 | BIO_B64_CTX *ctx; | 114 | BIO_B64_CTX *ctx; |
115 | 115 | ||
116 | ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX)); | 116 | ctx=(BIO_B64_CTX *)malloc(sizeof(BIO_B64_CTX)); |
117 | if (ctx == NULL) return(0); | 117 | if (ctx == NULL) return(0); |
118 | 118 | ||
119 | ctx->buf_len=0; | 119 | ctx->buf_len=0; |
@@ -134,7 +134,7 @@ static int b64_new(BIO *bi) | |||
134 | static int b64_free(BIO *a) | 134 | static int b64_free(BIO *a) |
135 | { | 135 | { |
136 | if (a == NULL) return(0); | 136 | if (a == NULL) return(0); |
137 | OPENSSL_free(a->ptr); | 137 | free(a->ptr); |
138 | a->ptr=NULL; | 138 | a->ptr=NULL; |
139 | a->init=0; | 139 | a->init=0; |
140 | a->flags=0; | 140 | a->flags=0; |
diff --git a/src/lib/libssl/src/crypto/evp/bio_enc.c b/src/lib/libssl/src/crypto/evp/bio_enc.c index b6efb5fbc4..8fe9a45e48 100644 --- a/src/lib/libssl/src/crypto/evp/bio_enc.c +++ b/src/lib/libssl/src/crypto/evp/bio_enc.c | |||
@@ -109,7 +109,7 @@ static int enc_new(BIO *bi) | |||
109 | { | 109 | { |
110 | BIO_ENC_CTX *ctx; | 110 | BIO_ENC_CTX *ctx; |
111 | 111 | ||
112 | ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX)); | 112 | ctx=(BIO_ENC_CTX *)malloc(sizeof(BIO_ENC_CTX)); |
113 | if (ctx == NULL) return(0); | 113 | if (ctx == NULL) return(0); |
114 | EVP_CIPHER_CTX_init(&ctx->cipher); | 114 | EVP_CIPHER_CTX_init(&ctx->cipher); |
115 | 115 | ||
@@ -133,7 +133,7 @@ static int enc_free(BIO *a) | |||
133 | b=(BIO_ENC_CTX *)a->ptr; | 133 | b=(BIO_ENC_CTX *)a->ptr; |
134 | EVP_CIPHER_CTX_cleanup(&(b->cipher)); | 134 | EVP_CIPHER_CTX_cleanup(&(b->cipher)); |
135 | OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX)); | 135 | OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX)); |
136 | OPENSSL_free(a->ptr); | 136 | free(a->ptr); |
137 | a->ptr=NULL; | 137 | a->ptr=NULL; |
138 | a->init=0; | 138 | a->init=0; |
139 | a->flags=0; | 139 | a->flags=0; |
diff --git a/src/lib/libssl/src/crypto/evp/bio_ok.c b/src/lib/libssl/src/crypto/evp/bio_ok.c index e64335353f..fdb742f554 100644 --- a/src/lib/libssl/src/crypto/evp/bio_ok.c +++ b/src/lib/libssl/src/crypto/evp/bio_ok.c | |||
@@ -178,7 +178,7 @@ static int ok_new(BIO *bi) | |||
178 | { | 178 | { |
179 | BIO_OK_CTX *ctx; | 179 | BIO_OK_CTX *ctx; |
180 | 180 | ||
181 | ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX)); | 181 | ctx=(BIO_OK_CTX *)malloc(sizeof(BIO_OK_CTX)); |
182 | if (ctx == NULL) return(0); | 182 | if (ctx == NULL) return(0); |
183 | 183 | ||
184 | ctx->buf_len=0; | 184 | ctx->buf_len=0; |
@@ -203,7 +203,7 @@ static int ok_free(BIO *a) | |||
203 | if (a == NULL) return(0); | 203 | if (a == NULL) return(0); |
204 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); | 204 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); |
205 | OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); | 205 | OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); |
206 | OPENSSL_free(a->ptr); | 206 | free(a->ptr); |
207 | a->ptr=NULL; | 207 | a->ptr=NULL; |
208 | a->init=0; | 208 | a->init=0; |
209 | a->flags=0; | 209 | a->flags=0; |
diff --git a/src/lib/libssl/src/crypto/evp/digest.c b/src/lib/libssl/src/crypto/evp/digest.c index 782d3199a5..2fae68ef5e 100644 --- a/src/lib/libssl/src/crypto/evp/digest.c +++ b/src/lib/libssl/src/crypto/evp/digest.c | |||
@@ -124,7 +124,7 @@ void EVP_MD_CTX_init(EVP_MD_CTX *ctx) | |||
124 | 124 | ||
125 | EVP_MD_CTX *EVP_MD_CTX_create(void) | 125 | EVP_MD_CTX *EVP_MD_CTX_create(void) |
126 | { | 126 | { |
127 | EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | 127 | EVP_MD_CTX *ctx=malloc(sizeof *ctx); |
128 | 128 | ||
129 | if (ctx) | 129 | if (ctx) |
130 | EVP_MD_CTX_init(ctx); | 130 | EVP_MD_CTX_init(ctx); |
@@ -198,12 +198,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | |||
198 | if (ctx->digest != type) | 198 | if (ctx->digest != type) |
199 | { | 199 | { |
200 | if (ctx->digest && ctx->digest->ctx_size) | 200 | if (ctx->digest && ctx->digest->ctx_size) |
201 | OPENSSL_free(ctx->md_data); | 201 | free(ctx->md_data); |
202 | ctx->digest=type; | 202 | ctx->digest=type; |
203 | if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) | 203 | if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) |
204 | { | 204 | { |
205 | ctx->update = type->update; | 205 | ctx->update = type->update; |
206 | ctx->md_data=OPENSSL_malloc(type->ctx_size); | 206 | ctx->md_data=malloc(type->ctx_size); |
207 | if (ctx->md_data == NULL) | 207 | if (ctx->md_data == NULL) |
208 | { | 208 | { |
209 | EVPerr(EVP_F_EVP_DIGESTINIT_EX, | 209 | EVPerr(EVP_F_EVP_DIGESTINIT_EX, |
@@ -298,7 +298,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | |||
298 | out->md_data = tmp_buf; | 298 | out->md_data = tmp_buf; |
299 | else | 299 | else |
300 | { | 300 | { |
301 | out->md_data=OPENSSL_malloc(out->digest->ctx_size); | 301 | out->md_data=malloc(out->digest->ctx_size); |
302 | if (!out->md_data) | 302 | if (!out->md_data) |
303 | { | 303 | { |
304 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE); | 304 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE); |
@@ -347,7 +347,7 @@ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | |||
347 | if (ctx) | 347 | if (ctx) |
348 | { | 348 | { |
349 | EVP_MD_CTX_cleanup(ctx); | 349 | EVP_MD_CTX_cleanup(ctx); |
350 | OPENSSL_free(ctx); | 350 | free(ctx); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
@@ -364,7 +364,7 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
364 | && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) | 364 | && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) |
365 | { | 365 | { |
366 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); | 366 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); |
367 | OPENSSL_free(ctx->md_data); | 367 | free(ctx->md_data); |
368 | } | 368 | } |
369 | if (ctx->pctx) | 369 | if (ctx->pctx) |
370 | EVP_PKEY_CTX_free(ctx->pctx); | 370 | EVP_PKEY_CTX_free(ctx->pctx); |
diff --git a/src/lib/libssl/src/crypto/evp/e_aes.c b/src/lib/libssl/src/crypto/evp/e_aes.c index c7eaafe89b..d6f0124a94 100644 --- a/src/lib/libssl/src/crypto/evp/e_aes.c +++ b/src/lib/libssl/src/crypto/evp/e_aes.c | |||
@@ -679,7 +679,7 @@ static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) | |||
679 | EVP_AES_GCM_CTX *gctx = c->cipher_data; | 679 | EVP_AES_GCM_CTX *gctx = c->cipher_data; |
680 | OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); | 680 | OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); |
681 | if (gctx->iv != c->iv) | 681 | if (gctx->iv != c->iv) |
682 | OPENSSL_free(gctx->iv); | 682 | free(gctx->iv); |
683 | return 1; | 683 | return 1; |
684 | } | 684 | } |
685 | 685 | ||
@@ -724,8 +724,8 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
724 | if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) | 724 | if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) |
725 | { | 725 | { |
726 | if (gctx->iv != c->iv) | 726 | if (gctx->iv != c->iv) |
727 | OPENSSL_free(gctx->iv); | 727 | free(gctx->iv); |
728 | gctx->iv = OPENSSL_malloc(arg); | 728 | gctx->iv = malloc(arg); |
729 | if (!gctx->iv) | 729 | if (!gctx->iv) |
730 | return 0; | 730 | return 0; |
731 | } | 731 | } |
diff --git a/src/lib/libssl/src/crypto/evp/evp_enc.c b/src/lib/libssl/src/crypto/evp/evp_enc.c index 50403a7578..e8ca502633 100644 --- a/src/lib/libssl/src/crypto/evp/evp_enc.c +++ b/src/lib/libssl/src/crypto/evp/evp_enc.c | |||
@@ -78,7 +78,7 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | |||
78 | 78 | ||
79 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) | 79 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) |
80 | { | 80 | { |
81 | EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | 81 | EVP_CIPHER_CTX *ctx=malloc(sizeof *ctx); |
82 | if (ctx) | 82 | if (ctx) |
83 | EVP_CIPHER_CTX_init(ctx); | 83 | EVP_CIPHER_CTX_init(ctx); |
84 | return ctx; | 84 | return ctx; |
@@ -164,7 +164,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
164 | ctx->cipher=cipher; | 164 | ctx->cipher=cipher; |
165 | if (ctx->cipher->ctx_size) | 165 | if (ctx->cipher->ctx_size) |
166 | { | 166 | { |
167 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | 167 | ctx->cipher_data=malloc(ctx->cipher->ctx_size); |
168 | if (!ctx->cipher_data) | 168 | if (!ctx->cipher_data) |
169 | { | 169 | { |
170 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); | 170 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); |
@@ -546,7 +546,7 @@ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | |||
546 | if (ctx) | 546 | if (ctx) |
547 | { | 547 | { |
548 | EVP_CIPHER_CTX_cleanup(ctx); | 548 | EVP_CIPHER_CTX_cleanup(ctx); |
549 | OPENSSL_free(ctx); | 549 | free(ctx); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | ||
@@ -561,7 +561,7 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | |||
561 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | 561 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); |
562 | } | 562 | } |
563 | if (c->cipher_data) | 563 | if (c->cipher_data) |
564 | OPENSSL_free(c->cipher_data); | 564 | free(c->cipher_data); |
565 | #ifndef OPENSSL_NO_ENGINE | 565 | #ifndef OPENSSL_NO_ENGINE |
566 | if (c->engine) | 566 | if (c->engine) |
567 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | 567 | /* The EVP_CIPHER we used belongs to an ENGINE, release the |
@@ -644,7 +644,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) | |||
644 | 644 | ||
645 | if (in->cipher_data && in->cipher->ctx_size) | 645 | if (in->cipher_data && in->cipher->ctx_size) |
646 | { | 646 | { |
647 | out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size); | 647 | out->cipher_data=malloc(in->cipher->ctx_size); |
648 | if (!out->cipher_data) | 648 | if (!out->cipher_data) |
649 | { | 649 | { |
650 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE); | 650 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/evp/evp_pbe.c b/src/lib/libssl/src/crypto/evp/evp_pbe.c index f8c32d825e..c808b96fef 100644 --- a/src/lib/libssl/src/crypto/evp/evp_pbe.c +++ b/src/lib/libssl/src/crypto/evp/evp_pbe.c | |||
@@ -238,7 +238,7 @@ int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, | |||
238 | EVP_PBE_CTL *pbe_tmp; | 238 | EVP_PBE_CTL *pbe_tmp; |
239 | if (!pbe_algs) | 239 | if (!pbe_algs) |
240 | pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp); | 240 | pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp); |
241 | if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) | 241 | if (!(pbe_tmp = (EVP_PBE_CTL*) malloc (sizeof(EVP_PBE_CTL)))) |
242 | { | 242 | { |
243 | EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE); | 243 | EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE); |
244 | return 0; | 244 | return 0; |
@@ -306,7 +306,7 @@ int EVP_PBE_find(int type, int pbe_nid, | |||
306 | 306 | ||
307 | static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe) | 307 | static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe) |
308 | { | 308 | { |
309 | OPENSSL_freeFunc(pbe); | 309 | free(pbe); |
310 | } | 310 | } |
311 | 311 | ||
312 | void EVP_PBE_cleanup(void) | 312 | void EVP_PBE_cleanup(void) |
diff --git a/src/lib/libssl/src/crypto/evp/p_lib.c b/src/lib/libssl/src/crypto/evp/p_lib.c index e26ccd0d08..7a9da3487a 100644 --- a/src/lib/libssl/src/crypto/evp/p_lib.c +++ b/src/lib/libssl/src/crypto/evp/p_lib.c | |||
@@ -183,7 +183,7 @@ EVP_PKEY *EVP_PKEY_new(void) | |||
183 | { | 183 | { |
184 | EVP_PKEY *ret; | 184 | EVP_PKEY *ret; |
185 | 185 | ||
186 | ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY)); | 186 | ret=(EVP_PKEY *)malloc(sizeof(EVP_PKEY)); |
187 | if (ret == NULL) | 187 | if (ret == NULL) |
188 | { | 188 | { |
189 | EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE); | 189 | EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE); |
@@ -405,7 +405,7 @@ void EVP_PKEY_free(EVP_PKEY *x) | |||
405 | EVP_PKEY_free_it(x); | 405 | EVP_PKEY_free_it(x); |
406 | if (x->attributes) | 406 | if (x->attributes) |
407 | sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); | 407 | sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); |
408 | OPENSSL_free(x); | 408 | free(x); |
409 | } | 409 | } |
410 | 410 | ||
411 | static void EVP_PKEY_free_it(EVP_PKEY *x) | 411 | static void EVP_PKEY_free_it(EVP_PKEY *x) |
diff --git a/src/lib/libssl/src/crypto/evp/p_open.c b/src/lib/libssl/src/crypto/evp/p_open.c index c748fbea87..2a5ab2b6cc 100644 --- a/src/lib/libssl/src/crypto/evp/p_open.c +++ b/src/lib/libssl/src/crypto/evp/p_open.c | |||
@@ -87,7 +87,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |||
87 | } | 87 | } |
88 | 88 | ||
89 | size=RSA_size(priv->pkey.rsa); | 89 | size=RSA_size(priv->pkey.rsa); |
90 | key=(unsigned char *)OPENSSL_malloc(size+2); | 90 | key=(unsigned char *)malloc(size+2); |
91 | if (key == NULL) | 91 | if (key == NULL) |
92 | { | 92 | { |
93 | /* ERROR */ | 93 | /* ERROR */ |
@@ -106,7 +106,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |||
106 | ret=1; | 106 | ret=1; |
107 | err: | 107 | err: |
108 | if (key != NULL) OPENSSL_cleanse(key,size); | 108 | if (key != NULL) OPENSSL_cleanse(key,size); |
109 | OPENSSL_free(key); | 109 | free(key); |
110 | return(ret); | 110 | return(ret); |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/src/lib/libssl/src/crypto/evp/pmeth_lib.c b/src/lib/libssl/src/crypto/evp/pmeth_lib.c index acfa7b6f87..a9fb15fdfe 100644 --- a/src/lib/libssl/src/crypto/evp/pmeth_lib.c +++ b/src/lib/libssl/src/crypto/evp/pmeth_lib.c | |||
@@ -165,7 +165,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) | |||
165 | return NULL; | 165 | return NULL; |
166 | } | 166 | } |
167 | 167 | ||
168 | ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); | 168 | ret = malloc(sizeof(EVP_PKEY_CTX)); |
169 | if (!ret) | 169 | if (!ret) |
170 | { | 170 | { |
171 | #ifndef OPENSSL_NO_ENGINE | 171 | #ifndef OPENSSL_NO_ENGINE |
@@ -200,7 +200,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) | |||
200 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags) | 200 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags) |
201 | { | 201 | { |
202 | EVP_PKEY_METHOD *pmeth; | 202 | EVP_PKEY_METHOD *pmeth; |
203 | pmeth = OPENSSL_malloc(sizeof(EVP_PKEY_METHOD)); | 203 | pmeth = malloc(sizeof(EVP_PKEY_METHOD)); |
204 | if (!pmeth) | 204 | if (!pmeth) |
205 | return NULL; | 205 | return NULL; |
206 | 206 | ||
@@ -291,7 +291,7 @@ void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src) | |||
291 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth) | 291 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth) |
292 | { | 292 | { |
293 | if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC)) | 293 | if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC)) |
294 | OPENSSL_free(pmeth); | 294 | free(pmeth); |
295 | } | 295 | } |
296 | 296 | ||
297 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) | 297 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) |
@@ -317,7 +317,7 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx) | |||
317 | return 0; | 317 | return 0; |
318 | } | 318 | } |
319 | #endif | 319 | #endif |
320 | rctx = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); | 320 | rctx = malloc(sizeof(EVP_PKEY_CTX)); |
321 | if (!rctx) | 321 | if (!rctx) |
322 | return NULL; | 322 | return NULL; |
323 | 323 | ||
@@ -378,7 +378,7 @@ void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx) | |||
378 | * functional reference we held for this reason. */ | 378 | * functional reference we held for this reason. */ |
379 | ENGINE_finish(ctx->engine); | 379 | ENGINE_finish(ctx->engine); |
380 | #endif | 380 | #endif |
381 | OPENSSL_free(ctx); | 381 | free(ctx); |
382 | } | 382 | } |
383 | 383 | ||
384 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | 384 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, |
diff --git a/src/lib/libssl/src/crypto/ex_data.c b/src/lib/libssl/src/crypto/ex_data.c index 44bad59527..4c09f9ee02 100644 --- a/src/lib/libssl/src/crypto/ex_data.c +++ b/src/lib/libssl/src/crypto/ex_data.c | |||
@@ -290,7 +290,7 @@ ex_data_check(void) | |||
290 | static void | 290 | static void |
291 | def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs) | 291 | def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs) |
292 | { | 292 | { |
293 | OPENSSL_free(funcs); | 293 | free(funcs); |
294 | } | 294 | } |
295 | 295 | ||
296 | /* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from | 296 | /* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from |
@@ -301,7 +301,7 @@ def_cleanup_cb(void *a_void) | |||
301 | { | 301 | { |
302 | EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void; | 302 | EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void; |
303 | sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, def_cleanup_util_cb); | 303 | sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, def_cleanup_util_cb); |
304 | OPENSSL_free(item); | 304 | free(item); |
305 | } | 305 | } |
306 | 306 | ||
307 | /* Return the EX_CLASS_ITEM from the "ex_data" hash table that corresponds to a | 307 | /* Return the EX_CLASS_ITEM from the "ex_data" hash table that corresponds to a |
@@ -315,13 +315,13 @@ static EX_CLASS_ITEM | |||
315 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); | 315 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); |
316 | p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d); | 316 | p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d); |
317 | if (!p) { | 317 | if (!p) { |
318 | gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM)); | 318 | gen = malloc(sizeof(EX_CLASS_ITEM)); |
319 | if (gen) { | 319 | if (gen) { |
320 | gen->class_index = class_index; | 320 | gen->class_index = class_index; |
321 | gen->meth_num = 0; | 321 | gen->meth_num = 0; |
322 | gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null(); | 322 | gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null(); |
323 | if (!gen->meth) | 323 | if (!gen->meth) |
324 | OPENSSL_free(gen); | 324 | free(gen); |
325 | else { | 325 | else { |
326 | /* Because we're inside the ex_data lock, the | 326 | /* Because we're inside the ex_data lock, the |
327 | * return value from the insert will be NULL */ | 327 | * return value from the insert will be NULL */ |
@@ -343,7 +343,7 @@ def_add_index(EX_CLASS_ITEM *item, long argl, void *argp, | |||
343 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | 343 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) |
344 | { | 344 | { |
345 | int toret = -1; | 345 | int toret = -1; |
346 | CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc( | 346 | CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)malloc( |
347 | sizeof(CRYPTO_EX_DATA_FUNCS)); | 347 | sizeof(CRYPTO_EX_DATA_FUNCS)); |
348 | if (!a) { | 348 | if (!a) { |
349 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); | 349 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); |
@@ -358,7 +358,7 @@ def_add_index(EX_CLASS_ITEM *item, long argl, void *argp, | |||
358 | while (sk_CRYPTO_EX_DATA_FUNCS_num(item->meth) <= item->meth_num) { | 358 | while (sk_CRYPTO_EX_DATA_FUNCS_num(item->meth) <= item->meth_num) { |
359 | if (!sk_CRYPTO_EX_DATA_FUNCS_push(item->meth, NULL)) { | 359 | if (!sk_CRYPTO_EX_DATA_FUNCS_push(item->meth, NULL)) { |
360 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); | 360 | CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); |
361 | OPENSSL_free(a); | 361 | free(a); |
362 | goto err; | 362 | goto err; |
363 | } | 363 | } |
364 | } | 364 | } |
@@ -422,7 +422,7 @@ int_new_ex_data(int class_index, void *obj, | |||
422 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); | 422 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); |
423 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); | 423 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); |
424 | if (mx > 0) { | 424 | if (mx > 0) { |
425 | storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); | 425 | storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); |
426 | if (!storage) | 426 | if (!storage) |
427 | goto skip; | 427 | goto skip; |
428 | for (i = 0; i < mx; i++) | 428 | for (i = 0; i < mx; i++) |
@@ -442,7 +442,7 @@ skip: | |||
442 | } | 442 | } |
443 | } | 443 | } |
444 | if (storage) | 444 | if (storage) |
445 | OPENSSL_free(storage); | 445 | free(storage); |
446 | return 1; | 446 | return 1; |
447 | } | 447 | } |
448 | 448 | ||
@@ -466,7 +466,7 @@ int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, | |||
466 | if (j < mx) | 466 | if (j < mx) |
467 | mx = j; | 467 | mx = j; |
468 | if (mx > 0) { | 468 | if (mx > 0) { |
469 | storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); | 469 | storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); |
470 | if (!storage) | 470 | if (!storage) |
471 | goto skip; | 471 | goto skip; |
472 | for (i = 0; i < mx; i++) | 472 | for (i = 0; i < mx; i++) |
@@ -486,7 +486,7 @@ skip: | |||
486 | CRYPTO_set_ex_data(to, i, ptr); | 486 | CRYPTO_set_ex_data(to, i, ptr); |
487 | } | 487 | } |
488 | if (storage) | 488 | if (storage) |
489 | OPENSSL_free(storage); | 489 | free(storage); |
490 | return 1; | 490 | return 1; |
491 | } | 491 | } |
492 | 492 | ||
@@ -503,7 +503,7 @@ int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | |||
503 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); | 503 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); |
504 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); | 504 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); |
505 | if (mx > 0) { | 505 | if (mx > 0) { |
506 | storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); | 506 | storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); |
507 | if (!storage) | 507 | if (!storage) |
508 | goto skip; | 508 | goto skip; |
509 | for (i = 0; i < mx; i++) | 509 | for (i = 0; i < mx; i++) |
@@ -523,7 +523,7 @@ skip: | |||
523 | } | 523 | } |
524 | } | 524 | } |
525 | if (storage) | 525 | if (storage) |
526 | OPENSSL_free(storage); | 526 | free(storage); |
527 | if (ad->sk) { | 527 | if (ad->sk) { |
528 | sk_void_free(ad->sk); | 528 | sk_void_free(ad->sk); |
529 | ad->sk = NULL; | 529 | ad->sk = NULL; |
diff --git a/src/lib/libssl/src/crypto/hmac/hm_ameth.c b/src/lib/libssl/src/crypto/hmac/hm_ameth.c index e03f24aeda..fbada40d9c 100644 --- a/src/lib/libssl/src/crypto/hmac/hm_ameth.c +++ b/src/lib/libssl/src/crypto/hmac/hm_ameth.c | |||
@@ -122,7 +122,7 @@ static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) | |||
122 | { | 122 | { |
123 | if (!*pder) | 123 | if (!*pder) |
124 | { | 124 | { |
125 | *pder = OPENSSL_malloc(os->length); | 125 | *pder = malloc(os->length); |
126 | inc = 0; | 126 | inc = 0; |
127 | } | 127 | } |
128 | else inc = 1; | 128 | else inc = 1; |
diff --git a/src/lib/libssl/src/crypto/hmac/hm_pmeth.c b/src/lib/libssl/src/crypto/hmac/hm_pmeth.c index 0daa44511d..f1c67329d0 100644 --- a/src/lib/libssl/src/crypto/hmac/hm_pmeth.c +++ b/src/lib/libssl/src/crypto/hmac/hm_pmeth.c | |||
@@ -75,7 +75,7 @@ typedef struct | |||
75 | static int pkey_hmac_init(EVP_PKEY_CTX *ctx) | 75 | static int pkey_hmac_init(EVP_PKEY_CTX *ctx) |
76 | { | 76 | { |
77 | HMAC_PKEY_CTX *hctx; | 77 | HMAC_PKEY_CTX *hctx; |
78 | hctx = OPENSSL_malloc(sizeof(HMAC_PKEY_CTX)); | 78 | hctx = malloc(sizeof(HMAC_PKEY_CTX)); |
79 | if (!hctx) | 79 | if (!hctx) |
80 | return 0; | 80 | return 0; |
81 | hctx->md = NULL; | 81 | hctx->md = NULL; |
@@ -119,10 +119,10 @@ static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx) | |||
119 | { | 119 | { |
120 | if (hctx->ktmp.length) | 120 | if (hctx->ktmp.length) |
121 | OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length); | 121 | OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length); |
122 | OPENSSL_free(hctx->ktmp.data); | 122 | free(hctx->ktmp.data); |
123 | hctx->ktmp.data = NULL; | 123 | hctx->ktmp.data = NULL; |
124 | } | 124 | } |
125 | OPENSSL_free(hctx); | 125 | free(hctx); |
126 | } | 126 | } |
127 | 127 | ||
128 | static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | 128 | static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) |
@@ -229,7 +229,7 @@ static int pkey_hmac_ctrl_str(EVP_PKEY_CTX *ctx, | |||
229 | if (!key) | 229 | if (!key) |
230 | return 0; | 230 | return 0; |
231 | r = pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); | 231 | r = pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key); |
232 | OPENSSL_free(key); | 232 | free(key); |
233 | return r; | 233 | return r; |
234 | } | 234 | } |
235 | return -2; | 235 | return -2; |
diff --git a/src/lib/libssl/src/crypto/lhash/lh_test.c b/src/lib/libssl/src/crypto/lhash/lh_test.c index 85700c859b..2224a216ab 100644 --- a/src/lib/libssl/src/crypto/lhash/lh_test.c +++ b/src/lib/libssl/src/crypto/lhash/lh_test.c | |||
@@ -76,7 +76,7 @@ main() | |||
76 | fgets(buf,256,stdin); | 76 | fgets(buf,256,stdin); |
77 | if (buf[0] == '\0') break; | 77 | if (buf[0] == '\0') break; |
78 | i=strlen(buf); | 78 | i=strlen(buf); |
79 | p=OPENSSL_malloc(i+1); | 79 | p=malloc(i+1); |
80 | memcpy(p,buf,i+1); | 80 | memcpy(p,buf,i+1); |
81 | lh_insert(conf,p); | 81 | lh_insert(conf,p); |
82 | } | 82 | } |
diff --git a/src/lib/libssl/src/crypto/lhash/lhash.c b/src/lib/libssl/src/crypto/lhash/lhash.c index 47f748081b..78ba26db83 100644 --- a/src/lib/libssl/src/crypto/lhash/lhash.c +++ b/src/lib/libssl/src/crypto/lhash/lhash.c | |||
@@ -116,9 +116,9 @@ _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) | |||
116 | _LHASH *ret; | 116 | _LHASH *ret; |
117 | int i; | 117 | int i; |
118 | 118 | ||
119 | if ((ret=OPENSSL_malloc(sizeof(_LHASH))) == NULL) | 119 | if ((ret=malloc(sizeof(_LHASH))) == NULL) |
120 | goto err0; | 120 | goto err0; |
121 | if ((ret->b=OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) | 121 | if ((ret->b=malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) |
122 | goto err1; | 122 | goto err1; |
123 | for (i=0; i<MIN_NODES; i++) | 123 | for (i=0; i<MIN_NODES; i++) |
124 | ret->b[i]=NULL; | 124 | ret->b[i]=NULL; |
@@ -149,7 +149,7 @@ _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) | |||
149 | ret->error=0; | 149 | ret->error=0; |
150 | return(ret); | 150 | return(ret); |
151 | err1: | 151 | err1: |
152 | OPENSSL_free(ret); | 152 | free(ret); |
153 | err0: | 153 | err0: |
154 | return(NULL); | 154 | return(NULL); |
155 | } | 155 | } |
@@ -168,12 +168,12 @@ void lh_free(_LHASH *lh) | |||
168 | while (n != NULL) | 168 | while (n != NULL) |
169 | { | 169 | { |
170 | nn=n->next; | 170 | nn=n->next; |
171 | OPENSSL_free(n); | 171 | free(n); |
172 | n=nn; | 172 | n=nn; |
173 | } | 173 | } |
174 | } | 174 | } |
175 | OPENSSL_free(lh->b); | 175 | free(lh->b); |
176 | OPENSSL_free(lh); | 176 | free(lh); |
177 | } | 177 | } |
178 | 178 | ||
179 | void *lh_insert(_LHASH *lh, void *data) | 179 | void *lh_insert(_LHASH *lh, void *data) |
@@ -190,7 +190,7 @@ void *lh_insert(_LHASH *lh, void *data) | |||
190 | 190 | ||
191 | if (*rn == NULL) | 191 | if (*rn == NULL) |
192 | { | 192 | { |
193 | if ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL) | 193 | if ((nn=(LHASH_NODE *)malloc(sizeof(LHASH_NODE))) == NULL) |
194 | { | 194 | { |
195 | lh->error++; | 195 | lh->error++; |
196 | return(NULL); | 196 | return(NULL); |
@@ -233,7 +233,7 @@ void *lh_delete(_LHASH *lh, const void *data) | |||
233 | nn= *rn; | 233 | nn= *rn; |
234 | *rn=nn->next; | 234 | *rn=nn->next; |
235 | ret=nn->data; | 235 | ret=nn->data; |
236 | OPENSSL_free(nn); | 236 | free(nn); |
237 | lh->num_delete++; | 237 | lh->num_delete++; |
238 | } | 238 | } |
239 | 239 | ||
@@ -343,7 +343,7 @@ static void expand(_LHASH *lh) | |||
343 | if ((lh->p) >= lh->pmax) | 343 | if ((lh->p) >= lh->pmax) |
344 | { | 344 | { |
345 | j=(int)lh->num_alloc_nodes*2; | 345 | j=(int)lh->num_alloc_nodes*2; |
346 | n=(LHASH_NODE **)OPENSSL_realloc(lh->b, | 346 | n=(LHASH_NODE **)realloc(lh->b, |
347 | (int)(sizeof(LHASH_NODE *)*j)); | 347 | (int)(sizeof(LHASH_NODE *)*j)); |
348 | if (n == NULL) | 348 | if (n == NULL) |
349 | { | 349 | { |
@@ -371,7 +371,7 @@ static void contract(_LHASH *lh) | |||
371 | lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ | 371 | lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ |
372 | if (lh->p == 0) | 372 | if (lh->p == 0) |
373 | { | 373 | { |
374 | n=(LHASH_NODE **)OPENSSL_realloc(lh->b, | 374 | n=(LHASH_NODE **)realloc(lh->b, |
375 | (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); | 375 | (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); |
376 | if (n == NULL) | 376 | if (n == NULL) |
377 | { | 377 | { |
diff --git a/src/lib/libssl/src/crypto/modes/gcm128.c b/src/lib/libssl/src/crypto/modes/gcm128.c index e1dc2b0f47..52de084318 100644 --- a/src/lib/libssl/src/crypto/modes/gcm128.c +++ b/src/lib/libssl/src/crypto/modes/gcm128.c | |||
@@ -1540,7 +1540,7 @@ GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block) | |||
1540 | { | 1540 | { |
1541 | GCM128_CONTEXT *ret; | 1541 | GCM128_CONTEXT *ret; |
1542 | 1542 | ||
1543 | if ((ret = (GCM128_CONTEXT *)OPENSSL_malloc(sizeof(GCM128_CONTEXT)))) | 1543 | if ((ret = (GCM128_CONTEXT *)malloc(sizeof(GCM128_CONTEXT)))) |
1544 | CRYPTO_gcm128_init(ret,key,block); | 1544 | CRYPTO_gcm128_init(ret,key,block); |
1545 | 1545 | ||
1546 | return ret; | 1546 | return ret; |
@@ -1550,7 +1550,7 @@ void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx) | |||
1550 | { | 1550 | { |
1551 | if (ctx) { | 1551 | if (ctx) { |
1552 | OPENSSL_cleanse(ctx,sizeof(*ctx)); | 1552 | OPENSSL_cleanse(ctx,sizeof(*ctx)); |
1553 | OPENSSL_free(ctx); | 1553 | free(ctx); |
1554 | } | 1554 | } |
1555 | } | 1555 | } |
1556 | 1556 | ||
diff --git a/src/lib/libssl/src/crypto/objects/o_names.c b/src/lib/libssl/src/crypto/objects/o_names.c index 4a548c2ed4..4c959db2da 100644 --- a/src/lib/libssl/src/crypto/objects/o_names.c +++ b/src/lib/libssl/src/crypto/objects/o_names.c | |||
@@ -83,7 +83,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), | |||
83 | for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++) | 83 | for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++) |
84 | { | 84 | { |
85 | MemCheck_off(); | 85 | MemCheck_off(); |
86 | name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); | 86 | name_funcs = malloc(sizeof(NAME_FUNCS)); |
87 | MemCheck_on(); | 87 | MemCheck_on(); |
88 | if (!name_funcs) | 88 | if (!name_funcs) |
89 | { | 89 | { |
@@ -192,7 +192,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
192 | alias=type&OBJ_NAME_ALIAS; | 192 | alias=type&OBJ_NAME_ALIAS; |
193 | type&= ~OBJ_NAME_ALIAS; | 193 | type&= ~OBJ_NAME_ALIAS; |
194 | 194 | ||
195 | onp=(OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME)); | 195 | onp=(OBJ_NAME *)malloc(sizeof(OBJ_NAME)); |
196 | if (onp == NULL) | 196 | if (onp == NULL) |
197 | { | 197 | { |
198 | /* ERROR */ | 198 | /* ERROR */ |
@@ -217,7 +217,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
217 | sk_NAME_FUNCS_value(name_funcs_stack, | 217 | sk_NAME_FUNCS_value(name_funcs_stack, |
218 | ret->type)->free_func(ret->name,ret->type,ret->data); | 218 | ret->type)->free_func(ret->name,ret->type,ret->data); |
219 | } | 219 | } |
220 | OPENSSL_free(ret); | 220 | free(ret); |
221 | } | 221 | } |
222 | else | 222 | else |
223 | { | 223 | { |
@@ -252,7 +252,7 @@ int OBJ_NAME_remove(const char *name, int type) | |||
252 | sk_NAME_FUNCS_value(name_funcs_stack, | 252 | sk_NAME_FUNCS_value(name_funcs_stack, |
253 | ret->type)->free_func(ret->name,ret->type,ret->data); | 253 | ret->type)->free_func(ret->name,ret->type,ret->data); |
254 | } | 254 | } |
255 | OPENSSL_free(ret); | 255 | free(ret); |
256 | return(1); | 256 | return(1); |
257 | } | 257 | } |
258 | else | 258 | else |
@@ -318,7 +318,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), | |||
318 | int n; | 318 | int n; |
319 | 319 | ||
320 | d.type=type; | 320 | d.type=type; |
321 | d.names=OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names); | 321 | d.names=malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names); |
322 | d.n=0; | 322 | d.n=0; |
323 | OBJ_NAME_do_all(type,do_all_sorted_fn,&d); | 323 | OBJ_NAME_do_all(type,do_all_sorted_fn,&d); |
324 | 324 | ||
@@ -327,7 +327,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), | |||
327 | for(n=0 ; n < d.n ; ++n) | 327 | for(n=0 ; n < d.n ; ++n) |
328 | fn(d.names[n],arg); | 328 | fn(d.names[n],arg); |
329 | 329 | ||
330 | OPENSSL_free((void *)d.names); | 330 | free((void *)d.names); |
331 | } | 331 | } |
332 | 332 | ||
333 | static int free_type; | 333 | static int free_type; |
@@ -345,7 +345,7 @@ static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME) | |||
345 | 345 | ||
346 | static void name_funcs_free(NAME_FUNCS *ptr) | 346 | static void name_funcs_free(NAME_FUNCS *ptr) |
347 | { | 347 | { |
348 | OPENSSL_free(ptr); | 348 | free(ptr); |
349 | } | 349 | } |
350 | 350 | ||
351 | void OBJ_NAME_cleanup(int type) | 351 | void OBJ_NAME_cleanup(int type) |
diff --git a/src/lib/libssl/src/crypto/objects/obj_dat.c b/src/lib/libssl/src/crypto/objects/obj_dat.c index bced796e62..641a97c8aa 100644 --- a/src/lib/libssl/src/crypto/objects/obj_dat.c +++ b/src/lib/libssl/src/crypto/objects/obj_dat.c | |||
@@ -199,7 +199,7 @@ static void cleanup3_doall(ADDED_OBJ *a) | |||
199 | { | 199 | { |
200 | if (--a->obj->nid == 0) | 200 | if (--a->obj->nid == 0) |
201 | ASN1_OBJECT_free(a->obj); | 201 | ASN1_OBJECT_free(a->obj); |
202 | OPENSSL_free(a); | 202 | free(a); |
203 | } | 203 | } |
204 | 204 | ||
205 | static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ) | 205 | static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ) |
@@ -253,13 +253,13 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
253 | if (added == NULL) | 253 | if (added == NULL) |
254 | if (!init_added()) return(0); | 254 | if (!init_added()) return(0); |
255 | if ((o=OBJ_dup(obj)) == NULL) goto err; | 255 | if ((o=OBJ_dup(obj)) == NULL) goto err; |
256 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 256 | if (!(ao[ADDED_NID]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
257 | if ((o->length != 0) && (obj->data != NULL)) | 257 | if ((o->length != 0) && (obj->data != NULL)) |
258 | if (!(ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 258 | if (!(ao[ADDED_DATA]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
259 | if (o->sn != NULL) | 259 | if (o->sn != NULL) |
260 | if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 260 | if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
261 | if (o->ln != NULL) | 261 | if (o->ln != NULL) |
262 | if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2; | 262 | if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2; |
263 | 263 | ||
264 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 264 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
265 | { | 265 | { |
@@ -270,7 +270,7 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
270 | aop=lh_ADDED_OBJ_insert(added,ao[i]); | 270 | aop=lh_ADDED_OBJ_insert(added,ao[i]); |
271 | /* memory leak, buit should not normally matter */ | 271 | /* memory leak, buit should not normally matter */ |
272 | if (aop != NULL) | 272 | if (aop != NULL) |
273 | OPENSSL_free(aop); | 273 | free(aop); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS| | 276 | o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS| |
@@ -281,8 +281,8 @@ err2: | |||
281 | OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE); | 281 | OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE); |
282 | err: | 282 | err: |
283 | for (i=ADDED_DATA; i<=ADDED_NID; i++) | 283 | for (i=ADDED_DATA; i<=ADDED_NID; i++) |
284 | if (ao[i] != NULL) OPENSSL_free(ao[i]); | 284 | if (ao[i] != NULL) free(ao[i]); |
285 | if (o != NULL) OPENSSL_free(o); | 285 | if (o != NULL) free(o); |
286 | return(NID_undef); | 286 | return(NID_undef); |
287 | } | 287 | } |
288 | 288 | ||
@@ -449,7 +449,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) | |||
449 | /* Work out total size */ | 449 | /* Work out total size */ |
450 | j = ASN1_object_size(0,i,V_ASN1_OBJECT); | 450 | j = ASN1_object_size(0,i,V_ASN1_OBJECT); |
451 | 451 | ||
452 | if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL; | 452 | if((buf=(unsigned char *)malloc(j)) == NULL) return NULL; |
453 | 453 | ||
454 | p = buf; | 454 | p = buf; |
455 | /* Write out tag+length */ | 455 | /* Write out tag+length */ |
@@ -459,7 +459,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) | |||
459 | 459 | ||
460 | cp=buf; | 460 | cp=buf; |
461 | op=d2i_ASN1_OBJECT(NULL,&cp,j); | 461 | op=d2i_ASN1_OBJECT(NULL,&cp,j); |
462 | OPENSSL_free(buf); | 462 | free(buf); |
463 | return op; | 463 | return op; |
464 | } | 464 | } |
465 | 465 | ||
@@ -590,7 +590,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
590 | } | 590 | } |
591 | n++; | 591 | n++; |
592 | n += i; | 592 | n += i; |
593 | OPENSSL_free(bndec); | 593 | free(bndec); |
594 | } | 594 | } |
595 | else | 595 | else |
596 | { | 596 | { |
@@ -774,7 +774,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) | |||
774 | i=a2d_ASN1_OBJECT(NULL,0,oid,-1); | 774 | i=a2d_ASN1_OBJECT(NULL,0,oid,-1); |
775 | if (i <= 0) return(0); | 775 | if (i <= 0) return(0); |
776 | 776 | ||
777 | if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) | 777 | if ((buf=(unsigned char *)malloc(i)) == NULL) |
778 | { | 778 | { |
779 | OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); | 779 | OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); |
780 | return(0); | 780 | return(0); |
@@ -788,7 +788,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) | |||
788 | ok=OBJ_add_object(op); | 788 | ok=OBJ_add_object(op); |
789 | err: | 789 | err: |
790 | ASN1_OBJECT_free(op); | 790 | ASN1_OBJECT_free(op); |
791 | OPENSSL_free(buf); | 791 | free(buf); |
792 | return(ok); | 792 | return(ok); |
793 | } | 793 | } |
794 | 794 | ||
diff --git a/src/lib/libssl/src/crypto/objects/obj_lib.c b/src/lib/libssl/src/crypto/objects/obj_lib.c index 23e9d48cdf..338fe851fc 100644 --- a/src/lib/libssl/src/crypto/objects/obj_lib.c +++ b/src/lib/libssl/src/crypto/objects/obj_lib.c | |||
@@ -80,7 +80,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
80 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); | 80 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); |
81 | return(NULL); | 81 | return(NULL); |
82 | } | 82 | } |
83 | data=OPENSSL_malloc(o->length); | 83 | data=malloc(o->length); |
84 | if (data == NULL) | 84 | if (data == NULL) |
85 | goto err; | 85 | goto err; |
86 | if (o->data != NULL) | 86 | if (o->data != NULL) |
@@ -93,7 +93,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
93 | if (o->ln != NULL) | 93 | if (o->ln != NULL) |
94 | { | 94 | { |
95 | i=strlen(o->ln)+1; | 95 | i=strlen(o->ln)+1; |
96 | ln=OPENSSL_malloc(i); | 96 | ln=malloc(i); |
97 | if (ln == NULL) goto err; | 97 | if (ln == NULL) goto err; |
98 | memcpy(ln,o->ln,i); | 98 | memcpy(ln,o->ln,i); |
99 | r->ln=ln; | 99 | r->ln=ln; |
@@ -102,7 +102,7 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
102 | if (o->sn != NULL) | 102 | if (o->sn != NULL) |
103 | { | 103 | { |
104 | i=strlen(o->sn)+1; | 104 | i=strlen(o->sn)+1; |
105 | sn=OPENSSL_malloc(i); | 105 | sn=malloc(i); |
106 | if (sn == NULL) goto err; | 106 | if (sn == NULL) goto err; |
107 | memcpy(sn,o->sn,i); | 107 | memcpy(sn,o->sn,i); |
108 | r->sn=sn; | 108 | r->sn=sn; |
@@ -112,10 +112,10 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
112 | return(r); | 112 | return(r); |
113 | err: | 113 | err: |
114 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); | 114 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); |
115 | if (ln != NULL) OPENSSL_free(ln); | 115 | if (ln != NULL) free(ln); |
116 | if (sn != NULL) OPENSSL_free(sn); | 116 | if (sn != NULL) free(sn); |
117 | if (data != NULL) OPENSSL_free(data); | 117 | if (data != NULL) free(data); |
118 | if (r != NULL) OPENSSL_free(r); | 118 | if (r != NULL) free(r); |
119 | return(NULL); | 119 | return(NULL); |
120 | } | 120 | } |
121 | 121 | ||
diff --git a/src/lib/libssl/src/crypto/objects/obj_xref.c b/src/lib/libssl/src/crypto/objects/obj_xref.c index 9f744bcede..797adc8d10 100644 --- a/src/lib/libssl/src/crypto/objects/obj_xref.c +++ b/src/lib/libssl/src/crypto/objects/obj_xref.c | |||
@@ -162,7 +162,7 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | |||
162 | sigx_app = sk_nid_triple_new(sigx_cmp); | 162 | sigx_app = sk_nid_triple_new(sigx_cmp); |
163 | if (!sigx_app) | 163 | if (!sigx_app) |
164 | return 0; | 164 | return 0; |
165 | ntr = OPENSSL_malloc(sizeof(int) * 3); | 165 | ntr = malloc(sizeof(int) * 3); |
166 | if (!ntr) | 166 | if (!ntr) |
167 | return 0; | 167 | return 0; |
168 | ntr->sign_id = signid; | 168 | ntr->sign_id = signid; |
@@ -171,7 +171,7 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | |||
171 | 171 | ||
172 | if (!sk_nid_triple_push(sig_app, ntr)) | 172 | if (!sk_nid_triple_push(sig_app, ntr)) |
173 | { | 173 | { |
174 | OPENSSL_free(ntr); | 174 | free(ntr); |
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
@@ -186,7 +186,7 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | |||
186 | 186 | ||
187 | static void sid_free(nid_triple *tt) | 187 | static void sid_free(nid_triple *tt) |
188 | { | 188 | { |
189 | OPENSSL_free(tt); | 189 | free(tt); |
190 | } | 190 | } |
191 | 191 | ||
192 | void OBJ_sigid_free(void) | 192 | void OBJ_sigid_free(void) |
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_ext.c b/src/lib/libssl/src/crypto/ocsp/ocsp_ext.c index ec884cb08f..9c7832b301 100644 --- a/src/lib/libssl/src/crypto/ocsp/ocsp_ext.c +++ b/src/lib/libssl/src/crypto/ocsp/ocsp_ext.c | |||
@@ -274,7 +274,7 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
274 | if (data) | 274 | if (data) |
275 | { | 275 | { |
276 | if ((i=i2d(data,NULL)) <= 0) goto err; | 276 | if ((i=i2d(data,NULL)) <= 0) goto err; |
277 | if (!(b=p=OPENSSL_malloc((unsigned int)i))) | 277 | if (!(b=p=malloc((unsigned int)i))) |
278 | goto err; | 278 | goto err; |
279 | if (i2d(data, &p) <= 0) goto err; | 279 | if (i2d(data, &p) <= 0) goto err; |
280 | } | 280 | } |
@@ -285,7 +285,7 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
285 | V_ASN1_SEQUENCE, | 285 | V_ASN1_SEQUENCE, |
286 | V_ASN1_UNIVERSAL, | 286 | V_ASN1_UNIVERSAL, |
287 | IS_SEQUENCE))<=0) goto err; | 287 | IS_SEQUENCE))<=0) goto err; |
288 | if (!(b=p=OPENSSL_malloc((unsigned int)i))) | 288 | if (!(b=p=malloc((unsigned int)i))) |
289 | goto err; | 289 | goto err; |
290 | if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d, | 290 | if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d, |
291 | V_ASN1_SEQUENCE, | 291 | V_ASN1_SEQUENCE, |
@@ -299,10 +299,10 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
299 | } | 299 | } |
300 | if (!s && !(s = ASN1_STRING_new())) goto err; | 300 | if (!s && !(s = ASN1_STRING_new())) goto err; |
301 | if (!(ASN1_STRING_set(s, b, i))) goto err; | 301 | if (!(ASN1_STRING_set(s, b, i))) goto err; |
302 | OPENSSL_free(b); | 302 | free(b); |
303 | return s; | 303 | return s; |
304 | err: | 304 | err: |
305 | if (b) OPENSSL_free(b); | 305 | if (b) free(b); |
306 | return NULL; | 306 | return NULL; |
307 | } | 307 | } |
308 | #endif | 308 | #endif |
@@ -327,7 +327,7 @@ static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts, unsigned char *val, | |||
327 | * it relies on library internals. | 327 | * it relies on library internals. |
328 | */ | 328 | */ |
329 | os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING); | 329 | os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING); |
330 | os.data = OPENSSL_malloc(os.length); | 330 | os.data = malloc(os.length); |
331 | if (os.data == NULL) | 331 | if (os.data == NULL) |
332 | goto err; | 332 | goto err; |
333 | tmpval = os.data; | 333 | tmpval = os.data; |
@@ -342,7 +342,7 @@ static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts, unsigned char *val, | |||
342 | ret = 1; | 342 | ret = 1; |
343 | err: | 343 | err: |
344 | if (os.data) | 344 | if (os.data) |
345 | OPENSSL_free(os.data); | 345 | free(os.data); |
346 | return ret; | 346 | return ret; |
347 | } | 347 | } |
348 | 348 | ||
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c index af5fc16691..17b252d6a8 100644 --- a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c +++ b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c | |||
@@ -114,8 +114,8 @@ void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) | |||
114 | if (rctx->mem) | 114 | if (rctx->mem) |
115 | BIO_free(rctx->mem); | 115 | BIO_free(rctx->mem); |
116 | if (rctx->iobuf) | 116 | if (rctx->iobuf) |
117 | OPENSSL_free(rctx->iobuf); | 117 | free(rctx->iobuf); |
118 | OPENSSL_free(rctx); | 118 | free(rctx); |
119 | } | 119 | } |
120 | 120 | ||
121 | int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) | 121 | int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) |
@@ -157,7 +157,7 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | |||
157 | static const char post_hdr[] = "POST %s HTTP/1.0\r\n"; | 157 | static const char post_hdr[] = "POST %s HTTP/1.0\r\n"; |
158 | 158 | ||
159 | OCSP_REQ_CTX *rctx; | 159 | OCSP_REQ_CTX *rctx; |
160 | rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX)); | 160 | rctx = malloc(sizeof(OCSP_REQ_CTX)); |
161 | rctx->state = OHS_ERROR; | 161 | rctx->state = OHS_ERROR; |
162 | rctx->mem = BIO_new(BIO_s_mem()); | 162 | rctx->mem = BIO_new(BIO_s_mem()); |
163 | rctx->io = io; | 163 | rctx->io = io; |
@@ -166,7 +166,7 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | |||
166 | rctx->iobuflen = maxline; | 166 | rctx->iobuflen = maxline; |
167 | else | 167 | else |
168 | rctx->iobuflen = OCSP_MAX_LINE_LEN; | 168 | rctx->iobuflen = OCSP_MAX_LINE_LEN; |
169 | rctx->iobuf = OPENSSL_malloc(rctx->iobuflen); | 169 | rctx->iobuf = malloc(rctx->iobuflen); |
170 | if (!rctx->iobuf) | 170 | if (!rctx->iobuf) |
171 | return 0; | 171 | return 0; |
172 | if (!path) | 172 | if (!path) |
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_lib.c b/src/lib/libssl/src/crypto/ocsp/ocsp_lib.c index a94dc838ee..514cdabf2d 100644 --- a/src/lib/libssl/src/crypto/ocsp/ocsp_lib.c +++ b/src/lib/libssl/src/crypto/ocsp/ocsp_lib.c | |||
@@ -242,7 +242,7 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss | |||
242 | 242 | ||
243 | if (!*phost) goto mem_err; | 243 | if (!*phost) goto mem_err; |
244 | 244 | ||
245 | OPENSSL_free(buf); | 245 | free(buf); |
246 | 246 | ||
247 | return 1; | 247 | return 1; |
248 | 248 | ||
@@ -255,10 +255,10 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss | |||
255 | 255 | ||
256 | 256 | ||
257 | err: | 257 | err: |
258 | if (buf) OPENSSL_free(buf); | 258 | if (buf) free(buf); |
259 | if (*ppath) OPENSSL_free(*ppath); | 259 | if (*ppath) free(*ppath); |
260 | if (*pport) OPENSSL_free(*pport); | 260 | if (*pport) free(*pport); |
261 | if (*phost) OPENSSL_free(*phost); | 261 | if (*phost) free(*phost); |
262 | return 0; | 262 | return 0; |
263 | 263 | ||
264 | } | 264 | } |
diff --git a/src/lib/libssl/src/crypto/pem/pem_info.c b/src/lib/libssl/src/crypto/pem/pem_info.c index cc7f24a9c1..4351260dfb 100644 --- a/src/lib/libssl/src/crypto/pem/pem_info.c +++ b/src/lib/libssl/src/crypto/pem/pem_info.c | |||
@@ -272,9 +272,9 @@ start: | |||
272 | else { | 272 | else { |
273 | /* unknown */ | 273 | /* unknown */ |
274 | } | 274 | } |
275 | if (name != NULL) OPENSSL_free(name); | 275 | if (name != NULL) free(name); |
276 | if (header != NULL) OPENSSL_free(header); | 276 | if (header != NULL) free(header); |
277 | if (data != NULL) OPENSSL_free(data); | 277 | if (data != NULL) free(data); |
278 | name=NULL; | 278 | name=NULL; |
279 | header=NULL; | 279 | header=NULL; |
280 | data=NULL; | 280 | data=NULL; |
@@ -303,9 +303,9 @@ err: | |||
303 | ret=NULL; | 303 | ret=NULL; |
304 | } | 304 | } |
305 | 305 | ||
306 | if (name != NULL) OPENSSL_free(name); | 306 | if (name != NULL) free(name); |
307 | if (header != NULL) OPENSSL_free(header); | 307 | if (header != NULL) free(header); |
308 | if (data != NULL) OPENSSL_free(data); | 308 | if (data != NULL) free(data); |
309 | return(ret); | 309 | return(ret); |
310 | } | 310 | } |
311 | 311 | ||
diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c index 0dfa7c7376..aa6a4c9387 100644 --- a/src/lib/libssl/src/crypto/pem/pem_lib.c +++ b/src/lib/libssl/src/crypto/pem/pem_lib.c | |||
@@ -288,9 +288,9 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char | |||
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | if(check_pem(nm, name)) break; | 290 | if(check_pem(nm, name)) break; |
291 | OPENSSL_free(nm); | 291 | free(nm); |
292 | OPENSSL_free(header); | 292 | free(header); |
293 | OPENSSL_free(data); | 293 | free(data); |
294 | } | 294 | } |
295 | if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err; | 295 | if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err; |
296 | if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err; | 296 | if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err; |
@@ -304,9 +304,9 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char | |||
304 | ret = 1; | 304 | ret = 1; |
305 | 305 | ||
306 | err: | 306 | err: |
307 | if (!ret || !pnm) OPENSSL_free(nm); | 307 | if (!ret || !pnm) free(nm); |
308 | OPENSSL_free(header); | 308 | free(header); |
309 | if (!ret) OPENSSL_free(data); | 309 | if (!ret) free(data); |
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
@@ -360,7 +360,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | |||
360 | } | 360 | } |
361 | /* dzise + 8 bytes are needed */ | 361 | /* dzise + 8 bytes are needed */ |
362 | /* actually it needs the cipher block size extra... */ | 362 | /* actually it needs the cipher block size extra... */ |
363 | data=(unsigned char *)OPENSSL_malloc((unsigned int)dsize+20); | 363 | data=(unsigned char *)malloc((unsigned int)dsize+20); |
364 | if (data == NULL) | 364 | if (data == NULL) |
365 | { | 365 | { |
366 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); | 366 | PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); |
@@ -427,7 +427,7 @@ err: | |||
427 | if (data != NULL) | 427 | if (data != NULL) |
428 | { | 428 | { |
429 | OPENSSL_cleanse(data,(unsigned int)dsize); | 429 | OPENSSL_cleanse(data,(unsigned int)dsize); |
430 | OPENSSL_free(data); | 430 | free(data); |
431 | } | 431 | } |
432 | return(ret); | 432 | return(ret); |
433 | } | 433 | } |
@@ -599,7 +599,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
599 | goto err; | 599 | goto err; |
600 | } | 600 | } |
601 | 601 | ||
602 | buf = OPENSSL_malloc(PEM_BUFSIZE*8); | 602 | buf = malloc(PEM_BUFSIZE*8); |
603 | if (buf == NULL) | 603 | if (buf == NULL) |
604 | { | 604 | { |
605 | reason=ERR_R_MALLOC_FAILURE; | 605 | reason=ERR_R_MALLOC_FAILURE; |
@@ -620,7 +620,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
620 | EVP_EncodeFinal(&ctx,buf,&outl); | 620 | EVP_EncodeFinal(&ctx,buf,&outl); |
621 | if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err; | 621 | if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err; |
622 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); | 622 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); |
623 | OPENSSL_free(buf); | 623 | free(buf); |
624 | buf = NULL; | 624 | buf = NULL; |
625 | if ( (BIO_write(bp,"-----END ",9) != 9) || | 625 | if ( (BIO_write(bp,"-----END ",9) != 9) || |
626 | (BIO_write(bp,name,nlen) != nlen) || | 626 | (BIO_write(bp,name,nlen) != nlen) || |
@@ -630,7 +630,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, | |||
630 | err: | 630 | err: |
631 | if (buf) { | 631 | if (buf) { |
632 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); | 632 | OPENSSL_cleanse(buf, PEM_BUFSIZE*8); |
633 | OPENSSL_free(buf); | 633 | free(buf); |
634 | } | 634 | } |
635 | PEMerr(PEM_F_PEM_WRITE_BIO,reason); | 635 | PEMerr(PEM_F_PEM_WRITE_BIO,reason); |
636 | return(0); | 636 | return(0); |
@@ -809,9 +809,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, | |||
809 | *header=headerB->data; | 809 | *header=headerB->data; |
810 | *data=(unsigned char *)dataB->data; | 810 | *data=(unsigned char *)dataB->data; |
811 | *len=bl; | 811 | *len=bl; |
812 | OPENSSL_free(nameB); | 812 | free(nameB); |
813 | OPENSSL_free(headerB); | 813 | free(headerB); |
814 | OPENSSL_free(dataB); | 814 | free(dataB); |
815 | return(1); | 815 | return(1); |
816 | err: | 816 | err: |
817 | BUF_MEM_free(nameB); | 817 | BUF_MEM_free(nameB); |
diff --git a/src/lib/libssl/src/crypto/pem/pem_oth.c b/src/lib/libssl/src/crypto/pem/pem_oth.c index b33868d25a..69d281aa9d 100644 --- a/src/lib/libssl/src/crypto/pem/pem_oth.c +++ b/src/lib/libssl/src/crypto/pem/pem_oth.c | |||
@@ -81,6 +81,6 @@ void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, | |||
81 | ret=d2i(x,&p,len); | 81 | ret=d2i(x,&p,len); |
82 | if (ret == NULL) | 82 | if (ret == NULL) |
83 | PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB); | 83 | PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB); |
84 | OPENSSL_free(data); | 84 | free(data); |
85 | return(ret); | 85 | return(ret); |
86 | } | 86 | } |
diff --git a/src/lib/libssl/src/crypto/pem/pem_pkey.c b/src/lib/libssl/src/crypto/pem/pem_pkey.c index ef152be264..a3b609b2f3 100644 --- a/src/lib/libssl/src/crypto/pem/pem_pkey.c +++ b/src/lib/libssl/src/crypto/pem/pem_pkey.c | |||
@@ -131,9 +131,9 @@ p8err: | |||
131 | if (ret == NULL) | 131 | if (ret == NULL) |
132 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB); | 132 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB); |
133 | err: | 133 | err: |
134 | OPENSSL_free(nm); | 134 | free(nm); |
135 | OPENSSL_cleanse(data, len); | 135 | OPENSSL_cleanse(data, len); |
136 | OPENSSL_free(data); | 136 | free(data); |
137 | return(ret); | 137 | return(ret); |
138 | } | 138 | } |
139 | 139 | ||
@@ -188,8 +188,8 @@ EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x) | |||
188 | err: | 188 | err: |
189 | if (ret == NULL) | 189 | if (ret == NULL) |
190 | PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB); | 190 | PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB); |
191 | OPENSSL_free(nm); | 191 | free(nm); |
192 | OPENSSL_free(data); | 192 | free(data); |
193 | return(ret); | 193 | return(ret); |
194 | } | 194 | } |
195 | 195 | ||
diff --git a/src/lib/libssl/src/crypto/pem/pem_seal.c b/src/lib/libssl/src/crypto/pem/pem_seal.c index b6b4e13498..bac7b16b44 100644 --- a/src/lib/libssl/src/crypto/pem/pem_seal.c +++ b/src/lib/libssl/src/crypto/pem/pem_seal.c | |||
@@ -86,7 +86,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
86 | j=RSA_size(pubk[i]->pkey.rsa); | 86 | j=RSA_size(pubk[i]->pkey.rsa); |
87 | if (j > max) max=j; | 87 | if (j > max) max=j; |
88 | } | 88 | } |
89 | s=(char *)OPENSSL_malloc(max*2); | 89 | s=(char *)malloc(max*2); |
90 | if (s == NULL) | 90 | if (s == NULL) |
91 | { | 91 | { |
92 | PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE); | 92 | PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE); |
@@ -114,7 +114,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
114 | 114 | ||
115 | ret=npubk; | 115 | ret=npubk; |
116 | err: | 116 | err: |
117 | if (s != NULL) OPENSSL_free(s); | 117 | if (s != NULL) free(s); |
118 | OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH); | 118 | OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH); |
119 | return(ret); | 119 | return(ret); |
120 | } | 120 | } |
@@ -157,7 +157,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, | |||
157 | } | 157 | } |
158 | i=RSA_size(priv->pkey.rsa); | 158 | i=RSA_size(priv->pkey.rsa); |
159 | if (i < 100) i=100; | 159 | if (i < 100) i=100; |
160 | s=(unsigned char *)OPENSSL_malloc(i*2); | 160 | s=(unsigned char *)malloc(i*2); |
161 | if (s == NULL) | 161 | if (s == NULL) |
162 | { | 162 | { |
163 | PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE); | 163 | PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE); |
@@ -179,7 +179,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, | |||
179 | err: | 179 | err: |
180 | EVP_MD_CTX_cleanup(&ctx->md); | 180 | EVP_MD_CTX_cleanup(&ctx->md); |
181 | EVP_CIPHER_CTX_cleanup(&ctx->cipher); | 181 | EVP_CIPHER_CTX_cleanup(&ctx->cipher); |
182 | if (s != NULL) OPENSSL_free(s); | 182 | if (s != NULL) free(s); |
183 | return(ret); | 183 | return(ret); |
184 | } | 184 | } |
185 | #else /* !OPENSSL_NO_RSA */ | 185 | #else /* !OPENSSL_NO_RSA */ |
diff --git a/src/lib/libssl/src/crypto/pem/pem_sign.c b/src/lib/libssl/src/crypto/pem/pem_sign.c index c3b9808cb2..cbd3cd0793 100644 --- a/src/lib/libssl/src/crypto/pem/pem_sign.c +++ b/src/lib/libssl/src/crypto/pem/pem_sign.c | |||
@@ -82,7 +82,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
82 | int i,ret=0; | 82 | int i,ret=0; |
83 | unsigned int m_len; | 83 | unsigned int m_len; |
84 | 84 | ||
85 | m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2); | 85 | m=(unsigned char *)malloc(EVP_PKEY_size(pkey)+2); |
86 | if (m == NULL) | 86 | if (m == NULL) |
87 | { | 87 | { |
88 | PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE); | 88 | PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE); |
@@ -96,7 +96,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
96 | ret=1; | 96 | ret=1; |
97 | err: | 97 | err: |
98 | /* ctx has been zeroed by EVP_SignFinal() */ | 98 | /* ctx has been zeroed by EVP_SignFinal() */ |
99 | if (m != NULL) OPENSSL_free(m); | 99 | if (m != NULL) free(m); |
100 | return(ret); | 100 | return(ret); |
101 | } | 101 | } |
102 | 102 | ||
diff --git a/src/lib/libssl/src/crypto/pem/pvkfmt.c b/src/lib/libssl/src/crypto/pem/pvkfmt.c index b1bf71a5da..8da8e77973 100644 --- a/src/lib/libssl/src/crypto/pem/pvkfmt.c +++ b/src/lib/libssl/src/crypto/pem/pvkfmt.c | |||
@@ -93,14 +93,14 @@ static int read_lebn(const unsigned char **in, unsigned int nbyte, BIGNUM **r) | |||
93 | unsigned char *tmpbuf, *q; | 93 | unsigned char *tmpbuf, *q; |
94 | unsigned int i; | 94 | unsigned int i; |
95 | p = *in + nbyte - 1; | 95 | p = *in + nbyte - 1; |
96 | tmpbuf = OPENSSL_malloc(nbyte); | 96 | tmpbuf = malloc(nbyte); |
97 | if (!tmpbuf) | 97 | if (!tmpbuf) |
98 | return 0; | 98 | return 0; |
99 | q = tmpbuf; | 99 | q = tmpbuf; |
100 | for (i = 0; i < nbyte; i++) | 100 | for (i = 0; i < nbyte; i++) |
101 | *q++ = *p--; | 101 | *q++ = *p--; |
102 | *r = BN_bin2bn(tmpbuf, nbyte, NULL); | 102 | *r = BN_bin2bn(tmpbuf, nbyte, NULL); |
103 | OPENSSL_free(tmpbuf); | 103 | free(tmpbuf); |
104 | if (*r) | 104 | if (*r) |
105 | { | 105 | { |
106 | *in += nbyte; | 106 | *in += nbyte; |
@@ -284,7 +284,7 @@ static EVP_PKEY *do_b2i_bio(BIO *in, int ispub) | |||
284 | return NULL; | 284 | return NULL; |
285 | 285 | ||
286 | length = blob_length(bitlen, isdss, ispub); | 286 | length = blob_length(bitlen, isdss, ispub); |
287 | buf = OPENSSL_malloc(length); | 287 | buf = malloc(length); |
288 | if (!buf) | 288 | if (!buf) |
289 | { | 289 | { |
290 | PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE); | 290 | PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE); |
@@ -304,7 +304,7 @@ static EVP_PKEY *do_b2i_bio(BIO *in, int ispub) | |||
304 | 304 | ||
305 | err: | 305 | err: |
306 | if (buf) | 306 | if (buf) |
307 | OPENSSL_free(buf); | 307 | free(buf); |
308 | return ret; | 308 | return ret; |
309 | } | 309 | } |
310 | 310 | ||
@@ -508,7 +508,7 @@ static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub) | |||
508 | p = *out; | 508 | p = *out; |
509 | else | 509 | else |
510 | { | 510 | { |
511 | p = OPENSSL_malloc(outlen); | 511 | p = malloc(outlen); |
512 | if (!p) | 512 | if (!p) |
513 | return -1; | 513 | return -1; |
514 | *out = p; | 514 | *out = p; |
@@ -541,7 +541,7 @@ static int do_i2b_bio(BIO *out, EVP_PKEY *pk, int ispub) | |||
541 | if (outlen < 0) | 541 | if (outlen < 0) |
542 | return -1; | 542 | return -1; |
543 | wrlen = BIO_write(out, tmp, outlen); | 543 | wrlen = BIO_write(out, tmp, outlen); |
544 | OPENSSL_free(tmp); | 544 | free(tmp); |
545 | if (wrlen == outlen) | 545 | if (wrlen == outlen) |
546 | return outlen; | 546 | return outlen; |
547 | return -1; | 547 | return -1; |
@@ -746,7 +746,7 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in, | |||
746 | PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ); | 746 | PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ); |
747 | return NULL; | 747 | return NULL; |
748 | } | 748 | } |
749 | enctmp = OPENSSL_malloc(keylen + 8); | 749 | enctmp = malloc(keylen + 8); |
750 | if (!enctmp) | 750 | if (!enctmp) |
751 | { | 751 | { |
752 | PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); | 752 | PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); |
@@ -797,7 +797,7 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in, | |||
797 | err: | 797 | err: |
798 | EVP_CIPHER_CTX_cleanup(&cctx); | 798 | EVP_CIPHER_CTX_cleanup(&cctx); |
799 | if (enctmp && saltlen) | 799 | if (enctmp && saltlen) |
800 | OPENSSL_free(enctmp); | 800 | free(enctmp); |
801 | return ret; | 801 | return ret; |
802 | } | 802 | } |
803 | 803 | ||
@@ -819,7 +819,7 @@ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u) | |||
819 | if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) | 819 | if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) |
820 | return 0; | 820 | return 0; |
821 | buflen = (int) keylen + saltlen; | 821 | buflen = (int) keylen + saltlen; |
822 | buf = OPENSSL_malloc(buflen); | 822 | buf = malloc(buflen); |
823 | if (!buf) | 823 | if (!buf) |
824 | { | 824 | { |
825 | PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE); | 825 | PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE); |
@@ -837,7 +837,7 @@ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u) | |||
837 | if (buf) | 837 | if (buf) |
838 | { | 838 | { |
839 | OPENSSL_cleanse(buf, buflen); | 839 | OPENSSL_cleanse(buf, buflen); |
840 | OPENSSL_free(buf); | 840 | free(buf); |
841 | } | 841 | } |
842 | return ret; | 842 | return ret; |
843 | } | 843 | } |
@@ -863,7 +863,7 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel, | |||
863 | p = *out; | 863 | p = *out; |
864 | else | 864 | else |
865 | { | 865 | { |
866 | p = OPENSSL_malloc(outlen); | 866 | p = malloc(outlen); |
867 | if (!p) | 867 | if (!p) |
868 | { | 868 | { |
869 | PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE); | 869 | PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE); |
@@ -936,7 +936,7 @@ int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, | |||
936 | if (outlen < 0) | 936 | if (outlen < 0) |
937 | return -1; | 937 | return -1; |
938 | wrlen = BIO_write(out, tmp, outlen); | 938 | wrlen = BIO_write(out, tmp, outlen); |
939 | OPENSSL_free(tmp); | 939 | free(tmp); |
940 | if (wrlen == outlen) | 940 | if (wrlen == outlen) |
941 | { | 941 | { |
942 | PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE); | 942 | PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE); |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_decr.c b/src/lib/libssl/src/crypto/pkcs12/p12_decr.c index 9d3557e8d7..9a73c21866 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_decr.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_decr.c | |||
@@ -65,7 +65,7 @@ | |||
65 | 65 | ||
66 | 66 | ||
67 | /* Encrypt/Decrypt a buffer based on password and algor, result in a | 67 | /* Encrypt/Decrypt a buffer based on password and algor, result in a |
68 | * OPENSSL_malloc'ed buffer | 68 | * malloc'ed buffer |
69 | */ | 69 | */ |
70 | 70 | ||
71 | unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | 71 | unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, |
@@ -84,14 +84,14 @@ unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | |||
84 | return NULL; | 84 | return NULL; |
85 | } | 85 | } |
86 | 86 | ||
87 | if(!(out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) { | 87 | if(!(out = malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) { |
88 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE); | 88 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE); |
89 | goto err; | 89 | goto err; |
90 | } | 90 | } |
91 | 91 | ||
92 | if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen)) | 92 | if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen)) |
93 | { | 93 | { |
94 | OPENSSL_free(out); | 94 | free(out); |
95 | out = NULL; | 95 | out = NULL; |
96 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB); | 96 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB); |
97 | goto err; | 97 | goto err; |
@@ -99,7 +99,7 @@ unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | |||
99 | 99 | ||
100 | outlen = i; | 100 | outlen = i; |
101 | if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) { | 101 | if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) { |
102 | OPENSSL_free(out); | 102 | free(out); |
103 | out = NULL; | 103 | out = NULL; |
104 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR); | 104 | PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR); |
105 | goto err; | 105 | goto err; |
@@ -146,7 +146,7 @@ void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, | |||
146 | ret = ASN1_item_d2i(NULL, &p, outlen, it); | 146 | ret = ASN1_item_d2i(NULL, &p, outlen, it); |
147 | if (zbuf) OPENSSL_cleanse(out, outlen); | 147 | if (zbuf) OPENSSL_cleanse(out, outlen); |
148 | if(!ret) PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,PKCS12_R_DECODE_ERROR); | 148 | if(!ret) PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,PKCS12_R_DECODE_ERROR); |
149 | OPENSSL_free(out); | 149 | free(out); |
150 | return ret; | 150 | return ret; |
151 | } | 151 | } |
152 | 152 | ||
@@ -173,11 +173,11 @@ ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *i | |||
173 | if (!PKCS12_pbe_crypt(algor, pass, passlen, in, inlen, &oct->data, | 173 | if (!PKCS12_pbe_crypt(algor, pass, passlen, in, inlen, &oct->data, |
174 | &oct->length, 1)) { | 174 | &oct->length, 1)) { |
175 | PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR); | 175 | PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR); |
176 | OPENSSL_free(in); | 176 | free(in); |
177 | return NULL; | 177 | return NULL; |
178 | } | 178 | } |
179 | if (zbuf) OPENSSL_cleanse(in, inlen); | 179 | if (zbuf) OPENSSL_cleanse(in, inlen); |
180 | OPENSSL_free(in); | 180 | free(in); |
181 | return oct; | 181 | return oct; |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_key.c b/src/lib/libssl/src/crypto/pkcs12/p12_key.c index 61d58502fd..b3672a95e5 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_key.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_key.c | |||
@@ -95,7 +95,7 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, | |||
95 | return 0; | 95 | return 0; |
96 | if(unipass) { | 96 | if(unipass) { |
97 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ | 97 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ |
98 | OPENSSL_free(unipass); | 98 | free(unipass); |
99 | } | 99 | } |
100 | return ret; | 100 | return ret; |
101 | } | 101 | } |
@@ -135,14 +135,14 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
135 | u = EVP_MD_size (md_type); | 135 | u = EVP_MD_size (md_type); |
136 | if (u < 0) | 136 | if (u < 0) |
137 | return 0; | 137 | return 0; |
138 | D = OPENSSL_malloc (v); | 138 | D = malloc (v); |
139 | Ai = OPENSSL_malloc (u); | 139 | Ai = malloc (u); |
140 | B = OPENSSL_malloc (v + 1); | 140 | B = malloc (v + 1); |
141 | Slen = v * ((saltlen+v-1)/v); | 141 | Slen = v * ((saltlen+v-1)/v); |
142 | if(passlen) Plen = v * ((passlen+v-1)/v); | 142 | if(passlen) Plen = v * ((passlen+v-1)/v); |
143 | else Plen = 0; | 143 | else Plen = 0; |
144 | Ilen = Slen + Plen; | 144 | Ilen = Slen + Plen; |
145 | I = OPENSSL_malloc (Ilen); | 145 | I = malloc (Ilen); |
146 | Ij = BN_new(); | 146 | Ij = BN_new(); |
147 | Bpl1 = BN_new(); | 147 | Bpl1 = BN_new(); |
148 | if (!D || !Ai || !B || !I || !Ij || !Bpl1) | 148 | if (!D || !Ai || !B || !I || !Ij || !Bpl1) |
@@ -209,10 +209,10 @@ err: | |||
209 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); | 209 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); |
210 | 210 | ||
211 | end: | 211 | end: |
212 | OPENSSL_free (Ai); | 212 | free (Ai); |
213 | OPENSSL_free (B); | 213 | free (B); |
214 | OPENSSL_free (D); | 214 | free (D); |
215 | OPENSSL_free (I); | 215 | free (I); |
216 | BN_free (Ij); | 216 | BN_free (Ij); |
217 | BN_free (Bpl1); | 217 | BN_free (Bpl1); |
218 | EVP_MD_CTX_cleanup(&ctx); | 218 | EVP_MD_CTX_cleanup(&ctx); |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c b/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c index 206b1b0b18..bc1fcff45d 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_kiss.c | |||
@@ -271,7 +271,7 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
271 | len = ASN1_STRING_to_UTF8(&data, fname); | 271 | len = ASN1_STRING_to_UTF8(&data, fname); |
272 | if(len > 0) { | 272 | if(len > 0) { |
273 | r = X509_alias_set1(x509, data, len); | 273 | r = X509_alias_set1(x509, data, len); |
274 | OPENSSL_free(data); | 274 | free(data); |
275 | if (!r) | 275 | if (!r) |
276 | { | 276 | { |
277 | X509_free(x509); | 277 | X509_free(x509); |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c b/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c index 96de1bd11e..98128e31cb 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_mutl.c | |||
@@ -169,7 +169,7 @@ int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, | |||
169 | } | 169 | } |
170 | if (!saltlen) saltlen = PKCS12_SALT_LEN; | 170 | if (!saltlen) saltlen = PKCS12_SALT_LEN; |
171 | p12->mac->salt->length = saltlen; | 171 | p12->mac->salt->length = saltlen; |
172 | if (!(p12->mac->salt->data = OPENSSL_malloc (saltlen))) { | 172 | if (!(p12->mac->salt->data = malloc (saltlen))) { |
173 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); | 173 | PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
diff --git a/src/lib/libssl/src/crypto/pkcs12/p12_utl.c b/src/lib/libssl/src/crypto/pkcs12/p12_utl.c index 59c6f453f6..9c58036169 100644 --- a/src/lib/libssl/src/crypto/pkcs12/p12_utl.c +++ b/src/lib/libssl/src/crypto/pkcs12/p12_utl.c | |||
@@ -68,7 +68,7 @@ unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, | |||
68 | unsigned char *unitmp; | 68 | unsigned char *unitmp; |
69 | if (asclen == -1) asclen = strlen(asc); | 69 | if (asclen == -1) asclen = strlen(asc); |
70 | ulen = asclen*2 + 2; | 70 | ulen = asclen*2 + 2; |
71 | if (!(unitmp = OPENSSL_malloc(ulen))) return NULL; | 71 | if (!(unitmp = malloc(ulen))) return NULL; |
72 | for (i = 0; i < ulen - 2; i+=2) { | 72 | for (i = 0; i < ulen - 2; i+=2) { |
73 | unitmp[i] = 0; | 73 | unitmp[i] = 0; |
74 | unitmp[i + 1] = asc[i>>1]; | 74 | unitmp[i + 1] = asc[i>>1]; |
@@ -89,7 +89,7 @@ char *OPENSSL_uni2asc(unsigned char *uni, int unilen) | |||
89 | /* If no terminating zero allow for one */ | 89 | /* If no terminating zero allow for one */ |
90 | if (!unilen || uni[unilen - 1]) asclen++; | 90 | if (!unilen || uni[unilen - 1]) asclen++; |
91 | uni++; | 91 | uni++; |
92 | if (!(asctmp = OPENSSL_malloc(asclen))) return NULL; | 92 | if (!(asctmp = malloc(asclen))) return NULL; |
93 | for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i]; | 93 | for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i]; |
94 | asctmp[asclen - 1] = 0; | 94 | asctmp[asclen - 1] = 0; |
95 | return asctmp; | 95 | return asctmp; |
diff --git a/src/lib/libssl/src/crypto/pkcs7/bio_ber.c b/src/lib/libssl/src/crypto/pkcs7/bio_ber.c index 31973fcd1f..04dc5c9b96 100644 --- a/src/lib/libssl/src/crypto/pkcs7/bio_ber.c +++ b/src/lib/libssl/src/crypto/pkcs7/bio_ber.c | |||
@@ -128,7 +128,7 @@ static int ber_new(BIO *bi) | |||
128 | { | 128 | { |
129 | BIO_BER_CTX *ctx; | 129 | BIO_BER_CTX *ctx; |
130 | 130 | ||
131 | ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX)); | 131 | ctx=(BIO_BER_CTX *)malloc(sizeof(BIO_BER_CTX)); |
132 | if (ctx == NULL) return(0); | 132 | if (ctx == NULL) return(0); |
133 | 133 | ||
134 | memset((char *)ctx,0,sizeof(BIO_BER_CTX)); | 134 | memset((char *)ctx,0,sizeof(BIO_BER_CTX)); |
@@ -146,7 +146,7 @@ static int ber_free(BIO *a) | |||
146 | if (a == NULL) return(0); | 146 | if (a == NULL) return(0); |
147 | b=(BIO_BER_CTX *)a->ptr; | 147 | b=(BIO_BER_CTX *)a->ptr; |
148 | OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX)); | 148 | OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX)); |
149 | OPENSSL_free(a->ptr); | 149 | free(a->ptr); |
150 | a->ptr=NULL; | 150 | a->ptr=NULL; |
151 | a->init=0; | 151 | a->init=0; |
152 | a->flags=0; | 152 | a->flags=0; |
diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c index 77fda3b82a..396a863f3b 100644 --- a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c +++ b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c | |||
@@ -169,7 +169,7 @@ static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, | |||
169 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0) | 169 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0) |
170 | goto err; | 170 | goto err; |
171 | 171 | ||
172 | ek = OPENSSL_malloc(eklen); | 172 | ek = malloc(eklen); |
173 | 173 | ||
174 | if (ek == NULL) | 174 | if (ek == NULL) |
175 | { | 175 | { |
@@ -191,7 +191,7 @@ static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, | |||
191 | if (pctx) | 191 | if (pctx) |
192 | EVP_PKEY_CTX_free(pctx); | 192 | EVP_PKEY_CTX_free(pctx); |
193 | if (ek) | 193 | if (ek) |
194 | OPENSSL_free(ek); | 194 | free(ek); |
195 | return ret; | 195 | return ret; |
196 | 196 | ||
197 | } | 197 | } |
@@ -224,7 +224,7 @@ static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | |||
224 | ri->enc_key->data, ri->enc_key->length) <= 0) | 224 | ri->enc_key->data, ri->enc_key->length) <= 0) |
225 | goto err; | 225 | goto err; |
226 | 226 | ||
227 | ek = OPENSSL_malloc(eklen); | 227 | ek = malloc(eklen); |
228 | 228 | ||
229 | if (ek == NULL) | 229 | if (ek == NULL) |
230 | { | 230 | { |
@@ -245,7 +245,7 @@ static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | |||
245 | if (*pek) | 245 | if (*pek) |
246 | { | 246 | { |
247 | OPENSSL_cleanse(*pek, *peklen); | 247 | OPENSSL_cleanse(*pek, *peklen); |
248 | OPENSSL_free(*pek); | 248 | free(*pek); |
249 | } | 249 | } |
250 | 250 | ||
251 | *pek = ek; | 251 | *pek = ek; |
@@ -255,7 +255,7 @@ static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | |||
255 | if (pctx) | 255 | if (pctx) |
256 | EVP_PKEY_CTX_free(pctx); | 256 | EVP_PKEY_CTX_free(pctx); |
257 | if (!ret && ek) | 257 | if (!ret && ek) |
258 | OPENSSL_free(ek); | 258 | free(ek); |
259 | 259 | ||
260 | return ret; | 260 | return ret; |
261 | } | 261 | } |
@@ -573,7 +573,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
573 | goto err; | 573 | goto err; |
574 | /* Generate random key as MMA defence */ | 574 | /* Generate random key as MMA defence */ |
575 | tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); | 575 | tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); |
576 | tkey = OPENSSL_malloc(tkeylen); | 576 | tkey = malloc(tkeylen); |
577 | if (!tkey) | 577 | if (!tkey) |
578 | goto err; | 578 | goto err; |
579 | if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) | 579 | if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) |
@@ -594,7 +594,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
594 | { | 594 | { |
595 | /* Use random key as MMA defence */ | 595 | /* Use random key as MMA defence */ |
596 | OPENSSL_cleanse(ek, eklen); | 596 | OPENSSL_cleanse(ek, eklen); |
597 | OPENSSL_free(ek); | 597 | free(ek); |
598 | ek = tkey; | 598 | ek = tkey; |
599 | eklen = tkeylen; | 599 | eklen = tkeylen; |
600 | tkey = NULL; | 600 | tkey = NULL; |
@@ -608,13 +608,13 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
608 | if (ek) | 608 | if (ek) |
609 | { | 609 | { |
610 | OPENSSL_cleanse(ek,eklen); | 610 | OPENSSL_cleanse(ek,eklen); |
611 | OPENSSL_free(ek); | 611 | free(ek); |
612 | ek = NULL; | 612 | ek = NULL; |
613 | } | 613 | } |
614 | if (tkey) | 614 | if (tkey) |
615 | { | 615 | { |
616 | OPENSSL_cleanse(tkey,tkeylen); | 616 | OPENSSL_cleanse(tkey,tkeylen); |
617 | OPENSSL_free(tkey); | 617 | free(tkey); |
618 | tkey = NULL; | 618 | tkey = NULL; |
619 | } | 619 | } |
620 | 620 | ||
@@ -661,12 +661,12 @@ err: | |||
661 | if (ek) | 661 | if (ek) |
662 | { | 662 | { |
663 | OPENSSL_cleanse(ek,eklen); | 663 | OPENSSL_cleanse(ek,eklen); |
664 | OPENSSL_free(ek); | 664 | free(ek); |
665 | } | 665 | } |
666 | if (tkey) | 666 | if (tkey) |
667 | { | 667 | { |
668 | OPENSSL_cleanse(tkey,tkeylen); | 668 | OPENSSL_cleanse(tkey,tkeylen); |
669 | OPENSSL_free(tkey); | 669 | free(tkey); |
670 | } | 670 | } |
671 | if (out != NULL) BIO_free_all(out); | 671 | if (out != NULL) BIO_free_all(out); |
672 | if (btmp != NULL) BIO_free_all(btmp); | 672 | if (btmp != NULL) BIO_free_all(btmp); |
@@ -846,7 +846,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
846 | unsigned char *abuf = NULL; | 846 | unsigned char *abuf = NULL; |
847 | unsigned int abuflen; | 847 | unsigned int abuflen; |
848 | abuflen = EVP_PKEY_size(si->pkey); | 848 | abuflen = EVP_PKEY_size(si->pkey); |
849 | abuf = OPENSSL_malloc(abuflen); | 849 | abuf = malloc(abuflen); |
850 | if (!abuf) | 850 | if (!abuf) |
851 | goto err; | 851 | goto err; |
852 | 852 | ||
@@ -927,10 +927,10 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) | |||
927 | goto err; | 927 | goto err; |
928 | if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) | 928 | if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) |
929 | goto err; | 929 | goto err; |
930 | OPENSSL_free(abuf); | 930 | free(abuf); |
931 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) | 931 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) |
932 | goto err; | 932 | goto err; |
933 | abuf = OPENSSL_malloc(siglen); | 933 | abuf = malloc(siglen); |
934 | if(!abuf) | 934 | if(!abuf) |
935 | goto err; | 935 | goto err; |
936 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) | 936 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) |
@@ -951,7 +951,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) | |||
951 | 951 | ||
952 | err: | 952 | err: |
953 | if (abuf) | 953 | if (abuf) |
954 | OPENSSL_free(abuf); | 954 | free(abuf); |
955 | EVP_MD_CTX_cleanup(&mctx); | 955 | EVP_MD_CTX_cleanup(&mctx); |
956 | return 0; | 956 | return 0; |
957 | 957 | ||
@@ -1113,7 +1113,7 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
1113 | if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) | 1113 | if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) |
1114 | goto err; | 1114 | goto err; |
1115 | 1115 | ||
1116 | OPENSSL_free(abuf); | 1116 | free(abuf); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | os=si->enc_digest; | 1119 | os=si->enc_digest; |
diff --git a/src/lib/libssl/src/crypto/pqueue/pqueue.c b/src/lib/libssl/src/crypto/pqueue/pqueue.c index eab13a1250..3ca8e049e4 100644 --- a/src/lib/libssl/src/crypto/pqueue/pqueue.c +++ b/src/lib/libssl/src/crypto/pqueue/pqueue.c | |||
@@ -70,7 +70,7 @@ typedef struct _pqueue | |||
70 | pitem * | 70 | pitem * |
71 | pitem_new(unsigned char *prio64be, void *data) | 71 | pitem_new(unsigned char *prio64be, void *data) |
72 | { | 72 | { |
73 | pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem)); | 73 | pitem *item = (pitem *) malloc(sizeof(pitem)); |
74 | if (item == NULL) return NULL; | 74 | if (item == NULL) return NULL; |
75 | 75 | ||
76 | memcpy(item->priority,prio64be,sizeof(item->priority)); | 76 | memcpy(item->priority,prio64be,sizeof(item->priority)); |
@@ -86,13 +86,13 @@ pitem_free(pitem *item) | |||
86 | { | 86 | { |
87 | if (item == NULL) return; | 87 | if (item == NULL) return; |
88 | 88 | ||
89 | OPENSSL_free(item); | 89 | free(item); |
90 | } | 90 | } |
91 | 91 | ||
92 | pqueue_s * | 92 | pqueue_s * |
93 | pqueue_new() | 93 | pqueue_new() |
94 | { | 94 | { |
95 | pqueue_s *pq = (pqueue_s *) OPENSSL_malloc(sizeof(pqueue_s)); | 95 | pqueue_s *pq = (pqueue_s *) malloc(sizeof(pqueue_s)); |
96 | if (pq == NULL) return NULL; | 96 | if (pq == NULL) return NULL; |
97 | 97 | ||
98 | memset(pq, 0x00, sizeof(pqueue_s)); | 98 | memset(pq, 0x00, sizeof(pqueue_s)); |
@@ -104,7 +104,7 @@ pqueue_free(pqueue_s *pq) | |||
104 | { | 104 | { |
105 | if (pq == NULL) return; | 105 | if (pq == NULL) return; |
106 | 106 | ||
107 | OPENSSL_free(pq); | 107 | free(pq); |
108 | } | 108 | } |
109 | 109 | ||
110 | pitem * | 110 | pitem * |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_ameth.c b/src/lib/libssl/src/crypto/rsa/rsa_ameth.c index 5a2062f903..fdd11835ad 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_ameth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_ameth.c | |||
@@ -78,7 +78,7 @@ static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
78 | V_ASN1_NULL, NULL, penc, penclen)) | 78 | V_ASN1_NULL, NULL, penc, penclen)) |
79 | return 1; | 79 | return 1; |
80 | 80 | ||
81 | OPENSSL_free(penc); | 81 | free(penc); |
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
@@ -201,7 +201,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
201 | update_buflen(x->iqmp, &buf_len); | 201 | update_buflen(x->iqmp, &buf_len); |
202 | } | 202 | } |
203 | 203 | ||
204 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | 204 | m=(unsigned char *)malloc(buf_len+10); |
205 | if (m == NULL) | 205 | if (m == NULL) |
206 | { | 206 | { |
207 | RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE); | 207 | RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE); |
@@ -248,7 +248,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
248 | } | 248 | } |
249 | ret=1; | 249 | ret=1; |
250 | err: | 250 | err: |
251 | if (m != NULL) OPENSSL_free(m); | 251 | if (m != NULL) free(m); |
252 | return(ret); | 252 | return(ret); |
253 | } | 253 | } |
254 | 254 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_eay.c b/src/lib/libssl/src/crypto/rsa/rsa_eay.c index 88ee2cb557..dcf0c16a8f 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_eay.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_eay.c | |||
@@ -185,7 +185,7 @@ static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | |||
185 | f = BN_CTX_get(ctx); | 185 | f = BN_CTX_get(ctx); |
186 | ret = BN_CTX_get(ctx); | 186 | ret = BN_CTX_get(ctx); |
187 | num=BN_num_bytes(rsa->n); | 187 | num=BN_num_bytes(rsa->n); |
188 | buf = OPENSSL_malloc(num); | 188 | buf = malloc(num); |
189 | if (!f || !ret || !buf) | 189 | if (!f || !ret || !buf) |
190 | { | 190 | { |
191 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); | 191 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); |
@@ -247,7 +247,7 @@ err: | |||
247 | if (buf != NULL) | 247 | if (buf != NULL) |
248 | { | 248 | { |
249 | OPENSSL_cleanse(buf,num); | 249 | OPENSSL_cleanse(buf,num); |
250 | OPENSSL_free(buf); | 250 | free(buf); |
251 | } | 251 | } |
252 | return(r); | 252 | return(r); |
253 | } | 253 | } |
@@ -366,7 +366,7 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | |||
366 | f = BN_CTX_get(ctx); | 366 | f = BN_CTX_get(ctx); |
367 | ret = BN_CTX_get(ctx); | 367 | ret = BN_CTX_get(ctx); |
368 | num = BN_num_bytes(rsa->n); | 368 | num = BN_num_bytes(rsa->n); |
369 | buf = OPENSSL_malloc(num); | 369 | buf = malloc(num); |
370 | if(!f || !ret || !buf) | 370 | if(!f || !ret || !buf) |
371 | { | 371 | { |
372 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); | 372 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); |
@@ -484,7 +484,7 @@ err: | |||
484 | if (buf != NULL) | 484 | if (buf != NULL) |
485 | { | 485 | { |
486 | OPENSSL_cleanse(buf,num); | 486 | OPENSSL_cleanse(buf,num); |
487 | OPENSSL_free(buf); | 487 | free(buf); |
488 | } | 488 | } |
489 | return(r); | 489 | return(r); |
490 | } | 490 | } |
@@ -509,7 +509,7 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | |||
509 | f = BN_CTX_get(ctx); | 509 | f = BN_CTX_get(ctx); |
510 | ret = BN_CTX_get(ctx); | 510 | ret = BN_CTX_get(ctx); |
511 | num = BN_num_bytes(rsa->n); | 511 | num = BN_num_bytes(rsa->n); |
512 | buf = OPENSSL_malloc(num); | 512 | buf = malloc(num); |
513 | if(!f || !ret || !buf) | 513 | if(!f || !ret || !buf) |
514 | { | 514 | { |
515 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); | 515 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); |
@@ -624,7 +624,7 @@ err: | |||
624 | if (buf != NULL) | 624 | if (buf != NULL) |
625 | { | 625 | { |
626 | OPENSSL_cleanse(buf,num); | 626 | OPENSSL_cleanse(buf,num); |
627 | OPENSSL_free(buf); | 627 | free(buf); |
628 | } | 628 | } |
629 | return(r); | 629 | return(r); |
630 | } | 630 | } |
@@ -666,7 +666,7 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from, | |||
666 | f = BN_CTX_get(ctx); | 666 | f = BN_CTX_get(ctx); |
667 | ret = BN_CTX_get(ctx); | 667 | ret = BN_CTX_get(ctx); |
668 | num=BN_num_bytes(rsa->n); | 668 | num=BN_num_bytes(rsa->n); |
669 | buf = OPENSSL_malloc(num); | 669 | buf = malloc(num); |
670 | if(!f || !ret || !buf) | 670 | if(!f || !ret || !buf) |
671 | { | 671 | { |
672 | RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE); | 672 | RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE); |
@@ -729,7 +729,7 @@ err: | |||
729 | if (buf != NULL) | 729 | if (buf != NULL) |
730 | { | 730 | { |
731 | OPENSSL_cleanse(buf,num); | 731 | OPENSSL_cleanse(buf,num); |
732 | OPENSSL_free(buf); | 732 | free(buf); |
733 | } | 733 | } |
734 | return(r); | 734 | return(r); |
735 | } | 735 | } |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_lib.c b/src/lib/libssl/src/crypto/rsa/rsa_lib.c index 9e3f7dafcd..e99a3627dc 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_lib.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_lib.c | |||
@@ -125,7 +125,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
125 | { | 125 | { |
126 | RSA *ret; | 126 | RSA *ret; |
127 | 127 | ||
128 | ret=(RSA *)OPENSSL_malloc(sizeof(RSA)); | 128 | ret=(RSA *)malloc(sizeof(RSA)); |
129 | if (ret == NULL) | 129 | if (ret == NULL) |
130 | { | 130 | { |
131 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 131 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -139,7 +139,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
139 | if (!ENGINE_init(engine)) | 139 | if (!ENGINE_init(engine)) |
140 | { | 140 | { |
141 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 141 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
142 | OPENSSL_free(ret); | 142 | free(ret); |
143 | return NULL; | 143 | return NULL; |
144 | } | 144 | } |
145 | ret->engine = engine; | 145 | ret->engine = engine; |
@@ -154,7 +154,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
154 | RSAerr(RSA_F_RSA_NEW_METHOD, | 154 | RSAerr(RSA_F_RSA_NEW_METHOD, |
155 | ERR_R_ENGINE_LIB); | 155 | ERR_R_ENGINE_LIB); |
156 | ENGINE_finish(ret->engine); | 156 | ENGINE_finish(ret->engine); |
157 | OPENSSL_free(ret); | 157 | free(ret); |
158 | return NULL; | 158 | return NULL; |
159 | } | 159 | } |
160 | } | 160 | } |
@@ -184,7 +184,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
184 | if (ret->engine) | 184 | if (ret->engine) |
185 | ENGINE_finish(ret->engine); | 185 | ENGINE_finish(ret->engine); |
186 | #endif | 186 | #endif |
187 | OPENSSL_free(ret); | 187 | free(ret); |
188 | return(NULL); | 188 | return(NULL); |
189 | } | 189 | } |
190 | 190 | ||
@@ -195,7 +195,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
195 | ENGINE_finish(ret->engine); | 195 | ENGINE_finish(ret->engine); |
196 | #endif | 196 | #endif |
197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); | 197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); |
198 | OPENSSL_free(ret); | 198 | free(ret); |
199 | ret=NULL; | 199 | ret=NULL; |
200 | } | 200 | } |
201 | return(ret); | 201 | return(ret); |
@@ -240,7 +240,7 @@ void RSA_free(RSA *r) | |||
240 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | 240 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); |
241 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | 241 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); |
242 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | 242 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); |
243 | OPENSSL_free(r); | 243 | free(r); |
244 | } | 244 | } |
245 | 245 | ||
246 | int RSA_up_ref(RSA *r) | 246 | int RSA_up_ref(RSA *r) |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_oaep.c b/src/lib/libssl/src/crypto/rsa/rsa_oaep.c index af4d24a56e..a107e89b81 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_oaep.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_oaep.c | |||
@@ -70,7 +70,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
70 | 20); | 70 | 20); |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH); | 73 | dbmask = malloc(emlen - SHA_DIGEST_LENGTH); |
74 | if (dbmask == NULL) | 74 | if (dbmask == NULL) |
75 | { | 75 | { |
76 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | 76 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); |
@@ -87,7 +87,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
87 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 87 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
88 | seed[i] ^= seedmask[i]; | 88 | seed[i] ^= seedmask[i]; |
89 | 89 | ||
90 | OPENSSL_free(dbmask); | 90 | free(dbmask); |
91 | return 1; | 91 | return 1; |
92 | } | 92 | } |
93 | 93 | ||
@@ -121,7 +121,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | dblen = num - SHA_DIGEST_LENGTH; | 123 | dblen = num - SHA_DIGEST_LENGTH; |
124 | db = OPENSSL_malloc(dblen + num); | 124 | db = malloc(dblen + num); |
125 | if (db == NULL) | 125 | if (db == NULL) |
126 | { | 126 | { |
127 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | 127 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); |
@@ -172,14 +172,14 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
172 | memcpy(to, db + i, mlen); | 172 | memcpy(to, db + i, mlen); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | OPENSSL_free(db); | 175 | free(db); |
176 | return mlen; | 176 | return mlen; |
177 | 177 | ||
178 | decoding_err: | 178 | decoding_err: |
179 | /* to avoid chosen ciphertext attacks, the error message should not reveal | 179 | /* to avoid chosen ciphertext attacks, the error message should not reveal |
180 | * which kind of decoding error happened */ | 180 | * which kind of decoding error happened */ |
181 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); | 181 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); |
182 | if (db != NULL) OPENSSL_free(db); | 182 | if (db != NULL) free(db); |
183 | return -1; | 183 | return -1; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c index d706d35ff6..adec632b3b 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c | |||
@@ -93,7 +93,7 @@ typedef struct | |||
93 | static int pkey_rsa_init(EVP_PKEY_CTX *ctx) | 93 | static int pkey_rsa_init(EVP_PKEY_CTX *ctx) |
94 | { | 94 | { |
95 | RSA_PKEY_CTX *rctx; | 95 | RSA_PKEY_CTX *rctx; |
96 | rctx = OPENSSL_malloc(sizeof(RSA_PKEY_CTX)); | 96 | rctx = malloc(sizeof(RSA_PKEY_CTX)); |
97 | if (!rctx) | 97 | if (!rctx) |
98 | return 0; | 98 | return 0; |
99 | rctx->nbits = 1024; | 99 | rctx->nbits = 1024; |
@@ -135,7 +135,7 @@ static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk) | |||
135 | { | 135 | { |
136 | if (ctx->tbuf) | 136 | if (ctx->tbuf) |
137 | return 1; | 137 | return 1; |
138 | ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey)); | 138 | ctx->tbuf = malloc(EVP_PKEY_size(pk->pkey)); |
139 | if (!ctx->tbuf) | 139 | if (!ctx->tbuf) |
140 | return 0; | 140 | return 0; |
141 | return 1; | 141 | return 1; |
@@ -149,8 +149,8 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) | |||
149 | if (rctx->pub_exp) | 149 | if (rctx->pub_exp) |
150 | BN_free(rctx->pub_exp); | 150 | BN_free(rctx->pub_exp); |
151 | if (rctx->tbuf) | 151 | if (rctx->tbuf) |
152 | OPENSSL_free(rctx->tbuf); | 152 | free(rctx->tbuf); |
153 | OPENSSL_free(rctx); | 153 | free(rctx); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 156 | static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pss.c b/src/lib/libssl/src/crypto/rsa/rsa_pss.c index 5f9f533d0c..75e8c18533 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pss.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pss.c | |||
@@ -133,7 +133,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
133 | } | 133 | } |
134 | maskedDBLen = emLen - hLen - 1; | 134 | maskedDBLen = emLen - hLen - 1; |
135 | H = EM + maskedDBLen; | 135 | H = EM + maskedDBLen; |
136 | DB = OPENSSL_malloc(maskedDBLen); | 136 | DB = malloc(maskedDBLen); |
137 | if (!DB) | 137 | if (!DB) |
138 | { | 138 | { |
139 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE); | 139 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE); |
@@ -177,7 +177,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
177 | 177 | ||
178 | err: | 178 | err: |
179 | if (DB) | 179 | if (DB) |
180 | OPENSSL_free(DB); | 180 | free(DB); |
181 | EVP_MD_CTX_cleanup(&ctx); | 181 | EVP_MD_CTX_cleanup(&ctx); |
182 | 182 | ||
183 | return ret; | 183 | return ret; |
@@ -239,7 +239,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | |||
239 | } | 239 | } |
240 | if (sLen > 0) | 240 | if (sLen > 0) |
241 | { | 241 | { |
242 | salt = OPENSSL_malloc(sLen); | 242 | salt = malloc(sLen); |
243 | if (!salt) | 243 | if (!salt) |
244 | { | 244 | { |
245 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE); | 245 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE); |
@@ -289,7 +289,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | |||
289 | 289 | ||
290 | err: | 290 | err: |
291 | if (salt) | 291 | if (salt) |
292 | OPENSSL_free(salt); | 292 | free(salt); |
293 | 293 | ||
294 | return ret; | 294 | return ret; |
295 | 295 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_saos.c b/src/lib/libssl/src/crypto/rsa/rsa_saos.c index f98e0a80a6..ee5473a184 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_saos.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_saos.c | |||
@@ -82,7 +82,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, | |||
82 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); | 82 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); |
83 | return(0); | 83 | return(0); |
84 | } | 84 | } |
85 | s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1); | 85 | s=(unsigned char *)malloc((unsigned int)j+1); |
86 | if (s == NULL) | 86 | if (s == NULL) |
87 | { | 87 | { |
88 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); | 88 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); |
@@ -97,7 +97,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, | |||
97 | *siglen=i; | 97 | *siglen=i; |
98 | 98 | ||
99 | OPENSSL_cleanse(s,(unsigned int)j+1); | 99 | OPENSSL_cleanse(s,(unsigned int)j+1); |
100 | OPENSSL_free(s); | 100 | free(s); |
101 | return(ret); | 101 | return(ret); |
102 | } | 102 | } |
103 | 103 | ||
@@ -117,7 +117,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, | |||
117 | return(0); | 117 | return(0); |
118 | } | 118 | } |
119 | 119 | ||
120 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 120 | s=(unsigned char *)malloc((unsigned int)siglen); |
121 | if (s == NULL) | 121 | if (s == NULL) |
122 | { | 122 | { |
123 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); | 123 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); |
@@ -143,7 +143,7 @@ err: | |||
143 | if (s != NULL) | 143 | if (s != NULL) |
144 | { | 144 | { |
145 | OPENSSL_cleanse(s,(unsigned int)siglen); | 145 | OPENSSL_cleanse(s,(unsigned int)siglen); |
146 | OPENSSL_free(s); | 146 | free(s); |
147 | } | 147 | } |
148 | return(ret); | 148 | return(ret); |
149 | } | 149 | } |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_sign.c b/src/lib/libssl/src/crypto/rsa/rsa_sign.c index fa3239ab30..71d6bb3ce4 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_sign.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_sign.c | |||
@@ -120,7 +120,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
120 | return(0); | 120 | return(0); |
121 | } | 121 | } |
122 | if(type != NID_md5_sha1) { | 122 | if(type != NID_md5_sha1) { |
123 | tmps=(unsigned char *)OPENSSL_malloc((unsigned int)j+1); | 123 | tmps=(unsigned char *)malloc((unsigned int)j+1); |
124 | if (tmps == NULL) | 124 | if (tmps == NULL) |
125 | { | 125 | { |
126 | RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE); | 126 | RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE); |
@@ -138,7 +138,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
138 | 138 | ||
139 | if(type != NID_md5_sha1) { | 139 | if(type != NID_md5_sha1) { |
140 | OPENSSL_cleanse(tmps,(unsigned int)j+1); | 140 | OPENSSL_cleanse(tmps,(unsigned int)j+1); |
141 | OPENSSL_free(tmps); | 141 | free(tmps); |
142 | } | 142 | } |
143 | return(ret); | 143 | return(ret); |
144 | } | 144 | } |
@@ -169,7 +169,7 @@ int int_rsa_verify(int dtype, const unsigned char *m, | |||
169 | return 1; | 169 | return 1; |
170 | } | 170 | } |
171 | 171 | ||
172 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 172 | s=(unsigned char *)malloc((unsigned int)siglen); |
173 | if (s == NULL) | 173 | if (s == NULL) |
174 | { | 174 | { |
175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); | 175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); |
@@ -281,7 +281,7 @@ err: | |||
281 | if (s != NULL) | 281 | if (s != NULL) |
282 | { | 282 | { |
283 | OPENSSL_cleanse(s,(unsigned int)siglen); | 283 | OPENSSL_cleanse(s,(unsigned int)siglen); |
284 | OPENSSL_free(s); | 284 | free(s); |
285 | } | 285 | } |
286 | return(ret); | 286 | return(ret); |
287 | } | 287 | } |
diff --git a/src/lib/libssl/src/crypto/srp/srp_lib.c b/src/lib/libssl/src/crypto/srp/srp_lib.c index 7c1dcc5111..8cc94f51db 100644 --- a/src/lib/libssl/src/crypto/srp/srp_lib.c +++ b/src/lib/libssl/src/crypto/srp/srp_lib.c | |||
@@ -89,7 +89,7 @@ static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) | |||
89 | int longg ; | 89 | int longg ; |
90 | int longN = BN_num_bytes(N); | 90 | int longN = BN_num_bytes(N); |
91 | 91 | ||
92 | if ((tmp = OPENSSL_malloc(longN)) == NULL) | 92 | if ((tmp = malloc(longN)) == NULL) |
93 | return NULL; | 93 | return NULL; |
94 | BN_bn2bin(N,tmp) ; | 94 | BN_bn2bin(N,tmp) ; |
95 | 95 | ||
@@ -102,7 +102,7 @@ static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) | |||
102 | /* use the zeros behind to pad on left */ | 102 | /* use the zeros behind to pad on left */ |
103 | EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg); | 103 | EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg); |
104 | EVP_DigestUpdate(&ctxt, tmp, longg); | 104 | EVP_DigestUpdate(&ctxt, tmp, longg); |
105 | OPENSSL_free(tmp); | 105 | free(tmp); |
106 | 106 | ||
107 | EVP_DigestFinal_ex(&ctxt, digest, NULL); | 107 | EVP_DigestFinal_ex(&ctxt, digest, NULL); |
108 | EVP_MD_CTX_cleanup(&ctxt); | 108 | EVP_MD_CTX_cleanup(&ctxt); |
@@ -123,7 +123,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) | |||
123 | 123 | ||
124 | longN= BN_num_bytes(N); | 124 | longN= BN_num_bytes(N); |
125 | 125 | ||
126 | if ((cAB = OPENSSL_malloc(2*longN)) == NULL) | 126 | if ((cAB = malloc(2*longN)) == NULL) |
127 | return NULL; | 127 | return NULL; |
128 | 128 | ||
129 | memset(cAB, 0, longN); | 129 | memset(cAB, 0, longN); |
@@ -132,7 +132,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) | |||
132 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); | 132 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); |
133 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN); | 133 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN); |
134 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN); | 134 | EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN); |
135 | OPENSSL_free(cAB); | 135 | free(cAB); |
136 | EVP_DigestFinal_ex(&ctxt, cu, NULL); | 136 | EVP_DigestFinal_ex(&ctxt, cu, NULL); |
137 | EVP_MD_CTX_cleanup(&ctxt); | 137 | EVP_MD_CTX_cleanup(&ctxt); |
138 | 138 | ||
@@ -215,7 +215,7 @@ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass) | |||
215 | (pass == NULL)) | 215 | (pass == NULL)) |
216 | return NULL; | 216 | return NULL; |
217 | 217 | ||
218 | if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL) | 218 | if ((cs = malloc(BN_num_bytes(s))) == NULL) |
219 | return NULL; | 219 | return NULL; |
220 | 220 | ||
221 | EVP_MD_CTX_init(&ctxt); | 221 | EVP_MD_CTX_init(&ctxt); |
@@ -228,7 +228,7 @@ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass) | |||
228 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); | 228 | EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL); |
229 | BN_bn2bin(s,cs); | 229 | BN_bn2bin(s,cs); |
230 | EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s)); | 230 | EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s)); |
231 | OPENSSL_free(cs); | 231 | free(cs); |
232 | EVP_DigestUpdate(&ctxt, dig, sizeof(dig)); | 232 | EVP_DigestUpdate(&ctxt, dig, sizeof(dig)); |
233 | EVP_DigestFinal_ex(&ctxt, dig, NULL); | 233 | EVP_DigestFinal_ex(&ctxt, dig, NULL); |
234 | EVP_MD_CTX_cleanup(&ctxt); | 234 | EVP_MD_CTX_cleanup(&ctxt); |
diff --git a/src/lib/libssl/src/crypto/srp/srp_vfy.c b/src/lib/libssl/src/crypto/srp/srp_vfy.c index 4a3d13edf6..de7dbe5bbd 100644 --- a/src/lib/libssl/src/crypto/srp/srp_vfy.c +++ b/src/lib/libssl/src/crypto/srp/srp_vfy.c | |||
@@ -185,14 +185,14 @@ static void SRP_user_pwd_free(SRP_user_pwd *user_pwd) | |||
185 | return; | 185 | return; |
186 | BN_free(user_pwd->s); | 186 | BN_free(user_pwd->s); |
187 | BN_clear_free(user_pwd->v); | 187 | BN_clear_free(user_pwd->v); |
188 | OPENSSL_free(user_pwd->id); | 188 | free(user_pwd->id); |
189 | OPENSSL_free(user_pwd->info); | 189 | free(user_pwd->info); |
190 | OPENSSL_free(user_pwd); | 190 | free(user_pwd); |
191 | } | 191 | } |
192 | 192 | ||
193 | static SRP_user_pwd *SRP_user_pwd_new() | 193 | static SRP_user_pwd *SRP_user_pwd_new() |
194 | { | 194 | { |
195 | SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd)); | 195 | SRP_user_pwd *ret = malloc(sizeof(SRP_user_pwd)); |
196 | if (ret == NULL) | 196 | if (ret == NULL) |
197 | return NULL; | 197 | return NULL; |
198 | ret->N = NULL; | 198 | ret->N = NULL; |
@@ -243,14 +243,14 @@ static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v) | |||
243 | 243 | ||
244 | SRP_VBASE *SRP_VBASE_new(char *seed_key) | 244 | SRP_VBASE *SRP_VBASE_new(char *seed_key) |
245 | { | 245 | { |
246 | SRP_VBASE *vb = (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE)); | 246 | SRP_VBASE *vb = (SRP_VBASE *) malloc(sizeof(SRP_VBASE)); |
247 | 247 | ||
248 | if (vb == NULL) | 248 | if (vb == NULL) |
249 | return NULL; | 249 | return NULL; |
250 | if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) || | 250 | if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) || |
251 | !(vb->gN_cache = sk_SRP_gN_cache_new_null())) | 251 | !(vb->gN_cache = sk_SRP_gN_cache_new_null())) |
252 | { | 252 | { |
253 | OPENSSL_free(vb); | 253 | free(vb); |
254 | return NULL; | 254 | return NULL; |
255 | } | 255 | } |
256 | vb->default_g = NULL; | 256 | vb->default_g = NULL; |
@@ -261,7 +261,7 @@ SRP_VBASE *SRP_VBASE_new(char *seed_key) | |||
261 | { | 261 | { |
262 | sk_SRP_user_pwd_free(vb->users_pwd); | 262 | sk_SRP_user_pwd_free(vb->users_pwd); |
263 | sk_SRP_gN_cache_free(vb->gN_cache); | 263 | sk_SRP_gN_cache_free(vb->gN_cache); |
264 | OPENSSL_free(vb); | 264 | free(vb); |
265 | return NULL; | 265 | return NULL; |
266 | } | 266 | } |
267 | return vb; | 267 | return vb; |
@@ -272,8 +272,8 @@ int SRP_VBASE_free(SRP_VBASE *vb) | |||
272 | { | 272 | { |
273 | sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free); | 273 | sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free); |
274 | sk_SRP_gN_cache_free(vb->gN_cache); | 274 | sk_SRP_gN_cache_free(vb->gN_cache); |
275 | OPENSSL_free(vb->seed_key); | 275 | free(vb->seed_key); |
276 | OPENSSL_free(vb); | 276 | free(vb); |
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
279 | 279 | ||
@@ -283,7 +283,7 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch) | |||
283 | unsigned char tmp[MAX_LEN]; | 283 | unsigned char tmp[MAX_LEN]; |
284 | int len; | 284 | int len; |
285 | 285 | ||
286 | SRP_gN_cache *newgN = (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache)); | 286 | SRP_gN_cache *newgN = (SRP_gN_cache *)malloc(sizeof(SRP_gN_cache)); |
287 | if (newgN == NULL) | 287 | if (newgN == NULL) |
288 | return NULL; | 288 | return NULL; |
289 | 289 | ||
@@ -294,9 +294,9 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch) | |||
294 | if ((newgN->bn = BN_bin2bn(tmp, len, NULL))) | 294 | if ((newgN->bn = BN_bin2bn(tmp, len, NULL))) |
295 | return newgN; | 295 | return newgN; |
296 | 296 | ||
297 | OPENSSL_free(newgN->b64_bn); | 297 | free(newgN->b64_bn); |
298 | err: | 298 | err: |
299 | OPENSSL_free(newgN); | 299 | free(newgN); |
300 | return NULL; | 300 | return NULL; |
301 | } | 301 | } |
302 | 302 | ||
@@ -305,9 +305,9 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache) | |||
305 | { | 305 | { |
306 | if (gN_cache == NULL) | 306 | if (gN_cache == NULL) |
307 | return; | 307 | return; |
308 | OPENSSL_free(gN_cache->b64_bn); | 308 | free(gN_cache->b64_bn); |
309 | BN_free(gN_cache->bn); | 309 | BN_free(gN_cache->bn); |
310 | OPENSSL_free(gN_cache); | 310 | free(gN_cache); |
311 | } | 311 | } |
312 | 312 | ||
313 | static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) | 313 | static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) |
@@ -395,7 +395,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) | |||
395 | { | 395 | { |
396 | /*we add this couple in the internal Stack */ | 396 | /*we add this couple in the internal Stack */ |
397 | 397 | ||
398 | if ((gN = (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) == NULL) | 398 | if ((gN = (SRP_gN *)malloc(sizeof(SRP_gN))) == NULL) |
399 | goto err; | 399 | goto err; |
400 | 400 | ||
401 | if (!(gN->id = BUF_strdup(pp[DB_srpid])) | 401 | if (!(gN->id = BUF_strdup(pp[DB_srpid])) |
@@ -456,8 +456,8 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) | |||
456 | 456 | ||
457 | if (gN != NULL) | 457 | if (gN != NULL) |
458 | { | 458 | { |
459 | OPENSSL_free(gN->id); | 459 | free(gN->id); |
460 | OPENSSL_free(gN); | 460 | free(gN); |
461 | } | 461 | } |
462 | 462 | ||
463 | SRP_user_pwd_free(user_pwd); | 463 | SRP_user_pwd_free(user_pwd); |
@@ -573,7 +573,7 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt, | |||
573 | if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err; | 573 | if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err; |
574 | 574 | ||
575 | BN_bn2bin(v,tmp); | 575 | BN_bn2bin(v,tmp); |
576 | if (((vf = OPENSSL_malloc(BN_num_bytes(v)*2)) == NULL)) | 576 | if (((vf = malloc(BN_num_bytes(v)*2)) == NULL)) |
577 | goto err; | 577 | goto err; |
578 | t_tob64(vf, tmp, BN_num_bytes(v)); | 578 | t_tob64(vf, tmp, BN_num_bytes(v)); |
579 | 579 | ||
@@ -582,9 +582,9 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt, | |||
582 | { | 582 | { |
583 | char *tmp_salt; | 583 | char *tmp_salt; |
584 | 584 | ||
585 | if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL) | 585 | if ((tmp_salt = malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL) |
586 | { | 586 | { |
587 | OPENSSL_free(vf); | 587 | free(vf); |
588 | goto err; | 588 | goto err; |
589 | } | 589 | } |
590 | t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN); | 590 | t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN); |
diff --git a/src/lib/libssl/src/crypto/stack/stack.c b/src/lib/libssl/src/crypto/stack/stack.c index 76cf1a1168..dabf26d2cd 100644 --- a/src/lib/libssl/src/crypto/stack/stack.c +++ b/src/lib/libssl/src/crypto/stack/stack.c | |||
@@ -95,7 +95,7 @@ _STACK *sk_dup(_STACK *sk) | |||
95 | char **s; | 95 | char **s; |
96 | 96 | ||
97 | if ((ret=sk_new(sk->comp)) == NULL) goto err; | 97 | if ((ret=sk_new(sk->comp)) == NULL) goto err; |
98 | s=(char **)OPENSSL_realloc((char *)ret->data, | 98 | s=(char **)realloc((char *)ret->data, |
99 | (unsigned int)sizeof(char *)*sk->num_alloc); | 99 | (unsigned int)sizeof(char *)*sk->num_alloc); |
100 | if (s == NULL) goto err; | 100 | if (s == NULL) goto err; |
101 | ret->data=s; | 101 | ret->data=s; |
@@ -122,9 +122,9 @@ _STACK *sk_new(int (*c)(const void *, const void *)) | |||
122 | _STACK *ret; | 122 | _STACK *ret; |
123 | int i; | 123 | int i; |
124 | 124 | ||
125 | if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL) | 125 | if ((ret=malloc(sizeof(_STACK))) == NULL) |
126 | goto err; | 126 | goto err; |
127 | if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL) | 127 | if ((ret->data=malloc(sizeof(char *)*MIN_NODES)) == NULL) |
128 | goto err; | 128 | goto err; |
129 | for (i=0; i<MIN_NODES; i++) | 129 | for (i=0; i<MIN_NODES; i++) |
130 | ret->data[i]=NULL; | 130 | ret->data[i]=NULL; |
@@ -135,7 +135,7 @@ _STACK *sk_new(int (*c)(const void *, const void *)) | |||
135 | return(ret); | 135 | return(ret); |
136 | err: | 136 | err: |
137 | if(ret) | 137 | if(ret) |
138 | OPENSSL_free(ret); | 138 | free(ret); |
139 | return(NULL); | 139 | return(NULL); |
140 | } | 140 | } |
141 | 141 | ||
@@ -146,7 +146,7 @@ int sk_insert(_STACK *st, void *data, int loc) | |||
146 | if(st == NULL) return 0; | 146 | if(st == NULL) return 0; |
147 | if (st->num_alloc <= st->num+1) | 147 | if (st->num_alloc <= st->num+1) |
148 | { | 148 | { |
149 | s=OPENSSL_realloc((char *)st->data, | 149 | s=realloc((char *)st->data, |
150 | (unsigned int)sizeof(char *)*st->num_alloc*2); | 150 | (unsigned int)sizeof(char *)*st->num_alloc*2); |
151 | if (s == NULL) | 151 | if (s == NULL) |
152 | return(0); | 152 | return(0); |
@@ -287,8 +287,8 @@ void sk_pop_free(_STACK *st, void (*func)(void *)) | |||
287 | void sk_free(_STACK *st) | 287 | void sk_free(_STACK *st) |
288 | { | 288 | { |
289 | if (st == NULL) return; | 289 | if (st == NULL) return; |
290 | if (st->data != NULL) OPENSSL_free(st->data); | 290 | if (st->data != NULL) free(st->data); |
291 | OPENSSL_free(st); | 291 | free(st); |
292 | } | 292 | } |
293 | 293 | ||
294 | int sk_num(const _STACK *st) | 294 | int sk_num(const _STACK *st) |
diff --git a/src/lib/libssl/src/crypto/store/str_lib.c b/src/lib/libssl/src/crypto/store/str_lib.c index e92dc1f51c..a451e9cb74 100644 --- a/src/lib/libssl/src/crypto/store/str_lib.c +++ b/src/lib/libssl/src/crypto/store/str_lib.c | |||
@@ -112,7 +112,7 @@ STORE *STORE_new_method(const STORE_METHOD *method) | |||
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | ret=(STORE *)OPENSSL_malloc(sizeof(STORE)); | 115 | ret=(STORE *)malloc(sizeof(STORE)); |
116 | if (ret == NULL) | 116 | if (ret == NULL) |
117 | { | 117 | { |
118 | STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 118 | STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -185,7 +185,7 @@ void STORE_free(STORE *store) | |||
185 | if (store->meth->clean) | 185 | if (store->meth->clean) |
186 | store->meth->clean(store); | 186 | store->meth->clean(store); |
187 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data); | 187 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data); |
188 | OPENSSL_free(store); | 188 | free(store); |
189 | } | 189 | } |
190 | 190 | ||
191 | int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)) | 191 | int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)) |
@@ -1227,7 +1227,7 @@ int STORE_delete_arbitrary(STORE *s, OPENSSL_ITEM attributes[], | |||
1227 | 1227 | ||
1228 | STORE_OBJECT *STORE_OBJECT_new(void) | 1228 | STORE_OBJECT *STORE_OBJECT_new(void) |
1229 | { | 1229 | { |
1230 | STORE_OBJECT *object = OPENSSL_malloc(sizeof(STORE_OBJECT)); | 1230 | STORE_OBJECT *object = malloc(sizeof(STORE_OBJECT)); |
1231 | if (object) memset(object, 0, sizeof(STORE_OBJECT)); | 1231 | if (object) memset(object, 0, sizeof(STORE_OBJECT)); |
1232 | return object; | 1232 | return object; |
1233 | } | 1233 | } |
@@ -1253,7 +1253,7 @@ void STORE_OBJECT_free(STORE_OBJECT *data) | |||
1253 | BUF_MEM_free(data->data.arbitrary); | 1253 | BUF_MEM_free(data->data.arbitrary); |
1254 | break; | 1254 | break; |
1255 | } | 1255 | } |
1256 | OPENSSL_free(data); | 1256 | free(data); |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | IMPLEMENT_STACK_OF(STORE_OBJECT*) | 1259 | IMPLEMENT_STACK_OF(STORE_OBJECT*) |
@@ -1280,7 +1280,7 @@ struct STORE_attr_info_st | |||
1280 | 1280 | ||
1281 | STORE_ATTR_INFO *STORE_ATTR_INFO_new(void) | 1281 | STORE_ATTR_INFO *STORE_ATTR_INFO_new(void) |
1282 | { | 1282 | { |
1283 | return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO)); | 1283 | return (STORE_ATTR_INFO *)malloc(sizeof(STORE_ATTR_INFO)); |
1284 | } | 1284 | } |
1285 | static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, | 1285 | static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, |
1286 | STORE_ATTR_TYPES code) | 1286 | STORE_ATTR_TYPES code) |
@@ -1320,7 +1320,7 @@ int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs) | |||
1320 | STORE_ATTR_TYPES i; | 1320 | STORE_ATTR_TYPES i; |
1321 | for(i = 0; i++ < STORE_ATTR_TYPE_NUM;) | 1321 | for(i = 0; i++ < STORE_ATTR_TYPE_NUM;) |
1322 | STORE_ATTR_INFO_attr_free(attrs, i); | 1322 | STORE_ATTR_INFO_attr_free(attrs, i); |
1323 | OPENSSL_free(attrs); | 1323 | free(attrs); |
1324 | } | 1324 | } |
1325 | return 1; | 1325 | return 1; |
1326 | } | 1326 | } |
@@ -1474,7 +1474,7 @@ int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
1474 | } | 1474 | } |
1475 | if (ATTR_IS_SET(attrs,code)) | 1475 | if (ATTR_IS_SET(attrs,code)) |
1476 | { | 1476 | { |
1477 | OPENSSL_free(attrs->values[code].cstring); | 1477 | free(attrs->values[code].cstring); |
1478 | attrs->values[code].cstring = NULL; | 1478 | attrs->values[code].cstring = NULL; |
1479 | CLEAR_ATTRBIT(attrs, code); | 1479 | CLEAR_ATTRBIT(attrs, code); |
1480 | } | 1480 | } |
@@ -1491,7 +1491,7 @@ int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code | |||
1491 | } | 1491 | } |
1492 | if (ATTR_IS_SET(attrs,code)) | 1492 | if (ATTR_IS_SET(attrs,code)) |
1493 | { | 1493 | { |
1494 | OPENSSL_free(attrs->values[code].sha1string); | 1494 | free(attrs->values[code].sha1string); |
1495 | attrs->values[code].sha1string = NULL; | 1495 | attrs->values[code].sha1string = NULL; |
1496 | CLEAR_ATTRBIT(attrs, code); | 1496 | CLEAR_ATTRBIT(attrs, code); |
1497 | } | 1497 | } |
@@ -1508,7 +1508,7 @@ int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
1508 | } | 1508 | } |
1509 | if (ATTR_IS_SET(attrs,code)) | 1509 | if (ATTR_IS_SET(attrs,code)) |
1510 | { | 1510 | { |
1511 | OPENSSL_free(attrs->values[code].dn); | 1511 | free(attrs->values[code].dn); |
1512 | attrs->values[code].dn = NULL; | 1512 | attrs->values[code].dn = NULL; |
1513 | CLEAR_ATTRBIT(attrs, code); | 1513 | CLEAR_ATTRBIT(attrs, code); |
1514 | } | 1514 | } |
@@ -1525,7 +1525,7 @@ int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
1525 | } | 1525 | } |
1526 | if (ATTR_IS_SET(attrs,code)) | 1526 | if (ATTR_IS_SET(attrs,code)) |
1527 | { | 1527 | { |
1528 | OPENSSL_free(attrs->values[code].number); | 1528 | free(attrs->values[code].number); |
1529 | attrs->values[code].number = NULL; | 1529 | attrs->values[code].number = NULL; |
1530 | CLEAR_ATTRBIT(attrs, code); | 1530 | CLEAR_ATTRBIT(attrs, code); |
1531 | } | 1531 | } |
@@ -1541,7 +1541,7 @@ void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes) | |||
1541 | if (attributes) | 1541 | if (attributes) |
1542 | { | 1542 | { |
1543 | struct attr_list_ctx_st *context = | 1543 | struct attr_list_ctx_st *context = |
1544 | (struct attr_list_ctx_st *)OPENSSL_malloc(sizeof(struct attr_list_ctx_st)); | 1544 | (struct attr_list_ctx_st *)malloc(sizeof(struct attr_list_ctx_st)); |
1545 | if (context) | 1545 | if (context) |
1546 | context->attributes = attributes; | 1546 | context->attributes = attributes; |
1547 | else | 1547 | else |
@@ -1650,7 +1650,7 @@ int STORE_parse_attrs_end(void *handle) | |||
1650 | #if 0 | 1650 | #if 0 |
1651 | OPENSSL_ITEM *attributes = context->attributes; | 1651 | OPENSSL_ITEM *attributes = context->attributes; |
1652 | #endif | 1652 | #endif |
1653 | OPENSSL_free(context); | 1653 | free(context); |
1654 | return 1; | 1654 | return 1; |
1655 | } | 1655 | } |
1656 | STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER); | 1656 | STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER); |
diff --git a/src/lib/libssl/src/crypto/store/str_mem.c b/src/lib/libssl/src/crypto/store/str_mem.c index 8ac4f7e55c..997e60fe93 100644 --- a/src/lib/libssl/src/crypto/store/str_mem.c +++ b/src/lib/libssl/src/crypto/store/str_mem.c | |||
@@ -222,7 +222,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | |||
222 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) | 222 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) |
223 | { | 223 | { |
224 | struct mem_ctx_st *context = | 224 | struct mem_ctx_st *context = |
225 | (struct mem_ctx_st *)OPENSSL_malloc(sizeof(struct mem_ctx_st)); | 225 | (struct mem_ctx_st *)malloc(sizeof(struct mem_ctx_st)); |
226 | void *attribute_context = NULL; | 226 | void *attribute_context = NULL; |
227 | STORE_ATTR_INFO *attrs = NULL; | 227 | STORE_ATTR_INFO *attrs = NULL; |
228 | 228 | ||
@@ -336,7 +336,7 @@ static int mem_list_end(STORE *s, void *handle) | |||
336 | } | 336 | } |
337 | if (context && context->search_attributes) | 337 | if (context && context->search_attributes) |
338 | sk_STORE_ATTR_INFO_free(context->search_attributes); | 338 | sk_STORE_ATTR_INFO_free(context->search_attributes); |
339 | if (context) OPENSSL_free(context); | 339 | if (context) free(context); |
340 | return 1; | 340 | return 1; |
341 | } | 341 | } |
342 | static int mem_list_endp(STORE *s, void *handle) | 342 | static int mem_list_endp(STORE *s, void *handle) |
diff --git a/src/lib/libssl/src/crypto/store/str_meth.c b/src/lib/libssl/src/crypto/store/str_meth.c index a46de03a26..8944824618 100644 --- a/src/lib/libssl/src/crypto/store/str_meth.c +++ b/src/lib/libssl/src/crypto/store/str_meth.c | |||
@@ -62,7 +62,7 @@ | |||
62 | 62 | ||
63 | STORE_METHOD *STORE_create_method(char *name) | 63 | STORE_METHOD *STORE_create_method(char *name) |
64 | { | 64 | { |
65 | STORE_METHOD *store_method = (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD)); | 65 | STORE_METHOD *store_method = (STORE_METHOD *)malloc(sizeof(STORE_METHOD)); |
66 | 66 | ||
67 | if (store_method) | 67 | if (store_method) |
68 | { | 68 | { |
@@ -78,9 +78,9 @@ STORE_METHOD *STORE_create_method(char *name) | |||
78 | void STORE_destroy_method(STORE_METHOD *store_method) | 78 | void STORE_destroy_method(STORE_METHOD *store_method) |
79 | { | 79 | { |
80 | if (!store_method) return; | 80 | if (!store_method) return; |
81 | OPENSSL_free(store_method->name); | 81 | free(store_method->name); |
82 | store_method->name = NULL; | 82 | store_method->name = NULL; |
83 | OPENSSL_free(store_method); | 83 | free(store_method); |
84 | } | 84 | } |
85 | 85 | ||
86 | int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f) | 86 | int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f) |
diff --git a/src/lib/libssl/src/crypto/ts/ts_lib.c b/src/lib/libssl/src/crypto/ts/ts_lib.c index e8608dbf71..a8de801e28 100644 --- a/src/lib/libssl/src/crypto/ts/ts_lib.c +++ b/src/lib/libssl/src/crypto/ts/ts_lib.c | |||
@@ -79,7 +79,7 @@ int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num) | |||
79 | { | 79 | { |
80 | result = BIO_write(bio, "0x", 2) > 0; | 80 | result = BIO_write(bio, "0x", 2) > 0; |
81 | result = result && BIO_write(bio, hex, strlen(hex)) > 0; | 81 | result = result && BIO_write(bio, hex, strlen(hex)) > 0; |
82 | OPENSSL_free(hex); | 82 | free(hex); |
83 | } | 83 | } |
84 | BN_free(&num_bn); | 84 | BN_free(&num_bn); |
85 | 85 | ||
diff --git a/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c b/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c index e7186a8ce0..e52c9ff03b 100644 --- a/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c +++ b/src/lib/libssl/src/crypto/ts/ts_rsp_sign.c | |||
@@ -167,7 +167,7 @@ TS_RESP_CTX *TS_RESP_CTX_new() | |||
167 | { | 167 | { |
168 | TS_RESP_CTX *ctx; | 168 | TS_RESP_CTX *ctx; |
169 | 169 | ||
170 | if (!(ctx = (TS_RESP_CTX *) OPENSSL_malloc(sizeof(TS_RESP_CTX)))) | 170 | if (!(ctx = (TS_RESP_CTX *) malloc(sizeof(TS_RESP_CTX)))) |
171 | { | 171 | { |
172 | TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE); | 172 | TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE); |
173 | return NULL; | 173 | return NULL; |
@@ -195,7 +195,7 @@ void TS_RESP_CTX_free(TS_RESP_CTX *ctx) | |||
195 | ASN1_INTEGER_free(ctx->seconds); | 195 | ASN1_INTEGER_free(ctx->seconds); |
196 | ASN1_INTEGER_free(ctx->millis); | 196 | ASN1_INTEGER_free(ctx->millis); |
197 | ASN1_INTEGER_free(ctx->micros); | 197 | ASN1_INTEGER_free(ctx->micros); |
198 | OPENSSL_free(ctx); | 198 | free(ctx); |
199 | } | 199 | } |
200 | 200 | ||
201 | int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer) | 201 | int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer) |
@@ -922,7 +922,7 @@ static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) | |||
922 | int len; | 922 | int len; |
923 | 923 | ||
924 | len = i2d_ESS_SIGNING_CERT(sc, NULL); | 924 | len = i2d_ESS_SIGNING_CERT(sc, NULL); |
925 | if (!(pp = (unsigned char *) OPENSSL_malloc(len))) | 925 | if (!(pp = (unsigned char *) malloc(len))) |
926 | { | 926 | { |
927 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); | 927 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); |
928 | goto err; | 928 | goto err; |
@@ -934,13 +934,13 @@ static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc) | |||
934 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); | 934 | TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE); |
935 | goto err; | 935 | goto err; |
936 | } | 936 | } |
937 | OPENSSL_free(pp); pp = NULL; | 937 | free(pp); pp = NULL; |
938 | return PKCS7_add_signed_attribute(si, | 938 | return PKCS7_add_signed_attribute(si, |
939 | NID_id_smime_aa_signingCertificate, | 939 | NID_id_smime_aa_signingCertificate, |
940 | V_ASN1_SEQUENCE, seq); | 940 | V_ASN1_SEQUENCE, seq); |
941 | err: | 941 | err: |
942 | ASN1_STRING_free(seq); | 942 | ASN1_STRING_free(seq); |
943 | OPENSSL_free(pp); | 943 | free(pp); |
944 | 944 | ||
945 | return 0; | 945 | return 0; |
946 | } | 946 | } |
diff --git a/src/lib/libssl/src/crypto/ts/ts_rsp_verify.c b/src/lib/libssl/src/crypto/ts/ts_rsp_verify.c index f241230ef4..d51500b5d4 100644 --- a/src/lib/libssl/src/crypto/ts/ts_rsp_verify.c +++ b/src/lib/libssl/src/crypto/ts/ts_rsp_verify.c | |||
@@ -472,7 +472,7 @@ static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx, | |||
472 | err: | 472 | err: |
473 | X509_free(signer); | 473 | X509_free(signer); |
474 | X509_ALGOR_free(md_alg); | 474 | X509_ALGOR_free(md_alg); |
475 | OPENSSL_free(imprint); | 475 | free(imprint); |
476 | return ret; | 476 | return ret; |
477 | } | 477 | } |
478 | 478 | ||
@@ -528,7 +528,7 @@ static int TS_check_status_info(TS_RESP *response) | |||
528 | ", status text: ", embedded_status_text ? | 528 | ", status text: ", embedded_status_text ? |
529 | embedded_status_text : "unspecified", | 529 | embedded_status_text : "unspecified", |
530 | ", failure codes: ", failure_text); | 530 | ", failure codes: ", failure_text); |
531 | OPENSSL_free(embedded_status_text); | 531 | free(embedded_status_text); |
532 | 532 | ||
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
@@ -547,7 +547,7 @@ static char *TS_get_status_text(STACK_OF(ASN1_UTF8STRING) *text) | |||
547 | length += 1; /* separator character */ | 547 | length += 1; /* separator character */ |
548 | } | 548 | } |
549 | /* Allocate memory (closing '\0' included). */ | 549 | /* Allocate memory (closing '\0' included). */ |
550 | if (!(result = OPENSSL_malloc(length))) | 550 | if (!(result = malloc(length))) |
551 | { | 551 | { |
552 | TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE); | 552 | TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE); |
553 | return NULL; | 553 | return NULL; |
@@ -606,7 +606,7 @@ static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, | |||
606 | if (length < 0) | 606 | if (length < 0) |
607 | goto err; | 607 | goto err; |
608 | *imprint_len = length; | 608 | *imprint_len = length; |
609 | if (!(*imprint = OPENSSL_malloc(*imprint_len))) | 609 | if (!(*imprint = malloc(*imprint_len))) |
610 | { | 610 | { |
611 | TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE); | 611 | TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE); |
612 | goto err; | 612 | goto err; |
@@ -625,7 +625,7 @@ static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, | |||
625 | return 1; | 625 | return 1; |
626 | err: | 626 | err: |
627 | X509_ALGOR_free(*md_alg); | 627 | X509_ALGOR_free(*md_alg); |
628 | OPENSSL_free(*imprint); | 628 | free(*imprint); |
629 | *imprint_len = 0; | 629 | *imprint_len = 0; |
630 | return 0; | 630 | return 0; |
631 | } | 631 | } |
diff --git a/src/lib/libssl/src/crypto/ts/ts_verify_ctx.c b/src/lib/libssl/src/crypto/ts/ts_verify_ctx.c index 609b7735d4..629107aeec 100644 --- a/src/lib/libssl/src/crypto/ts/ts_verify_ctx.c +++ b/src/lib/libssl/src/crypto/ts/ts_verify_ctx.c | |||
@@ -63,7 +63,7 @@ | |||
63 | TS_VERIFY_CTX *TS_VERIFY_CTX_new(void) | 63 | TS_VERIFY_CTX *TS_VERIFY_CTX_new(void) |
64 | { | 64 | { |
65 | TS_VERIFY_CTX *ctx = | 65 | TS_VERIFY_CTX *ctx = |
66 | (TS_VERIFY_CTX *) OPENSSL_malloc(sizeof(TS_VERIFY_CTX)); | 66 | (TS_VERIFY_CTX *) malloc(sizeof(TS_VERIFY_CTX)); |
67 | if (ctx) | 67 | if (ctx) |
68 | memset(ctx, 0, sizeof(TS_VERIFY_CTX)); | 68 | memset(ctx, 0, sizeof(TS_VERIFY_CTX)); |
69 | else | 69 | else |
@@ -82,7 +82,7 @@ void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) | |||
82 | if (!ctx) return; | 82 | if (!ctx) return; |
83 | 83 | ||
84 | TS_VERIFY_CTX_cleanup(ctx); | 84 | TS_VERIFY_CTX_cleanup(ctx); |
85 | OPENSSL_free(ctx); | 85 | free(ctx); |
86 | } | 86 | } |
87 | 87 | ||
88 | void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) | 88 | void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) |
@@ -95,7 +95,7 @@ void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) | |||
95 | ASN1_OBJECT_free(ctx->policy); | 95 | ASN1_OBJECT_free(ctx->policy); |
96 | 96 | ||
97 | X509_ALGOR_free(ctx->md_alg); | 97 | X509_ALGOR_free(ctx->md_alg); |
98 | OPENSSL_free(ctx->imprint); | 98 | free(ctx->imprint); |
99 | 99 | ||
100 | BIO_free_all(ctx->data); | 100 | BIO_free_all(ctx->data); |
101 | 101 | ||
@@ -138,7 +138,7 @@ TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx) | |||
138 | if (!(ret->md_alg = X509_ALGOR_dup(md_alg))) goto err; | 138 | if (!(ret->md_alg = X509_ALGOR_dup(md_alg))) goto err; |
139 | msg = TS_MSG_IMPRINT_get_msg(imprint); | 139 | msg = TS_MSG_IMPRINT_get_msg(imprint); |
140 | ret->imprint_len = ASN1_STRING_length(msg); | 140 | ret->imprint_len = ASN1_STRING_length(msg); |
141 | if (!(ret->imprint = OPENSSL_malloc(ret->imprint_len))) goto err; | 141 | if (!(ret->imprint = malloc(ret->imprint_len))) goto err; |
142 | memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len); | 142 | memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len); |
143 | 143 | ||
144 | /* Setting nonce. */ | 144 | /* Setting nonce. */ |
diff --git a/src/lib/libssl/src/crypto/txt_db/txt_db.c b/src/lib/libssl/src/crypto/txt_db/txt_db.c index 6f2ce3b5a4..c1e7a79a1a 100644 --- a/src/lib/libssl/src/crypto/txt_db/txt_db.c +++ b/src/lib/libssl/src/crypto/txt_db/txt_db.c | |||
@@ -84,16 +84,16 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
84 | if ((buf=BUF_MEM_new()) == NULL) goto err; | 84 | if ((buf=BUF_MEM_new()) == NULL) goto err; |
85 | if (!BUF_MEM_grow(buf,size)) goto err; | 85 | if (!BUF_MEM_grow(buf,size)) goto err; |
86 | 86 | ||
87 | if ((ret=OPENSSL_malloc(sizeof(TXT_DB))) == NULL) | 87 | if ((ret=malloc(sizeof(TXT_DB))) == NULL) |
88 | goto err; | 88 | goto err; |
89 | ret->num_fields=num; | 89 | ret->num_fields=num; |
90 | ret->index=NULL; | 90 | ret->index=NULL; |
91 | ret->qual=NULL; | 91 | ret->qual=NULL; |
92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) | 92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) |
93 | goto err; | 93 | goto err; |
94 | if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL) | 94 | if ((ret->index=malloc(sizeof(*ret->index)*num)) == NULL) |
95 | goto err; | 95 | goto err; |
96 | if ((ret->qual=OPENSSL_malloc(sizeof(*(ret->qual))*num)) == NULL) | 96 | if ((ret->qual=malloc(sizeof(*(ret->qual))*num)) == NULL) |
97 | goto err; | 97 | goto err; |
98 | for (i=0; i<num; i++) | 98 | for (i=0; i<num; i++) |
99 | { | 99 | { |
@@ -123,7 +123,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
123 | else | 123 | else |
124 | { | 124 | { |
125 | buf->data[offset-1]='\0'; /* blat the '\n' */ | 125 | buf->data[offset-1]='\0'; /* blat the '\n' */ |
126 | if (!(p=OPENSSL_malloc(add+offset))) goto err; | 126 | if (!(p=malloc(add+offset))) goto err; |
127 | offset=0; | 127 | offset=0; |
128 | } | 128 | } |
129 | pp=(char **)p; | 129 | pp=(char **)p; |
@@ -178,14 +178,14 @@ err: | |||
178 | if (er) | 178 | if (er) |
179 | { | 179 | { |
180 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | 180 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) |
181 | if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n"); | 181 | if (er == 1) fprintf(stderr,"malloc failure\n"); |
182 | #endif | 182 | #endif |
183 | if (ret != NULL) | 183 | if (ret != NULL) |
184 | { | 184 | { |
185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); | 185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); |
186 | if (ret->index != NULL) OPENSSL_free(ret->index); | 186 | if (ret->index != NULL) free(ret->index); |
187 | if (ret->qual != NULL) OPENSSL_free(ret->qual); | 187 | if (ret->qual != NULL) free(ret->qual); |
188 | if (ret != NULL) OPENSSL_free(ret); | 188 | if (ret != NULL) free(ret); |
189 | } | 189 | } |
190 | return(NULL); | 190 | return(NULL); |
191 | } | 191 | } |
@@ -354,10 +354,10 @@ void TXT_DB_free(TXT_DB *db) | |||
354 | { | 354 | { |
355 | for (i=db->num_fields-1; i>=0; i--) | 355 | for (i=db->num_fields-1; i>=0; i--) |
356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); | 356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); |
357 | OPENSSL_free(db->index); | 357 | free(db->index); |
358 | } | 358 | } |
359 | if (db->qual != NULL) | 359 | if (db->qual != NULL) |
360 | OPENSSL_free(db->qual); | 360 | free(db->qual); |
361 | if (db->data != NULL) | 361 | if (db->data != NULL) |
362 | { | 362 | { |
363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) | 363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) |
@@ -369,7 +369,7 @@ void TXT_DB_free(TXT_DB *db) | |||
369 | if (max == NULL) /* new row */ | 369 | if (max == NULL) /* new row */ |
370 | { | 370 | { |
371 | for (n=0; n<db->num_fields; n++) | 371 | for (n=0; n<db->num_fields; n++) |
372 | if (p[n] != NULL) OPENSSL_free(p[n]); | 372 | if (p[n] != NULL) free(p[n]); |
373 | } | 373 | } |
374 | else | 374 | else |
375 | { | 375 | { |
@@ -377,12 +377,12 @@ void TXT_DB_free(TXT_DB *db) | |||
377 | { | 377 | { |
378 | if (((p[n] < (char *)p) || (p[n] > max)) | 378 | if (((p[n] < (char *)p) || (p[n] > max)) |
379 | && (p[n] != NULL)) | 379 | && (p[n] != NULL)) |
380 | OPENSSL_free(p[n]); | 380 | free(p[n]); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i)); | 383 | free(sk_OPENSSL_PSTRING_value(db->data,i)); |
384 | } | 384 | } |
385 | sk_OPENSSL_PSTRING_free(db->data); | 385 | sk_OPENSSL_PSTRING_free(db->data); |
386 | } | 386 | } |
387 | OPENSSL_free(db); | 387 | free(db); |
388 | } | 388 | } |
diff --git a/src/lib/libssl/src/crypto/ui/ui.h b/src/lib/libssl/src/crypto/ui/ui.h index bd78aa413f..ed35e50eb4 100644 --- a/src/lib/libssl/src/crypto/ui/ui.h +++ b/src/lib/libssl/src/crypto/ui/ui.h | |||
@@ -173,7 +173,7 @@ int UI_dup_error_string(UI *ui, const char *text); | |||
173 | and object_name is the name of the object (might be a card name or | 173 | and object_name is the name of the object (might be a card name or |
174 | a file name. | 174 | a file name. |
175 | The returned string shall always be allocated on the heap with | 175 | The returned string shall always be allocated on the heap with |
176 | OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). | 176 | malloc(), and need to be free'd with free(). |
177 | 177 | ||
178 | If the ui_method doesn't contain a pointer to a user-defined prompt | 178 | If the ui_method doesn't contain a pointer to a user-defined prompt |
179 | constructor, a default string is built, looking like this: | 179 | constructor, a default string is built, looking like this: |
diff --git a/src/lib/libssl/src/crypto/ui/ui_lib.c b/src/lib/libssl/src/crypto/ui/ui_lib.c index 6113060aa9..d3cadd51f6 100644 --- a/src/lib/libssl/src/crypto/ui/ui_lib.c +++ b/src/lib/libssl/src/crypto/ui/ui_lib.c | |||
@@ -77,7 +77,7 @@ UI *UI_new_method(const UI_METHOD *method) | |||
77 | { | 77 | { |
78 | UI *ret; | 78 | UI *ret; |
79 | 79 | ||
80 | ret=(UI *)OPENSSL_malloc(sizeof(UI)); | 80 | ret=(UI *)malloc(sizeof(UI)); |
81 | if (ret == NULL) | 81 | if (ret == NULL) |
82 | { | 82 | { |
83 | UIerr(UI_F_UI_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 83 | UIerr(UI_F_UI_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
@@ -99,19 +99,19 @@ static void free_string(UI_STRING *uis) | |||
99 | { | 99 | { |
100 | if (uis->flags & OUT_STRING_FREEABLE) | 100 | if (uis->flags & OUT_STRING_FREEABLE) |
101 | { | 101 | { |
102 | OPENSSL_free((char *)uis->out_string); | 102 | free((char *)uis->out_string); |
103 | switch(uis->type) | 103 | switch(uis->type) |
104 | { | 104 | { |
105 | case UIT_BOOLEAN: | 105 | case UIT_BOOLEAN: |
106 | OPENSSL_free((char *)uis->_.boolean_data.action_desc); | 106 | free((char *)uis->_.boolean_data.action_desc); |
107 | OPENSSL_free((char *)uis->_.boolean_data.ok_chars); | 107 | free((char *)uis->_.boolean_data.ok_chars); |
108 | OPENSSL_free((char *)uis->_.boolean_data.cancel_chars); | 108 | free((char *)uis->_.boolean_data.cancel_chars); |
109 | break; | 109 | break; |
110 | default: | 110 | default: |
111 | break; | 111 | break; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | OPENSSL_free(uis); | 114 | free(uis); |
115 | } | 115 | } |
116 | 116 | ||
117 | void UI_free(UI *ui) | 117 | void UI_free(UI *ui) |
@@ -120,7 +120,7 @@ void UI_free(UI *ui) | |||
120 | return; | 120 | return; |
121 | sk_UI_STRING_pop_free(ui->strings,free_string); | 121 | sk_UI_STRING_pop_free(ui->strings,free_string); |
122 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data); | 122 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data); |
123 | OPENSSL_free(ui); | 123 | free(ui); |
124 | } | 124 | } |
125 | 125 | ||
126 | static int allocate_string_stack(UI *ui) | 126 | static int allocate_string_stack(UI *ui) |
@@ -151,7 +151,7 @@ static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt, | |||
151 | { | 151 | { |
152 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); | 152 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); |
153 | } | 153 | } |
154 | else if ((ret = (UI_STRING *)OPENSSL_malloc(sizeof(UI_STRING)))) | 154 | else if ((ret = (UI_STRING *)malloc(sizeof(UI_STRING)))) |
155 | { | 155 | { |
156 | ret->out_string=prompt; | 156 | ret->out_string=prompt; |
157 | ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0; | 157 | ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0; |
@@ -354,10 +354,10 @@ int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, | |||
354 | ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags, | 354 | ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags, |
355 | result_buf); | 355 | result_buf); |
356 | err: | 356 | err: |
357 | if (prompt_copy) OPENSSL_free(prompt_copy); | 357 | if (prompt_copy) free(prompt_copy); |
358 | if (action_desc_copy) OPENSSL_free(action_desc_copy); | 358 | if (action_desc_copy) free(action_desc_copy); |
359 | if (ok_chars_copy) OPENSSL_free(ok_chars_copy); | 359 | if (ok_chars_copy) free(ok_chars_copy); |
360 | if (cancel_chars_copy) OPENSSL_free(cancel_chars_copy); | 360 | if (cancel_chars_copy) free(cancel_chars_copy); |
361 | return -1; | 361 | return -1; |
362 | } | 362 | } |
363 | 363 | ||
@@ -430,7 +430,7 @@ char *UI_construct_prompt(UI *ui, const char *object_desc, | |||
430 | len += sizeof(prompt2) - 1 + strlen(object_name); | 430 | len += sizeof(prompt2) - 1 + strlen(object_name); |
431 | len += sizeof(prompt3) - 1; | 431 | len += sizeof(prompt3) - 1; |
432 | 432 | ||
433 | prompt = (char *)OPENSSL_malloc(len + 1); | 433 | prompt = (char *)malloc(len + 1); |
434 | BUF_strlcpy(prompt, prompt1, len + 1); | 434 | BUF_strlcpy(prompt, prompt1, len + 1); |
435 | BUF_strlcat(prompt, object_desc, len + 1); | 435 | BUF_strlcat(prompt, object_desc, len + 1); |
436 | if (object_name) | 436 | if (object_name) |
@@ -618,7 +618,7 @@ const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth) | |||
618 | 618 | ||
619 | UI_METHOD *UI_create_method(char *name) | 619 | UI_METHOD *UI_create_method(char *name) |
620 | { | 620 | { |
621 | UI_METHOD *ui_method = (UI_METHOD *)OPENSSL_malloc(sizeof(UI_METHOD)); | 621 | UI_METHOD *ui_method = (UI_METHOD *)malloc(sizeof(UI_METHOD)); |
622 | 622 | ||
623 | if (ui_method) | 623 | if (ui_method) |
624 | { | 624 | { |
@@ -633,9 +633,9 @@ UI_METHOD *UI_create_method(char *name) | |||
633 | anything Murphy can throw at you and more! You have been warned. */ | 633 | anything Murphy can throw at you and more! You have been warned. */ |
634 | void UI_destroy_method(UI_METHOD *ui_method) | 634 | void UI_destroy_method(UI_METHOD *ui_method) |
635 | { | 635 | { |
636 | OPENSSL_free(ui_method->name); | 636 | free(ui_method->name); |
637 | ui_method->name = NULL; | 637 | ui_method->name = NULL; |
638 | OPENSSL_free(ui_method); | 638 | free(ui_method); |
639 | } | 639 | } |
640 | 640 | ||
641 | int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)) | 641 | int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)) |
diff --git a/src/lib/libssl/src/crypto/ui/ui_locl.h b/src/lib/libssl/src/crypto/ui/ui_locl.h index aa4a55637d..39789e2638 100644 --- a/src/lib/libssl/src/crypto/ui/ui_locl.h +++ b/src/lib/libssl/src/crypto/ui/ui_locl.h | |||
@@ -94,7 +94,7 @@ struct ui_method_st | |||
94 | and object_name is the name of the object (might be a card name or | 94 | and object_name is the name of the object (might be a card name or |
95 | a file name. | 95 | a file name. |
96 | The returned string shall always be allocated on the heap with | 96 | The returned string shall always be allocated on the heap with |
97 | OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). */ | 97 | malloc(), and need to be free'd with free(). */ |
98 | char *(*ui_construct_prompt)(UI *ui, const char *object_desc, | 98 | char *(*ui_construct_prompt)(UI *ui, const char *object_desc, |
99 | const char *object_name); | 99 | const char *object_name); |
100 | }; | 100 | }; |
diff --git a/src/lib/libssl/src/crypto/x509/by_dir.c b/src/lib/libssl/src/crypto/x509/by_dir.c index ccf2f6e0bf..3b72fd302f 100644 --- a/src/lib/libssl/src/crypto/x509/by_dir.c +++ b/src/lib/libssl/src/crypto/x509/by_dir.c | |||
@@ -153,10 +153,10 @@ new_dir(X509_LOOKUP *lu) | |||
153 | { | 153 | { |
154 | BY_DIR *a; | 154 | BY_DIR *a; |
155 | 155 | ||
156 | if ((a = (BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL) | 156 | if ((a = (BY_DIR *)malloc(sizeof(BY_DIR))) == NULL) |
157 | return (0); | 157 | return (0); |
158 | if ((a->buffer = BUF_MEM_new()) == NULL) { | 158 | if ((a->buffer = BUF_MEM_new()) == NULL) { |
159 | OPENSSL_free(a); | 159 | free(a); |
160 | return (0); | 160 | return (0); |
161 | } | 161 | } |
162 | a->dirs = NULL; | 162 | a->dirs = NULL; |
@@ -167,7 +167,7 @@ new_dir(X509_LOOKUP *lu) | |||
167 | static void | 167 | static void |
168 | by_dir_hash_free(BY_DIR_HASH *hash) | 168 | by_dir_hash_free(BY_DIR_HASH *hash) |
169 | { | 169 | { |
170 | OPENSSL_free(hash); | 170 | free(hash); |
171 | } | 171 | } |
172 | 172 | ||
173 | static int | 173 | static int |
@@ -185,10 +185,10 @@ static void | |||
185 | by_dir_entry_free(BY_DIR_ENTRY *ent) | 185 | by_dir_entry_free(BY_DIR_ENTRY *ent) |
186 | { | 186 | { |
187 | if (ent->dir) | 187 | if (ent->dir) |
188 | OPENSSL_free(ent->dir); | 188 | free(ent->dir); |
189 | if (ent->hashes) | 189 | if (ent->hashes) |
190 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); | 190 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); |
191 | OPENSSL_free(ent); | 191 | free(ent); |
192 | } | 192 | } |
193 | 193 | ||
194 | static void | 194 | static void |
@@ -201,7 +201,7 @@ free_dir(X509_LOOKUP *lu) | |||
201 | sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); | 201 | sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); |
202 | if (a->buffer != NULL) | 202 | if (a->buffer != NULL) |
203 | BUF_MEM_free(a->buffer); | 203 | BUF_MEM_free(a->buffer); |
204 | OPENSSL_free(a); | 204 | free(a); |
205 | } | 205 | } |
206 | 206 | ||
207 | static int | 207 | static int |
@@ -241,7 +241,7 @@ add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | ent = OPENSSL_malloc(sizeof(BY_DIR_ENTRY)); | 244 | ent = malloc(sizeof(BY_DIR_ENTRY)); |
245 | if (!ent) | 245 | if (!ent) |
246 | return 0; | 246 | return 0; |
247 | ent->dir_type = type; | 247 | ent->dir_type = type; |
@@ -411,12 +411,12 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
411 | ent->hashes, idx); | 411 | ent->hashes, idx); |
412 | } | 412 | } |
413 | if (!hent) { | 413 | if (!hent) { |
414 | hent = OPENSSL_malloc(sizeof(BY_DIR_HASH)); | 414 | hent = malloc(sizeof(BY_DIR_HASH)); |
415 | hent->hash = h; | 415 | hent->hash = h; |
416 | hent->suffix = k; | 416 | hent->suffix = k; |
417 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) { | 417 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) { |
418 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | 418 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); |
419 | OPENSSL_free(hent); | 419 | free(hent); |
420 | ok = 0; | 420 | ok = 0; |
421 | goto finish; | 421 | goto finish; |
422 | } | 422 | } |
diff --git a/src/lib/libssl/src/crypto/x509/x509_cmp.c b/src/lib/libssl/src/crypto/x509/x509_cmp.c index 352aa37434..2f1b8953e5 100644 --- a/src/lib/libssl/src/crypto/x509/x509_cmp.c +++ b/src/lib/libssl/src/crypto/x509/x509_cmp.c | |||
@@ -90,7 +90,7 @@ unsigned long X509_issuer_and_serial_hash(X509 *a) | |||
90 | goto err; | 90 | goto err; |
91 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) | 91 | if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) |
92 | goto err; | 92 | goto err; |
93 | OPENSSL_free(f); | 93 | free(f); |
94 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, | 94 | if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, |
95 | (unsigned long)a->cert_info->serialNumber->length)) | 95 | (unsigned long)a->cert_info->serialNumber->length)) |
96 | goto err; | 96 | goto err; |
diff --git a/src/lib/libssl/src/crypto/x509/x509_lu.c b/src/lib/libssl/src/crypto/x509/x509_lu.c index 38525a8cdd..644ea83bac 100644 --- a/src/lib/libssl/src/crypto/x509/x509_lu.c +++ b/src/lib/libssl/src/crypto/x509/x509_lu.c | |||
@@ -66,7 +66,7 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) | |||
66 | { | 66 | { |
67 | X509_LOOKUP *ret; | 67 | X509_LOOKUP *ret; |
68 | 68 | ||
69 | ret=(X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP)); | 69 | ret=(X509_LOOKUP *)malloc(sizeof(X509_LOOKUP)); |
70 | if (ret == NULL) return NULL; | 70 | if (ret == NULL) return NULL; |
71 | 71 | ||
72 | ret->init=0; | 72 | ret->init=0; |
@@ -76,7 +76,7 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) | |||
76 | ret->store_ctx=NULL; | 76 | ret->store_ctx=NULL; |
77 | if ((method->new_item != NULL) && !method->new_item(ret)) | 77 | if ((method->new_item != NULL) && !method->new_item(ret)) |
78 | { | 78 | { |
79 | OPENSSL_free(ret); | 79 | free(ret); |
80 | return NULL; | 80 | return NULL; |
81 | } | 81 | } |
82 | return ret; | 82 | return ret; |
@@ -88,7 +88,7 @@ void X509_LOOKUP_free(X509_LOOKUP *ctx) | |||
88 | if ( (ctx->method != NULL) && | 88 | if ( (ctx->method != NULL) && |
89 | (ctx->method->free != NULL)) | 89 | (ctx->method->free != NULL)) |
90 | (*ctx->method->free)(ctx); | 90 | (*ctx->method->free)(ctx); |
91 | OPENSSL_free(ctx); | 91 | free(ctx); |
92 | } | 92 | } |
93 | 93 | ||
94 | int X509_LOOKUP_init(X509_LOOKUP *ctx) | 94 | int X509_LOOKUP_init(X509_LOOKUP *ctx) |
@@ -179,7 +179,7 @@ X509_STORE *X509_STORE_new(void) | |||
179 | { | 179 | { |
180 | X509_STORE *ret; | 180 | X509_STORE *ret; |
181 | 181 | ||
182 | if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) | 182 | if ((ret=(X509_STORE *)malloc(sizeof(X509_STORE))) == NULL) |
183 | return NULL; | 183 | return NULL; |
184 | ret->objs = sk_X509_OBJECT_new(x509_object_cmp); | 184 | ret->objs = sk_X509_OBJECT_new(x509_object_cmp); |
185 | ret->cache=1; | 185 | ret->cache=1; |
@@ -203,7 +203,7 @@ X509_STORE *X509_STORE_new(void) | |||
203 | if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) | 203 | if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) |
204 | { | 204 | { |
205 | sk_X509_OBJECT_free(ret->objs); | 205 | sk_X509_OBJECT_free(ret->objs); |
206 | OPENSSL_free(ret); | 206 | free(ret); |
207 | return NULL; | 207 | return NULL; |
208 | } | 208 | } |
209 | 209 | ||
@@ -226,7 +226,7 @@ static void cleanup(X509_OBJECT *a) | |||
226 | /* abort(); */ | 226 | /* abort(); */ |
227 | } | 227 | } |
228 | 228 | ||
229 | OPENSSL_free(a); | 229 | free(a); |
230 | } | 230 | } |
231 | 231 | ||
232 | void X509_STORE_free(X509_STORE *vfy) | 232 | void X509_STORE_free(X509_STORE *vfy) |
@@ -251,7 +251,7 @@ void X509_STORE_free(X509_STORE *vfy) | |||
251 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data); | 251 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data); |
252 | if (vfy->param) | 252 | if (vfy->param) |
253 | X509_VERIFY_PARAM_free(vfy->param); | 253 | X509_VERIFY_PARAM_free(vfy->param); |
254 | OPENSSL_free(vfy); | 254 | free(vfy); |
255 | } | 255 | } |
256 | 256 | ||
257 | X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) | 257 | X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) |
@@ -337,7 +337,7 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) | |||
337 | int ret=1; | 337 | int ret=1; |
338 | 338 | ||
339 | if (x == NULL) return 0; | 339 | if (x == NULL) return 0; |
340 | obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT)); | 340 | obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT)); |
341 | if (obj == NULL) | 341 | if (obj == NULL) |
342 | { | 342 | { |
343 | X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE); | 343 | X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE); |
@@ -353,7 +353,7 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) | |||
353 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) | 353 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) |
354 | { | 354 | { |
355 | X509_OBJECT_free_contents(obj); | 355 | X509_OBJECT_free_contents(obj); |
356 | OPENSSL_free(obj); | 356 | free(obj); |
357 | X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE); | 357 | X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE); |
358 | ret=0; | 358 | ret=0; |
359 | } | 359 | } |
@@ -370,7 +370,7 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x) | |||
370 | int ret=1; | 370 | int ret=1; |
371 | 371 | ||
372 | if (x == NULL) return 0; | 372 | if (x == NULL) return 0; |
373 | obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT)); | 373 | obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT)); |
374 | if (obj == NULL) | 374 | if (obj == NULL) |
375 | { | 375 | { |
376 | X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE); | 376 | X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE); |
@@ -386,7 +386,7 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x) | |||
386 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) | 386 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) |
387 | { | 387 | { |
388 | X509_OBJECT_free_contents(obj); | 388 | X509_OBJECT_free_contents(obj); |
389 | OPENSSL_free(obj); | 389 | free(obj); |
390 | X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE); | 390 | X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE); |
391 | ret=0; | 391 | ret=0; |
392 | } | 392 | } |
diff --git a/src/lib/libssl/src/crypto/x509/x509_obj.c b/src/lib/libssl/src/crypto/x509/x509_obj.c index 1d3cf547d7..5f38315f22 100644 --- a/src/lib/libssl/src/crypto/x509/x509_obj.c +++ b/src/lib/libssl/src/crypto/x509/x509_obj.c | |||
@@ -88,7 +88,7 @@ int i; | |||
88 | if(b) | 88 | if(b) |
89 | { | 89 | { |
90 | buf=b->data; | 90 | buf=b->data; |
91 | OPENSSL_free(b); | 91 | free(b); |
92 | } | 92 | } |
93 | strlcpy(buf,"NO X509_NAME",len); | 93 | strlcpy(buf,"NO X509_NAME",len); |
94 | return buf; | 94 | return buf; |
@@ -170,7 +170,7 @@ int i; | |||
170 | if (b != NULL) | 170 | if (b != NULL) |
171 | { | 171 | { |
172 | p=b->data; | 172 | p=b->data; |
173 | OPENSSL_free(b); | 173 | free(b); |
174 | } | 174 | } |
175 | else | 175 | else |
176 | p=buf; | 176 | p=buf; |
diff --git a/src/lib/libssl/src/crypto/x509/x509_req.c b/src/lib/libssl/src/crypto/x509/x509_req.c index 48183dc00c..1c5cee8030 100644 --- a/src/lib/libssl/src/crypto/x509/x509_req.c +++ b/src/lib/libssl/src/crypto/x509/x509_req.c | |||
@@ -84,7 +84,7 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) | |||
84 | ri=ret->req_info; | 84 | ri=ret->req_info; |
85 | 85 | ||
86 | ri->version->length=1; | 86 | ri->version->length=1; |
87 | ri->version->data=(unsigned char *)OPENSSL_malloc(1); | 87 | ri->version->data=(unsigned char *)malloc(1); |
88 | if (ri->version->data == NULL) goto err; | 88 | if (ri->version->data == NULL) goto err; |
89 | ri->version->data[0]=0; /* version == 0 */ | 89 | ri->version->data[0]=0; /* version == 0 */ |
90 | 90 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x509_trs.c b/src/lib/libssl/src/crypto/x509/x509_trs.c index a6cb9c8b1b..7bb5094e64 100644 --- a/src/lib/libssl/src/crypto/x509/x509_trs.c +++ b/src/lib/libssl/src/crypto/x509/x509_trs.c | |||
@@ -169,15 +169,15 @@ int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), | |||
169 | idx = X509_TRUST_get_by_id(id); | 169 | idx = X509_TRUST_get_by_id(id); |
170 | /* Need a new entry */ | 170 | /* Need a new entry */ |
171 | if(idx == -1) { | 171 | if(idx == -1) { |
172 | if(!(trtmp = OPENSSL_malloc(sizeof(X509_TRUST)))) { | 172 | if(!(trtmp = malloc(sizeof(X509_TRUST)))) { |
173 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); | 173 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | trtmp->flags = X509_TRUST_DYNAMIC; | 176 | trtmp->flags = X509_TRUST_DYNAMIC; |
177 | } else trtmp = X509_TRUST_get0(idx); | 177 | } else trtmp = X509_TRUST_get0(idx); |
178 | 178 | ||
179 | /* OPENSSL_free existing name if dynamic */ | 179 | /* free existing name if dynamic */ |
180 | if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name); | 180 | if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) free(trtmp->name); |
181 | /* dup supplied name */ | 181 | /* dup supplied name */ |
182 | if(!(trtmp->name = BUF_strdup(name))) { | 182 | if(!(trtmp->name = BUF_strdup(name))) { |
183 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); | 183 | X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); |
@@ -213,8 +213,8 @@ static void trtable_free(X509_TRUST *p) | |||
213 | if (p->flags & X509_TRUST_DYNAMIC) | 213 | if (p->flags & X509_TRUST_DYNAMIC) |
214 | { | 214 | { |
215 | if (p->flags & X509_TRUST_DYNAMIC_NAME) | 215 | if (p->flags & X509_TRUST_DYNAMIC_NAME) |
216 | OPENSSL_free(p->name); | 216 | free(p->name); |
217 | OPENSSL_free(p); | 217 | free(p); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
diff --git a/src/lib/libssl/src/crypto/x509/x509_vfy.c b/src/lib/libssl/src/crypto/x509/x509_vfy.c index a82c2872e0..077bfd8f2d 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vfy.c +++ b/src/lib/libssl/src/crypto/x509/x509_vfy.c | |||
@@ -1986,7 +1986,7 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, | |||
1986 | X509_STORE_CTX *X509_STORE_CTX_new(void) | 1986 | X509_STORE_CTX *X509_STORE_CTX_new(void) |
1987 | { | 1987 | { |
1988 | X509_STORE_CTX *ctx; | 1988 | X509_STORE_CTX *ctx; |
1989 | ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX)); | 1989 | ctx = (X509_STORE_CTX *)malloc(sizeof(X509_STORE_CTX)); |
1990 | if (!ctx) | 1990 | if (!ctx) |
1991 | { | 1991 | { |
1992 | X509err(X509_F_X509_STORE_CTX_NEW,ERR_R_MALLOC_FAILURE); | 1992 | X509err(X509_F_X509_STORE_CTX_NEW,ERR_R_MALLOC_FAILURE); |
@@ -1999,7 +1999,7 @@ X509_STORE_CTX *X509_STORE_CTX_new(void) | |||
1999 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx) | 1999 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx) |
2000 | { | 2000 | { |
2001 | X509_STORE_CTX_cleanup(ctx); | 2001 | X509_STORE_CTX_cleanup(ctx); |
2002 | OPENSSL_free(ctx); | 2002 | free(ctx); |
2003 | } | 2003 | } |
2004 | 2004 | ||
2005 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | 2005 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, |
@@ -2122,7 +2122,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
2122 | if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, | 2122 | if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, |
2123 | &(ctx->ex_data))) | 2123 | &(ctx->ex_data))) |
2124 | { | 2124 | { |
2125 | OPENSSL_free(ctx); | 2125 | free(ctx); |
2126 | X509err(X509_F_X509_STORE_CTX_INIT,ERR_R_MALLOC_FAILURE); | 2126 | X509err(X509_F_X509_STORE_CTX_INIT,ERR_R_MALLOC_FAILURE); |
2127 | return 0; | 2127 | return 0; |
2128 | } | 2128 | } |
diff --git a/src/lib/libssl/src/crypto/x509/x509_vpm.c b/src/lib/libssl/src/crypto/x509/x509_vpm.c index dfd89d89fa..5e3eba4029 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vpm.c +++ b/src/lib/libssl/src/crypto/x509/x509_vpm.c | |||
@@ -88,7 +88,7 @@ static void x509_verify_param_zero(X509_VERIFY_PARAM *param) | |||
88 | X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) | 88 | X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) |
89 | { | 89 | { |
90 | X509_VERIFY_PARAM *param; | 90 | X509_VERIFY_PARAM *param; |
91 | param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM)); | 91 | param = malloc(sizeof(X509_VERIFY_PARAM)); |
92 | memset(param, 0, sizeof(X509_VERIFY_PARAM)); | 92 | memset(param, 0, sizeof(X509_VERIFY_PARAM)); |
93 | x509_verify_param_zero(param); | 93 | x509_verify_param_zero(param); |
94 | return param; | 94 | return param; |
@@ -97,7 +97,7 @@ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) | |||
97 | void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) | 97 | void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) |
98 | { | 98 | { |
99 | x509_verify_param_zero(param); | 99 | x509_verify_param_zero(param); |
100 | OPENSSL_free(param); | 100 | free(param); |
101 | } | 101 | } |
102 | 102 | ||
103 | /* This function determines how parameters are "inherited" from one structure | 103 | /* This function determines how parameters are "inherited" from one structure |
@@ -210,7 +210,7 @@ int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, | |||
210 | int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) | 210 | int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) |
211 | { | 211 | { |
212 | if (param->name) | 212 | if (param->name) |
213 | OPENSSL_free(param->name); | 213 | free(param->name); |
214 | param->name = BUF_strdup(name); | 214 | param->name = BUF_strdup(name); |
215 | if (param->name) | 215 | if (param->name) |
216 | return 1; | 216 | return 1; |
diff --git a/src/lib/libssl/src/crypto/x509/x509spki.c b/src/lib/libssl/src/crypto/x509/x509spki.c index 02a203d72c..28bc12e1a2 100644 --- a/src/lib/libssl/src/crypto/x509/x509spki.c +++ b/src/lib/libssl/src/crypto/x509/x509spki.c | |||
@@ -82,7 +82,7 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len) | |||
82 | int spki_len; | 82 | int spki_len; |
83 | NETSCAPE_SPKI *spki; | 83 | NETSCAPE_SPKI *spki; |
84 | if(len <= 0) len = strlen(str); | 84 | if(len <= 0) len = strlen(str); |
85 | if (!(spki_der = OPENSSL_malloc(len + 1))) { | 85 | if (!(spki_der = malloc(len + 1))) { |
86 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE); | 86 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE); |
87 | return NULL; | 87 | return NULL; |
88 | } | 88 | } |
@@ -90,12 +90,12 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len) | |||
90 | if(spki_len < 0) { | 90 | if(spki_len < 0) { |
91 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, | 91 | X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, |
92 | X509_R_BASE64_DECODE_ERROR); | 92 | X509_R_BASE64_DECODE_ERROR); |
93 | OPENSSL_free(spki_der); | 93 | free(spki_der); |
94 | return NULL; | 94 | return NULL; |
95 | } | 95 | } |
96 | p = spki_der; | 96 | p = spki_der; |
97 | spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len); | 97 | spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len); |
98 | OPENSSL_free(spki_der); | 98 | free(spki_der); |
99 | return spki; | 99 | return spki; |
100 | } | 100 | } |
101 | 101 | ||
@@ -107,8 +107,8 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) | |||
107 | char *b64_str; | 107 | char *b64_str; |
108 | int der_len; | 108 | int der_len; |
109 | der_len = i2d_NETSCAPE_SPKI(spki, NULL); | 109 | der_len = i2d_NETSCAPE_SPKI(spki, NULL); |
110 | der_spki = OPENSSL_malloc(der_len); | 110 | der_spki = malloc(der_len); |
111 | b64_str = OPENSSL_malloc(der_len * 2); | 111 | b64_str = malloc(der_len * 2); |
112 | if(!der_spki || !b64_str) { | 112 | if(!der_spki || !b64_str) { |
113 | X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); | 113 | X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); |
114 | return NULL; | 114 | return NULL; |
@@ -116,6 +116,6 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) | |||
116 | p = der_spki; | 116 | p = der_spki; |
117 | i2d_NETSCAPE_SPKI(spki, &p); | 117 | i2d_NETSCAPE_SPKI(spki, &p); |
118 | EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len); | 118 | EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len); |
119 | OPENSSL_free(der_spki); | 119 | free(der_spki); |
120 | return b64_str; | 120 | return b64_str; |
121 | } | 121 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/pcy_cache.c b/src/lib/libssl/src/crypto/x509v3/pcy_cache.c index 172b7e7ee4..24c79b4a80 100644 --- a/src/lib/libssl/src/crypto/x509v3/pcy_cache.c +++ b/src/lib/libssl/src/crypto/x509v3/pcy_cache.c | |||
@@ -134,7 +134,7 @@ static int policy_cache_new(X509 *x) | |||
134 | CERTIFICATEPOLICIES *ext_cpols = NULL; | 134 | CERTIFICATEPOLICIES *ext_cpols = NULL; |
135 | POLICY_MAPPINGS *ext_pmaps = NULL; | 135 | POLICY_MAPPINGS *ext_pmaps = NULL; |
136 | int i; | 136 | int i; |
137 | cache = OPENSSL_malloc(sizeof(X509_POLICY_CACHE)); | 137 | cache = malloc(sizeof(X509_POLICY_CACHE)); |
138 | if (!cache) | 138 | if (!cache) |
139 | return 0; | 139 | return 0; |
140 | cache->anyPolicy = NULL; | 140 | cache->anyPolicy = NULL; |
@@ -240,7 +240,7 @@ void policy_cache_free(X509_POLICY_CACHE *cache) | |||
240 | policy_data_free(cache->anyPolicy); | 240 | policy_data_free(cache->anyPolicy); |
241 | if (cache->data) | 241 | if (cache->data) |
242 | sk_X509_POLICY_DATA_pop_free(cache->data, policy_data_free); | 242 | sk_X509_POLICY_DATA_pop_free(cache->data, policy_data_free); |
243 | OPENSSL_free(cache); | 243 | free(cache); |
244 | } | 244 | } |
245 | 245 | ||
246 | const X509_POLICY_CACHE *policy_cache_set(X509 *x) | 246 | const X509_POLICY_CACHE *policy_cache_set(X509 *x) |
diff --git a/src/lib/libssl/src/crypto/x509v3/pcy_data.c b/src/lib/libssl/src/crypto/x509v3/pcy_data.c index 3444b03195..7c80915f5b 100644 --- a/src/lib/libssl/src/crypto/x509v3/pcy_data.c +++ b/src/lib/libssl/src/crypto/x509v3/pcy_data.c | |||
@@ -72,7 +72,7 @@ void policy_data_free(X509_POLICY_DATA *data) | |||
72 | sk_POLICYQUALINFO_pop_free(data->qualifier_set, | 72 | sk_POLICYQUALINFO_pop_free(data->qualifier_set, |
73 | POLICYQUALINFO_free); | 73 | POLICYQUALINFO_free); |
74 | sk_ASN1_OBJECT_pop_free(data->expected_policy_set, ASN1_OBJECT_free); | 74 | sk_ASN1_OBJECT_pop_free(data->expected_policy_set, ASN1_OBJECT_free); |
75 | OPENSSL_free(data); | 75 | free(data); |
76 | } | 76 | } |
77 | 77 | ||
78 | /* Create a data based on an existing policy. If 'id' is NULL use the | 78 | /* Create a data based on an existing policy. If 'id' is NULL use the |
@@ -97,13 +97,13 @@ X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, | |||
97 | } | 97 | } |
98 | else | 98 | else |
99 | id = NULL; | 99 | id = NULL; |
100 | ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA)); | 100 | ret = malloc(sizeof(X509_POLICY_DATA)); |
101 | if (!ret) | 101 | if (!ret) |
102 | return NULL; | 102 | return NULL; |
103 | ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); | 103 | ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); |
104 | if (!ret->expected_policy_set) | 104 | if (!ret->expected_policy_set) |
105 | { | 105 | { |
106 | OPENSSL_free(ret); | 106 | free(ret); |
107 | if (id) | 107 | if (id) |
108 | ASN1_OBJECT_free(id); | 108 | ASN1_OBJECT_free(id); |
109 | return NULL; | 109 | return NULL; |
diff --git a/src/lib/libssl/src/crypto/x509v3/pcy_node.c b/src/lib/libssl/src/crypto/x509v3/pcy_node.c index bd1e7f1ae8..8c2124a7f6 100644 --- a/src/lib/libssl/src/crypto/x509v3/pcy_node.c +++ b/src/lib/libssl/src/crypto/x509v3/pcy_node.c | |||
@@ -115,7 +115,7 @@ X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level, | |||
115 | X509_POLICY_TREE *tree) | 115 | X509_POLICY_TREE *tree) |
116 | { | 116 | { |
117 | X509_POLICY_NODE *node; | 117 | X509_POLICY_NODE *node; |
118 | node = OPENSSL_malloc(sizeof(X509_POLICY_NODE)); | 118 | node = malloc(sizeof(X509_POLICY_NODE)); |
119 | if (!node) | 119 | if (!node) |
120 | return NULL; | 120 | return NULL; |
121 | node->data = data; | 121 | node->data = data; |
@@ -164,7 +164,7 @@ X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level, | |||
164 | 164 | ||
165 | void policy_node_free(X509_POLICY_NODE *node) | 165 | void policy_node_free(X509_POLICY_NODE *node) |
166 | { | 166 | { |
167 | OPENSSL_free(node); | 167 | free(node); |
168 | } | 168 | } |
169 | 169 | ||
170 | /* See if a policy node matches a policy OID. If mapping enabled look through | 170 | /* See if a policy node matches a policy OID. If mapping enabled look through |
diff --git a/src/lib/libssl/src/crypto/x509v3/pcy_tree.c b/src/lib/libssl/src/crypto/x509v3/pcy_tree.c index bb9777348f..c4239b1fd9 100644 --- a/src/lib/libssl/src/crypto/x509v3/pcy_tree.c +++ b/src/lib/libssl/src/crypto/x509v3/pcy_tree.c | |||
@@ -219,13 +219,13 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
219 | 219 | ||
220 | /* If we get this far initialize the tree */ | 220 | /* If we get this far initialize the tree */ |
221 | 221 | ||
222 | tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE)); | 222 | tree = malloc(sizeof(X509_POLICY_TREE)); |
223 | 223 | ||
224 | if (!tree) | 224 | if (!tree) |
225 | return 0; | 225 | return 0; |
226 | 226 | ||
227 | tree->flags = 0; | 227 | tree->flags = 0; |
228 | tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n); | 228 | tree->levels = malloc(sizeof(X509_POLICY_LEVEL) * n); |
229 | tree->nlevel = 0; | 229 | tree->nlevel = 0; |
230 | tree->extra_data = NULL; | 230 | tree->extra_data = NULL; |
231 | tree->auth_policies = NULL; | 231 | tree->auth_policies = NULL; |
@@ -233,7 +233,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
233 | 233 | ||
234 | if (!tree->levels) | 234 | if (!tree->levels) |
235 | { | 235 | { |
236 | OPENSSL_free(tree); | 236 | free(tree); |
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | 239 | ||
@@ -516,7 +516,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | |||
516 | if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) | 516 | if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) |
517 | { | 517 | { |
518 | node->parent->nchild--; | 518 | node->parent->nchild--; |
519 | OPENSSL_free(node); | 519 | free(node); |
520 | (void)sk_X509_POLICY_NODE_delete(nodes,i); | 520 | (void)sk_X509_POLICY_NODE_delete(nodes,i); |
521 | } | 521 | } |
522 | } | 522 | } |
@@ -531,7 +531,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | |||
531 | if (node->nchild == 0) | 531 | if (node->nchild == 0) |
532 | { | 532 | { |
533 | node->parent->nchild--; | 533 | node->parent->nchild--; |
534 | OPENSSL_free(node); | 534 | free(node); |
535 | (void)sk_X509_POLICY_NODE_delete(nodes, i); | 535 | (void)sk_X509_POLICY_NODE_delete(nodes, i); |
536 | } | 536 | } |
537 | } | 537 | } |
@@ -539,7 +539,7 @@ static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | |||
539 | { | 539 | { |
540 | if (curr->anyPolicy->parent) | 540 | if (curr->anyPolicy->parent) |
541 | curr->anyPolicy->parent->nchild--; | 541 | curr->anyPolicy->parent->nchild--; |
542 | OPENSSL_free(curr->anyPolicy); | 542 | free(curr->anyPolicy); |
543 | curr->anyPolicy = NULL; | 543 | curr->anyPolicy = NULL; |
544 | } | 544 | } |
545 | if (curr == tree->levels) | 545 | if (curr == tree->levels) |
@@ -721,7 +721,7 @@ static int tree_evaluate(X509_POLICY_TREE *tree) | |||
721 | static void exnode_free(X509_POLICY_NODE *node) | 721 | static void exnode_free(X509_POLICY_NODE *node) |
722 | { | 722 | { |
723 | if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE)) | 723 | if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE)) |
724 | OPENSSL_free(node); | 724 | free(node); |
725 | } | 725 | } |
726 | 726 | ||
727 | 727 | ||
@@ -751,8 +751,8 @@ void X509_policy_tree_free(X509_POLICY_TREE *tree) | |||
751 | sk_X509_POLICY_DATA_pop_free(tree->extra_data, | 751 | sk_X509_POLICY_DATA_pop_free(tree->extra_data, |
752 | policy_data_free); | 752 | policy_data_free); |
753 | 753 | ||
754 | OPENSSL_free(tree->levels); | 754 | free(tree->levels); |
755 | OPENSSL_free(tree); | 755 | free(tree); |
756 | 756 | ||
757 | } | 757 | } |
758 | 758 | ||
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_addr.c b/src/lib/libssl/src/crypto/x509v3/v3_addr.c index df46a4983b..179f08d222 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_addr.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_addr.c | |||
@@ -1013,7 +1013,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
1013 | X509V3_conf_err(val); | 1013 | X509V3_conf_err(val); |
1014 | goto err; | 1014 | goto err; |
1015 | } | 1015 | } |
1016 | OPENSSL_free(s); | 1016 | free(s); |
1017 | s = NULL; | 1017 | s = NULL; |
1018 | continue; | 1018 | continue; |
1019 | } | 1019 | } |
@@ -1077,7 +1077,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
1077 | goto err; | 1077 | goto err; |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | OPENSSL_free(s); | 1080 | free(s); |
1081 | s = NULL; | 1081 | s = NULL; |
1082 | } | 1082 | } |
1083 | 1083 | ||
@@ -1089,7 +1089,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
1089 | return addr; | 1089 | return addr; |
1090 | 1090 | ||
1091 | err: | 1091 | err: |
1092 | OPENSSL_free(s); | 1092 | free(s); |
1093 | sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); | 1093 | sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); |
1094 | return NULL; | 1094 | return NULL; |
1095 | } | 1095 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_akey.c b/src/lib/libssl/src/crypto/x509v3/v3_akey.c index c6b68ee221..04e1fb9544 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_akey.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_akey.c | |||
@@ -87,7 +87,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, | |||
87 | if(akeyid->keyid) { | 87 | if(akeyid->keyid) { |
88 | tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length); | 88 | tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length); |
89 | X509V3_add_value("keyid", tmp, &extlist); | 89 | X509V3_add_value("keyid", tmp, &extlist); |
90 | OPENSSL_free(tmp); | 90 | free(tmp); |
91 | } | 91 | } |
92 | if(akeyid->issuer) | 92 | if(akeyid->issuer) |
93 | extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); | 93 | extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); |
@@ -95,7 +95,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, | |||
95 | tmp = hex_to_string(akeyid->serial->data, | 95 | tmp = hex_to_string(akeyid->serial->data, |
96 | akeyid->serial->length); | 96 | akeyid->serial->length); |
97 | X509V3_add_value("serial", tmp, &extlist); | 97 | X509V3_add_value("serial", tmp, &extlist); |
98 | OPENSSL_free(tmp); | 98 | free(tmp); |
99 | } | 99 | } |
100 | return extlist; | 100 | return extlist; |
101 | } | 101 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_alt.c b/src/lib/libssl/src/crypto/x509v3/v3_alt.c index 8de5dd041b..636677df94 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_alt.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_alt.c | |||
@@ -578,11 +578,11 @@ static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx) | |||
578 | if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx))) | 578 | if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx))) |
579 | return 0; | 579 | return 0; |
580 | objlen = p - value; | 580 | objlen = p - value; |
581 | objtmp = OPENSSL_malloc(objlen + 1); | 581 | objtmp = malloc(objlen + 1); |
582 | if (objtmp) { | 582 | if (objtmp) { |
583 | strlcpy(objtmp, value, objlen + 1); | 583 | strlcpy(objtmp, value, objlen + 1); |
584 | gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0); | 584 | gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0); |
585 | OPENSSL_free(objtmp); | 585 | free(objtmp); |
586 | } else | 586 | } else |
587 | gen->d.otherName->type_id = NULL; | 587 | gen->d.otherName->type_id = NULL; |
588 | if (!gen->d.otherName->type_id) | 588 | if (!gen->d.otherName->type_id) |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_asid.c b/src/lib/libssl/src/crypto/x509v3/v3_asid.c index 1587e8ed72..325c8e0406 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_asid.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_asid.c | |||
@@ -125,17 +125,17 @@ static int i2r_ASIdentifierChoice(BIO *out, | |||
125 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL) | 125 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL) |
126 | return 0; | 126 | return 0; |
127 | BIO_printf(out, "%*s%s\n", indent + 2, "", s); | 127 | BIO_printf(out, "%*s%s\n", indent + 2, "", s); |
128 | OPENSSL_free(s); | 128 | free(s); |
129 | break; | 129 | break; |
130 | case ASIdOrRange_range: | 130 | case ASIdOrRange_range: |
131 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL) | 131 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL) |
132 | return 0; | 132 | return 0; |
133 | BIO_printf(out, "%*s%s-", indent + 2, "", s); | 133 | BIO_printf(out, "%*s%s-", indent + 2, "", s); |
134 | OPENSSL_free(s); | 134 | free(s); |
135 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL) | 135 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL) |
136 | return 0; | 136 | return 0; |
137 | BIO_printf(out, "%s\n", s); | 137 | BIO_printf(out, "%s\n", s); |
138 | OPENSSL_free(s); | 138 | free(s); |
139 | break; | 139 | break; |
140 | default: | 140 | default: |
141 | return 0; | 141 | return 0; |
@@ -471,7 +471,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
471 | ASRange *r; | 471 | ASRange *r; |
472 | switch (a->type) { | 472 | switch (a->type) { |
473 | case ASIdOrRange_id: | 473 | case ASIdOrRange_id: |
474 | if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) { | 474 | if ((r = malloc(sizeof(ASRange))) == NULL) { |
475 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | 475 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, |
476 | ERR_R_MALLOC_FAILURE); | 476 | ERR_R_MALLOC_FAILURE); |
477 | goto done; | 477 | goto done; |
@@ -620,7 +620,7 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | |||
620 | s[i1] = '\0'; | 620 | s[i1] = '\0'; |
621 | min = s2i_ASN1_INTEGER(NULL, s); | 621 | min = s2i_ASN1_INTEGER(NULL, s); |
622 | max = s2i_ASN1_INTEGER(NULL, s + i2); | 622 | max = s2i_ASN1_INTEGER(NULL, s + i2); |
623 | OPENSSL_free(s); | 623 | free(s); |
624 | if (min == NULL || max == NULL) { | 624 | if (min == NULL || max == NULL) { |
625 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | 625 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); |
626 | goto err; | 626 | goto err; |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_conf.c b/src/lib/libssl/src/crypto/x509v3/v3_conf.c index 6730f9a6ee..519aefc93c 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_conf.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_conf.c | |||
@@ -190,7 +190,7 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, | |||
190 | { | 190 | { |
191 | unsigned char *p; | 191 | unsigned char *p; |
192 | ext_len = method->i2d(ext_struc, NULL); | 192 | ext_len = method->i2d(ext_struc, NULL); |
193 | if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr; | 193 | if(!(ext_der = malloc(ext_len))) goto merr; |
194 | p = ext_der; | 194 | p = ext_der; |
195 | method->i2d(ext_struc, &p); | 195 | method->i2d(ext_struc, &p); |
196 | } | 196 | } |
@@ -300,7 +300,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, | |||
300 | err: | 300 | err: |
301 | ASN1_OBJECT_free(obj); | 301 | ASN1_OBJECT_free(obj); |
302 | M_ASN1_OCTET_STRING_free(oct); | 302 | M_ASN1_OCTET_STRING_free(oct); |
303 | if(ext_der) OPENSSL_free(ext_der); | 303 | if(ext_der) free(ext_der); |
304 | return extension; | 304 | return extension; |
305 | 305 | ||
306 | } | 306 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_cpols.c b/src/lib/libssl/src/crypto/x509v3/v3_cpols.c index 1f0798b946..1a337fa07e 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_cpols.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_cpols.c | |||
@@ -426,7 +426,7 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent) | |||
426 | if(i) BIO_puts(out, ", "); | 426 | if(i) BIO_puts(out, ", "); |
427 | tmp = i2s_ASN1_INTEGER(NULL, num); | 427 | tmp = i2s_ASN1_INTEGER(NULL, num); |
428 | BIO_puts(out, tmp); | 428 | BIO_puts(out, tmp); |
429 | OPENSSL_free(tmp); | 429 | free(tmp); |
430 | } | 430 | } |
431 | BIO_puts(out, "\n"); | 431 | BIO_puts(out, "\n"); |
432 | } | 432 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_ia5.c b/src/lib/libssl/src/crypto/x509v3/v3_ia5.c index ab1c5188b8..98789b36e9 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_ia5.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_ia5.c | |||
@@ -82,7 +82,7 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | |||
82 | { | 82 | { |
83 | char *tmp; | 83 | char *tmp; |
84 | if(!ia5 || !ia5->length) return NULL; | 84 | if(!ia5 || !ia5->length) return NULL; |
85 | if(!(tmp = OPENSSL_malloc(ia5->length + 1))) { | 85 | if(!(tmp = malloc(ia5->length + 1))) { |
86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | 86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); |
87 | return NULL; | 87 | return NULL; |
88 | } | 88 | } |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_info.c b/src/lib/libssl/src/crypto/x509v3/v3_info.c index 44bc3e1105..2b290ca00c 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_info.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_info.c | |||
@@ -115,7 +115,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method | |||
115 | vtmp = sk_CONF_VALUE_value(ret, i); | 115 | vtmp = sk_CONF_VALUE_value(ret, i); |
116 | i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method); | 116 | i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method); |
117 | nlen = strlen(objtmp) + strlen(vtmp->name) + 5; | 117 | nlen = strlen(objtmp) + strlen(vtmp->name) + 5; |
118 | ntmp = OPENSSL_malloc(nlen); | 118 | ntmp = malloc(nlen); |
119 | if(!ntmp) { | 119 | if(!ntmp) { |
120 | X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, | 120 | X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, |
121 | ERR_R_MALLOC_FAILURE); | 121 | ERR_R_MALLOC_FAILURE); |
@@ -124,7 +124,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method | |||
124 | BUF_strlcpy(ntmp, objtmp, nlen); | 124 | BUF_strlcpy(ntmp, objtmp, nlen); |
125 | BUF_strlcat(ntmp, " - ", nlen); | 125 | BUF_strlcat(ntmp, " - ", nlen); |
126 | BUF_strlcat(ntmp, vtmp->name, nlen); | 126 | BUF_strlcat(ntmp, vtmp->name, nlen); |
127 | OPENSSL_free(vtmp->name); | 127 | free(vtmp->name); |
128 | vtmp->name = ntmp; | 128 | vtmp->name = ntmp; |
129 | 129 | ||
130 | } | 130 | } |
@@ -161,7 +161,7 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *metho | |||
161 | ctmp.value = cnf->value; | 161 | ctmp.value = cnf->value; |
162 | if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0)) | 162 | if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0)) |
163 | goto err; | 163 | goto err; |
164 | if(!(objtmp = OPENSSL_malloc(objlen + 1))) { | 164 | if(!(objtmp = malloc(objlen + 1))) { |
165 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE); | 165 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE); |
166 | goto err; | 166 | goto err; |
167 | } | 167 | } |
@@ -170,10 +170,10 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *metho | |||
170 | if(!acc->method) { | 170 | if(!acc->method) { |
171 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT); | 171 | X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT); |
172 | ERR_add_error_data(2, "value=", objtmp); | 172 | ERR_add_error_data(2, "value=", objtmp); |
173 | OPENSSL_free(objtmp); | 173 | free(objtmp); |
174 | goto err; | 174 | goto err; |
175 | } | 175 | } |
176 | OPENSSL_free(objtmp); | 176 | free(objtmp); |
177 | 177 | ||
178 | } | 178 | } |
179 | return ainfo; | 179 | return ainfo; |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_lib.c b/src/lib/libssl/src/crypto/x509v3/v3_lib.c index 0f1e1d4422..0613ea7f22 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_lib.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_lib.c | |||
@@ -133,7 +133,7 @@ int X509V3_EXT_add_alias(int nid_to, int nid_from) | |||
133 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND); | 133 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND); |
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | if(!(tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) { | 136 | if(!(tmpext = (X509V3_EXT_METHOD *)malloc(sizeof(X509V3_EXT_METHOD)))) { |
137 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE); | 137 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE); |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
@@ -151,7 +151,7 @@ void X509V3_EXT_cleanup(void) | |||
151 | 151 | ||
152 | static void ext_list_free(X509V3_EXT_METHOD *ext) | 152 | static void ext_list_free(X509V3_EXT_METHOD *ext) |
153 | { | 153 | { |
154 | if(ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext); | 154 | if(ext->ext_flags & X509V3_EXT_DYNAMIC) free(ext); |
155 | } | 155 | } |
156 | 156 | ||
157 | /* Legacy function: we don't need to add standard extensions | 157 | /* Legacy function: we don't need to add standard extensions |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_pci.c b/src/lib/libssl/src/crypto/x509v3/v3_pci.c index 0dcfa004fe..9cef94258c 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_pci.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_pci.c | |||
@@ -135,7 +135,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
135 | goto err; | 135 | goto err; |
136 | } | 136 | } |
137 | 137 | ||
138 | tmp_data = OPENSSL_realloc((*policy)->data, | 138 | tmp_data = realloc((*policy)->data, |
139 | (*policy)->length + val_len + 1); | 139 | (*policy)->length + val_len + 1); |
140 | if (tmp_data) | 140 | if (tmp_data) |
141 | { | 141 | { |
@@ -147,7 +147,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
147 | } | 147 | } |
148 | else | 148 | else |
149 | { | 149 | { |
150 | OPENSSL_free(tmp_data2); | 150 | free(tmp_data2); |
151 | /* realloc failure implies the original data space is b0rked too! */ | 151 | /* realloc failure implies the original data space is b0rked too! */ |
152 | (*policy)->data = NULL; | 152 | (*policy)->data = NULL; |
153 | (*policy)->length = 0; | 153 | (*policy)->length = 0; |
@@ -155,7 +155,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
155 | X509V3_conf_err(val); | 155 | X509V3_conf_err(val); |
156 | goto err; | 156 | goto err; |
157 | } | 157 | } |
158 | OPENSSL_free(tmp_data2); | 158 | free(tmp_data2); |
159 | } | 159 | } |
160 | else if (strncmp(val->value, "file:", 5) == 0) | 160 | else if (strncmp(val->value, "file:", 5) == 0) |
161 | { | 161 | { |
@@ -173,7 +173,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
173 | { | 173 | { |
174 | if (!n) continue; | 174 | if (!n) continue; |
175 | 175 | ||
176 | tmp_data = OPENSSL_realloc((*policy)->data, | 176 | tmp_data = realloc((*policy)->data, |
177 | (*policy)->length + n + 1); | 177 | (*policy)->length + n + 1); |
178 | 178 | ||
179 | if (!tmp_data) | 179 | if (!tmp_data) |
@@ -197,7 +197,7 @@ static int process_pci_value(CONF_VALUE *val, | |||
197 | else if (strncmp(val->value, "text:", 5) == 0) | 197 | else if (strncmp(val->value, "text:", 5) == 0) |
198 | { | 198 | { |
199 | val_len = strlen(val->value + 5); | 199 | val_len = strlen(val->value + 5); |
200 | tmp_data = OPENSSL_realloc((*policy)->data, | 200 | tmp_data = realloc((*policy)->data, |
201 | (*policy)->length + val_len + 1); | 201 | (*policy)->length + val_len + 1); |
202 | if (tmp_data) | 202 | if (tmp_data) |
203 | { | 203 | { |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_prn.c b/src/lib/libssl/src/crypto/x509v3/v3_prn.c index 2124b447b4..565937af47 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_prn.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_prn.c | |||
@@ -126,7 +126,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde | |||
126 | 126 | ||
127 | err: | 127 | err: |
128 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); | 128 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); |
129 | if(value) OPENSSL_free(value); | 129 | if(value) free(value); |
130 | if(method->it) ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it)); | 130 | if(method->it) ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it)); |
131 | else method->ext_free(ext_str); | 131 | else method->ext_free(ext_str); |
132 | return ok; | 132 | return ok; |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_purp.c b/src/lib/libssl/src/crypto/x509v3/v3_purp.c index f59bfc1844..45d7251c29 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_purp.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_purp.c | |||
@@ -183,17 +183,17 @@ int X509_PURPOSE_add(int id, int trust, int flags, | |||
183 | idx = X509_PURPOSE_get_by_id(id); | 183 | idx = X509_PURPOSE_get_by_id(id); |
184 | /* Need a new entry */ | 184 | /* Need a new entry */ |
185 | if(idx == -1) { | 185 | if(idx == -1) { |
186 | if(!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) { | 186 | if(!(ptmp = malloc(sizeof(X509_PURPOSE)))) { |
187 | X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE); | 187 | X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | ptmp->flags = X509_PURPOSE_DYNAMIC; | 190 | ptmp->flags = X509_PURPOSE_DYNAMIC; |
191 | } else ptmp = X509_PURPOSE_get0(idx); | 191 | } else ptmp = X509_PURPOSE_get0(idx); |
192 | 192 | ||
193 | /* OPENSSL_free existing name if dynamic */ | 193 | /* free existing name if dynamic */ |
194 | if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) { | 194 | if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) { |
195 | OPENSSL_free(ptmp->name); | 195 | free(ptmp->name); |
196 | OPENSSL_free(ptmp->sname); | 196 | free(ptmp->sname); |
197 | } | 197 | } |
198 | /* dup supplied name */ | 198 | /* dup supplied name */ |
199 | ptmp->name = BUF_strdup(name); | 199 | ptmp->name = BUF_strdup(name); |
@@ -232,10 +232,10 @@ static void xptable_free(X509_PURPOSE *p) | |||
232 | if (p->flags & X509_PURPOSE_DYNAMIC) | 232 | if (p->flags & X509_PURPOSE_DYNAMIC) |
233 | { | 233 | { |
234 | if (p->flags & X509_PURPOSE_DYNAMIC_NAME) { | 234 | if (p->flags & X509_PURPOSE_DYNAMIC_NAME) { |
235 | OPENSSL_free(p->name); | 235 | free(p->name); |
236 | OPENSSL_free(p->sname); | 236 | free(p->sname); |
237 | } | 237 | } |
238 | OPENSSL_free(p); | 238 | free(p); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_sxnet.c b/src/lib/libssl/src/crypto/x509v3/v3_sxnet.c index 2a6bf11b65..a2b0322e44 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_sxnet.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_sxnet.c | |||
@@ -114,7 +114,7 @@ static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out, | |||
114 | id = sk_SXNETID_value(sx->ids, i); | 114 | id = sk_SXNETID_value(sx->ids, i); |
115 | tmp = i2s_ASN1_INTEGER(NULL, id->zone); | 115 | tmp = i2s_ASN1_INTEGER(NULL, id->zone); |
116 | BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp); | 116 | BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp); |
117 | OPENSSL_free(tmp); | 117 | free(tmp); |
118 | M_ASN1_OCTET_STRING_print(out, id->user); | 118 | M_ASN1_OCTET_STRING_print(out, id->user); |
119 | } | 119 | } |
120 | return 1; | 120 | return 1; |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_utl.c b/src/lib/libssl/src/crypto/x509v3/v3_utl.c index c4b6143eff..d938a175ed 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_utl.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_utl.c | |||
@@ -85,7 +85,7 @@ int X509V3_add_value(const char *name, const char *value, | |||
85 | char *tname = NULL, *tvalue = NULL; | 85 | char *tname = NULL, *tvalue = NULL; |
86 | if(name && !(tname = BUF_strdup(name))) goto err; | 86 | if(name && !(tname = BUF_strdup(name))) goto err; |
87 | if(value && !(tvalue = BUF_strdup(value))) goto err; | 87 | if(value && !(tvalue = BUF_strdup(value))) goto err; |
88 | if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err; | 88 | if(!(vtmp = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) goto err; |
89 | if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; | 89 | if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; |
90 | vtmp->section = NULL; | 90 | vtmp->section = NULL; |
91 | vtmp->name = tname; | 91 | vtmp->name = tname; |
@@ -94,9 +94,9 @@ int X509V3_add_value(const char *name, const char *value, | |||
94 | return 1; | 94 | return 1; |
95 | err: | 95 | err: |
96 | X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE); | 96 | X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE); |
97 | if(vtmp) OPENSSL_free(vtmp); | 97 | if(vtmp) free(vtmp); |
98 | if(tname) OPENSSL_free(tname); | 98 | if(tname) free(tname); |
99 | if(tvalue) OPENSSL_free(tvalue); | 99 | if(tvalue) free(tvalue); |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
@@ -111,10 +111,10 @@ int X509V3_add_value_uchar(const char *name, const unsigned char *value, | |||
111 | void X509V3_conf_free(CONF_VALUE *conf) | 111 | void X509V3_conf_free(CONF_VALUE *conf) |
112 | { | 112 | { |
113 | if(!conf) return; | 113 | if(!conf) return; |
114 | if(conf->name) OPENSSL_free(conf->name); | 114 | if(conf->name) free(conf->name); |
115 | if(conf->value) OPENSSL_free(conf->value); | 115 | if(conf->value) free(conf->value); |
116 | if(conf->section) OPENSSL_free(conf->section); | 116 | if(conf->section) free(conf->section); |
117 | OPENSSL_free(conf); | 117 | free(conf); |
118 | } | 118 | } |
119 | 119 | ||
120 | int X509V3_add_value_bool(const char *name, int asn1_bool, | 120 | int X509V3_add_value_bool(const char *name, int asn1_bool, |
@@ -206,7 +206,7 @@ int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, | |||
206 | if(!aint) return 1; | 206 | if(!aint) return 1; |
207 | if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0; | 207 | if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0; |
208 | ret = X509V3_add_value(name, strtmp, extlist); | 208 | ret = X509V3_add_value(name, strtmp, extlist); |
209 | OPENSSL_free(strtmp); | 209 | free(strtmp); |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
@@ -328,11 +328,11 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line) | |||
328 | } | 328 | } |
329 | X509V3_add_value(ntmp, NULL, &values); | 329 | X509V3_add_value(ntmp, NULL, &values); |
330 | } | 330 | } |
331 | OPENSSL_free(linebuf); | 331 | free(linebuf); |
332 | return values; | 332 | return values; |
333 | 333 | ||
334 | err: | 334 | err: |
335 | OPENSSL_free(linebuf); | 335 | free(linebuf); |
336 | sk_CONF_VALUE_pop_free(values, X509V3_conf_free); | 336 | sk_CONF_VALUE_pop_free(values, X509V3_conf_free); |
337 | return NULL; | 337 | return NULL; |
338 | 338 | ||
@@ -355,7 +355,7 @@ static char *strip_spaces(char *name) | |||
355 | 355 | ||
356 | /* hex string utilities */ | 356 | /* hex string utilities */ |
357 | 357 | ||
358 | /* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its | 358 | /* Given a buffer of length 'len' return a malloc'ed string with its |
359 | * hex representation | 359 | * hex representation |
360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) | 360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) |
361 | */ | 361 | */ |
@@ -367,7 +367,7 @@ char *hex_to_string(const unsigned char *buffer, long len) | |||
367 | int i; | 367 | int i; |
368 | const static char hexdig[] = "0123456789ABCDEF"; | 368 | const static char hexdig[] = "0123456789ABCDEF"; |
369 | if(!buffer || !len) return NULL; | 369 | if(!buffer || !len) return NULL; |
370 | if(!(tmp = OPENSSL_malloc(len * 3 + 1))) { | 370 | if(!(tmp = malloc(len * 3 + 1))) { |
371 | X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE); | 371 | X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE); |
372 | return NULL; | 372 | return NULL; |
373 | } | 373 | } |
@@ -393,14 +393,14 @@ unsigned char *string_to_hex(const char *str, long *len) | |||
393 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT); | 393 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT); |
394 | return NULL; | 394 | return NULL; |
395 | } | 395 | } |
396 | if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err; | 396 | if(!(hexbuf = malloc(strlen(str) >> 1))) goto err; |
397 | for(p = (unsigned char *)str, q = hexbuf; *p;) { | 397 | for(p = (unsigned char *)str, q = hexbuf; *p;) { |
398 | ch = *p++; | 398 | ch = *p++; |
399 | if(ch == ':') continue; | 399 | if(ch == ':') continue; |
400 | cl = *p++; | 400 | cl = *p++; |
401 | if(!cl) { | 401 | if(!cl) { |
402 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); | 402 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); |
403 | OPENSSL_free(hexbuf); | 403 | free(hexbuf); |
404 | return NULL; | 404 | return NULL; |
405 | } | 405 | } |
406 | if(isupper(ch)) ch = tolower(ch); | 406 | if(isupper(ch)) ch = tolower(ch); |
@@ -422,12 +422,12 @@ unsigned char *string_to_hex(const char *str, long *len) | |||
422 | return hexbuf; | 422 | return hexbuf; |
423 | 423 | ||
424 | err: | 424 | err: |
425 | if(hexbuf) OPENSSL_free(hexbuf); | 425 | if(hexbuf) free(hexbuf); |
426 | X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE); | 426 | X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE); |
427 | return NULL; | 427 | return NULL; |
428 | 428 | ||
429 | badhex: | 429 | badhex: |
430 | OPENSSL_free(hexbuf); | 430 | free(hexbuf); |
431 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT); | 431 | X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT); |
432 | return NULL; | 432 | return NULL; |
433 | 433 | ||
@@ -531,7 +531,7 @@ static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES *gens) | |||
531 | 531 | ||
532 | static void str_free(OPENSSL_STRING str) | 532 | static void str_free(OPENSSL_STRING str) |
533 | { | 533 | { |
534 | OPENSSL_free(str); | 534 | free(str); |
535 | } | 535 | } |
536 | 536 | ||
537 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) | 537 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) |
@@ -608,7 +608,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc) | |||
608 | 608 | ||
609 | iplen2 = a2i_ipadd(ipout + iplen1, p); | 609 | iplen2 = a2i_ipadd(ipout + iplen1, p); |
610 | 610 | ||
611 | OPENSSL_free(iptmp); | 611 | free(iptmp); |
612 | iptmp = NULL; | 612 | iptmp = NULL; |
613 | 613 | ||
614 | if (!iplen2 || (iplen1 != iplen2)) | 614 | if (!iplen2 || (iplen1 != iplen2)) |
@@ -624,7 +624,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc) | |||
624 | 624 | ||
625 | err: | 625 | err: |
626 | if (iptmp) | 626 | if (iptmp) |
627 | OPENSSL_free(iptmp); | 627 | free(iptmp); |
628 | if (ret) | 628 | if (ret) |
629 | ASN1_OCTET_STRING_free(ret); | 629 | ASN1_OCTET_STRING_free(ret); |
630 | return NULL; | 630 | return NULL; |
diff --git a/src/lib/libssl/src/ssl/bio_ssl.c b/src/lib/libssl/src/ssl/bio_ssl.c index 65077aaa00..35463c73d4 100644 --- a/src/lib/libssl/src/ssl/bio_ssl.c +++ b/src/lib/libssl/src/ssl/bio_ssl.c | |||
@@ -105,7 +105,7 @@ ssl_new(BIO *bi) | |||
105 | { | 105 | { |
106 | BIO_SSL *bs; | 106 | BIO_SSL *bs; |
107 | 107 | ||
108 | bs = (BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL)); | 108 | bs = (BIO_SSL *)malloc(sizeof(BIO_SSL)); |
109 | if (bs == NULL) { | 109 | if (bs == NULL) { |
110 | BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE); | 110 | BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE); |
111 | return (0); | 111 | return (0); |
@@ -134,7 +134,7 @@ ssl_free(BIO *a) | |||
134 | a->flags = 0; | 134 | a->flags = 0; |
135 | } | 135 | } |
136 | if (a->ptr != NULL) | 136 | if (a->ptr != NULL) |
137 | OPENSSL_free(a->ptr); | 137 | free(a->ptr); |
138 | return (1); | 138 | return (1); |
139 | } | 139 | } |
140 | 140 | ||
diff --git a/src/lib/libssl/src/ssl/d1_both.c b/src/lib/libssl/src/ssl/d1_both.c index 731245c6a6..2f7dc283a0 100644 --- a/src/lib/libssl/src/ssl/d1_both.c +++ b/src/lib/libssl/src/ssl/d1_both.c | |||
@@ -179,14 +179,14 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) | |||
179 | unsigned char *buf = NULL; | 179 | unsigned char *buf = NULL; |
180 | unsigned char *bitmask = NULL; | 180 | unsigned char *bitmask = NULL; |
181 | 181 | ||
182 | frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); | 182 | frag = (hm_fragment *)malloc(sizeof(hm_fragment)); |
183 | if (frag == NULL) | 183 | if (frag == NULL) |
184 | return NULL; | 184 | return NULL; |
185 | 185 | ||
186 | if (frag_len) { | 186 | if (frag_len) { |
187 | buf = (unsigned char *)OPENSSL_malloc(frag_len); | 187 | buf = (unsigned char *)malloc(frag_len); |
188 | if (buf == NULL) { | 188 | if (buf == NULL) { |
189 | OPENSSL_free(frag); | 189 | free(frag); |
190 | return NULL; | 190 | return NULL; |
191 | } | 191 | } |
192 | } | 192 | } |
@@ -196,11 +196,11 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) | |||
196 | 196 | ||
197 | /* Initialize reassembly bitmask if necessary */ | 197 | /* Initialize reassembly bitmask if necessary */ |
198 | if (reassembly) { | 198 | if (reassembly) { |
199 | bitmask = (unsigned char *)OPENSSL_malloc(RSMBLY_BITMASK_SIZE(frag_len)); | 199 | bitmask = (unsigned char *)malloc(RSMBLY_BITMASK_SIZE(frag_len)); |
200 | if (bitmask == NULL) { | 200 | if (bitmask == NULL) { |
201 | if (buf != NULL) | 201 | if (buf != NULL) |
202 | OPENSSL_free(buf); | 202 | free(buf); |
203 | OPENSSL_free(frag); | 203 | free(frag); |
204 | return NULL; | 204 | return NULL; |
205 | } | 205 | } |
206 | memset(bitmask, 0, RSMBLY_BITMASK_SIZE(frag_len)); | 206 | memset(bitmask, 0, RSMBLY_BITMASK_SIZE(frag_len)); |
@@ -220,10 +220,10 @@ dtls1_hm_fragment_free(hm_fragment *frag) | |||
220 | EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash); | 220 | EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash); |
221 | } | 221 | } |
222 | if (frag->fragment) | 222 | if (frag->fragment) |
223 | OPENSSL_free(frag->fragment); | 223 | free(frag->fragment); |
224 | if (frag->reassembly) | 224 | if (frag->reassembly) |
225 | OPENSSL_free(frag->reassembly); | 225 | free(frag->reassembly); |
226 | OPENSSL_free(frag); | 226 | free(frag); |
227 | } | 227 | } |
228 | 228 | ||
229 | /* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ | 229 | /* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */ |
@@ -636,7 +636,7 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) { | |||
636 | is_complete); | 636 | is_complete); |
637 | 637 | ||
638 | if (is_complete) { | 638 | if (is_complete) { |
639 | OPENSSL_free(frag->reassembly); | 639 | free(frag->reassembly); |
640 | frag->reassembly = NULL; | 640 | frag->reassembly = NULL; |
641 | } | 641 | } |
642 | 642 | ||
@@ -660,7 +660,7 @@ err: | |||
660 | if (frag != NULL) | 660 | if (frag != NULL) |
661 | dtls1_hm_fragment_free(frag); | 661 | dtls1_hm_fragment_free(frag); |
662 | if (item != NULL) | 662 | if (item != NULL) |
663 | OPENSSL_free(item); | 663 | free(item); |
664 | *ok = 0; | 664 | *ok = 0; |
665 | return i; | 665 | return i; |
666 | } | 666 | } |
@@ -742,7 +742,7 @@ err: | |||
742 | if (frag != NULL) | 742 | if (frag != NULL) |
743 | dtls1_hm_fragment_free(frag); | 743 | dtls1_hm_fragment_free(frag); |
744 | if (item != NULL) | 744 | if (item != NULL) |
745 | OPENSSL_free(item); | 745 | free(item); |
746 | *ok = 0; | 746 | *ok = 0; |
747 | return i; | 747 | return i; |
748 | } | 748 | } |
diff --git a/src/lib/libssl/src/ssl/d1_clnt.c b/src/lib/libssl/src/ssl/d1_clnt.c index 1b7cbaec15..3f159eed26 100644 --- a/src/lib/libssl/src/ssl/d1_clnt.c +++ b/src/lib/libssl/src/ssl/d1_clnt.c | |||
@@ -1317,7 +1317,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1317 | NULL, 0, NULL); | 1317 | NULL, 0, NULL); |
1318 | 1318 | ||
1319 | encodedPoint = (unsigned char *) | 1319 | encodedPoint = (unsigned char *) |
1320 | OPENSSL_malloc(encoded_pt_len * | 1320 | malloc(encoded_pt_len * |
1321 | sizeof(unsigned char)); | 1321 | sizeof(unsigned char)); |
1322 | 1322 | ||
1323 | bn_ctx = BN_CTX_new(); | 1323 | bn_ctx = BN_CTX_new(); |
@@ -1347,7 +1347,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1347 | /* Free allocated memory */ | 1347 | /* Free allocated memory */ |
1348 | BN_CTX_free(bn_ctx); | 1348 | BN_CTX_free(bn_ctx); |
1349 | if (encodedPoint != NULL) | 1349 | if (encodedPoint != NULL) |
1350 | OPENSSL_free(encodedPoint); | 1350 | free(encodedPoint); |
1351 | if (clnt_ecdh != NULL) | 1351 | if (clnt_ecdh != NULL) |
1352 | EC_KEY_free(clnt_ecdh); | 1352 | EC_KEY_free(clnt_ecdh); |
1353 | EVP_PKEY_free(srvr_pub_pkey); | 1353 | EVP_PKEY_free(srvr_pub_pkey); |
@@ -1393,7 +1393,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1393 | s2n(psk_len, t); | 1393 | s2n(psk_len, t); |
1394 | 1394 | ||
1395 | if (s->session->psk_identity_hint != NULL) | 1395 | if (s->session->psk_identity_hint != NULL) |
1396 | OPENSSL_free(s->session->psk_identity_hint); | 1396 | free(s->session->psk_identity_hint); |
1397 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); | 1397 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); |
1398 | if (s->ctx->psk_identity_hint != NULL && | 1398 | if (s->ctx->psk_identity_hint != NULL && |
1399 | s->session->psk_identity_hint == NULL) { | 1399 | s->session->psk_identity_hint == NULL) { |
@@ -1403,7 +1403,7 @@ dtls1_send_client_key_exchange(SSL *s) | |||
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | if (s->session->psk_identity != NULL) | 1405 | if (s->session->psk_identity != NULL) |
1406 | OPENSSL_free(s->session->psk_identity); | 1406 | free(s->session->psk_identity); |
1407 | s->session->psk_identity = BUF_strdup(identity); | 1407 | s->session->psk_identity = BUF_strdup(identity); |
1408 | if (s->session->psk_identity == NULL) { | 1408 | if (s->session->psk_identity == NULL) { |
1409 | SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, | 1409 | SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE, |
@@ -1460,7 +1460,7 @@ err: | |||
1460 | #ifndef OPENSSL_NO_ECDH | 1460 | #ifndef OPENSSL_NO_ECDH |
1461 | BN_CTX_free(bn_ctx); | 1461 | BN_CTX_free(bn_ctx); |
1462 | if (encodedPoint != NULL) | 1462 | if (encodedPoint != NULL) |
1463 | OPENSSL_free(encodedPoint); | 1463 | free(encodedPoint); |
1464 | if (clnt_ecdh != NULL) | 1464 | if (clnt_ecdh != NULL) |
1465 | EC_KEY_free(clnt_ecdh); | 1465 | EC_KEY_free(clnt_ecdh); |
1466 | EVP_PKEY_free(srvr_pub_pkey); | 1466 | EVP_PKEY_free(srvr_pub_pkey); |
diff --git a/src/lib/libssl/src/ssl/d1_lib.c b/src/lib/libssl/src/ssl/d1_lib.c index 73c44c807a..7da57b0a36 100644 --- a/src/lib/libssl/src/ssl/d1_lib.c +++ b/src/lib/libssl/src/ssl/d1_lib.c | |||
@@ -100,7 +100,7 @@ dtls1_new(SSL *s) | |||
100 | 100 | ||
101 | if (!ssl3_new(s)) | 101 | if (!ssl3_new(s)) |
102 | return (0); | 102 | return (0); |
103 | if ((d1 = OPENSSL_malloc(sizeof *d1)) == NULL) return (0); | 103 | if ((d1 = malloc(sizeof *d1)) == NULL) return (0); |
104 | memset(d1, 0, sizeof *d1); | 104 | memset(d1, 0, sizeof *d1); |
105 | 105 | ||
106 | /* d1->handshake_epoch=0; */ | 106 | /* d1->handshake_epoch=0; */ |
@@ -128,7 +128,7 @@ dtls1_new(SSL *s) | |||
128 | pqueue_free(d1->sent_messages); | 128 | pqueue_free(d1->sent_messages); |
129 | if (d1->buffered_app_data.q) | 129 | if (d1->buffered_app_data.q) |
130 | pqueue_free(d1->buffered_app_data.q); | 130 | pqueue_free(d1->buffered_app_data.q); |
131 | OPENSSL_free(d1); | 131 | free(d1); |
132 | return (0); | 132 | return (0); |
133 | } | 133 | } |
134 | 134 | ||
@@ -147,39 +147,39 @@ dtls1_clear_queues(SSL *s) | |||
147 | while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) { | 147 | while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) { |
148 | rdata = (DTLS1_RECORD_DATA *) item->data; | 148 | rdata = (DTLS1_RECORD_DATA *) item->data; |
149 | if (rdata->rbuf.buf) { | 149 | if (rdata->rbuf.buf) { |
150 | OPENSSL_free(rdata->rbuf.buf); | 150 | free(rdata->rbuf.buf); |
151 | } | 151 | } |
152 | OPENSSL_free(item->data); | 152 | free(item->data); |
153 | pitem_free(item); | 153 | pitem_free(item); |
154 | } | 154 | } |
155 | 155 | ||
156 | while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) { | 156 | while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) { |
157 | rdata = (DTLS1_RECORD_DATA *) item->data; | 157 | rdata = (DTLS1_RECORD_DATA *) item->data; |
158 | if (rdata->rbuf.buf) { | 158 | if (rdata->rbuf.buf) { |
159 | OPENSSL_free(rdata->rbuf.buf); | 159 | free(rdata->rbuf.buf); |
160 | } | 160 | } |
161 | OPENSSL_free(item->data); | 161 | free(item->data); |
162 | pitem_free(item); | 162 | pitem_free(item); |
163 | } | 163 | } |
164 | 164 | ||
165 | while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) { | 165 | while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) { |
166 | frag = (hm_fragment *)item->data; | 166 | frag = (hm_fragment *)item->data; |
167 | OPENSSL_free(frag->fragment); | 167 | free(frag->fragment); |
168 | OPENSSL_free(frag); | 168 | free(frag); |
169 | pitem_free(item); | 169 | pitem_free(item); |
170 | } | 170 | } |
171 | 171 | ||
172 | while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { | 172 | while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { |
173 | frag = (hm_fragment *)item->data; | 173 | frag = (hm_fragment *)item->data; |
174 | OPENSSL_free(frag->fragment); | 174 | free(frag->fragment); |
175 | OPENSSL_free(frag); | 175 | free(frag); |
176 | pitem_free(item); | 176 | pitem_free(item); |
177 | } | 177 | } |
178 | 178 | ||
179 | while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) { | 179 | while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) { |
180 | frag = (hm_fragment *)item->data; | 180 | frag = (hm_fragment *)item->data; |
181 | OPENSSL_free(frag->fragment); | 181 | free(frag->fragment); |
182 | OPENSSL_free(frag); | 182 | free(frag); |
183 | pitem_free(item); | 183 | pitem_free(item); |
184 | } | 184 | } |
185 | } | 185 | } |
@@ -197,7 +197,7 @@ dtls1_free(SSL *s) | |||
197 | pqueue_free(s->d1->sent_messages); | 197 | pqueue_free(s->d1->sent_messages); |
198 | pqueue_free(s->d1->buffered_app_data.q); | 198 | pqueue_free(s->d1->buffered_app_data.q); |
199 | 199 | ||
200 | OPENSSL_free(s->d1); | 200 | free(s->d1); |
201 | s->d1 = NULL; | 201 | s->d1 = NULL; |
202 | } | 202 | } |
203 | 203 | ||
diff --git a/src/lib/libssl/src/ssl/d1_pkt.c b/src/lib/libssl/src/ssl/d1_pkt.c index cb5f2c3199..69f3d45734 100644 --- a/src/lib/libssl/src/ssl/d1_pkt.c +++ b/src/lib/libssl/src/ssl/d1_pkt.c | |||
@@ -200,7 +200,7 @@ dtls1_copy_record(SSL *s, pitem *item) | |||
200 | rdata = (DTLS1_RECORD_DATA *)item->data; | 200 | rdata = (DTLS1_RECORD_DATA *)item->data; |
201 | 201 | ||
202 | if (s->s3->rbuf.buf != NULL) | 202 | if (s->s3->rbuf.buf != NULL) |
203 | OPENSSL_free(s->s3->rbuf.buf); | 203 | free(s->s3->rbuf.buf); |
204 | 204 | ||
205 | s->packet = rdata->packet; | 205 | s->packet = rdata->packet; |
206 | s->packet_length = rdata->packet_length; | 206 | s->packet_length = rdata->packet_length; |
@@ -224,11 +224,11 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
224 | if (pqueue_size(queue->q) >= 100) | 224 | if (pqueue_size(queue->q) >= 100) |
225 | return 0; | 225 | return 0; |
226 | 226 | ||
227 | rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); | 227 | rdata = malloc(sizeof(DTLS1_RECORD_DATA)); |
228 | item = pitem_new(priority, rdata); | 228 | item = pitem_new(priority, rdata); |
229 | if (rdata == NULL || item == NULL) { | 229 | if (rdata == NULL || item == NULL) { |
230 | if (rdata != NULL) | 230 | if (rdata != NULL) |
231 | OPENSSL_free(rdata); | 231 | free(rdata); |
232 | if (item != NULL) | 232 | if (item != NULL) |
233 | pitem_free(item); | 233 | pitem_free(item); |
234 | 234 | ||
@@ -253,7 +253,7 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
253 | 253 | ||
254 | /* insert should not fail, since duplicates are dropped */ | 254 | /* insert should not fail, since duplicates are dropped */ |
255 | if (pqueue_insert(queue->q, item) == NULL) { | 255 | if (pqueue_insert(queue->q, item) == NULL) { |
256 | OPENSSL_free(rdata); | 256 | free(rdata); |
257 | pitem_free(item); | 257 | pitem_free(item); |
258 | return (0); | 258 | return (0); |
259 | } | 259 | } |
@@ -265,7 +265,7 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | |||
265 | 265 | ||
266 | if (!ssl3_setup_buffers(s)) { | 266 | if (!ssl3_setup_buffers(s)) { |
267 | SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); | 267 | SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); |
268 | OPENSSL_free(rdata); | 268 | free(rdata); |
269 | pitem_free(item); | 269 | pitem_free(item); |
270 | return (0); | 270 | return (0); |
271 | } | 271 | } |
@@ -283,7 +283,7 @@ dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue) | |||
283 | if (item) { | 283 | if (item) { |
284 | dtls1_copy_record(s, item); | 284 | dtls1_copy_record(s, item); |
285 | 285 | ||
286 | OPENSSL_free(item->data); | 286 | free(item->data); |
287 | pitem_free(item); | 287 | pitem_free(item); |
288 | 288 | ||
289 | return (1); | 289 | return (1); |
@@ -360,14 +360,14 @@ dtls1_get_buffered_record(SSL *s) | |||
360 | rdata = (DTLS1_RECORD_DATA *)item->data; | 360 | rdata = (DTLS1_RECORD_DATA *)item->data; |
361 | 361 | ||
362 | if (s->s3->rbuf.buf != NULL) | 362 | if (s->s3->rbuf.buf != NULL) |
363 | OPENSSL_free(s->s3->rbuf.buf); | 363 | free(s->s3->rbuf.buf); |
364 | 364 | ||
365 | s->packet = rdata->packet; | 365 | s->packet = rdata->packet; |
366 | s->packet_length = rdata->packet_length; | 366 | s->packet_length = rdata->packet_length; |
367 | memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER)); | 367 | memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER)); |
368 | memcpy(&(s->s3->rrec), &(rdata->rrec), sizeof(SSL3_RECORD)); | 368 | memcpy(&(s->s3->rrec), &(rdata->rrec), sizeof(SSL3_RECORD)); |
369 | 369 | ||
370 | OPENSSL_free(item->data); | 370 | free(item->data); |
371 | pitem_free(item); | 371 | pitem_free(item); |
372 | 372 | ||
373 | /* s->d1->next_expected_seq_num++; */ | 373 | /* s->d1->next_expected_seq_num++; */ |
@@ -810,7 +810,7 @@ start: | |||
810 | 810 | ||
811 | dtls1_copy_record(s, item); | 811 | dtls1_copy_record(s, item); |
812 | 812 | ||
813 | OPENSSL_free(item->data); | 813 | free(item->data); |
814 | pitem_free(item); | 814 | pitem_free(item); |
815 | } | 815 | } |
816 | } | 816 | } |
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c index 6040dd96ca..9b87dcd067 100644 --- a/src/lib/libssl/src/ssl/d1_srvr.c +++ b/src/lib/libssl/src/ssl/d1_srvr.c | |||
@@ -1188,7 +1188,7 @@ dtls1_send_server_key_exchange(SSL *s) | |||
1188 | NULL, 0, NULL); | 1188 | NULL, 0, NULL); |
1189 | 1189 | ||
1190 | encodedPoint = (unsigned char *) | 1190 | encodedPoint = (unsigned char *) |
1191 | OPENSSL_malloc(encodedlen*sizeof(unsigned char)); | 1191 | malloc(encodedlen*sizeof(unsigned char)); |
1192 | 1192 | ||
1193 | bn_ctx = BN_CTX_new(); | 1193 | bn_ctx = BN_CTX_new(); |
1194 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { | 1194 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { |
@@ -1289,7 +1289,7 @@ dtls1_send_server_key_exchange(SSL *s) | |||
1289 | memcpy((unsigned char*)p, | 1289 | memcpy((unsigned char*)p, |
1290 | (unsigned char *)encodedPoint, | 1290 | (unsigned char *)encodedPoint, |
1291 | encodedlen); | 1291 | encodedlen); |
1292 | OPENSSL_free(encodedPoint); | 1292 | free(encodedPoint); |
1293 | p += encodedlen; | 1293 | p += encodedlen; |
1294 | } | 1294 | } |
1295 | #endif | 1295 | #endif |
@@ -1398,7 +1398,7 @@ f_err: | |||
1398 | err: | 1398 | err: |
1399 | #ifndef OPENSSL_NO_ECDH | 1399 | #ifndef OPENSSL_NO_ECDH |
1400 | if (encodedPoint != NULL) | 1400 | if (encodedPoint != NULL) |
1401 | OPENSSL_free(encodedPoint); | 1401 | free(encodedPoint); |
1402 | BN_CTX_free(bn_ctx); | 1402 | BN_CTX_free(bn_ctx); |
1403 | #endif | 1403 | #endif |
1404 | EVP_MD_CTX_cleanup(&md_ctx); | 1404 | EVP_MD_CTX_cleanup(&md_ctx); |
@@ -1564,7 +1564,7 @@ dtls1_send_newsession_ticket(SSL *s) | |||
1564 | DTLS1_HM_HEADER_LENGTH + 22 + EVP_MAX_IV_LENGTH + | 1564 | DTLS1_HM_HEADER_LENGTH + 22 + EVP_MAX_IV_LENGTH + |
1565 | EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen)) | 1565 | EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen)) |
1566 | return -1; | 1566 | return -1; |
1567 | senc = OPENSSL_malloc(slen); | 1567 | senc = malloc(slen); |
1568 | if (!senc) | 1568 | if (!senc) |
1569 | return -1; | 1569 | return -1; |
1570 | p = senc; | 1570 | p = senc; |
@@ -1580,7 +1580,7 @@ dtls1_send_newsession_ticket(SSL *s) | |||
1580 | if (tctx->tlsext_ticket_key_cb) { | 1580 | if (tctx->tlsext_ticket_key_cb) { |
1581 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, | 1581 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, |
1582 | &hctx, 1) < 0) { | 1582 | &hctx, 1) < 0) { |
1583 | OPENSSL_free(senc); | 1583 | free(senc); |
1584 | return -1; | 1584 | return -1; |
1585 | } | 1585 | } |
1586 | } else { | 1586 | } else { |
@@ -1624,7 +1624,7 @@ dtls1_send_newsession_ticket(SSL *s) | |||
1624 | s->init_num = len; | 1624 | s->init_num = len; |
1625 | s->state = SSL3_ST_SW_SESSION_TICKET_B; | 1625 | s->state = SSL3_ST_SW_SESSION_TICKET_B; |
1626 | s->init_off = 0; | 1626 | s->init_off = 0; |
1627 | OPENSSL_free(senc); | 1627 | free(senc); |
1628 | 1628 | ||
1629 | /* XDTLS: set message header ? */ | 1629 | /* XDTLS: set message header ? */ |
1630 | msg_len = s->init_num - DTLS1_HM_HEADER_LENGTH; | 1630 | msg_len = s->init_num - DTLS1_HM_HEADER_LENGTH; |
diff --git a/src/lib/libssl/src/ssl/kssl.c b/src/lib/libssl/src/ssl/kssl.c index 83afa97f03..163079de20 100644 --- a/src/lib/libssl/src/ssl/kssl.c +++ b/src/lib/libssl/src/ssl/kssl.c | |||
@@ -92,16 +92,16 @@ kssl_calloc(size_t nmemb, size_t size) | |||
92 | { | 92 | { |
93 | void* p; | 93 | void* p; |
94 | 94 | ||
95 | p = OPENSSL_malloc(nmemb*size); | 95 | p = malloc(nmemb*size); |
96 | if (p){ | 96 | if (p){ |
97 | memset(p, 0, nmemb*size); | 97 | memset(p, 0, nmemb*size); |
98 | } | 98 | } |
99 | return p; | 99 | return p; |
100 | } | 100 | } |
101 | 101 | ||
102 | #define kssl_malloc(size) OPENSSL_malloc((size)) | 102 | #define kssl_malloc(size) malloc((size)) |
103 | #define kssl_realloc(ptr, size) OPENSSL_realloc(ptr, size) | 103 | #define kssl_realloc(ptr, size) realloc(ptr, size) |
104 | #define kssl_free(ptr) OPENSSL_free((ptr)) | 104 | #define kssl_free(ptr) free((ptr)) |
105 | 105 | ||
106 | 106 | ||
107 | char | 107 | char |
diff --git a/src/lib/libssl/src/ssl/s23_srvr.c b/src/lib/libssl/src/ssl/s23_srvr.c index 35651183b7..8010d72fa7 100644 --- a/src/lib/libssl/src/ssl/s23_srvr.c +++ b/src/lib/libssl/src/ssl/s23_srvr.c | |||
@@ -533,10 +533,10 @@ ssl23_get_client_hello(SSL *s) | |||
533 | s->init_num = 0; | 533 | s->init_num = 0; |
534 | 534 | ||
535 | if (buf != buf_space) | 535 | if (buf != buf_space) |
536 | OPENSSL_free(buf); | 536 | free(buf); |
537 | return (SSL_accept(s)); | 537 | return (SSL_accept(s)); |
538 | err: | 538 | err: |
539 | if (buf != buf_space) | 539 | if (buf != buf_space) |
540 | OPENSSL_free(buf); | 540 | free(buf); |
541 | return (-1); | 541 | return (-1); |
542 | } | 542 | } |
diff --git a/src/lib/libssl/src/ssl/s3_both.c b/src/lib/libssl/src/ssl/s3_both.c index 5642e6c175..12b38c4596 100644 --- a/src/lib/libssl/src/ssl/s3_both.c +++ b/src/lib/libssl/src/ssl/s3_both.c | |||
@@ -650,7 +650,7 @@ ssl3_setup_read_buffer(SSL *s) | |||
650 | if (!(s->options & SSL_OP_NO_COMPRESSION)) | 650 | if (!(s->options & SSL_OP_NO_COMPRESSION)) |
651 | len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; | 651 | len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; |
652 | #endif | 652 | #endif |
653 | if ((p = OPENSSL_malloc(len)) == NULL) | 653 | if ((p = malloc(len)) == NULL) |
654 | goto err; | 654 | goto err; |
655 | s->s3->rbuf.buf = p; | 655 | s->s3->rbuf.buf = p; |
656 | s->s3->rbuf.len = len; | 656 | s->s3->rbuf.len = len; |
@@ -690,7 +690,7 @@ ssl3_setup_write_buffer(SSL *s) | |||
690 | len += headerlen + align + | 690 | len += headerlen + align + |
691 | SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD; | 691 | SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD; |
692 | 692 | ||
693 | if ((p = OPENSSL_malloc(len)) == NULL) | 693 | if ((p = malloc(len)) == NULL) |
694 | goto err; | 694 | goto err; |
695 | s->s3->wbuf.buf = p; | 695 | s->s3->wbuf.buf = p; |
696 | s->s3->wbuf.len = len; | 696 | s->s3->wbuf.len = len; |
@@ -718,7 +718,7 @@ int | |||
718 | ssl3_release_write_buffer(SSL *s) | 718 | ssl3_release_write_buffer(SSL *s) |
719 | { | 719 | { |
720 | if (s->s3->wbuf.buf != NULL) { | 720 | if (s->s3->wbuf.buf != NULL) { |
721 | OPENSSL_free(s->s3->wbuf.buf); | 721 | free(s->s3->wbuf.buf); |
722 | s->s3->wbuf.buf = NULL; | 722 | s->s3->wbuf.buf = NULL; |
723 | } | 723 | } |
724 | return 1; | 724 | return 1; |
@@ -728,7 +728,7 @@ int | |||
728 | ssl3_release_read_buffer(SSL *s) | 728 | ssl3_release_read_buffer(SSL *s) |
729 | { | 729 | { |
730 | if (s->s3->rbuf.buf != NULL) { | 730 | if (s->s3->rbuf.buf != NULL) { |
731 | OPENSSL_free(s->s3->rbuf.buf); | 731 | free(s->s3->rbuf.buf); |
732 | s->s3->rbuf.buf = NULL; | 732 | s->s3->rbuf.buf = NULL; |
733 | } | 733 | } |
734 | return 1; | 734 | return 1; |
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c index 88be294ab7..26bdef6b4f 100644 --- a/src/lib/libssl/src/ssl/s3_clnt.c +++ b/src/lib/libssl/src/ssl/s3_clnt.c | |||
@@ -1222,7 +1222,7 @@ ssl3_get_key_exchange(SSL *s) | |||
1222 | if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) { | 1222 | if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) { |
1223 | s->session->sess_cert = ssl_sess_cert_new(); | 1223 | s->session->sess_cert = ssl_sess_cert_new(); |
1224 | if (s->ctx->psk_identity_hint) | 1224 | if (s->ctx->psk_identity_hint) |
1225 | OPENSSL_free(s->ctx->psk_identity_hint); | 1225 | free(s->ctx->psk_identity_hint); |
1226 | s->ctx->psk_identity_hint = NULL; | 1226 | s->ctx->psk_identity_hint = NULL; |
1227 | } | 1227 | } |
1228 | #endif | 1228 | #endif |
@@ -1288,7 +1288,7 @@ ssl3_get_key_exchange(SSL *s) | |||
1288 | memcpy(tmp_id_hint, p, i); | 1288 | memcpy(tmp_id_hint, p, i); |
1289 | memset(tmp_id_hint + i, 0, PSK_MAX_IDENTITY_LEN + 1 - i); | 1289 | memset(tmp_id_hint + i, 0, PSK_MAX_IDENTITY_LEN + 1 - i); |
1290 | if (s->ctx->psk_identity_hint != NULL) | 1290 | if (s->ctx->psk_identity_hint != NULL) |
1291 | OPENSSL_free(s->ctx->psk_identity_hint); | 1291 | free(s->ctx->psk_identity_hint); |
1292 | s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint); | 1292 | s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint); |
1293 | if (s->ctx->psk_identity_hint == NULL) { | 1293 | if (s->ctx->psk_identity_hint == NULL) { |
1294 | SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); | 1294 | SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); |
@@ -1913,10 +1913,10 @@ ssl3_get_new_session_ticket(SSL *s) | |||
1913 | goto f_err; | 1913 | goto f_err; |
1914 | } | 1914 | } |
1915 | if (s->session->tlsext_tick) { | 1915 | if (s->session->tlsext_tick) { |
1916 | OPENSSL_free(s->session->tlsext_tick); | 1916 | free(s->session->tlsext_tick); |
1917 | s->session->tlsext_ticklen = 0; | 1917 | s->session->tlsext_ticklen = 0; |
1918 | } | 1918 | } |
1919 | s->session->tlsext_tick = OPENSSL_malloc(ticklen); | 1919 | s->session->tlsext_tick = malloc(ticklen); |
1920 | if (!s->session->tlsext_tick) { | 1920 | if (!s->session->tlsext_tick) { |
1921 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE); | 1921 | SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE); |
1922 | goto err; | 1922 | goto err; |
@@ -1988,7 +1988,7 @@ ssl3_get_cert_status(SSL *s) | |||
1988 | goto f_err; | 1988 | goto f_err; |
1989 | } | 1989 | } |
1990 | if (s->tlsext_ocsp_resp) | 1990 | if (s->tlsext_ocsp_resp) |
1991 | OPENSSL_free(s->tlsext_ocsp_resp); | 1991 | free(s->tlsext_ocsp_resp); |
1992 | s->tlsext_ocsp_resp = BUF_memdup(p, resplen); | 1992 | s->tlsext_ocsp_resp = BUF_memdup(p, resplen); |
1993 | if (!s->tlsext_ocsp_resp) { | 1993 | if (!s->tlsext_ocsp_resp) { |
1994 | al = SSL_AD_INTERNAL_ERROR; | 1994 | al = SSL_AD_INTERNAL_ERROR; |
@@ -2449,7 +2449,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2449 | NULL, 0, NULL); | 2449 | NULL, 0, NULL); |
2450 | 2450 | ||
2451 | encodedPoint = | 2451 | encodedPoint = |
2452 | (unsigned char *)OPENSSL_malloc( | 2452 | (unsigned char *)malloc( |
2453 | encoded_pt_len * sizeof(unsigned char)); | 2453 | encoded_pt_len * sizeof(unsigned char)); |
2454 | 2454 | ||
2455 | bn_ctx = BN_CTX_new(); | 2455 | bn_ctx = BN_CTX_new(); |
@@ -2479,7 +2479,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2479 | /* Free allocated memory */ | 2479 | /* Free allocated memory */ |
2480 | BN_CTX_free(bn_ctx); | 2480 | BN_CTX_free(bn_ctx); |
2481 | if (encodedPoint != NULL) | 2481 | if (encodedPoint != NULL) |
2482 | OPENSSL_free(encodedPoint); | 2482 | free(encodedPoint); |
2483 | if (clnt_ecdh != NULL) | 2483 | if (clnt_ecdh != NULL) |
2484 | EC_KEY_free(clnt_ecdh); | 2484 | EC_KEY_free(clnt_ecdh); |
2485 | EVP_PKEY_free(srvr_pub_pkey); | 2485 | EVP_PKEY_free(srvr_pub_pkey); |
@@ -2584,7 +2584,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2584 | goto err; | 2584 | goto err; |
2585 | } | 2585 | } |
2586 | if (s->session->srp_username != NULL) | 2586 | if (s->session->srp_username != NULL) |
2587 | OPENSSL_free(s->session->srp_username); | 2587 | free(s->session->srp_username); |
2588 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); | 2588 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); |
2589 | if (s->session->srp_username == NULL) { | 2589 | if (s->session->srp_username == NULL) { |
2590 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, | 2590 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, |
@@ -2636,7 +2636,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2636 | s2n(psk_len, t); | 2636 | s2n(psk_len, t); |
2637 | 2637 | ||
2638 | if (s->session->psk_identity_hint != NULL) | 2638 | if (s->session->psk_identity_hint != NULL) |
2639 | OPENSSL_free(s->session->psk_identity_hint); | 2639 | free(s->session->psk_identity_hint); |
2640 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); | 2640 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); |
2641 | if (s->ctx->psk_identity_hint != NULL && | 2641 | if (s->ctx->psk_identity_hint != NULL && |
2642 | s->session->psk_identity_hint == NULL) { | 2642 | s->session->psk_identity_hint == NULL) { |
@@ -2646,7 +2646,7 @@ ssl3_send_client_key_exchange(SSL *s) | |||
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | if (s->session->psk_identity != NULL) | 2648 | if (s->session->psk_identity != NULL) |
2649 | OPENSSL_free(s->session->psk_identity); | 2649 | free(s->session->psk_identity); |
2650 | s->session->psk_identity = BUF_strdup(identity); | 2650 | s->session->psk_identity = BUF_strdup(identity); |
2651 | if (s->session->psk_identity == NULL) { | 2651 | if (s->session->psk_identity == NULL) { |
2652 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, | 2652 | SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, |
@@ -2696,7 +2696,7 @@ err: | |||
2696 | #ifndef OPENSSL_NO_ECDH | 2696 | #ifndef OPENSSL_NO_ECDH |
2697 | BN_CTX_free(bn_ctx); | 2697 | BN_CTX_free(bn_ctx); |
2698 | if (encodedPoint != NULL) | 2698 | if (encodedPoint != NULL) |
2699 | OPENSSL_free(encodedPoint); | 2699 | free(encodedPoint); |
2700 | if (clnt_ecdh != NULL) | 2700 | if (clnt_ecdh != NULL) |
2701 | EC_KEY_free(clnt_ecdh); | 2701 | EC_KEY_free(clnt_ecdh); |
2702 | EVP_PKEY_free(srvr_pub_pkey); | 2702 | EVP_PKEY_free(srvr_pub_pkey); |
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c index bfd40b3d11..4d12631694 100644 --- a/src/lib/libssl/src/ssl/s3_enc.c +++ b/src/lib/libssl/src/ssl/s3_enc.c | |||
@@ -243,7 +243,7 @@ ssl3_change_cipher_state(SSL *s, int which) | |||
243 | if (which & SSL3_CC_READ) { | 243 | if (which & SSL3_CC_READ) { |
244 | if (s->enc_read_ctx != NULL) | 244 | if (s->enc_read_ctx != NULL) |
245 | reuse_dd = 1; | 245 | reuse_dd = 1; |
246 | else if ((s->enc_read_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) | 246 | else if ((s->enc_read_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL) |
247 | goto err; | 247 | goto err; |
248 | else | 248 | else |
249 | /* make sure it's intialized in case we exit later with an error */ | 249 | /* make sure it's intialized in case we exit later with an error */ |
@@ -265,7 +265,7 @@ ssl3_change_cipher_state(SSL *s, int which) | |||
265 | } | 265 | } |
266 | if (s->s3->rrec.comp == NULL) | 266 | if (s->s3->rrec.comp == NULL) |
267 | s->s3->rrec.comp = (unsigned char *) | 267 | s->s3->rrec.comp = (unsigned char *) |
268 | OPENSSL_malloc(SSL3_RT_MAX_PLAIN_LENGTH); | 268 | malloc(SSL3_RT_MAX_PLAIN_LENGTH); |
269 | if (s->s3->rrec.comp == NULL) | 269 | if (s->s3->rrec.comp == NULL) |
270 | goto err; | 270 | goto err; |
271 | } | 271 | } |
@@ -275,7 +275,7 @@ ssl3_change_cipher_state(SSL *s, int which) | |||
275 | } else { | 275 | } else { |
276 | if (s->enc_write_ctx != NULL) | 276 | if (s->enc_write_ctx != NULL) |
277 | reuse_dd = 1; | 277 | reuse_dd = 1; |
278 | else if ((s->enc_write_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) | 278 | else if ((s->enc_write_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL) |
279 | goto err; | 279 | goto err; |
280 | else | 280 | else |
281 | /* make sure it's intialized in case we exit later with an error */ | 281 | /* make sure it's intialized in case we exit later with an error */ |
@@ -410,7 +410,7 @@ ssl3_setup_key_block(SSL *s) | |||
410 | 410 | ||
411 | ssl3_cleanup_key_block(s); | 411 | ssl3_cleanup_key_block(s); |
412 | 412 | ||
413 | if ((p = OPENSSL_malloc(num)) == NULL) | 413 | if ((p = malloc(num)) == NULL) |
414 | goto err; | 414 | goto err; |
415 | 415 | ||
416 | s->s3->tmp.key_block_length = num; | 416 | s->s3->tmp.key_block_length = num; |
@@ -448,7 +448,7 @@ ssl3_cleanup_key_block(SSL *s) | |||
448 | if (s->s3->tmp.key_block != NULL) { | 448 | if (s->s3->tmp.key_block != NULL) { |
449 | OPENSSL_cleanse(s->s3->tmp.key_block, | 449 | OPENSSL_cleanse(s->s3->tmp.key_block, |
450 | s->s3->tmp.key_block_length); | 450 | s->s3->tmp.key_block_length); |
451 | OPENSSL_free(s->s3->tmp.key_block); | 451 | free(s->s3->tmp.key_block); |
452 | s->s3->tmp.key_block = NULL; | 452 | s->s3->tmp.key_block = NULL; |
453 | } | 453 | } |
454 | s->s3->tmp.key_block_length = 0; | 454 | s->s3->tmp.key_block_length = 0; |
@@ -548,7 +548,7 @@ ssl3_free_digest_list(SSL *s) | |||
548 | if (s->s3->handshake_dgst[i]) | 548 | if (s->s3->handshake_dgst[i]) |
549 | EVP_MD_CTX_destroy(s->s3->handshake_dgst[i]); | 549 | EVP_MD_CTX_destroy(s->s3->handshake_dgst[i]); |
550 | } | 550 | } |
551 | OPENSSL_free(s->s3->handshake_dgst); | 551 | free(s->s3->handshake_dgst); |
552 | s->s3->handshake_dgst = NULL; | 552 | s->s3->handshake_dgst = NULL; |
553 | } | 553 | } |
554 | 554 | ||
@@ -579,7 +579,7 @@ ssl3_digest_cached_records(SSL *s) | |||
579 | 579 | ||
580 | /* Allocate handshake_dgst array */ | 580 | /* Allocate handshake_dgst array */ |
581 | ssl3_free_digest_list(s); | 581 | ssl3_free_digest_list(s); |
582 | s->s3->handshake_dgst = OPENSSL_malloc(SSL_MAX_DIGEST * sizeof(EVP_MD_CTX *)); | 582 | s->s3->handshake_dgst = malloc(SSL_MAX_DIGEST * sizeof(EVP_MD_CTX *)); |
583 | memset(s->s3->handshake_dgst, 0, SSL_MAX_DIGEST *sizeof(EVP_MD_CTX *)); | 583 | memset(s->s3->handshake_dgst, 0, SSL_MAX_DIGEST *sizeof(EVP_MD_CTX *)); |
584 | hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); | 584 | hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); |
585 | if (hdatalen <= 0) { | 585 | if (hdatalen <= 0) { |
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c index 68a4b8ca2d..8df07a1e4c 100644 --- a/src/lib/libssl/src/ssl/s3_lib.c +++ b/src/lib/libssl/src/ssl/s3_lib.c | |||
@@ -2946,7 +2946,7 @@ ssl3_new(SSL *s) | |||
2946 | { | 2946 | { |
2947 | SSL3_STATE *s3; | 2947 | SSL3_STATE *s3; |
2948 | 2948 | ||
2949 | if ((s3 = OPENSSL_malloc(sizeof *s3)) == NULL) goto err; | 2949 | if ((s3 = malloc(sizeof *s3)) == NULL) goto err; |
2950 | memset(s3, 0, sizeof *s3); | 2950 | memset(s3, 0, sizeof *s3); |
2951 | memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num)); | 2951 | memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num)); |
2952 | memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num)); | 2952 | memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num)); |
@@ -2970,9 +2970,9 @@ ssl3_free(SSL *s) | |||
2970 | 2970 | ||
2971 | #ifdef TLSEXT_TYPE_opaque_prf_input | 2971 | #ifdef TLSEXT_TYPE_opaque_prf_input |
2972 | if (s->s3->client_opaque_prf_input != NULL) | 2972 | if (s->s3->client_opaque_prf_input != NULL) |
2973 | OPENSSL_free(s->s3->client_opaque_prf_input); | 2973 | free(s->s3->client_opaque_prf_input); |
2974 | if (s->s3->server_opaque_prf_input != NULL) | 2974 | if (s->s3->server_opaque_prf_input != NULL) |
2975 | OPENSSL_free(s->s3->server_opaque_prf_input); | 2975 | free(s->s3->server_opaque_prf_input); |
2976 | #endif | 2976 | #endif |
2977 | 2977 | ||
2978 | ssl3_cleanup_key_block(s); | 2978 | ssl3_cleanup_key_block(s); |
@@ -2981,7 +2981,7 @@ ssl3_free(SSL *s) | |||
2981 | if (s->s3->wbuf.buf != NULL) | 2981 | if (s->s3->wbuf.buf != NULL) |
2982 | ssl3_release_write_buffer(s); | 2982 | ssl3_release_write_buffer(s); |
2983 | if (s->s3->rrec.comp != NULL) | 2983 | if (s->s3->rrec.comp != NULL) |
2984 | OPENSSL_free(s->s3->rrec.comp); | 2984 | free(s->s3->rrec.comp); |
2985 | #ifndef OPENSSL_NO_DH | 2985 | #ifndef OPENSSL_NO_DH |
2986 | if (s->s3->tmp.dh != NULL) | 2986 | if (s->s3->tmp.dh != NULL) |
2987 | DH_free(s->s3->tmp.dh); | 2987 | DH_free(s->s3->tmp.dh); |
@@ -3002,7 +3002,7 @@ ssl3_free(SSL *s) | |||
3002 | SSL_SRP_CTX_free(s); | 3002 | SSL_SRP_CTX_free(s); |
3003 | #endif | 3003 | #endif |
3004 | OPENSSL_cleanse(s->s3, sizeof *s->s3); | 3004 | OPENSSL_cleanse(s->s3, sizeof *s->s3); |
3005 | OPENSSL_free(s->s3); | 3005 | free(s->s3); |
3006 | s->s3 = NULL; | 3006 | s->s3 = NULL; |
3007 | } | 3007 | } |
3008 | 3008 | ||
@@ -3015,10 +3015,10 @@ ssl3_clear(SSL *s) | |||
3015 | 3015 | ||
3016 | #ifdef TLSEXT_TYPE_opaque_prf_input | 3016 | #ifdef TLSEXT_TYPE_opaque_prf_input |
3017 | if (s->s3->client_opaque_prf_input != NULL) | 3017 | if (s->s3->client_opaque_prf_input != NULL) |
3018 | OPENSSL_free(s->s3->client_opaque_prf_input); | 3018 | free(s->s3->client_opaque_prf_input); |
3019 | s->s3->client_opaque_prf_input = NULL; | 3019 | s->s3->client_opaque_prf_input = NULL; |
3020 | if (s->s3->server_opaque_prf_input != NULL) | 3020 | if (s->s3->server_opaque_prf_input != NULL) |
3021 | OPENSSL_free(s->s3->server_opaque_prf_input); | 3021 | free(s->s3->server_opaque_prf_input); |
3022 | s->s3->server_opaque_prf_input = NULL; | 3022 | s->s3->server_opaque_prf_input = NULL; |
3023 | #endif | 3023 | #endif |
3024 | 3024 | ||
@@ -3027,7 +3027,7 @@ ssl3_clear(SSL *s) | |||
3027 | sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); | 3027 | sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); |
3028 | 3028 | ||
3029 | if (s->s3->rrec.comp != NULL) { | 3029 | if (s->s3->rrec.comp != NULL) { |
3030 | OPENSSL_free(s->s3->rrec.comp); | 3030 | free(s->s3->rrec.comp); |
3031 | s->s3->rrec.comp = NULL; | 3031 | s->s3->rrec.comp = NULL; |
3032 | } | 3032 | } |
3033 | #ifndef OPENSSL_NO_DH | 3033 | #ifndef OPENSSL_NO_DH |
@@ -3078,7 +3078,7 @@ ssl3_clear(SSL *s) | |||
3078 | 3078 | ||
3079 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 3079 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
3080 | if (s->next_proto_negotiated) { | 3080 | if (s->next_proto_negotiated) { |
3081 | OPENSSL_free(s->next_proto_negotiated); | 3081 | free(s->next_proto_negotiated); |
3082 | s->next_proto_negotiated = NULL; | 3082 | s->next_proto_negotiated = NULL; |
3083 | s->next_proto_negotiated_len = 0; | 3083 | s->next_proto_negotiated_len = 0; |
3084 | } | 3084 | } |
@@ -3236,7 +3236,7 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
3236 | case SSL_CTRL_SET_TLSEXT_HOSTNAME: | 3236 | case SSL_CTRL_SET_TLSEXT_HOSTNAME: |
3237 | if (larg == TLSEXT_NAMETYPE_host_name) { | 3237 | if (larg == TLSEXT_NAMETYPE_host_name) { |
3238 | if (s->tlsext_hostname != NULL) | 3238 | if (s->tlsext_hostname != NULL) |
3239 | OPENSSL_free(s->tlsext_hostname); | 3239 | free(s->tlsext_hostname); |
3240 | s->tlsext_hostname = NULL; | 3240 | s->tlsext_hostname = NULL; |
3241 | 3241 | ||
3242 | ret = 1; | 3242 | ret = 1; |
@@ -3269,9 +3269,9 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
3269 | break; | 3269 | break; |
3270 | } | 3270 | } |
3271 | if (s->tlsext_opaque_prf_input != NULL) | 3271 | if (s->tlsext_opaque_prf_input != NULL) |
3272 | OPENSSL_free(s->tlsext_opaque_prf_input); | 3272 | free(s->tlsext_opaque_prf_input); |
3273 | if ((size_t)larg == 0) | 3273 | if ((size_t)larg == 0) |
3274 | s->tlsext_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 3274 | s->tlsext_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
3275 | else | 3275 | else |
3276 | s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg); | 3276 | s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg); |
3277 | if (s->tlsext_opaque_prf_input != NULL) { | 3277 | if (s->tlsext_opaque_prf_input != NULL) { |
@@ -3313,7 +3313,7 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
3313 | 3313 | ||
3314 | case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP: | 3314 | case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP: |
3315 | if (s->tlsext_ocsp_resp) | 3315 | if (s->tlsext_ocsp_resp) |
3316 | OPENSSL_free(s->tlsext_ocsp_resp); | 3316 | free(s->tlsext_ocsp_resp); |
3317 | s->tlsext_ocsp_resp = parg; | 3317 | s->tlsext_ocsp_resp = parg; |
3318 | s->tlsext_ocsp_resplen = larg; | 3318 | s->tlsext_ocsp_resplen = larg; |
3319 | ret = 1; | 3319 | ret = 1; |
@@ -3537,7 +3537,7 @@ ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) | |||
3537 | case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME: | 3537 | case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME: |
3538 | ctx->srp_ctx.srp_Mask|=SSL_kSRP; | 3538 | ctx->srp_ctx.srp_Mask|=SSL_kSRP; |
3539 | if (ctx->srp_ctx.login != NULL) | 3539 | if (ctx->srp_ctx.login != NULL) |
3540 | OPENSSL_free(ctx->srp_ctx.login); | 3540 | free(ctx->srp_ctx.login); |
3541 | ctx->srp_ctx.login = NULL; | 3541 | ctx->srp_ctx.login = NULL; |
3542 | if (parg == NULL) | 3542 | if (parg == NULL) |
3543 | break; | 3543 | break; |
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c index cc46e241d4..927b0d7db1 100644 --- a/src/lib/libssl/src/ssl/s3_srvr.c +++ b/src/lib/libssl/src/ssl/s3_srvr.c | |||
@@ -1760,7 +1760,7 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1760 | NULL, 0, NULL); | 1760 | NULL, 0, NULL); |
1761 | 1761 | ||
1762 | encodedPoint = (unsigned char *) | 1762 | encodedPoint = (unsigned char *) |
1763 | OPENSSL_malloc(encodedlen*sizeof(unsigned char)); | 1763 | malloc(encodedlen*sizeof(unsigned char)); |
1764 | 1764 | ||
1765 | bn_ctx = BN_CTX_new(); | 1765 | bn_ctx = BN_CTX_new(); |
1766 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { | 1766 | if ((encodedPoint == NULL) || (bn_ctx == NULL)) { |
@@ -1891,7 +1891,7 @@ ssl3_send_server_key_exchange(SSL *s) | |||
1891 | p += 1; | 1891 | p += 1; |
1892 | memcpy((unsigned char*)p, | 1892 | memcpy((unsigned char*)p, |
1893 | (unsigned char *)encodedPoint, encodedlen); | 1893 | (unsigned char *)encodedPoint, encodedlen); |
1894 | OPENSSL_free(encodedPoint); | 1894 | free(encodedPoint); |
1895 | encodedPoint = NULL; | 1895 | encodedPoint = NULL; |
1896 | p += encodedlen; | 1896 | p += encodedlen; |
1897 | } | 1897 | } |
@@ -2012,7 +2012,7 @@ f_err: | |||
2012 | err: | 2012 | err: |
2013 | #ifndef OPENSSL_NO_ECDH | 2013 | #ifndef OPENSSL_NO_ECDH |
2014 | if (encodedPoint != NULL) | 2014 | if (encodedPoint != NULL) |
2015 | OPENSSL_free(encodedPoint); | 2015 | free(encodedPoint); |
2016 | BN_CTX_free(bn_ctx); | 2016 | BN_CTX_free(bn_ctx); |
2017 | #endif | 2017 | #endif |
2018 | EVP_MD_CTX_cleanup(&md_ctx); | 2018 | EVP_MD_CTX_cleanup(&md_ctx); |
@@ -2706,7 +2706,7 @@ ssl3_get_client_key_exchange(SSL *s) | |||
2706 | s2n(psk_len, t); | 2706 | s2n(psk_len, t); |
2707 | 2707 | ||
2708 | if (s->session->psk_identity != NULL) | 2708 | if (s->session->psk_identity != NULL) |
2709 | OPENSSL_free(s->session->psk_identity); | 2709 | free(s->session->psk_identity); |
2710 | s->session->psk_identity = BUF_strdup((char *)p); | 2710 | s->session->psk_identity = BUF_strdup((char *)p); |
2711 | if (s->session->psk_identity == NULL) { | 2711 | if (s->session->psk_identity == NULL) { |
2712 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 2712 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
@@ -2715,7 +2715,7 @@ ssl3_get_client_key_exchange(SSL *s) | |||
2715 | } | 2715 | } |
2716 | 2716 | ||
2717 | if (s->session->psk_identity_hint != NULL) | 2717 | if (s->session->psk_identity_hint != NULL) |
2718 | OPENSSL_free(s->session->psk_identity_hint); | 2718 | free(s->session->psk_identity_hint); |
2719 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); | 2719 | s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); |
2720 | if (s->ctx->psk_identity_hint != NULL && | 2720 | if (s->ctx->psk_identity_hint != NULL && |
2721 | s->session->psk_identity_hint == NULL) { | 2721 | s->session->psk_identity_hint == NULL) { |
@@ -2752,7 +2752,7 @@ ssl3_get_client_key_exchange(SSL *s) | |||
2752 | goto err; | 2752 | goto err; |
2753 | } | 2753 | } |
2754 | if (s->session->srp_username != NULL) | 2754 | if (s->session->srp_username != NULL) |
2755 | OPENSSL_free(s->session->srp_username); | 2755 | free(s->session->srp_username); |
2756 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); | 2756 | s->session->srp_username = BUF_strdup(s->srp_ctx.login); |
2757 | if (s->session->srp_username == NULL) { | 2757 | if (s->session->srp_username == NULL) { |
2758 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 2758 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
@@ -3314,7 +3314,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3314 | */ | 3314 | */ |
3315 | if (slen_full > 0xFF00) | 3315 | if (slen_full > 0xFF00) |
3316 | return -1; | 3316 | return -1; |
3317 | senc = OPENSSL_malloc(slen_full); | 3317 | senc = malloc(slen_full); |
3318 | if (!senc) | 3318 | if (!senc) |
3319 | return -1; | 3319 | return -1; |
3320 | p = senc; | 3320 | p = senc; |
@@ -3327,7 +3327,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3327 | const_p = senc; | 3327 | const_p = senc; |
3328 | sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); | 3328 | sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); |
3329 | if (sess == NULL) { | 3329 | if (sess == NULL) { |
3330 | OPENSSL_free(senc); | 3330 | free(senc); |
3331 | return -1; | 3331 | return -1; |
3332 | } | 3332 | } |
3333 | 3333 | ||
@@ -3337,7 +3337,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3337 | slen = i2d_SSL_SESSION(sess, NULL); | 3337 | slen = i2d_SSL_SESSION(sess, NULL); |
3338 | if (slen > slen_full) { | 3338 | if (slen > slen_full) { |
3339 | /* shouldn't ever happen */ | 3339 | /* shouldn't ever happen */ |
3340 | OPENSSL_free(senc); | 3340 | free(senc); |
3341 | return -1; | 3341 | return -1; |
3342 | } | 3342 | } |
3343 | p = senc; | 3343 | p = senc; |
@@ -3372,7 +3372,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3372 | if (tctx->tlsext_ticket_key_cb) { | 3372 | if (tctx->tlsext_ticket_key_cb) { |
3373 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, | 3373 | if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx, |
3374 | &hctx, 1) < 0) { | 3374 | &hctx, 1) < 0) { |
3375 | OPENSSL_free(senc); | 3375 | free(senc); |
3376 | return -1; | 3376 | return -1; |
3377 | } | 3377 | } |
3378 | } else { | 3378 | } else { |
@@ -3426,7 +3426,7 @@ ssl3_send_newsession_ticket(SSL *s) | |||
3426 | s->init_num = len; | 3426 | s->init_num = len; |
3427 | s->state = SSL3_ST_SW_SESSION_TICKET_B; | 3427 | s->state = SSL3_ST_SW_SESSION_TICKET_B; |
3428 | s->init_off = 0; | 3428 | s->init_off = 0; |
3429 | OPENSSL_free(senc); | 3429 | free(senc); |
3430 | } | 3430 | } |
3431 | 3431 | ||
3432 | /* SSL3_ST_SW_SESSION_TICKET_B */ | 3432 | /* SSL3_ST_SW_SESSION_TICKET_B */ |
@@ -3529,7 +3529,7 @@ ssl3_get_next_proto(SSL *s) | |||
3529 | if (proto_len + padding_len + 2 != s->init_num) | 3529 | if (proto_len + padding_len + 2 != s->init_num) |
3530 | return 0; | 3530 | return 0; |
3531 | 3531 | ||
3532 | s->next_proto_negotiated = OPENSSL_malloc(proto_len); | 3532 | s->next_proto_negotiated = malloc(proto_len); |
3533 | if (!s->next_proto_negotiated) { | 3533 | if (!s->next_proto_negotiated) { |
3534 | SSLerr(SSL_F_SSL3_GET_NEXT_PROTO, ERR_R_MALLOC_FAILURE); | 3534 | SSLerr(SSL_F_SSL3_GET_NEXT_PROTO, ERR_R_MALLOC_FAILURE); |
3535 | return 0; | 3535 | return 0; |
diff --git a/src/lib/libssl/src/ssl/ssl_asn1.c b/src/lib/libssl/src/ssl/ssl_asn1.c index 28e295f6a4..60ee189f29 100644 --- a/src/lib/libssl/src/ssl/ssl_asn1.c +++ b/src/lib/libssl/src/ssl/ssl_asn1.c | |||
@@ -145,7 +145,7 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
145 | 145 | ||
146 | /* Note that I cheat in the following 2 assignments. I know | 146 | /* Note that I cheat in the following 2 assignments. I know |
147 | * that if the ASN1_INTEGER passed to ASN1_INTEGER_set | 147 | * that if the ASN1_INTEGER passed to ASN1_INTEGER_set |
148 | * is > sizeof(long)+1, the buffer will not be re-OPENSSL_malloc()ed. | 148 | * is > sizeof(long)+1, the buffer will not be re-malloc()ed. |
149 | * This is a bit evil but makes things simple, no dynamic allocation | 149 | * This is a bit evil but makes things simple, no dynamic allocation |
150 | * to clean up :-) */ | 150 | * to clean up :-) */ |
151 | a.version.length = LSIZE2; | 151 | a.version.length = LSIZE2; |
@@ -375,7 +375,7 @@ long length) | |||
375 | ai.length = 0; | 375 | ai.length = 0; |
376 | M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); | 376 | M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); |
377 | if (ai.data != NULL) { | 377 | if (ai.data != NULL) { |
378 | OPENSSL_free(ai.data); | 378 | free(ai.data); |
379 | ai.data = NULL; | 379 | ai.data = NULL; |
380 | ai.length = 0; | 380 | ai.length = 0; |
381 | } | 381 | } |
@@ -385,7 +385,7 @@ long length) | |||
385 | ssl_version = (int)ASN1_INTEGER_get(aip); | 385 | ssl_version = (int)ASN1_INTEGER_get(aip); |
386 | ret->ssl_version = ssl_version; | 386 | ret->ssl_version = ssl_version; |
387 | if (ai.data != NULL) { | 387 | if (ai.data != NULL) { |
388 | OPENSSL_free(ai.data); | 388 | free(ai.data); |
389 | ai.data = NULL; | 389 | ai.data = NULL; |
390 | ai.length = 0; | 390 | ai.length = 0; |
391 | } | 391 | } |
@@ -439,7 +439,7 @@ long length) | |||
439 | else | 439 | else |
440 | ret->krb5_client_princ_len = os.length; | 440 | ret->krb5_client_princ_len = os.length; |
441 | memcpy(ret->krb5_client_princ, os.data, ret->krb5_client_princ_len); | 441 | memcpy(ret->krb5_client_princ, os.data, ret->krb5_client_princ_len); |
442 | OPENSSL_free(os.data); | 442 | free(os.data); |
443 | os.data = NULL; | 443 | os.data = NULL; |
444 | os.length = 0; | 444 | os.length = 0; |
445 | } else | 445 | } else |
@@ -453,13 +453,13 @@ long length) | |||
453 | ret->key_arg_length = os.length; | 453 | ret->key_arg_length = os.length; |
454 | memcpy(ret->key_arg, os.data, ret->key_arg_length); | 454 | memcpy(ret->key_arg, os.data, ret->key_arg_length); |
455 | if (os.data != NULL) | 455 | if (os.data != NULL) |
456 | OPENSSL_free(os.data); | 456 | free(os.data); |
457 | 457 | ||
458 | ai.length = 0; | 458 | ai.length = 0; |
459 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 1); | 459 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 1); |
460 | if (ai.data != NULL) { | 460 | if (ai.data != NULL) { |
461 | ret->time = ASN1_INTEGER_get(aip); | 461 | ret->time = ASN1_INTEGER_get(aip); |
462 | OPENSSL_free(ai.data); | 462 | free(ai.data); |
463 | ai.data = NULL; | 463 | ai.data = NULL; |
464 | ai.length = 0; | 464 | ai.length = 0; |
465 | } else | 465 | } else |
@@ -469,7 +469,7 @@ long length) | |||
469 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 2); | 469 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 2); |
470 | if (ai.data != NULL) { | 470 | if (ai.data != NULL) { |
471 | ret->timeout = ASN1_INTEGER_get(aip); | 471 | ret->timeout = ASN1_INTEGER_get(aip); |
472 | OPENSSL_free(ai.data); | 472 | free(ai.data); |
473 | ai.data = NULL; | 473 | ai.data = NULL; |
474 | ai.length = 0; | 474 | ai.length = 0; |
475 | } else | 475 | } else |
@@ -493,7 +493,7 @@ long length) | |||
493 | ret->sid_ctx_length = os.length; | 493 | ret->sid_ctx_length = os.length; |
494 | memcpy(ret->sid_ctx, os.data, os.length); | 494 | memcpy(ret->sid_ctx, os.data, os.length); |
495 | } | 495 | } |
496 | OPENSSL_free(os.data); | 496 | free(os.data); |
497 | os.data = NULL; | 497 | os.data = NULL; |
498 | os.length = 0; | 498 | os.length = 0; |
499 | } else | 499 | } else |
@@ -503,7 +503,7 @@ long length) | |||
503 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 5); | 503 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 5); |
504 | if (ai.data != NULL) { | 504 | if (ai.data != NULL) { |
505 | ret->verify_result = ASN1_INTEGER_get(aip); | 505 | ret->verify_result = ASN1_INTEGER_get(aip); |
506 | OPENSSL_free(ai.data); | 506 | free(ai.data); |
507 | ai.data = NULL; | 507 | ai.data = NULL; |
508 | ai.length = 0; | 508 | ai.length = 0; |
509 | } else | 509 | } else |
@@ -515,7 +515,7 @@ long length) | |||
515 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 6); | 515 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 6); |
516 | if (os.data) { | 516 | if (os.data) { |
517 | ret->tlsext_hostname = BUF_strndup((char *)os.data, os.length); | 517 | ret->tlsext_hostname = BUF_strndup((char *)os.data, os.length); |
518 | OPENSSL_free(os.data); | 518 | free(os.data); |
519 | os.data = NULL; | 519 | os.data = NULL; |
520 | os.length = 0; | 520 | os.length = 0; |
521 | } else | 521 | } else |
@@ -528,7 +528,7 @@ long length) | |||
528 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 7); | 528 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 7); |
529 | if (os.data) { | 529 | if (os.data) { |
530 | ret->psk_identity_hint = BUF_strndup((char *)os.data, os.length); | 530 | ret->psk_identity_hint = BUF_strndup((char *)os.data, os.length); |
531 | OPENSSL_free(os.data); | 531 | free(os.data); |
532 | os.data = NULL; | 532 | os.data = NULL; |
533 | os.length = 0; | 533 | os.length = 0; |
534 | } else | 534 | } else |
@@ -539,7 +539,7 @@ long length) | |||
539 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 8); | 539 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 8); |
540 | if (os.data) { | 540 | if (os.data) { |
541 | ret->psk_identity = BUF_strndup((char *)os.data, os.length); | 541 | ret->psk_identity = BUF_strndup((char *)os.data, os.length); |
542 | OPENSSL_free(os.data); | 542 | free(os.data); |
543 | os.data = NULL; | 543 | os.data = NULL; |
544 | os.length = 0; | 544 | os.length = 0; |
545 | } else | 545 | } else |
@@ -551,7 +551,7 @@ long length) | |||
551 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 9); | 551 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 9); |
552 | if (ai.data != NULL) { | 552 | if (ai.data != NULL) { |
553 | ret->tlsext_tick_lifetime_hint = ASN1_INTEGER_get(aip); | 553 | ret->tlsext_tick_lifetime_hint = ASN1_INTEGER_get(aip); |
554 | OPENSSL_free(ai.data); | 554 | free(ai.data); |
555 | ai.data = NULL; | 555 | ai.data = NULL; |
556 | ai.length = 0; | 556 | ai.length = 0; |
557 | } else if (ret->tlsext_ticklen && ret->session_id_length) | 557 | } else if (ret->tlsext_ticklen && ret->session_id_length) |
@@ -575,7 +575,7 @@ long length) | |||
575 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11); | 575 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11); |
576 | if (os.data) { | 576 | if (os.data) { |
577 | ret->compress_meth = os.data[0]; | 577 | ret->compress_meth = os.data[0]; |
578 | OPENSSL_free(os.data); | 578 | free(os.data); |
579 | os.data = NULL; | 579 | os.data = NULL; |
580 | } | 580 | } |
581 | #endif | 581 | #endif |
@@ -586,7 +586,7 @@ long length) | |||
586 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 12); | 586 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 12); |
587 | if (os.data) { | 587 | if (os.data) { |
588 | ret->srp_username = BUF_strndup((char *)os.data, os.length); | 588 | ret->srp_username = BUF_strndup((char *)os.data, os.length); |
589 | OPENSSL_free(os.data); | 589 | free(os.data); |
590 | os.data = NULL; | 590 | os.data = NULL; |
591 | os.length = 0; | 591 | os.length = 0; |
592 | } else | 592 | } else |
diff --git a/src/lib/libssl/src/ssl/ssl_cert.c b/src/lib/libssl/src/ssl/ssl_cert.c index 72b5d8d2bd..87dc80be20 100644 --- a/src/lib/libssl/src/ssl/ssl_cert.c +++ b/src/lib/libssl/src/ssl/ssl_cert.c | |||
@@ -180,7 +180,7 @@ CERT | |||
180 | { | 180 | { |
181 | CERT *ret; | 181 | CERT *ret; |
182 | 182 | ||
183 | ret = (CERT *)OPENSSL_malloc(sizeof(CERT)); | 183 | ret = (CERT *)malloc(sizeof(CERT)); |
184 | if (ret == NULL) { | 184 | if (ret == NULL) { |
185 | SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE); | 185 | SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE); |
186 | return (NULL); | 186 | return (NULL); |
@@ -199,7 +199,7 @@ CERT | |||
199 | CERT *ret; | 199 | CERT *ret; |
200 | int i; | 200 | int i; |
201 | 201 | ||
202 | ret = (CERT *)OPENSSL_malloc(sizeof(CERT)); | 202 | ret = (CERT *)malloc(sizeof(CERT)); |
203 | if (ret == NULL) { | 203 | if (ret == NULL) { |
204 | SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE); | 204 | SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE); |
205 | return (NULL); | 205 | return (NULL); |
@@ -387,7 +387,7 @@ ssl_cert_free(CERT *c) | |||
387 | EVP_PKEY_free(c->pkeys[i].publickey); | 387 | EVP_PKEY_free(c->pkeys[i].publickey); |
388 | #endif | 388 | #endif |
389 | } | 389 | } |
390 | OPENSSL_free(c); | 390 | free(c); |
391 | } | 391 | } |
392 | 392 | ||
393 | int | 393 | int |
@@ -422,7 +422,7 @@ SESS_CERT | |||
422 | { | 422 | { |
423 | SESS_CERT *ret; | 423 | SESS_CERT *ret; |
424 | 424 | ||
425 | ret = OPENSSL_malloc(sizeof *ret); | 425 | ret = malloc(sizeof *ret); |
426 | if (ret == NULL) { | 426 | if (ret == NULL) { |
427 | SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE); | 427 | SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE); |
428 | return NULL; | 428 | return NULL; |
@@ -483,7 +483,7 @@ ssl_sess_cert_free(SESS_CERT *sc) | |||
483 | EC_KEY_free(sc->peer_ecdh_tmp); | 483 | EC_KEY_free(sc->peer_ecdh_tmp); |
484 | #endif | 484 | #endif |
485 | 485 | ||
486 | OPENSSL_free(sc); | 486 | free(sc); |
487 | } | 487 | } |
488 | 488 | ||
489 | int | 489 | int |
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c index 4bd3be0d41..b56a93d4cb 100644 --- a/src/lib/libssl/src/ssl/ssl_ciph.c +++ b/src/lib/libssl/src/ssl/ssl_ciph.c | |||
@@ -456,12 +456,12 @@ load_builtin_compressions(void) | |||
456 | MemCheck_off(); | 456 | MemCheck_off(); |
457 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); | 457 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); |
458 | if (ssl_comp_methods != NULL) { | 458 | if (ssl_comp_methods != NULL) { |
459 | comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); | 459 | comp = (SSL_COMP *)malloc(sizeof(SSL_COMP)); |
460 | if (comp != NULL) { | 460 | if (comp != NULL) { |
461 | comp->method = COMP_zlib(); | 461 | comp->method = COMP_zlib(); |
462 | if (comp->method && | 462 | if (comp->method && |
463 | comp->method->type == NID_undef) | 463 | comp->method->type == NID_undef) |
464 | OPENSSL_free(comp); | 464 | free(comp); |
465 | else { | 465 | else { |
466 | comp->id = SSL_COMP_ZLIB_IDX; | 466 | comp->id = SSL_COMP_ZLIB_IDX; |
467 | comp->name = comp->method->name; | 467 | comp->name = comp->method->name; |
@@ -1037,7 +1037,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) | |||
1037 | curr = curr->next; | 1037 | curr = curr->next; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int)); | 1040 | number_uses = malloc((max_strength_bits + 1) * sizeof(int)); |
1041 | if (!number_uses) { | 1041 | if (!number_uses) { |
1042 | SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE); | 1042 | SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE); |
1043 | return (0); | 1043 | return (0); |
@@ -1061,7 +1061,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) | |||
1061 | if (number_uses[i] > 0) | 1061 | if (number_uses[i] > 0) |
1062 | ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p); | 1062 | ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p); |
1063 | 1063 | ||
1064 | OPENSSL_free(number_uses); | 1064 | free(number_uses); |
1065 | return (1); | 1065 | return (1); |
1066 | } | 1066 | } |
1067 | 1067 | ||
@@ -1336,7 +1336,7 @@ STACK_OF(SSL_CIPHER) | |||
1336 | #ifdef KSSL_DEBUG | 1336 | #ifdef KSSL_DEBUG |
1337 | printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers); | 1337 | printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers); |
1338 | #endif /* KSSL_DEBUG */ | 1338 | #endif /* KSSL_DEBUG */ |
1339 | co_list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); | 1339 | co_list = (CIPHER_ORDER *)malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); |
1340 | if (co_list == NULL) { | 1340 | if (co_list == NULL) { |
1341 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); | 1341 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); |
1342 | return(NULL); /* Failure */ | 1342 | return(NULL); /* Failure */ |
@@ -1380,7 +1380,7 @@ STACK_OF(SSL_CIPHER) | |||
1380 | /* Now sort by symmetric encryption strength. The above ordering remains | 1380 | /* Now sort by symmetric encryption strength. The above ordering remains |
1381 | * in force within each class */ | 1381 | * in force within each class */ |
1382 | if (!ssl_cipher_strength_sort(&head, &tail)) { | 1382 | if (!ssl_cipher_strength_sort(&head, &tail)) { |
1383 | OPENSSL_free(co_list); | 1383 | free(co_list); |
1384 | return NULL; | 1384 | return NULL; |
1385 | } | 1385 | } |
1386 | 1386 | ||
@@ -1398,9 +1398,9 @@ STACK_OF(SSL_CIPHER) | |||
1398 | */ | 1398 | */ |
1399 | num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); | 1399 | num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); |
1400 | num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; | 1400 | num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; |
1401 | ca_list = OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); | 1401 | ca_list = malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); |
1402 | if (ca_list == NULL) { | 1402 | if (ca_list == NULL) { |
1403 | OPENSSL_free(co_list); | 1403 | free(co_list); |
1404 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); | 1404 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); |
1405 | return(NULL); /* Failure */ | 1405 | return(NULL); /* Failure */ |
1406 | } | 1406 | } |
@@ -1425,11 +1425,11 @@ STACK_OF(SSL_CIPHER) | |||
1425 | if (ok && (strlen(rule_p) > 0)) | 1425 | if (ok && (strlen(rule_p) > 0)) |
1426 | ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list); | 1426 | ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list); |
1427 | 1427 | ||
1428 | OPENSSL_free((void *)ca_list); /* Not needed anymore */ | 1428 | free((void *)ca_list); /* Not needed anymore */ |
1429 | 1429 | ||
1430 | if (!ok) | 1430 | if (!ok) |
1431 | { /* Rule processing failure */ | 1431 | { /* Rule processing failure */ |
1432 | OPENSSL_free(co_list); | 1432 | free(co_list); |
1433 | return (NULL); | 1433 | return (NULL); |
1434 | } | 1434 | } |
1435 | 1435 | ||
@@ -1438,7 +1438,7 @@ STACK_OF(SSL_CIPHER) | |||
1438 | * if we cannot get one. | 1438 | * if we cannot get one. |
1439 | */ | 1439 | */ |
1440 | if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { | 1440 | if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { |
1441 | OPENSSL_free(co_list); | 1441 | free(co_list); |
1442 | return (NULL); | 1442 | return (NULL); |
1443 | } | 1443 | } |
1444 | 1444 | ||
@@ -1454,7 +1454,7 @@ STACK_OF(SSL_CIPHER) | |||
1454 | #endif | 1454 | #endif |
1455 | } | 1455 | } |
1456 | } | 1456 | } |
1457 | OPENSSL_free(co_list); /* Not needed any longer */ | 1457 | free(co_list); /* Not needed any longer */ |
1458 | 1458 | ||
1459 | tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack); | 1459 | tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack); |
1460 | if (tmp_cipher_list == NULL) { | 1460 | if (tmp_cipher_list == NULL) { |
@@ -1642,9 +1642,9 @@ char | |||
1642 | 1642 | ||
1643 | if (buf == NULL) { | 1643 | if (buf == NULL) { |
1644 | len = 128; | 1644 | len = 128; |
1645 | buf = OPENSSL_malloc(len); | 1645 | buf = malloc(len); |
1646 | if (buf == NULL) | 1646 | if (buf == NULL) |
1647 | return("OPENSSL_malloc Error"); | 1647 | return("malloc Error"); |
1648 | } else if (len < 128) | 1648 | } else if (len < 128) |
1649 | return("Buffer too small"); | 1649 | return("Buffer too small"); |
1650 | 1650 | ||
@@ -1767,19 +1767,19 @@ SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) | |||
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | MemCheck_off(); | 1769 | MemCheck_off(); |
1770 | comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); | 1770 | comp = (SSL_COMP *)malloc(sizeof(SSL_COMP)); |
1771 | comp->id = id; | 1771 | comp->id = id; |
1772 | comp->method = cm; | 1772 | comp->method = cm; |
1773 | load_builtin_compressions(); | 1773 | load_builtin_compressions(); |
1774 | if (ssl_comp_methods && | 1774 | if (ssl_comp_methods && |
1775 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { | 1775 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { |
1776 | OPENSSL_free(comp); | 1776 | free(comp); |
1777 | MemCheck_on(); | 1777 | MemCheck_on(); |
1778 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID); | 1778 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID); |
1779 | return (1); | 1779 | return (1); |
1780 | } else if ((ssl_comp_methods == NULL) || | 1780 | } else if ((ssl_comp_methods == NULL) || |
1781 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { | 1781 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { |
1782 | OPENSSL_free(comp); | 1782 | free(comp); |
1783 | MemCheck_on(); | 1783 | MemCheck_on(); |
1784 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE); | 1784 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE); |
1785 | return (1); | 1785 | return (1); |
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c index 6db3bd2993..589bd625bb 100644 --- a/src/lib/libssl/src/ssl/ssl_lib.c +++ b/src/lib/libssl/src/ssl/ssl_lib.c | |||
@@ -281,7 +281,7 @@ SSL | |||
281 | return (NULL); | 281 | return (NULL); |
282 | } | 282 | } |
283 | 283 | ||
284 | s = (SSL *)OPENSSL_malloc(sizeof(SSL)); | 284 | s = (SSL *)malloc(sizeof(SSL)); |
285 | if (s == NULL) | 285 | if (s == NULL) |
286 | goto err; | 286 | goto err; |
287 | memset(s, 0, sizeof(SSL)); | 287 | memset(s, 0, sizeof(SSL)); |
@@ -380,7 +380,7 @@ err: | |||
380 | ssl_cert_free(s->cert); | 380 | ssl_cert_free(s->cert); |
381 | if (s->ctx != NULL) | 381 | if (s->ctx != NULL) |
382 | SSL_CTX_free(s->ctx); /* decrement reference count */ | 382 | SSL_CTX_free(s->ctx); /* decrement reference count */ |
383 | OPENSSL_free(s); | 383 | free(s); |
384 | } | 384 | } |
385 | SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); | 385 | SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); |
386 | return (NULL); | 386 | return (NULL); |
@@ -558,24 +558,24 @@ SSL_free(SSL *s) | |||
558 | 558 | ||
559 | #ifndef OPENSSL_NO_TLSEXT | 559 | #ifndef OPENSSL_NO_TLSEXT |
560 | if (s->tlsext_hostname) | 560 | if (s->tlsext_hostname) |
561 | OPENSSL_free(s->tlsext_hostname); | 561 | free(s->tlsext_hostname); |
562 | if (s->initial_ctx) | 562 | if (s->initial_ctx) |
563 | SSL_CTX_free(s->initial_ctx); | 563 | SSL_CTX_free(s->initial_ctx); |
564 | #ifndef OPENSSL_NO_EC | 564 | #ifndef OPENSSL_NO_EC |
565 | if (s->tlsext_ecpointformatlist) | 565 | if (s->tlsext_ecpointformatlist) |
566 | OPENSSL_free(s->tlsext_ecpointformatlist); | 566 | free(s->tlsext_ecpointformatlist); |
567 | if (s->tlsext_ellipticcurvelist) | 567 | if (s->tlsext_ellipticcurvelist) |
568 | OPENSSL_free(s->tlsext_ellipticcurvelist); | 568 | free(s->tlsext_ellipticcurvelist); |
569 | #endif /* OPENSSL_NO_EC */ | 569 | #endif /* OPENSSL_NO_EC */ |
570 | if (s->tlsext_opaque_prf_input) | 570 | if (s->tlsext_opaque_prf_input) |
571 | OPENSSL_free(s->tlsext_opaque_prf_input); | 571 | free(s->tlsext_opaque_prf_input); |
572 | if (s->tlsext_ocsp_exts) | 572 | if (s->tlsext_ocsp_exts) |
573 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, | 573 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, |
574 | X509_EXTENSION_free); | 574 | X509_EXTENSION_free); |
575 | if (s->tlsext_ocsp_ids) | 575 | if (s->tlsext_ocsp_ids) |
576 | sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); | 576 | sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); |
577 | if (s->tlsext_ocsp_resp) | 577 | if (s->tlsext_ocsp_resp) |
578 | OPENSSL_free(s->tlsext_ocsp_resp); | 578 | free(s->tlsext_ocsp_resp); |
579 | #endif | 579 | #endif |
580 | 580 | ||
581 | if (s->client_CA != NULL) | 581 | if (s->client_CA != NULL) |
@@ -594,7 +594,7 @@ SSL_free(SSL *s) | |||
594 | 594 | ||
595 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 595 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
596 | if (s->next_proto_negotiated) | 596 | if (s->next_proto_negotiated) |
597 | OPENSSL_free(s->next_proto_negotiated); | 597 | free(s->next_proto_negotiated); |
598 | #endif | 598 | #endif |
599 | 599 | ||
600 | #ifndef OPENSSL_NO_SRTP | 600 | #ifndef OPENSSL_NO_SRTP |
@@ -602,7 +602,7 @@ SSL_free(SSL *s) | |||
602 | sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); | 602 | sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); |
603 | #endif | 603 | #endif |
604 | 604 | ||
605 | OPENSSL_free(s); | 605 | free(s); |
606 | } | 606 | } |
607 | 607 | ||
608 | void | 608 | void |
@@ -1703,7 +1703,7 @@ SSL_CTX | |||
1703 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); | 1703 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); |
1704 | goto err; | 1704 | goto err; |
1705 | } | 1705 | } |
1706 | ret = (SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX)); | 1706 | ret = (SSL_CTX *)malloc(sizeof(SSL_CTX)); |
1707 | if (ret == NULL) | 1707 | if (ret == NULL) |
1708 | goto err; | 1708 | goto err; |
1709 | 1709 | ||
@@ -1862,7 +1862,7 @@ err2: | |||
1862 | #if 0 | 1862 | #if 0 |
1863 | static void | 1863 | static void |
1864 | SSL_COMP_free(SSL_COMP *comp) | 1864 | SSL_COMP_free(SSL_COMP *comp) |
1865 | { OPENSSL_free(comp); | 1865 | { free(comp); |
1866 | } | 1866 | } |
1867 | #endif | 1867 | #endif |
1868 | 1868 | ||
@@ -1933,7 +1933,7 @@ SSL_CTX_free(SSL_CTX *a) | |||
1933 | 1933 | ||
1934 | #ifndef OPENSSL_NO_PSK | 1934 | #ifndef OPENSSL_NO_PSK |
1935 | if (a->psk_identity_hint) | 1935 | if (a->psk_identity_hint) |
1936 | OPENSSL_free(a->psk_identity_hint); | 1936 | free(a->psk_identity_hint); |
1937 | #endif | 1937 | #endif |
1938 | #ifndef OPENSSL_NO_SRP | 1938 | #ifndef OPENSSL_NO_SRP |
1939 | SSL_CTX_SRP_CTX_free(a); | 1939 | SSL_CTX_SRP_CTX_free(a); |
@@ -1943,7 +1943,7 @@ SSL_CTX_free(SSL_CTX *a) | |||
1943 | ENGINE_finish(a->client_cert_engine); | 1943 | ENGINE_finish(a->client_cert_engine); |
1944 | #endif | 1944 | #endif |
1945 | 1945 | ||
1946 | OPENSSL_free(a); | 1946 | free(a); |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | void | 1949 | void |
@@ -2696,12 +2696,12 @@ ssl_clear_cipher_ctx(SSL *s) | |||
2696 | { | 2696 | { |
2697 | if (s->enc_read_ctx != NULL) { | 2697 | if (s->enc_read_ctx != NULL) { |
2698 | EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); | 2698 | EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); |
2699 | OPENSSL_free(s->enc_read_ctx); | 2699 | free(s->enc_read_ctx); |
2700 | s->enc_read_ctx = NULL; | 2700 | s->enc_read_ctx = NULL; |
2701 | } | 2701 | } |
2702 | if (s->enc_write_ctx != NULL) { | 2702 | if (s->enc_write_ctx != NULL) { |
2703 | EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); | 2703 | EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); |
2704 | OPENSSL_free(s->enc_write_ctx); | 2704 | free(s->enc_write_ctx); |
2705 | s->enc_write_ctx = NULL; | 2705 | s->enc_write_ctx = NULL; |
2706 | } | 2706 | } |
2707 | #ifndef OPENSSL_NO_COMP | 2707 | #ifndef OPENSSL_NO_COMP |
@@ -3095,7 +3095,7 @@ SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) | |||
3095 | return 0; | 3095 | return 0; |
3096 | } | 3096 | } |
3097 | if (ctx->psk_identity_hint != NULL) | 3097 | if (ctx->psk_identity_hint != NULL) |
3098 | OPENSSL_free(ctx->psk_identity_hint); | 3098 | free(ctx->psk_identity_hint); |
3099 | if (identity_hint != NULL) { | 3099 | if (identity_hint != NULL) { |
3100 | ctx->psk_identity_hint = BUF_strdup(identity_hint); | 3100 | ctx->psk_identity_hint = BUF_strdup(identity_hint); |
3101 | if (ctx->psk_identity_hint == NULL) | 3101 | if (ctx->psk_identity_hint == NULL) |
@@ -3119,7 +3119,7 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint) | |||
3119 | return 0; | 3119 | return 0; |
3120 | } | 3120 | } |
3121 | if (s->session->psk_identity_hint != NULL) | 3121 | if (s->session->psk_identity_hint != NULL) |
3122 | OPENSSL_free(s->session->psk_identity_hint); | 3122 | free(s->session->psk_identity_hint); |
3123 | if (identity_hint != NULL) { | 3123 | if (identity_hint != NULL) { |
3124 | s->session->psk_identity_hint = BUF_strdup(identity_hint); | 3124 | s->session->psk_identity_hint = BUF_strdup(identity_hint); |
3125 | if (s->session->psk_identity_hint == NULL) | 3125 | if (s->session->psk_identity_hint == NULL) |
diff --git a/src/lib/libssl/src/ssl/ssl_sess.c b/src/lib/libssl/src/ssl/ssl_sess.c index 0b1c655820..f9f6ee5ecb 100644 --- a/src/lib/libssl/src/ssl/ssl_sess.c +++ b/src/lib/libssl/src/ssl/ssl_sess.c | |||
@@ -195,7 +195,7 @@ SSL_SESSION | |||
195 | { | 195 | { |
196 | SSL_SESSION *ss; | 196 | SSL_SESSION *ss; |
197 | 197 | ||
198 | ss = (SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION)); | 198 | ss = (SSL_SESSION *)malloc(sizeof(SSL_SESSION)); |
199 | if (ss == NULL) { | 199 | if (ss == NULL) { |
200 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); | 200 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); |
201 | return (0); | 201 | return (0); |
@@ -371,8 +371,8 @@ ssl_get_new_session(SSL *s, int session) | |||
371 | #ifndef OPENSSL_NO_EC | 371 | #ifndef OPENSSL_NO_EC |
372 | if (s->tlsext_ecpointformatlist) { | 372 | if (s->tlsext_ecpointformatlist) { |
373 | if (ss->tlsext_ecpointformatlist != NULL) | 373 | if (ss->tlsext_ecpointformatlist != NULL) |
374 | OPENSSL_free(ss->tlsext_ecpointformatlist); | 374 | free(ss->tlsext_ecpointformatlist); |
375 | if ((ss->tlsext_ecpointformatlist = OPENSSL_malloc(s->tlsext_ecpointformatlist_length)) == NULL) { | 375 | if ((ss->tlsext_ecpointformatlist = malloc(s->tlsext_ecpointformatlist_length)) == NULL) { |
376 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); | 376 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); |
377 | SSL_SESSION_free(ss); | 377 | SSL_SESSION_free(ss); |
378 | return 0; | 378 | return 0; |
@@ -382,8 +382,8 @@ ssl_get_new_session(SSL *s, int session) | |||
382 | } | 382 | } |
383 | if (s->tlsext_ellipticcurvelist) { | 383 | if (s->tlsext_ellipticcurvelist) { |
384 | if (ss->tlsext_ellipticcurvelist != NULL) | 384 | if (ss->tlsext_ellipticcurvelist != NULL) |
385 | OPENSSL_free(ss->tlsext_ellipticcurvelist); | 385 | free(ss->tlsext_ellipticcurvelist); |
386 | if ((ss->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { | 386 | if ((ss->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { |
387 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); | 387 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); |
388 | SSL_SESSION_free(ss); | 388 | SSL_SESSION_free(ss); |
389 | return 0; | 389 | return 0; |
@@ -719,30 +719,30 @@ SSL_SESSION_free(SSL_SESSION *ss) | |||
719 | sk_SSL_CIPHER_free(ss->ciphers); | 719 | sk_SSL_CIPHER_free(ss->ciphers); |
720 | #ifndef OPENSSL_NO_TLSEXT | 720 | #ifndef OPENSSL_NO_TLSEXT |
721 | if (ss->tlsext_hostname != NULL) | 721 | if (ss->tlsext_hostname != NULL) |
722 | OPENSSL_free(ss->tlsext_hostname); | 722 | free(ss->tlsext_hostname); |
723 | if (ss->tlsext_tick != NULL) | 723 | if (ss->tlsext_tick != NULL) |
724 | OPENSSL_free(ss->tlsext_tick); | 724 | free(ss->tlsext_tick); |
725 | #ifndef OPENSSL_NO_EC | 725 | #ifndef OPENSSL_NO_EC |
726 | ss->tlsext_ecpointformatlist_length = 0; | 726 | ss->tlsext_ecpointformatlist_length = 0; |
727 | if (ss->tlsext_ecpointformatlist != NULL) | 727 | if (ss->tlsext_ecpointformatlist != NULL) |
728 | OPENSSL_free(ss->tlsext_ecpointformatlist); | 728 | free(ss->tlsext_ecpointformatlist); |
729 | ss->tlsext_ellipticcurvelist_length = 0; | 729 | ss->tlsext_ellipticcurvelist_length = 0; |
730 | if (ss->tlsext_ellipticcurvelist != NULL) | 730 | if (ss->tlsext_ellipticcurvelist != NULL) |
731 | OPENSSL_free(ss->tlsext_ellipticcurvelist); | 731 | free(ss->tlsext_ellipticcurvelist); |
732 | #endif /* OPENSSL_NO_EC */ | 732 | #endif /* OPENSSL_NO_EC */ |
733 | #endif | 733 | #endif |
734 | #ifndef OPENSSL_NO_PSK | 734 | #ifndef OPENSSL_NO_PSK |
735 | if (ss->psk_identity_hint != NULL) | 735 | if (ss->psk_identity_hint != NULL) |
736 | OPENSSL_free(ss->psk_identity_hint); | 736 | free(ss->psk_identity_hint); |
737 | if (ss->psk_identity != NULL) | 737 | if (ss->psk_identity != NULL) |
738 | OPENSSL_free(ss->psk_identity); | 738 | free(ss->psk_identity); |
739 | #endif | 739 | #endif |
740 | #ifndef OPENSSL_NO_SRP | 740 | #ifndef OPENSSL_NO_SRP |
741 | if (ss->srp_username != NULL) | 741 | if (ss->srp_username != NULL) |
742 | OPENSSL_free(ss->srp_username); | 742 | free(ss->srp_username); |
743 | #endif | 743 | #endif |
744 | OPENSSL_cleanse(ss, sizeof(*ss)); | 744 | OPENSSL_cleanse(ss, sizeof(*ss)); |
745 | OPENSSL_free(ss); | 745 | free(ss); |
746 | } | 746 | } |
747 | 747 | ||
748 | int | 748 | int |
@@ -768,7 +768,7 @@ SSL_set_session(SSL *s, SSL_SESSION *session) | |||
768 | #ifndef OPENSSL_NO_KRB5 | 768 | #ifndef OPENSSL_NO_KRB5 |
769 | if (s->kssl_ctx && !s->kssl_ctx->client_princ && | 769 | if (s->kssl_ctx && !s->kssl_ctx->client_princ && |
770 | session->krb5_client_princ_len > 0) { | 770 | session->krb5_client_princ_len > 0) { |
771 | s->kssl_ctx->client_princ = (char *)OPENSSL_malloc(session->krb5_client_princ_len + 1); | 771 | s->kssl_ctx->client_princ = (char *)malloc(session->krb5_client_princ_len + 1); |
772 | memcpy(s->kssl_ctx->client_princ, session->krb5_client_princ, | 772 | memcpy(s->kssl_ctx->client_princ, session->krb5_client_princ, |
773 | session->krb5_client_princ_len); | 773 | session->krb5_client_princ_len); |
774 | s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0'; | 774 | s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0'; |
@@ -900,11 +900,11 @@ SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len) | |||
900 | { | 900 | { |
901 | if (s->version >= TLS1_VERSION) { | 901 | if (s->version >= TLS1_VERSION) { |
902 | if (s->tlsext_session_ticket) { | 902 | if (s->tlsext_session_ticket) { |
903 | OPENSSL_free(s->tlsext_session_ticket); | 903 | free(s->tlsext_session_ticket); |
904 | s->tlsext_session_ticket = NULL; | 904 | s->tlsext_session_ticket = NULL; |
905 | } | 905 | } |
906 | 906 | ||
907 | s->tlsext_session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len); | 907 | s->tlsext_session_ticket = malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len); |
908 | if (!s->tlsext_session_ticket) { | 908 | if (!s->tlsext_session_ticket) { |
909 | SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE); | 909 | SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE); |
910 | return 0; | 910 | return 0; |
diff --git a/src/lib/libssl/src/ssl/ssltest.c b/src/lib/libssl/src/ssl/ssltest.c index e56c811a47..a8228fbfa5 100644 --- a/src/lib/libssl/src/ssl/ssltest.c +++ b/src/lib/libssl/src/ssl/ssltest.c | |||
@@ -1601,7 +1601,7 @@ doit(SSL *s_ssl, SSL *c_ssl, long count) | |||
1601 | ret = 0; | 1601 | ret = 0; |
1602 | err: | 1602 | err: |
1603 | /* We have to set the BIO's to NULL otherwise they will be | 1603 | /* We have to set the BIO's to NULL otherwise they will be |
1604 | * OPENSSL_free()ed twice. Once when th s_ssl is SSL_free()ed and | 1604 | * free()ed twice. Once when th s_ssl is SSL_free()ed and |
1605 | * again when c_ssl is SSL_free()ed. | 1605 | * again when c_ssl is SSL_free()ed. |
1606 | * This is a hack required because s_ssl and c_ssl are sharing the same | 1606 | * This is a hack required because s_ssl and c_ssl are sharing the same |
1607 | * BIO structure and SSL_set_bio() and SSL_free() automatically | 1607 | * BIO structure and SSL_set_bio() and SSL_free() automatically |
diff --git a/src/lib/libssl/src/ssl/t1_enc.c b/src/lib/libssl/src/ssl/t1_enc.c index 71d9f164b4..fb471b2f14 100644 --- a/src/lib/libssl/src/ssl/t1_enc.c +++ b/src/lib/libssl/src/ssl/t1_enc.c | |||
@@ -367,7 +367,7 @@ tls1_change_cipher_state(SSL *s, int which) | |||
367 | 367 | ||
368 | if (s->enc_read_ctx != NULL) | 368 | if (s->enc_read_ctx != NULL) |
369 | reuse_dd = 1; | 369 | reuse_dd = 1; |
370 | else if ((s->enc_read_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) | 370 | else if ((s->enc_read_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL) |
371 | goto err; | 371 | goto err; |
372 | else | 372 | else |
373 | /* make sure it's intialized in case we exit later with an error */ | 373 | /* make sure it's intialized in case we exit later with an error */ |
@@ -387,7 +387,7 @@ tls1_change_cipher_state(SSL *s, int which) | |||
387 | } | 387 | } |
388 | if (s->s3->rrec.comp == NULL) | 388 | if (s->s3->rrec.comp == NULL) |
389 | s->s3->rrec.comp = (unsigned char *) | 389 | s->s3->rrec.comp = (unsigned char *) |
390 | OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH); | 390 | malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH); |
391 | if (s->s3->rrec.comp == NULL) | 391 | if (s->s3->rrec.comp == NULL) |
392 | goto err; | 392 | goto err; |
393 | } | 393 | } |
@@ -592,7 +592,7 @@ tls1_setup_key_block(SSL *s) | |||
592 | 592 | ||
593 | ssl3_cleanup_key_block(s); | 593 | ssl3_cleanup_key_block(s); |
594 | 594 | ||
595 | if ((p1 = (unsigned char *)OPENSSL_malloc(num)) == NULL) { | 595 | if ((p1 = (unsigned char *)malloc(num)) == NULL) { |
596 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); | 596 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); |
597 | goto err; | 597 | goto err; |
598 | } | 598 | } |
@@ -600,7 +600,7 @@ tls1_setup_key_block(SSL *s) | |||
600 | s->s3->tmp.key_block_length = num; | 600 | s->s3->tmp.key_block_length = num; |
601 | s->s3->tmp.key_block = p1; | 601 | s->s3->tmp.key_block = p1; |
602 | 602 | ||
603 | if ((p2 = (unsigned char *)OPENSSL_malloc(num)) == NULL) { | 603 | if ((p2 = (unsigned char *)malloc(num)) == NULL) { |
604 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); | 604 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); |
605 | goto err; | 605 | goto err; |
606 | } | 606 | } |
@@ -642,7 +642,7 @@ tls1_setup_key_block(SSL *s) | |||
642 | err: | 642 | err: |
643 | if (p2) { | 643 | if (p2) { |
644 | OPENSSL_cleanse(p2, num); | 644 | OPENSSL_cleanse(p2, num); |
645 | OPENSSL_free(p2); | 645 | free(p2); |
646 | } | 646 | } |
647 | return (ret); | 647 | return (ret); |
648 | } | 648 | } |
@@ -1074,7 +1074,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | |||
1074 | printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, olen, label, llen, p, plen); | 1074 | printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, olen, label, llen, p, plen); |
1075 | #endif /* KSSL_DEBUG */ | 1075 | #endif /* KSSL_DEBUG */ |
1076 | 1076 | ||
1077 | buff = OPENSSL_malloc(olen); | 1077 | buff = malloc(olen); |
1078 | if (buff == NULL) | 1078 | if (buff == NULL) |
1079 | goto err2; | 1079 | goto err2; |
1080 | 1080 | ||
@@ -1088,7 +1088,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | |||
1088 | vallen += 2 + contextlen; | 1088 | vallen += 2 + contextlen; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | val = OPENSSL_malloc(vallen); | 1091 | val = malloc(vallen); |
1092 | if (val == NULL) | 1092 | if (val == NULL) |
1093 | goto err2; | 1093 | goto err2; |
1094 | currentvalpos = 0; | 1094 | currentvalpos = 0; |
@@ -1145,9 +1145,9 @@ err2: | |||
1145 | rv = 0; | 1145 | rv = 0; |
1146 | ret: | 1146 | ret: |
1147 | if (buff != NULL) | 1147 | if (buff != NULL) |
1148 | OPENSSL_free(buff); | 1148 | free(buff); |
1149 | if (val != NULL) | 1149 | if (val != NULL) |
1150 | OPENSSL_free(val); | 1150 | free(val); |
1151 | return (rv); | 1151 | return (rv); |
1152 | } | 1152 | } |
1153 | 1153 | ||
diff --git a/src/lib/libssl/src/ssl/t1_lib.c b/src/lib/libssl/src/ssl/t1_lib.c index c3d62957ae..7ecf7e0658 100644 --- a/src/lib/libssl/src/ssl/t1_lib.c +++ b/src/lib/libssl/src/ssl/t1_lib.c | |||
@@ -162,7 +162,7 @@ tls1_free(SSL *s) | |||
162 | { | 162 | { |
163 | #ifndef OPENSSL_NO_TLSEXT | 163 | #ifndef OPENSSL_NO_TLSEXT |
164 | if (s->tlsext_session_ticket) { | 164 | if (s->tlsext_session_ticket) { |
165 | OPENSSL_free(s->tlsext_session_ticket); | 165 | free(s->tlsext_session_ticket); |
166 | } | 166 | } |
167 | #endif /* OPENSSL_NO_TLSEXT */ | 167 | #endif /* OPENSSL_NO_TLSEXT */ |
168 | ssl3_free(s); | 168 | ssl3_free(s); |
@@ -515,7 +515,7 @@ unsigned char | |||
515 | else if (s->session && s->tlsext_session_ticket && | 515 | else if (s->session && s->tlsext_session_ticket && |
516 | s->tlsext_session_ticket->data) { | 516 | s->tlsext_session_ticket->data) { |
517 | ticklen = s->tlsext_session_ticket->length; | 517 | ticklen = s->tlsext_session_ticket->length; |
518 | s->session->tlsext_tick = OPENSSL_malloc(ticklen); | 518 | s->session->tlsext_tick = malloc(ticklen); |
519 | if (!s->session->tlsext_tick) | 519 | if (!s->session->tlsext_tick) |
520 | return NULL; | 520 | return NULL; |
521 | memcpy(s->session->tlsext_tick, | 521 | memcpy(s->session->tlsext_tick, |
@@ -1037,14 +1037,14 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1037 | *al = TLS1_AD_UNRECOGNIZED_NAME; | 1037 | *al = TLS1_AD_UNRECOGNIZED_NAME; |
1038 | return 0; | 1038 | return 0; |
1039 | } | 1039 | } |
1040 | if ((s->session->tlsext_hostname = OPENSSL_malloc(len + 1)) == NULL) { | 1040 | if ((s->session->tlsext_hostname = malloc(len + 1)) == NULL) { |
1041 | *al = TLS1_AD_INTERNAL_ERROR; | 1041 | *al = TLS1_AD_INTERNAL_ERROR; |
1042 | return 0; | 1042 | return 0; |
1043 | } | 1043 | } |
1044 | memcpy(s->session->tlsext_hostname, sdata, len); | 1044 | memcpy(s->session->tlsext_hostname, sdata, len); |
1045 | s->session->tlsext_hostname[len] = '\0'; | 1045 | s->session->tlsext_hostname[len] = '\0'; |
1046 | if (strlen(s->session->tlsext_hostname) != len) { | 1046 | if (strlen(s->session->tlsext_hostname) != len) { |
1047 | OPENSSL_free(s->session->tlsext_hostname); | 1047 | free(s->session->tlsext_hostname); |
1048 | s->session->tlsext_hostname = NULL; | 1048 | s->session->tlsext_hostname = NULL; |
1049 | *al = TLS1_AD_UNRECOGNIZED_NAME; | 1049 | *al = TLS1_AD_UNRECOGNIZED_NAME; |
1050 | return 0; | 1050 | return 0; |
@@ -1081,7 +1081,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1081 | *al = SSL_AD_DECODE_ERROR; | 1081 | *al = SSL_AD_DECODE_ERROR; |
1082 | return 0; | 1082 | return 0; |
1083 | } | 1083 | } |
1084 | if ((s->srp_ctx.login = OPENSSL_malloc(len + 1)) == NULL) | 1084 | if ((s->srp_ctx.login = malloc(len + 1)) == NULL) |
1085 | return -1; | 1085 | return -1; |
1086 | memcpy(s->srp_ctx.login, &data[1], len); | 1086 | memcpy(s->srp_ctx.login, &data[1], len); |
1087 | s->srp_ctx.login[len] = '\0'; | 1087 | s->srp_ctx.login[len] = '\0'; |
@@ -1105,11 +1105,11 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1105 | } | 1105 | } |
1106 | if (!s->hit) { | 1106 | if (!s->hit) { |
1107 | if (s->session->tlsext_ecpointformatlist) { | 1107 | if (s->session->tlsext_ecpointformatlist) { |
1108 | OPENSSL_free(s->session->tlsext_ecpointformatlist); | 1108 | free(s->session->tlsext_ecpointformatlist); |
1109 | s->session->tlsext_ecpointformatlist = NULL; | 1109 | s->session->tlsext_ecpointformatlist = NULL; |
1110 | } | 1110 | } |
1111 | s->session->tlsext_ecpointformatlist_length = 0; | 1111 | s->session->tlsext_ecpointformatlist_length = 0; |
1112 | if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { | 1112 | if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) { |
1113 | *al = TLS1_AD_INTERNAL_ERROR; | 1113 | *al = TLS1_AD_INTERNAL_ERROR; |
1114 | return 0; | 1114 | return 0; |
1115 | } | 1115 | } |
@@ -1140,7 +1140,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1140 | return 0; | 1140 | return 0; |
1141 | } | 1141 | } |
1142 | s->session->tlsext_ellipticcurvelist_length = 0; | 1142 | s->session->tlsext_ellipticcurvelist_length = 0; |
1143 | if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL) { | 1143 | if ((s->session->tlsext_ellipticcurvelist = malloc(ellipticcurvelist_length)) == NULL) { |
1144 | *al = TLS1_AD_INTERNAL_ERROR; | 1144 | *al = TLS1_AD_INTERNAL_ERROR; |
1145 | return 0; | 1145 | return 0; |
1146 | } | 1146 | } |
@@ -1172,9 +1172,9 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ | 1174 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ |
1175 | OPENSSL_free(s->s3->client_opaque_prf_input); | 1175 | free(s->s3->client_opaque_prf_input); |
1176 | if (s->s3->client_opaque_prf_input_len == 0) | 1176 | if (s->s3->client_opaque_prf_input_len == 0) |
1177 | s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1177 | s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1178 | else | 1178 | else |
1179 | s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len); | 1179 | s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len); |
1180 | if (s->s3->client_opaque_prf_input == NULL) { | 1180 | if (s->s3->client_opaque_prf_input == NULL) { |
@@ -1432,8 +1432,8 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, | |||
1432 | } | 1432 | } |
1433 | s->session->tlsext_ecpointformatlist_length = 0; | 1433 | s->session->tlsext_ecpointformatlist_length = 0; |
1434 | if (s->session->tlsext_ecpointformatlist != NULL) | 1434 | if (s->session->tlsext_ecpointformatlist != NULL) |
1435 | OPENSSL_free(s->session->tlsext_ecpointformatlist); | 1435 | free(s->session->tlsext_ecpointformatlist); |
1436 | if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { | 1436 | if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) { |
1437 | *al = TLS1_AD_INTERNAL_ERROR; | 1437 | *al = TLS1_AD_INTERNAL_ERROR; |
1438 | return 0; | 1438 | return 0; |
1439 | } | 1439 | } |
@@ -1478,9 +1478,9 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, | |||
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ | 1480 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ |
1481 | OPENSSL_free(s->s3->server_opaque_prf_input); | 1481 | free(s->s3->server_opaque_prf_input); |
1482 | if (s->s3->server_opaque_prf_input_len == 0) | 1482 | if (s->s3->server_opaque_prf_input_len == 0) |
1483 | s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1483 | s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1484 | else | 1484 | else |
1485 | s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len); | 1485 | s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len); |
1486 | 1486 | ||
@@ -1522,7 +1522,7 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, | |||
1522 | *al = TLS1_AD_INTERNAL_ERROR; | 1522 | *al = TLS1_AD_INTERNAL_ERROR; |
1523 | return 0; | 1523 | return 0; |
1524 | } | 1524 | } |
1525 | s->next_proto_negotiated = OPENSSL_malloc(selected_len); | 1525 | s->next_proto_negotiated = malloc(selected_len); |
1526 | if (!s->next_proto_negotiated) { | 1526 | if (!s->next_proto_negotiated) { |
1527 | *al = TLS1_AD_INTERNAL_ERROR; | 1527 | *al = TLS1_AD_INTERNAL_ERROR; |
1528 | return 0; | 1528 | return 0; |
@@ -1619,8 +1619,8 @@ ssl_prepare_clienthello_tlsext(SSL *s) | |||
1619 | using_ecc = using_ecc && (s->version >= TLS1_VERSION); | 1619 | using_ecc = using_ecc && (s->version >= TLS1_VERSION); |
1620 | if (using_ecc) { | 1620 | if (using_ecc) { |
1621 | if (s->tlsext_ecpointformatlist != NULL) | 1621 | if (s->tlsext_ecpointformatlist != NULL) |
1622 | OPENSSL_free(s->tlsext_ecpointformatlist); | 1622 | free(s->tlsext_ecpointformatlist); |
1623 | if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) { | 1623 | if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) { |
1624 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); | 1624 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); |
1625 | return -1; | 1625 | return -1; |
1626 | } | 1626 | } |
@@ -1631,9 +1631,9 @@ ssl_prepare_clienthello_tlsext(SSL *s) | |||
1631 | 1631 | ||
1632 | /* we support all named elliptic curves in draft-ietf-tls-ecc-12 */ | 1632 | /* we support all named elliptic curves in draft-ietf-tls-ecc-12 */ |
1633 | if (s->tlsext_ellipticcurvelist != NULL) | 1633 | if (s->tlsext_ellipticcurvelist != NULL) |
1634 | OPENSSL_free(s->tlsext_ellipticcurvelist); | 1634 | free(s->tlsext_ellipticcurvelist); |
1635 | s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2; | 1635 | s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2; |
1636 | if ((s->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { | 1636 | if ((s->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { |
1637 | s->tlsext_ellipticcurvelist_length = 0; | 1637 | s->tlsext_ellipticcurvelist_length = 0; |
1638 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); | 1638 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); |
1639 | return -1; | 1639 | return -1; |
@@ -1660,10 +1660,10 @@ ssl_prepare_clienthello_tlsext(SSL *s) | |||
1660 | 1660 | ||
1661 | if (s->tlsext_opaque_prf_input != NULL) { | 1661 | if (s->tlsext_opaque_prf_input != NULL) { |
1662 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ | 1662 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ |
1663 | OPENSSL_free(s->s3->client_opaque_prf_input); | 1663 | free(s->s3->client_opaque_prf_input); |
1664 | 1664 | ||
1665 | if (s->tlsext_opaque_prf_input_len == 0) | 1665 | if (s->tlsext_opaque_prf_input_len == 0) |
1666 | s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1666 | s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1667 | else | 1667 | else |
1668 | s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); | 1668 | s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); |
1669 | if (s->s3->client_opaque_prf_input == NULL) { | 1669 | if (s->s3->client_opaque_prf_input == NULL) { |
@@ -1698,8 +1698,8 @@ ssl_prepare_serverhello_tlsext(SSL *s) | |||
1698 | 1698 | ||
1699 | if (using_ecc) { | 1699 | if (using_ecc) { |
1700 | if (s->tlsext_ecpointformatlist != NULL) | 1700 | if (s->tlsext_ecpointformatlist != NULL) |
1701 | OPENSSL_free(s->tlsext_ecpointformatlist); | 1701 | free(s->tlsext_ecpointformatlist); |
1702 | if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) { | 1702 | if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) { |
1703 | SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); | 1703 | SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); |
1704 | return -1; | 1704 | return -1; |
1705 | } | 1705 | } |
@@ -1752,7 +1752,7 @@ ssl_check_clienthello_tlsext_early(SSL *s) | |||
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ | 1754 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ |
1755 | OPENSSL_free(s->s3->server_opaque_prf_input); | 1755 | free(s->s3->server_opaque_prf_input); |
1756 | s->s3->server_opaque_prf_input = NULL; | 1756 | s->s3->server_opaque_prf_input = NULL; |
1757 | 1757 | ||
1758 | if (s->tlsext_opaque_prf_input != NULL) { | 1758 | if (s->tlsext_opaque_prf_input != NULL) { |
@@ -1762,7 +1762,7 @@ ssl_check_clienthello_tlsext_early(SSL *s) | |||
1762 | * of the same length as the client opaque PRF input! */ | 1762 | * of the same length as the client opaque PRF input! */ |
1763 | 1763 | ||
1764 | if (s->tlsext_opaque_prf_input_len == 0) | 1764 | if (s->tlsext_opaque_prf_input_len == 0) |
1765 | s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1765 | s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1766 | else | 1766 | else |
1767 | s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); | 1767 | s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); |
1768 | if (s->s3->server_opaque_prf_input == NULL) { | 1768 | if (s->s3->server_opaque_prf_input == NULL) { |
@@ -1937,7 +1937,7 @@ ssl_check_serverhello_tlsext(SSL *s) | |||
1937 | * there is no response. | 1937 | * there is no response. |
1938 | */ | 1938 | */ |
1939 | if (s->tlsext_ocsp_resp) { | 1939 | if (s->tlsext_ocsp_resp) { |
1940 | OPENSSL_free(s->tlsext_ocsp_resp); | 1940 | free(s->tlsext_ocsp_resp); |
1941 | s->tlsext_ocsp_resp = NULL; | 1941 | s->tlsext_ocsp_resp = NULL; |
1942 | } | 1942 | } |
1943 | s->tlsext_ocsp_resplen = -1; | 1943 | s->tlsext_ocsp_resplen = -1; |
@@ -2156,7 +2156,7 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
2156 | /* Move p after IV to start of encrypted ticket, update length */ | 2156 | /* Move p after IV to start of encrypted ticket, update length */ |
2157 | p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); | 2157 | p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); |
2158 | eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); | 2158 | eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); |
2159 | sdec = OPENSSL_malloc(eticklen); | 2159 | sdec = malloc(eticklen); |
2160 | if (!sdec) { | 2160 | if (!sdec) { |
2161 | EVP_CIPHER_CTX_cleanup(&ctx); | 2161 | EVP_CIPHER_CTX_cleanup(&ctx); |
2162 | return -1; | 2162 | return -1; |
@@ -2169,7 +2169,7 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
2169 | p = sdec; | 2169 | p = sdec; |
2170 | 2170 | ||
2171 | sess = d2i_SSL_SESSION(NULL, &p, slen); | 2171 | sess = d2i_SSL_SESSION(NULL, &p, slen); |
2172 | OPENSSL_free(sdec); | 2172 | free(sdec); |
2173 | if (sess) { | 2173 | if (sess) { |
2174 | /* The session ID, if non-empty, is used by some clients to | 2174 | /* The session ID, if non-empty, is used by some clients to |
2175 | * detect that the ticket has been accepted. So we copy it to | 2175 | * detect that the ticket has been accepted. So we copy it to |
diff --git a/src/lib/libssl/src/ssl/tls_srp.c b/src/lib/libssl/src/ssl/tls_srp.c index 25ab73af9d..a3acb6fd14 100644 --- a/src/lib/libssl/src/ssl/tls_srp.c +++ b/src/lib/libssl/src/ssl/tls_srp.c | |||
@@ -67,7 +67,7 @@ int | |||
67 | SSL_CTX_SRP_CTX_free(struct ssl_ctx_st *ctx) { | 67 | SSL_CTX_SRP_CTX_free(struct ssl_ctx_st *ctx) { |
68 | if (ctx == NULL) | 68 | if (ctx == NULL) |
69 | return 0; | 69 | return 0; |
70 | OPENSSL_free(ctx->srp_ctx.login); | 70 | free(ctx->srp_ctx.login); |
71 | BN_free(ctx->srp_ctx.N); | 71 | BN_free(ctx->srp_ctx.N); |
72 | BN_free(ctx->srp_ctx.g); | 72 | BN_free(ctx->srp_ctx.g); |
73 | BN_free(ctx->srp_ctx.s); | 73 | BN_free(ctx->srp_ctx.s); |
@@ -99,7 +99,7 @@ int | |||
99 | SSL_SRP_CTX_free(struct ssl_st *s) { | 99 | SSL_SRP_CTX_free(struct ssl_st *s) { |
100 | if (s == NULL) | 100 | if (s == NULL) |
101 | return 0; | 101 | return 0; |
102 | OPENSSL_free(s->srp_ctx.login); | 102 | free(s->srp_ctx.login); |
103 | BN_free(s->srp_ctx.N); | 103 | BN_free(s->srp_ctx.N); |
104 | BN_free(s->srp_ctx.g); | 104 | BN_free(s->srp_ctx.g); |
105 | BN_free(s->srp_ctx.s); | 105 | BN_free(s->srp_ctx.s); |
@@ -181,7 +181,7 @@ SSL_SRP_CTX_init(struct ssl_st *s) { | |||
181 | 181 | ||
182 | return (1); | 182 | return (1); |
183 | err: | 183 | err: |
184 | OPENSSL_free(s->srp_ctx.login); | 184 | free(s->srp_ctx.login); |
185 | BN_free(s->srp_ctx.N); | 185 | BN_free(s->srp_ctx.N); |
186 | BN_free(s->srp_ctx.g); | 186 | BN_free(s->srp_ctx.g); |
187 | BN_free(s->srp_ctx.s); | 187 | BN_free(s->srp_ctx.s); |
@@ -338,14 +338,14 @@ SRP_generate_server_master_secret(SSL *s, unsigned char *master_key) | |||
338 | goto err; | 338 | goto err; |
339 | 339 | ||
340 | tmp_len = BN_num_bytes(K); | 340 | tmp_len = BN_num_bytes(K); |
341 | if ((tmp = OPENSSL_malloc(tmp_len)) == NULL) | 341 | if ((tmp = malloc(tmp_len)) == NULL) |
342 | goto err; | 342 | goto err; |
343 | BN_bn2bin(K, tmp); | 343 | BN_bn2bin(K, tmp); |
344 | ret = s->method->ssl3_enc->generate_master_secret(s, master_key, tmp, tmp_len); | 344 | ret = s->method->ssl3_enc->generate_master_secret(s, master_key, tmp, tmp_len); |
345 | err: | 345 | err: |
346 | if (tmp) { | 346 | if (tmp) { |
347 | OPENSSL_cleanse(tmp, tmp_len); | 347 | OPENSSL_cleanse(tmp, tmp_len); |
348 | OPENSSL_free(tmp); | 348 | free(tmp); |
349 | } | 349 | } |
350 | BN_clear_free(K); | 350 | BN_clear_free(K); |
351 | BN_clear_free(u); | 351 | BN_clear_free(u); |
@@ -379,20 +379,20 @@ SRP_generate_client_master_secret(SSL *s, unsigned char *master_key) | |||
379 | goto err; | 379 | goto err; |
380 | 380 | ||
381 | tmp_len = BN_num_bytes(K); | 381 | tmp_len = BN_num_bytes(K); |
382 | if ((tmp = OPENSSL_malloc(tmp_len)) == NULL) goto err; | 382 | if ((tmp = malloc(tmp_len)) == NULL) goto err; |
383 | BN_bn2bin(K, tmp); | 383 | BN_bn2bin(K, tmp); |
384 | ret = s->method->ssl3_enc->generate_master_secret(s, master_key, | 384 | ret = s->method->ssl3_enc->generate_master_secret(s, master_key, |
385 | tmp, tmp_len); | 385 | tmp, tmp_len); |
386 | err: | 386 | err: |
387 | if (tmp) { | 387 | if (tmp) { |
388 | OPENSSL_cleanse(tmp, tmp_len); | 388 | OPENSSL_cleanse(tmp, tmp_len); |
389 | OPENSSL_free(tmp); | 389 | free(tmp); |
390 | } | 390 | } |
391 | BN_clear_free(K); | 391 | BN_clear_free(K); |
392 | BN_clear_free(x); | 392 | BN_clear_free(x); |
393 | if (passwd) { | 393 | if (passwd) { |
394 | OPENSSL_cleanse(passwd, strlen(passwd)); | 394 | OPENSSL_cleanse(passwd, strlen(passwd)); |
395 | OPENSSL_free(passwd); | 395 | free(passwd); |
396 | } | 396 | } |
397 | BN_clear_free(u); | 397 | BN_clear_free(u); |
398 | return ret; | 398 | return ret; |
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c index 28e295f6a4..60ee189f29 100644 --- a/src/lib/libssl/ssl_asn1.c +++ b/src/lib/libssl/ssl_asn1.c | |||
@@ -145,7 +145,7 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | |||
145 | 145 | ||
146 | /* Note that I cheat in the following 2 assignments. I know | 146 | /* Note that I cheat in the following 2 assignments. I know |
147 | * that if the ASN1_INTEGER passed to ASN1_INTEGER_set | 147 | * that if the ASN1_INTEGER passed to ASN1_INTEGER_set |
148 | * is > sizeof(long)+1, the buffer will not be re-OPENSSL_malloc()ed. | 148 | * is > sizeof(long)+1, the buffer will not be re-malloc()ed. |
149 | * This is a bit evil but makes things simple, no dynamic allocation | 149 | * This is a bit evil but makes things simple, no dynamic allocation |
150 | * to clean up :-) */ | 150 | * to clean up :-) */ |
151 | a.version.length = LSIZE2; | 151 | a.version.length = LSIZE2; |
@@ -375,7 +375,7 @@ long length) | |||
375 | ai.length = 0; | 375 | ai.length = 0; |
376 | M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); | 376 | M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); |
377 | if (ai.data != NULL) { | 377 | if (ai.data != NULL) { |
378 | OPENSSL_free(ai.data); | 378 | free(ai.data); |
379 | ai.data = NULL; | 379 | ai.data = NULL; |
380 | ai.length = 0; | 380 | ai.length = 0; |
381 | } | 381 | } |
@@ -385,7 +385,7 @@ long length) | |||
385 | ssl_version = (int)ASN1_INTEGER_get(aip); | 385 | ssl_version = (int)ASN1_INTEGER_get(aip); |
386 | ret->ssl_version = ssl_version; | 386 | ret->ssl_version = ssl_version; |
387 | if (ai.data != NULL) { | 387 | if (ai.data != NULL) { |
388 | OPENSSL_free(ai.data); | 388 | free(ai.data); |
389 | ai.data = NULL; | 389 | ai.data = NULL; |
390 | ai.length = 0; | 390 | ai.length = 0; |
391 | } | 391 | } |
@@ -439,7 +439,7 @@ long length) | |||
439 | else | 439 | else |
440 | ret->krb5_client_princ_len = os.length; | 440 | ret->krb5_client_princ_len = os.length; |
441 | memcpy(ret->krb5_client_princ, os.data, ret->krb5_client_princ_len); | 441 | memcpy(ret->krb5_client_princ, os.data, ret->krb5_client_princ_len); |
442 | OPENSSL_free(os.data); | 442 | free(os.data); |
443 | os.data = NULL; | 443 | os.data = NULL; |
444 | os.length = 0; | 444 | os.length = 0; |
445 | } else | 445 | } else |
@@ -453,13 +453,13 @@ long length) | |||
453 | ret->key_arg_length = os.length; | 453 | ret->key_arg_length = os.length; |
454 | memcpy(ret->key_arg, os.data, ret->key_arg_length); | 454 | memcpy(ret->key_arg, os.data, ret->key_arg_length); |
455 | if (os.data != NULL) | 455 | if (os.data != NULL) |
456 | OPENSSL_free(os.data); | 456 | free(os.data); |
457 | 457 | ||
458 | ai.length = 0; | 458 | ai.length = 0; |
459 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 1); | 459 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 1); |
460 | if (ai.data != NULL) { | 460 | if (ai.data != NULL) { |
461 | ret->time = ASN1_INTEGER_get(aip); | 461 | ret->time = ASN1_INTEGER_get(aip); |
462 | OPENSSL_free(ai.data); | 462 | free(ai.data); |
463 | ai.data = NULL; | 463 | ai.data = NULL; |
464 | ai.length = 0; | 464 | ai.length = 0; |
465 | } else | 465 | } else |
@@ -469,7 +469,7 @@ long length) | |||
469 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 2); | 469 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 2); |
470 | if (ai.data != NULL) { | 470 | if (ai.data != NULL) { |
471 | ret->timeout = ASN1_INTEGER_get(aip); | 471 | ret->timeout = ASN1_INTEGER_get(aip); |
472 | OPENSSL_free(ai.data); | 472 | free(ai.data); |
473 | ai.data = NULL; | 473 | ai.data = NULL; |
474 | ai.length = 0; | 474 | ai.length = 0; |
475 | } else | 475 | } else |
@@ -493,7 +493,7 @@ long length) | |||
493 | ret->sid_ctx_length = os.length; | 493 | ret->sid_ctx_length = os.length; |
494 | memcpy(ret->sid_ctx, os.data, os.length); | 494 | memcpy(ret->sid_ctx, os.data, os.length); |
495 | } | 495 | } |
496 | OPENSSL_free(os.data); | 496 | free(os.data); |
497 | os.data = NULL; | 497 | os.data = NULL; |
498 | os.length = 0; | 498 | os.length = 0; |
499 | } else | 499 | } else |
@@ -503,7 +503,7 @@ long length) | |||
503 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 5); | 503 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 5); |
504 | if (ai.data != NULL) { | 504 | if (ai.data != NULL) { |
505 | ret->verify_result = ASN1_INTEGER_get(aip); | 505 | ret->verify_result = ASN1_INTEGER_get(aip); |
506 | OPENSSL_free(ai.data); | 506 | free(ai.data); |
507 | ai.data = NULL; | 507 | ai.data = NULL; |
508 | ai.length = 0; | 508 | ai.length = 0; |
509 | } else | 509 | } else |
@@ -515,7 +515,7 @@ long length) | |||
515 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 6); | 515 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 6); |
516 | if (os.data) { | 516 | if (os.data) { |
517 | ret->tlsext_hostname = BUF_strndup((char *)os.data, os.length); | 517 | ret->tlsext_hostname = BUF_strndup((char *)os.data, os.length); |
518 | OPENSSL_free(os.data); | 518 | free(os.data); |
519 | os.data = NULL; | 519 | os.data = NULL; |
520 | os.length = 0; | 520 | os.length = 0; |
521 | } else | 521 | } else |
@@ -528,7 +528,7 @@ long length) | |||
528 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 7); | 528 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 7); |
529 | if (os.data) { | 529 | if (os.data) { |
530 | ret->psk_identity_hint = BUF_strndup((char *)os.data, os.length); | 530 | ret->psk_identity_hint = BUF_strndup((char *)os.data, os.length); |
531 | OPENSSL_free(os.data); | 531 | free(os.data); |
532 | os.data = NULL; | 532 | os.data = NULL; |
533 | os.length = 0; | 533 | os.length = 0; |
534 | } else | 534 | } else |
@@ -539,7 +539,7 @@ long length) | |||
539 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 8); | 539 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 8); |
540 | if (os.data) { | 540 | if (os.data) { |
541 | ret->psk_identity = BUF_strndup((char *)os.data, os.length); | 541 | ret->psk_identity = BUF_strndup((char *)os.data, os.length); |
542 | OPENSSL_free(os.data); | 542 | free(os.data); |
543 | os.data = NULL; | 543 | os.data = NULL; |
544 | os.length = 0; | 544 | os.length = 0; |
545 | } else | 545 | } else |
@@ -551,7 +551,7 @@ long length) | |||
551 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 9); | 551 | M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 9); |
552 | if (ai.data != NULL) { | 552 | if (ai.data != NULL) { |
553 | ret->tlsext_tick_lifetime_hint = ASN1_INTEGER_get(aip); | 553 | ret->tlsext_tick_lifetime_hint = ASN1_INTEGER_get(aip); |
554 | OPENSSL_free(ai.data); | 554 | free(ai.data); |
555 | ai.data = NULL; | 555 | ai.data = NULL; |
556 | ai.length = 0; | 556 | ai.length = 0; |
557 | } else if (ret->tlsext_ticklen && ret->session_id_length) | 557 | } else if (ret->tlsext_ticklen && ret->session_id_length) |
@@ -575,7 +575,7 @@ long length) | |||
575 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11); | 575 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11); |
576 | if (os.data) { | 576 | if (os.data) { |
577 | ret->compress_meth = os.data[0]; | 577 | ret->compress_meth = os.data[0]; |
578 | OPENSSL_free(os.data); | 578 | free(os.data); |
579 | os.data = NULL; | 579 | os.data = NULL; |
580 | } | 580 | } |
581 | #endif | 581 | #endif |
@@ -586,7 +586,7 @@ long length) | |||
586 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 12); | 586 | M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 12); |
587 | if (os.data) { | 587 | if (os.data) { |
588 | ret->srp_username = BUF_strndup((char *)os.data, os.length); | 588 | ret->srp_username = BUF_strndup((char *)os.data, os.length); |
589 | OPENSSL_free(os.data); | 589 | free(os.data); |
590 | os.data = NULL; | 590 | os.data = NULL; |
591 | os.length = 0; | 591 | os.length = 0; |
592 | } else | 592 | } else |
diff --git a/src/lib/libssl/ssl_cert.c b/src/lib/libssl/ssl_cert.c index 72b5d8d2bd..87dc80be20 100644 --- a/src/lib/libssl/ssl_cert.c +++ b/src/lib/libssl/ssl_cert.c | |||
@@ -180,7 +180,7 @@ CERT | |||
180 | { | 180 | { |
181 | CERT *ret; | 181 | CERT *ret; |
182 | 182 | ||
183 | ret = (CERT *)OPENSSL_malloc(sizeof(CERT)); | 183 | ret = (CERT *)malloc(sizeof(CERT)); |
184 | if (ret == NULL) { | 184 | if (ret == NULL) { |
185 | SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE); | 185 | SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE); |
186 | return (NULL); | 186 | return (NULL); |
@@ -199,7 +199,7 @@ CERT | |||
199 | CERT *ret; | 199 | CERT *ret; |
200 | int i; | 200 | int i; |
201 | 201 | ||
202 | ret = (CERT *)OPENSSL_malloc(sizeof(CERT)); | 202 | ret = (CERT *)malloc(sizeof(CERT)); |
203 | if (ret == NULL) { | 203 | if (ret == NULL) { |
204 | SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE); | 204 | SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE); |
205 | return (NULL); | 205 | return (NULL); |
@@ -387,7 +387,7 @@ ssl_cert_free(CERT *c) | |||
387 | EVP_PKEY_free(c->pkeys[i].publickey); | 387 | EVP_PKEY_free(c->pkeys[i].publickey); |
388 | #endif | 388 | #endif |
389 | } | 389 | } |
390 | OPENSSL_free(c); | 390 | free(c); |
391 | } | 391 | } |
392 | 392 | ||
393 | int | 393 | int |
@@ -422,7 +422,7 @@ SESS_CERT | |||
422 | { | 422 | { |
423 | SESS_CERT *ret; | 423 | SESS_CERT *ret; |
424 | 424 | ||
425 | ret = OPENSSL_malloc(sizeof *ret); | 425 | ret = malloc(sizeof *ret); |
426 | if (ret == NULL) { | 426 | if (ret == NULL) { |
427 | SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE); | 427 | SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE); |
428 | return NULL; | 428 | return NULL; |
@@ -483,7 +483,7 @@ ssl_sess_cert_free(SESS_CERT *sc) | |||
483 | EC_KEY_free(sc->peer_ecdh_tmp); | 483 | EC_KEY_free(sc->peer_ecdh_tmp); |
484 | #endif | 484 | #endif |
485 | 485 | ||
486 | OPENSSL_free(sc); | 486 | free(sc); |
487 | } | 487 | } |
488 | 488 | ||
489 | int | 489 | int |
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index 4bd3be0d41..b56a93d4cb 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
@@ -456,12 +456,12 @@ load_builtin_compressions(void) | |||
456 | MemCheck_off(); | 456 | MemCheck_off(); |
457 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); | 457 | ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); |
458 | if (ssl_comp_methods != NULL) { | 458 | if (ssl_comp_methods != NULL) { |
459 | comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); | 459 | comp = (SSL_COMP *)malloc(sizeof(SSL_COMP)); |
460 | if (comp != NULL) { | 460 | if (comp != NULL) { |
461 | comp->method = COMP_zlib(); | 461 | comp->method = COMP_zlib(); |
462 | if (comp->method && | 462 | if (comp->method && |
463 | comp->method->type == NID_undef) | 463 | comp->method->type == NID_undef) |
464 | OPENSSL_free(comp); | 464 | free(comp); |
465 | else { | 465 | else { |
466 | comp->id = SSL_COMP_ZLIB_IDX; | 466 | comp->id = SSL_COMP_ZLIB_IDX; |
467 | comp->name = comp->method->name; | 467 | comp->name = comp->method->name; |
@@ -1037,7 +1037,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) | |||
1037 | curr = curr->next; | 1037 | curr = curr->next; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int)); | 1040 | number_uses = malloc((max_strength_bits + 1) * sizeof(int)); |
1041 | if (!number_uses) { | 1041 | if (!number_uses) { |
1042 | SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE); | 1042 | SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE); |
1043 | return (0); | 1043 | return (0); |
@@ -1061,7 +1061,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) | |||
1061 | if (number_uses[i] > 0) | 1061 | if (number_uses[i] > 0) |
1062 | ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p); | 1062 | ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p); |
1063 | 1063 | ||
1064 | OPENSSL_free(number_uses); | 1064 | free(number_uses); |
1065 | return (1); | 1065 | return (1); |
1066 | } | 1066 | } |
1067 | 1067 | ||
@@ -1336,7 +1336,7 @@ STACK_OF(SSL_CIPHER) | |||
1336 | #ifdef KSSL_DEBUG | 1336 | #ifdef KSSL_DEBUG |
1337 | printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers); | 1337 | printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers); |
1338 | #endif /* KSSL_DEBUG */ | 1338 | #endif /* KSSL_DEBUG */ |
1339 | co_list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); | 1339 | co_list = (CIPHER_ORDER *)malloc(sizeof(CIPHER_ORDER) * num_of_ciphers); |
1340 | if (co_list == NULL) { | 1340 | if (co_list == NULL) { |
1341 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); | 1341 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); |
1342 | return(NULL); /* Failure */ | 1342 | return(NULL); /* Failure */ |
@@ -1380,7 +1380,7 @@ STACK_OF(SSL_CIPHER) | |||
1380 | /* Now sort by symmetric encryption strength. The above ordering remains | 1380 | /* Now sort by symmetric encryption strength. The above ordering remains |
1381 | * in force within each class */ | 1381 | * in force within each class */ |
1382 | if (!ssl_cipher_strength_sort(&head, &tail)) { | 1382 | if (!ssl_cipher_strength_sort(&head, &tail)) { |
1383 | OPENSSL_free(co_list); | 1383 | free(co_list); |
1384 | return NULL; | 1384 | return NULL; |
1385 | } | 1385 | } |
1386 | 1386 | ||
@@ -1398,9 +1398,9 @@ STACK_OF(SSL_CIPHER) | |||
1398 | */ | 1398 | */ |
1399 | num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); | 1399 | num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER); |
1400 | num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; | 1400 | num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1; |
1401 | ca_list = OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); | 1401 | ca_list = malloc(sizeof(SSL_CIPHER *) * num_of_alias_max); |
1402 | if (ca_list == NULL) { | 1402 | if (ca_list == NULL) { |
1403 | OPENSSL_free(co_list); | 1403 | free(co_list); |
1404 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); | 1404 | SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE); |
1405 | return(NULL); /* Failure */ | 1405 | return(NULL); /* Failure */ |
1406 | } | 1406 | } |
@@ -1425,11 +1425,11 @@ STACK_OF(SSL_CIPHER) | |||
1425 | if (ok && (strlen(rule_p) > 0)) | 1425 | if (ok && (strlen(rule_p) > 0)) |
1426 | ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list); | 1426 | ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list); |
1427 | 1427 | ||
1428 | OPENSSL_free((void *)ca_list); /* Not needed anymore */ | 1428 | free((void *)ca_list); /* Not needed anymore */ |
1429 | 1429 | ||
1430 | if (!ok) | 1430 | if (!ok) |
1431 | { /* Rule processing failure */ | 1431 | { /* Rule processing failure */ |
1432 | OPENSSL_free(co_list); | 1432 | free(co_list); |
1433 | return (NULL); | 1433 | return (NULL); |
1434 | } | 1434 | } |
1435 | 1435 | ||
@@ -1438,7 +1438,7 @@ STACK_OF(SSL_CIPHER) | |||
1438 | * if we cannot get one. | 1438 | * if we cannot get one. |
1439 | */ | 1439 | */ |
1440 | if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { | 1440 | if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { |
1441 | OPENSSL_free(co_list); | 1441 | free(co_list); |
1442 | return (NULL); | 1442 | return (NULL); |
1443 | } | 1443 | } |
1444 | 1444 | ||
@@ -1454,7 +1454,7 @@ STACK_OF(SSL_CIPHER) | |||
1454 | #endif | 1454 | #endif |
1455 | } | 1455 | } |
1456 | } | 1456 | } |
1457 | OPENSSL_free(co_list); /* Not needed any longer */ | 1457 | free(co_list); /* Not needed any longer */ |
1458 | 1458 | ||
1459 | tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack); | 1459 | tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack); |
1460 | if (tmp_cipher_list == NULL) { | 1460 | if (tmp_cipher_list == NULL) { |
@@ -1642,9 +1642,9 @@ char | |||
1642 | 1642 | ||
1643 | if (buf == NULL) { | 1643 | if (buf == NULL) { |
1644 | len = 128; | 1644 | len = 128; |
1645 | buf = OPENSSL_malloc(len); | 1645 | buf = malloc(len); |
1646 | if (buf == NULL) | 1646 | if (buf == NULL) |
1647 | return("OPENSSL_malloc Error"); | 1647 | return("malloc Error"); |
1648 | } else if (len < 128) | 1648 | } else if (len < 128) |
1649 | return("Buffer too small"); | 1649 | return("Buffer too small"); |
1650 | 1650 | ||
@@ -1767,19 +1767,19 @@ SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) | |||
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | MemCheck_off(); | 1769 | MemCheck_off(); |
1770 | comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); | 1770 | comp = (SSL_COMP *)malloc(sizeof(SSL_COMP)); |
1771 | comp->id = id; | 1771 | comp->id = id; |
1772 | comp->method = cm; | 1772 | comp->method = cm; |
1773 | load_builtin_compressions(); | 1773 | load_builtin_compressions(); |
1774 | if (ssl_comp_methods && | 1774 | if (ssl_comp_methods && |
1775 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { | 1775 | sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) { |
1776 | OPENSSL_free(comp); | 1776 | free(comp); |
1777 | MemCheck_on(); | 1777 | MemCheck_on(); |
1778 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID); | 1778 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID); |
1779 | return (1); | 1779 | return (1); |
1780 | } else if ((ssl_comp_methods == NULL) || | 1780 | } else if ((ssl_comp_methods == NULL) || |
1781 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { | 1781 | !sk_SSL_COMP_push(ssl_comp_methods, comp)) { |
1782 | OPENSSL_free(comp); | 1782 | free(comp); |
1783 | MemCheck_on(); | 1783 | MemCheck_on(); |
1784 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE); | 1784 | SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE); |
1785 | return (1); | 1785 | return (1); |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 6db3bd2993..589bd625bb 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -281,7 +281,7 @@ SSL | |||
281 | return (NULL); | 281 | return (NULL); |
282 | } | 282 | } |
283 | 283 | ||
284 | s = (SSL *)OPENSSL_malloc(sizeof(SSL)); | 284 | s = (SSL *)malloc(sizeof(SSL)); |
285 | if (s == NULL) | 285 | if (s == NULL) |
286 | goto err; | 286 | goto err; |
287 | memset(s, 0, sizeof(SSL)); | 287 | memset(s, 0, sizeof(SSL)); |
@@ -380,7 +380,7 @@ err: | |||
380 | ssl_cert_free(s->cert); | 380 | ssl_cert_free(s->cert); |
381 | if (s->ctx != NULL) | 381 | if (s->ctx != NULL) |
382 | SSL_CTX_free(s->ctx); /* decrement reference count */ | 382 | SSL_CTX_free(s->ctx); /* decrement reference count */ |
383 | OPENSSL_free(s); | 383 | free(s); |
384 | } | 384 | } |
385 | SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); | 385 | SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); |
386 | return (NULL); | 386 | return (NULL); |
@@ -558,24 +558,24 @@ SSL_free(SSL *s) | |||
558 | 558 | ||
559 | #ifndef OPENSSL_NO_TLSEXT | 559 | #ifndef OPENSSL_NO_TLSEXT |
560 | if (s->tlsext_hostname) | 560 | if (s->tlsext_hostname) |
561 | OPENSSL_free(s->tlsext_hostname); | 561 | free(s->tlsext_hostname); |
562 | if (s->initial_ctx) | 562 | if (s->initial_ctx) |
563 | SSL_CTX_free(s->initial_ctx); | 563 | SSL_CTX_free(s->initial_ctx); |
564 | #ifndef OPENSSL_NO_EC | 564 | #ifndef OPENSSL_NO_EC |
565 | if (s->tlsext_ecpointformatlist) | 565 | if (s->tlsext_ecpointformatlist) |
566 | OPENSSL_free(s->tlsext_ecpointformatlist); | 566 | free(s->tlsext_ecpointformatlist); |
567 | if (s->tlsext_ellipticcurvelist) | 567 | if (s->tlsext_ellipticcurvelist) |
568 | OPENSSL_free(s->tlsext_ellipticcurvelist); | 568 | free(s->tlsext_ellipticcurvelist); |
569 | #endif /* OPENSSL_NO_EC */ | 569 | #endif /* OPENSSL_NO_EC */ |
570 | if (s->tlsext_opaque_prf_input) | 570 | if (s->tlsext_opaque_prf_input) |
571 | OPENSSL_free(s->tlsext_opaque_prf_input); | 571 | free(s->tlsext_opaque_prf_input); |
572 | if (s->tlsext_ocsp_exts) | 572 | if (s->tlsext_ocsp_exts) |
573 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, | 573 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, |
574 | X509_EXTENSION_free); | 574 | X509_EXTENSION_free); |
575 | if (s->tlsext_ocsp_ids) | 575 | if (s->tlsext_ocsp_ids) |
576 | sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); | 576 | sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); |
577 | if (s->tlsext_ocsp_resp) | 577 | if (s->tlsext_ocsp_resp) |
578 | OPENSSL_free(s->tlsext_ocsp_resp); | 578 | free(s->tlsext_ocsp_resp); |
579 | #endif | 579 | #endif |
580 | 580 | ||
581 | if (s->client_CA != NULL) | 581 | if (s->client_CA != NULL) |
@@ -594,7 +594,7 @@ SSL_free(SSL *s) | |||
594 | 594 | ||
595 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 595 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
596 | if (s->next_proto_negotiated) | 596 | if (s->next_proto_negotiated) |
597 | OPENSSL_free(s->next_proto_negotiated); | 597 | free(s->next_proto_negotiated); |
598 | #endif | 598 | #endif |
599 | 599 | ||
600 | #ifndef OPENSSL_NO_SRTP | 600 | #ifndef OPENSSL_NO_SRTP |
@@ -602,7 +602,7 @@ SSL_free(SSL *s) | |||
602 | sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); | 602 | sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); |
603 | #endif | 603 | #endif |
604 | 604 | ||
605 | OPENSSL_free(s); | 605 | free(s); |
606 | } | 606 | } |
607 | 607 | ||
608 | void | 608 | void |
@@ -1703,7 +1703,7 @@ SSL_CTX | |||
1703 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); | 1703 | SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); |
1704 | goto err; | 1704 | goto err; |
1705 | } | 1705 | } |
1706 | ret = (SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX)); | 1706 | ret = (SSL_CTX *)malloc(sizeof(SSL_CTX)); |
1707 | if (ret == NULL) | 1707 | if (ret == NULL) |
1708 | goto err; | 1708 | goto err; |
1709 | 1709 | ||
@@ -1862,7 +1862,7 @@ err2: | |||
1862 | #if 0 | 1862 | #if 0 |
1863 | static void | 1863 | static void |
1864 | SSL_COMP_free(SSL_COMP *comp) | 1864 | SSL_COMP_free(SSL_COMP *comp) |
1865 | { OPENSSL_free(comp); | 1865 | { free(comp); |
1866 | } | 1866 | } |
1867 | #endif | 1867 | #endif |
1868 | 1868 | ||
@@ -1933,7 +1933,7 @@ SSL_CTX_free(SSL_CTX *a) | |||
1933 | 1933 | ||
1934 | #ifndef OPENSSL_NO_PSK | 1934 | #ifndef OPENSSL_NO_PSK |
1935 | if (a->psk_identity_hint) | 1935 | if (a->psk_identity_hint) |
1936 | OPENSSL_free(a->psk_identity_hint); | 1936 | free(a->psk_identity_hint); |
1937 | #endif | 1937 | #endif |
1938 | #ifndef OPENSSL_NO_SRP | 1938 | #ifndef OPENSSL_NO_SRP |
1939 | SSL_CTX_SRP_CTX_free(a); | 1939 | SSL_CTX_SRP_CTX_free(a); |
@@ -1943,7 +1943,7 @@ SSL_CTX_free(SSL_CTX *a) | |||
1943 | ENGINE_finish(a->client_cert_engine); | 1943 | ENGINE_finish(a->client_cert_engine); |
1944 | #endif | 1944 | #endif |
1945 | 1945 | ||
1946 | OPENSSL_free(a); | 1946 | free(a); |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | void | 1949 | void |
@@ -2696,12 +2696,12 @@ ssl_clear_cipher_ctx(SSL *s) | |||
2696 | { | 2696 | { |
2697 | if (s->enc_read_ctx != NULL) { | 2697 | if (s->enc_read_ctx != NULL) { |
2698 | EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); | 2698 | EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); |
2699 | OPENSSL_free(s->enc_read_ctx); | 2699 | free(s->enc_read_ctx); |
2700 | s->enc_read_ctx = NULL; | 2700 | s->enc_read_ctx = NULL; |
2701 | } | 2701 | } |
2702 | if (s->enc_write_ctx != NULL) { | 2702 | if (s->enc_write_ctx != NULL) { |
2703 | EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); | 2703 | EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); |
2704 | OPENSSL_free(s->enc_write_ctx); | 2704 | free(s->enc_write_ctx); |
2705 | s->enc_write_ctx = NULL; | 2705 | s->enc_write_ctx = NULL; |
2706 | } | 2706 | } |
2707 | #ifndef OPENSSL_NO_COMP | 2707 | #ifndef OPENSSL_NO_COMP |
@@ -3095,7 +3095,7 @@ SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) | |||
3095 | return 0; | 3095 | return 0; |
3096 | } | 3096 | } |
3097 | if (ctx->psk_identity_hint != NULL) | 3097 | if (ctx->psk_identity_hint != NULL) |
3098 | OPENSSL_free(ctx->psk_identity_hint); | 3098 | free(ctx->psk_identity_hint); |
3099 | if (identity_hint != NULL) { | 3099 | if (identity_hint != NULL) { |
3100 | ctx->psk_identity_hint = BUF_strdup(identity_hint); | 3100 | ctx->psk_identity_hint = BUF_strdup(identity_hint); |
3101 | if (ctx->psk_identity_hint == NULL) | 3101 | if (ctx->psk_identity_hint == NULL) |
@@ -3119,7 +3119,7 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint) | |||
3119 | return 0; | 3119 | return 0; |
3120 | } | 3120 | } |
3121 | if (s->session->psk_identity_hint != NULL) | 3121 | if (s->session->psk_identity_hint != NULL) |
3122 | OPENSSL_free(s->session->psk_identity_hint); | 3122 | free(s->session->psk_identity_hint); |
3123 | if (identity_hint != NULL) { | 3123 | if (identity_hint != NULL) { |
3124 | s->session->psk_identity_hint = BUF_strdup(identity_hint); | 3124 | s->session->psk_identity_hint = BUF_strdup(identity_hint); |
3125 | if (s->session->psk_identity_hint == NULL) | 3125 | if (s->session->psk_identity_hint == NULL) |
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index 0b1c655820..f9f6ee5ecb 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
@@ -195,7 +195,7 @@ SSL_SESSION | |||
195 | { | 195 | { |
196 | SSL_SESSION *ss; | 196 | SSL_SESSION *ss; |
197 | 197 | ||
198 | ss = (SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION)); | 198 | ss = (SSL_SESSION *)malloc(sizeof(SSL_SESSION)); |
199 | if (ss == NULL) { | 199 | if (ss == NULL) { |
200 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); | 200 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); |
201 | return (0); | 201 | return (0); |
@@ -371,8 +371,8 @@ ssl_get_new_session(SSL *s, int session) | |||
371 | #ifndef OPENSSL_NO_EC | 371 | #ifndef OPENSSL_NO_EC |
372 | if (s->tlsext_ecpointformatlist) { | 372 | if (s->tlsext_ecpointformatlist) { |
373 | if (ss->tlsext_ecpointformatlist != NULL) | 373 | if (ss->tlsext_ecpointformatlist != NULL) |
374 | OPENSSL_free(ss->tlsext_ecpointformatlist); | 374 | free(ss->tlsext_ecpointformatlist); |
375 | if ((ss->tlsext_ecpointformatlist = OPENSSL_malloc(s->tlsext_ecpointformatlist_length)) == NULL) { | 375 | if ((ss->tlsext_ecpointformatlist = malloc(s->tlsext_ecpointformatlist_length)) == NULL) { |
376 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); | 376 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); |
377 | SSL_SESSION_free(ss); | 377 | SSL_SESSION_free(ss); |
378 | return 0; | 378 | return 0; |
@@ -382,8 +382,8 @@ ssl_get_new_session(SSL *s, int session) | |||
382 | } | 382 | } |
383 | if (s->tlsext_ellipticcurvelist) { | 383 | if (s->tlsext_ellipticcurvelist) { |
384 | if (ss->tlsext_ellipticcurvelist != NULL) | 384 | if (ss->tlsext_ellipticcurvelist != NULL) |
385 | OPENSSL_free(ss->tlsext_ellipticcurvelist); | 385 | free(ss->tlsext_ellipticcurvelist); |
386 | if ((ss->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { | 386 | if ((ss->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { |
387 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); | 387 | SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE); |
388 | SSL_SESSION_free(ss); | 388 | SSL_SESSION_free(ss); |
389 | return 0; | 389 | return 0; |
@@ -719,30 +719,30 @@ SSL_SESSION_free(SSL_SESSION *ss) | |||
719 | sk_SSL_CIPHER_free(ss->ciphers); | 719 | sk_SSL_CIPHER_free(ss->ciphers); |
720 | #ifndef OPENSSL_NO_TLSEXT | 720 | #ifndef OPENSSL_NO_TLSEXT |
721 | if (ss->tlsext_hostname != NULL) | 721 | if (ss->tlsext_hostname != NULL) |
722 | OPENSSL_free(ss->tlsext_hostname); | 722 | free(ss->tlsext_hostname); |
723 | if (ss->tlsext_tick != NULL) | 723 | if (ss->tlsext_tick != NULL) |
724 | OPENSSL_free(ss->tlsext_tick); | 724 | free(ss->tlsext_tick); |
725 | #ifndef OPENSSL_NO_EC | 725 | #ifndef OPENSSL_NO_EC |
726 | ss->tlsext_ecpointformatlist_length = 0; | 726 | ss->tlsext_ecpointformatlist_length = 0; |
727 | if (ss->tlsext_ecpointformatlist != NULL) | 727 | if (ss->tlsext_ecpointformatlist != NULL) |
728 | OPENSSL_free(ss->tlsext_ecpointformatlist); | 728 | free(ss->tlsext_ecpointformatlist); |
729 | ss->tlsext_ellipticcurvelist_length = 0; | 729 | ss->tlsext_ellipticcurvelist_length = 0; |
730 | if (ss->tlsext_ellipticcurvelist != NULL) | 730 | if (ss->tlsext_ellipticcurvelist != NULL) |
731 | OPENSSL_free(ss->tlsext_ellipticcurvelist); | 731 | free(ss->tlsext_ellipticcurvelist); |
732 | #endif /* OPENSSL_NO_EC */ | 732 | #endif /* OPENSSL_NO_EC */ |
733 | #endif | 733 | #endif |
734 | #ifndef OPENSSL_NO_PSK | 734 | #ifndef OPENSSL_NO_PSK |
735 | if (ss->psk_identity_hint != NULL) | 735 | if (ss->psk_identity_hint != NULL) |
736 | OPENSSL_free(ss->psk_identity_hint); | 736 | free(ss->psk_identity_hint); |
737 | if (ss->psk_identity != NULL) | 737 | if (ss->psk_identity != NULL) |
738 | OPENSSL_free(ss->psk_identity); | 738 | free(ss->psk_identity); |
739 | #endif | 739 | #endif |
740 | #ifndef OPENSSL_NO_SRP | 740 | #ifndef OPENSSL_NO_SRP |
741 | if (ss->srp_username != NULL) | 741 | if (ss->srp_username != NULL) |
742 | OPENSSL_free(ss->srp_username); | 742 | free(ss->srp_username); |
743 | #endif | 743 | #endif |
744 | OPENSSL_cleanse(ss, sizeof(*ss)); | 744 | OPENSSL_cleanse(ss, sizeof(*ss)); |
745 | OPENSSL_free(ss); | 745 | free(ss); |
746 | } | 746 | } |
747 | 747 | ||
748 | int | 748 | int |
@@ -768,7 +768,7 @@ SSL_set_session(SSL *s, SSL_SESSION *session) | |||
768 | #ifndef OPENSSL_NO_KRB5 | 768 | #ifndef OPENSSL_NO_KRB5 |
769 | if (s->kssl_ctx && !s->kssl_ctx->client_princ && | 769 | if (s->kssl_ctx && !s->kssl_ctx->client_princ && |
770 | session->krb5_client_princ_len > 0) { | 770 | session->krb5_client_princ_len > 0) { |
771 | s->kssl_ctx->client_princ = (char *)OPENSSL_malloc(session->krb5_client_princ_len + 1); | 771 | s->kssl_ctx->client_princ = (char *)malloc(session->krb5_client_princ_len + 1); |
772 | memcpy(s->kssl_ctx->client_princ, session->krb5_client_princ, | 772 | memcpy(s->kssl_ctx->client_princ, session->krb5_client_princ, |
773 | session->krb5_client_princ_len); | 773 | session->krb5_client_princ_len); |
774 | s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0'; | 774 | s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0'; |
@@ -900,11 +900,11 @@ SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len) | |||
900 | { | 900 | { |
901 | if (s->version >= TLS1_VERSION) { | 901 | if (s->version >= TLS1_VERSION) { |
902 | if (s->tlsext_session_ticket) { | 902 | if (s->tlsext_session_ticket) { |
903 | OPENSSL_free(s->tlsext_session_ticket); | 903 | free(s->tlsext_session_ticket); |
904 | s->tlsext_session_ticket = NULL; | 904 | s->tlsext_session_ticket = NULL; |
905 | } | 905 | } |
906 | 906 | ||
907 | s->tlsext_session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len); | 907 | s->tlsext_session_ticket = malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len); |
908 | if (!s->tlsext_session_ticket) { | 908 | if (!s->tlsext_session_ticket) { |
909 | SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE); | 909 | SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE); |
910 | return 0; | 910 | return 0; |
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c index 71d9f164b4..fb471b2f14 100644 --- a/src/lib/libssl/t1_enc.c +++ b/src/lib/libssl/t1_enc.c | |||
@@ -367,7 +367,7 @@ tls1_change_cipher_state(SSL *s, int which) | |||
367 | 367 | ||
368 | if (s->enc_read_ctx != NULL) | 368 | if (s->enc_read_ctx != NULL) |
369 | reuse_dd = 1; | 369 | reuse_dd = 1; |
370 | else if ((s->enc_read_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) | 370 | else if ((s->enc_read_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL) |
371 | goto err; | 371 | goto err; |
372 | else | 372 | else |
373 | /* make sure it's intialized in case we exit later with an error */ | 373 | /* make sure it's intialized in case we exit later with an error */ |
@@ -387,7 +387,7 @@ tls1_change_cipher_state(SSL *s, int which) | |||
387 | } | 387 | } |
388 | if (s->s3->rrec.comp == NULL) | 388 | if (s->s3->rrec.comp == NULL) |
389 | s->s3->rrec.comp = (unsigned char *) | 389 | s->s3->rrec.comp = (unsigned char *) |
390 | OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH); | 390 | malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH); |
391 | if (s->s3->rrec.comp == NULL) | 391 | if (s->s3->rrec.comp == NULL) |
392 | goto err; | 392 | goto err; |
393 | } | 393 | } |
@@ -592,7 +592,7 @@ tls1_setup_key_block(SSL *s) | |||
592 | 592 | ||
593 | ssl3_cleanup_key_block(s); | 593 | ssl3_cleanup_key_block(s); |
594 | 594 | ||
595 | if ((p1 = (unsigned char *)OPENSSL_malloc(num)) == NULL) { | 595 | if ((p1 = (unsigned char *)malloc(num)) == NULL) { |
596 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); | 596 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); |
597 | goto err; | 597 | goto err; |
598 | } | 598 | } |
@@ -600,7 +600,7 @@ tls1_setup_key_block(SSL *s) | |||
600 | s->s3->tmp.key_block_length = num; | 600 | s->s3->tmp.key_block_length = num; |
601 | s->s3->tmp.key_block = p1; | 601 | s->s3->tmp.key_block = p1; |
602 | 602 | ||
603 | if ((p2 = (unsigned char *)OPENSSL_malloc(num)) == NULL) { | 603 | if ((p2 = (unsigned char *)malloc(num)) == NULL) { |
604 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); | 604 | SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE); |
605 | goto err; | 605 | goto err; |
606 | } | 606 | } |
@@ -642,7 +642,7 @@ tls1_setup_key_block(SSL *s) | |||
642 | err: | 642 | err: |
643 | if (p2) { | 643 | if (p2) { |
644 | OPENSSL_cleanse(p2, num); | 644 | OPENSSL_cleanse(p2, num); |
645 | OPENSSL_free(p2); | 645 | free(p2); |
646 | } | 646 | } |
647 | return (ret); | 647 | return (ret); |
648 | } | 648 | } |
@@ -1074,7 +1074,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | |||
1074 | printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, olen, label, llen, p, plen); | 1074 | printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, olen, label, llen, p, plen); |
1075 | #endif /* KSSL_DEBUG */ | 1075 | #endif /* KSSL_DEBUG */ |
1076 | 1076 | ||
1077 | buff = OPENSSL_malloc(olen); | 1077 | buff = malloc(olen); |
1078 | if (buff == NULL) | 1078 | if (buff == NULL) |
1079 | goto err2; | 1079 | goto err2; |
1080 | 1080 | ||
@@ -1088,7 +1088,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | |||
1088 | vallen += 2 + contextlen; | 1088 | vallen += 2 + contextlen; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | val = OPENSSL_malloc(vallen); | 1091 | val = malloc(vallen); |
1092 | if (val == NULL) | 1092 | if (val == NULL) |
1093 | goto err2; | 1093 | goto err2; |
1094 | currentvalpos = 0; | 1094 | currentvalpos = 0; |
@@ -1145,9 +1145,9 @@ err2: | |||
1145 | rv = 0; | 1145 | rv = 0; |
1146 | ret: | 1146 | ret: |
1147 | if (buff != NULL) | 1147 | if (buff != NULL) |
1148 | OPENSSL_free(buff); | 1148 | free(buff); |
1149 | if (val != NULL) | 1149 | if (val != NULL) |
1150 | OPENSSL_free(val); | 1150 | free(val); |
1151 | return (rv); | 1151 | return (rv); |
1152 | } | 1152 | } |
1153 | 1153 | ||
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c index c3d62957ae..7ecf7e0658 100644 --- a/src/lib/libssl/t1_lib.c +++ b/src/lib/libssl/t1_lib.c | |||
@@ -162,7 +162,7 @@ tls1_free(SSL *s) | |||
162 | { | 162 | { |
163 | #ifndef OPENSSL_NO_TLSEXT | 163 | #ifndef OPENSSL_NO_TLSEXT |
164 | if (s->tlsext_session_ticket) { | 164 | if (s->tlsext_session_ticket) { |
165 | OPENSSL_free(s->tlsext_session_ticket); | 165 | free(s->tlsext_session_ticket); |
166 | } | 166 | } |
167 | #endif /* OPENSSL_NO_TLSEXT */ | 167 | #endif /* OPENSSL_NO_TLSEXT */ |
168 | ssl3_free(s); | 168 | ssl3_free(s); |
@@ -515,7 +515,7 @@ unsigned char | |||
515 | else if (s->session && s->tlsext_session_ticket && | 515 | else if (s->session && s->tlsext_session_ticket && |
516 | s->tlsext_session_ticket->data) { | 516 | s->tlsext_session_ticket->data) { |
517 | ticklen = s->tlsext_session_ticket->length; | 517 | ticklen = s->tlsext_session_ticket->length; |
518 | s->session->tlsext_tick = OPENSSL_malloc(ticklen); | 518 | s->session->tlsext_tick = malloc(ticklen); |
519 | if (!s->session->tlsext_tick) | 519 | if (!s->session->tlsext_tick) |
520 | return NULL; | 520 | return NULL; |
521 | memcpy(s->session->tlsext_tick, | 521 | memcpy(s->session->tlsext_tick, |
@@ -1037,14 +1037,14 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1037 | *al = TLS1_AD_UNRECOGNIZED_NAME; | 1037 | *al = TLS1_AD_UNRECOGNIZED_NAME; |
1038 | return 0; | 1038 | return 0; |
1039 | } | 1039 | } |
1040 | if ((s->session->tlsext_hostname = OPENSSL_malloc(len + 1)) == NULL) { | 1040 | if ((s->session->tlsext_hostname = malloc(len + 1)) == NULL) { |
1041 | *al = TLS1_AD_INTERNAL_ERROR; | 1041 | *al = TLS1_AD_INTERNAL_ERROR; |
1042 | return 0; | 1042 | return 0; |
1043 | } | 1043 | } |
1044 | memcpy(s->session->tlsext_hostname, sdata, len); | 1044 | memcpy(s->session->tlsext_hostname, sdata, len); |
1045 | s->session->tlsext_hostname[len] = '\0'; | 1045 | s->session->tlsext_hostname[len] = '\0'; |
1046 | if (strlen(s->session->tlsext_hostname) != len) { | 1046 | if (strlen(s->session->tlsext_hostname) != len) { |
1047 | OPENSSL_free(s->session->tlsext_hostname); | 1047 | free(s->session->tlsext_hostname); |
1048 | s->session->tlsext_hostname = NULL; | 1048 | s->session->tlsext_hostname = NULL; |
1049 | *al = TLS1_AD_UNRECOGNIZED_NAME; | 1049 | *al = TLS1_AD_UNRECOGNIZED_NAME; |
1050 | return 0; | 1050 | return 0; |
@@ -1081,7 +1081,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1081 | *al = SSL_AD_DECODE_ERROR; | 1081 | *al = SSL_AD_DECODE_ERROR; |
1082 | return 0; | 1082 | return 0; |
1083 | } | 1083 | } |
1084 | if ((s->srp_ctx.login = OPENSSL_malloc(len + 1)) == NULL) | 1084 | if ((s->srp_ctx.login = malloc(len + 1)) == NULL) |
1085 | return -1; | 1085 | return -1; |
1086 | memcpy(s->srp_ctx.login, &data[1], len); | 1086 | memcpy(s->srp_ctx.login, &data[1], len); |
1087 | s->srp_ctx.login[len] = '\0'; | 1087 | s->srp_ctx.login[len] = '\0'; |
@@ -1105,11 +1105,11 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1105 | } | 1105 | } |
1106 | if (!s->hit) { | 1106 | if (!s->hit) { |
1107 | if (s->session->tlsext_ecpointformatlist) { | 1107 | if (s->session->tlsext_ecpointformatlist) { |
1108 | OPENSSL_free(s->session->tlsext_ecpointformatlist); | 1108 | free(s->session->tlsext_ecpointformatlist); |
1109 | s->session->tlsext_ecpointformatlist = NULL; | 1109 | s->session->tlsext_ecpointformatlist = NULL; |
1110 | } | 1110 | } |
1111 | s->session->tlsext_ecpointformatlist_length = 0; | 1111 | s->session->tlsext_ecpointformatlist_length = 0; |
1112 | if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { | 1112 | if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) { |
1113 | *al = TLS1_AD_INTERNAL_ERROR; | 1113 | *al = TLS1_AD_INTERNAL_ERROR; |
1114 | return 0; | 1114 | return 0; |
1115 | } | 1115 | } |
@@ -1140,7 +1140,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1140 | return 0; | 1140 | return 0; |
1141 | } | 1141 | } |
1142 | s->session->tlsext_ellipticcurvelist_length = 0; | 1142 | s->session->tlsext_ellipticcurvelist_length = 0; |
1143 | if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL) { | 1143 | if ((s->session->tlsext_ellipticcurvelist = malloc(ellipticcurvelist_length)) == NULL) { |
1144 | *al = TLS1_AD_INTERNAL_ERROR; | 1144 | *al = TLS1_AD_INTERNAL_ERROR; |
1145 | return 0; | 1145 | return 0; |
1146 | } | 1146 | } |
@@ -1172,9 +1172,9 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, | |||
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ | 1174 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ |
1175 | OPENSSL_free(s->s3->client_opaque_prf_input); | 1175 | free(s->s3->client_opaque_prf_input); |
1176 | if (s->s3->client_opaque_prf_input_len == 0) | 1176 | if (s->s3->client_opaque_prf_input_len == 0) |
1177 | s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1177 | s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1178 | else | 1178 | else |
1179 | s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len); | 1179 | s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len); |
1180 | if (s->s3->client_opaque_prf_input == NULL) { | 1180 | if (s->s3->client_opaque_prf_input == NULL) { |
@@ -1432,8 +1432,8 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, | |||
1432 | } | 1432 | } |
1433 | s->session->tlsext_ecpointformatlist_length = 0; | 1433 | s->session->tlsext_ecpointformatlist_length = 0; |
1434 | if (s->session->tlsext_ecpointformatlist != NULL) | 1434 | if (s->session->tlsext_ecpointformatlist != NULL) |
1435 | OPENSSL_free(s->session->tlsext_ecpointformatlist); | 1435 | free(s->session->tlsext_ecpointformatlist); |
1436 | if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { | 1436 | if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) { |
1437 | *al = TLS1_AD_INTERNAL_ERROR; | 1437 | *al = TLS1_AD_INTERNAL_ERROR; |
1438 | return 0; | 1438 | return 0; |
1439 | } | 1439 | } |
@@ -1478,9 +1478,9 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, | |||
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ | 1480 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ |
1481 | OPENSSL_free(s->s3->server_opaque_prf_input); | 1481 | free(s->s3->server_opaque_prf_input); |
1482 | if (s->s3->server_opaque_prf_input_len == 0) | 1482 | if (s->s3->server_opaque_prf_input_len == 0) |
1483 | s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1483 | s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1484 | else | 1484 | else |
1485 | s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len); | 1485 | s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len); |
1486 | 1486 | ||
@@ -1522,7 +1522,7 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, | |||
1522 | *al = TLS1_AD_INTERNAL_ERROR; | 1522 | *al = TLS1_AD_INTERNAL_ERROR; |
1523 | return 0; | 1523 | return 0; |
1524 | } | 1524 | } |
1525 | s->next_proto_negotiated = OPENSSL_malloc(selected_len); | 1525 | s->next_proto_negotiated = malloc(selected_len); |
1526 | if (!s->next_proto_negotiated) { | 1526 | if (!s->next_proto_negotiated) { |
1527 | *al = TLS1_AD_INTERNAL_ERROR; | 1527 | *al = TLS1_AD_INTERNAL_ERROR; |
1528 | return 0; | 1528 | return 0; |
@@ -1619,8 +1619,8 @@ ssl_prepare_clienthello_tlsext(SSL *s) | |||
1619 | using_ecc = using_ecc && (s->version >= TLS1_VERSION); | 1619 | using_ecc = using_ecc && (s->version >= TLS1_VERSION); |
1620 | if (using_ecc) { | 1620 | if (using_ecc) { |
1621 | if (s->tlsext_ecpointformatlist != NULL) | 1621 | if (s->tlsext_ecpointformatlist != NULL) |
1622 | OPENSSL_free(s->tlsext_ecpointformatlist); | 1622 | free(s->tlsext_ecpointformatlist); |
1623 | if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) { | 1623 | if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) { |
1624 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); | 1624 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); |
1625 | return -1; | 1625 | return -1; |
1626 | } | 1626 | } |
@@ -1631,9 +1631,9 @@ ssl_prepare_clienthello_tlsext(SSL *s) | |||
1631 | 1631 | ||
1632 | /* we support all named elliptic curves in draft-ietf-tls-ecc-12 */ | 1632 | /* we support all named elliptic curves in draft-ietf-tls-ecc-12 */ |
1633 | if (s->tlsext_ellipticcurvelist != NULL) | 1633 | if (s->tlsext_ellipticcurvelist != NULL) |
1634 | OPENSSL_free(s->tlsext_ellipticcurvelist); | 1634 | free(s->tlsext_ellipticcurvelist); |
1635 | s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2; | 1635 | s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2; |
1636 | if ((s->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { | 1636 | if ((s->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) { |
1637 | s->tlsext_ellipticcurvelist_length = 0; | 1637 | s->tlsext_ellipticcurvelist_length = 0; |
1638 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); | 1638 | SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); |
1639 | return -1; | 1639 | return -1; |
@@ -1660,10 +1660,10 @@ ssl_prepare_clienthello_tlsext(SSL *s) | |||
1660 | 1660 | ||
1661 | if (s->tlsext_opaque_prf_input != NULL) { | 1661 | if (s->tlsext_opaque_prf_input != NULL) { |
1662 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ | 1662 | if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ |
1663 | OPENSSL_free(s->s3->client_opaque_prf_input); | 1663 | free(s->s3->client_opaque_prf_input); |
1664 | 1664 | ||
1665 | if (s->tlsext_opaque_prf_input_len == 0) | 1665 | if (s->tlsext_opaque_prf_input_len == 0) |
1666 | s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1666 | s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1667 | else | 1667 | else |
1668 | s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); | 1668 | s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); |
1669 | if (s->s3->client_opaque_prf_input == NULL) { | 1669 | if (s->s3->client_opaque_prf_input == NULL) { |
@@ -1698,8 +1698,8 @@ ssl_prepare_serverhello_tlsext(SSL *s) | |||
1698 | 1698 | ||
1699 | if (using_ecc) { | 1699 | if (using_ecc) { |
1700 | if (s->tlsext_ecpointformatlist != NULL) | 1700 | if (s->tlsext_ecpointformatlist != NULL) |
1701 | OPENSSL_free(s->tlsext_ecpointformatlist); | 1701 | free(s->tlsext_ecpointformatlist); |
1702 | if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) { | 1702 | if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) { |
1703 | SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); | 1703 | SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT, ERR_R_MALLOC_FAILURE); |
1704 | return -1; | 1704 | return -1; |
1705 | } | 1705 | } |
@@ -1752,7 +1752,7 @@ ssl_check_clienthello_tlsext_early(SSL *s) | |||
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ | 1754 | if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */ |
1755 | OPENSSL_free(s->s3->server_opaque_prf_input); | 1755 | free(s->s3->server_opaque_prf_input); |
1756 | s->s3->server_opaque_prf_input = NULL; | 1756 | s->s3->server_opaque_prf_input = NULL; |
1757 | 1757 | ||
1758 | if (s->tlsext_opaque_prf_input != NULL) { | 1758 | if (s->tlsext_opaque_prf_input != NULL) { |
@@ -1762,7 +1762,7 @@ ssl_check_clienthello_tlsext_early(SSL *s) | |||
1762 | * of the same length as the client opaque PRF input! */ | 1762 | * of the same length as the client opaque PRF input! */ |
1763 | 1763 | ||
1764 | if (s->tlsext_opaque_prf_input_len == 0) | 1764 | if (s->tlsext_opaque_prf_input_len == 0) |
1765 | s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ | 1765 | s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */ |
1766 | else | 1766 | else |
1767 | s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); | 1767 | s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len); |
1768 | if (s->s3->server_opaque_prf_input == NULL) { | 1768 | if (s->s3->server_opaque_prf_input == NULL) { |
@@ -1937,7 +1937,7 @@ ssl_check_serverhello_tlsext(SSL *s) | |||
1937 | * there is no response. | 1937 | * there is no response. |
1938 | */ | 1938 | */ |
1939 | if (s->tlsext_ocsp_resp) { | 1939 | if (s->tlsext_ocsp_resp) { |
1940 | OPENSSL_free(s->tlsext_ocsp_resp); | 1940 | free(s->tlsext_ocsp_resp); |
1941 | s->tlsext_ocsp_resp = NULL; | 1941 | s->tlsext_ocsp_resp = NULL; |
1942 | } | 1942 | } |
1943 | s->tlsext_ocsp_resplen = -1; | 1943 | s->tlsext_ocsp_resplen = -1; |
@@ -2156,7 +2156,7 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
2156 | /* Move p after IV to start of encrypted ticket, update length */ | 2156 | /* Move p after IV to start of encrypted ticket, update length */ |
2157 | p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); | 2157 | p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); |
2158 | eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); | 2158 | eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); |
2159 | sdec = OPENSSL_malloc(eticklen); | 2159 | sdec = malloc(eticklen); |
2160 | if (!sdec) { | 2160 | if (!sdec) { |
2161 | EVP_CIPHER_CTX_cleanup(&ctx); | 2161 | EVP_CIPHER_CTX_cleanup(&ctx); |
2162 | return -1; | 2162 | return -1; |
@@ -2169,7 +2169,7 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, | |||
2169 | p = sdec; | 2169 | p = sdec; |
2170 | 2170 | ||
2171 | sess = d2i_SSL_SESSION(NULL, &p, slen); | 2171 | sess = d2i_SSL_SESSION(NULL, &p, slen); |
2172 | OPENSSL_free(sdec); | 2172 | free(sdec); |
2173 | if (sess) { | 2173 | if (sess) { |
2174 | /* The session ID, if non-empty, is used by some clients to | 2174 | /* The session ID, if non-empty, is used by some clients to |
2175 | * detect that the ticket has been accepted. So we copy it to | 2175 | * detect that the ticket has been accepted. So we copy it to |