summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pem/pvkfmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pem/pvkfmt.c')
-rw-r--r--src/lib/libcrypto/pem/pvkfmt.c24
1 files changed, 12 insertions, 12 deletions
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);