summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pem/pem_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pem/pem_lib.c')
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c28
1 files changed, 14 insertions, 14 deletions
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
306err: 306err:
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,
630err: 630err:
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);
816err: 816err:
817 BUF_MEM_free(nameB); 817 BUF_MEM_free(nameB);