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.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c
index 82815067b3..7785039b99 100644
--- a/src/lib/libcrypto/pem/pem_lib.c
+++ b/src/lib/libcrypto/pem/pem_lib.c
@@ -73,7 +73,7 @@ const char *PEM_version="PEM" OPENSSL_VERSION_PTEXT;
73 73
74#define MIN_LENGTH 4 74#define MIN_LENGTH 4
75 75
76static int load_iv(char **fromp,unsigned char *to, int num); 76static int load_iv(unsigned char **fromp,unsigned char *to, int num);
77static int check_pem(const char *nm, const char *name); 77static int check_pem(const char *nm, const char *name);
78 78
79int PEM_def_callback(char *buf, int num, int w, void *key) 79int PEM_def_callback(char *buf, int num, int w, void *key)
@@ -301,7 +301,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
301 301
302 if ((dsize=i2d(x,NULL)) < 0) 302 if ((dsize=i2d(x,NULL)) < 0)
303 { 303 {
304 PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_ASN1_LIB); 304 PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE);
305 dsize=0; 305 dsize=0;
306 goto err; 306 goto err;
307 } 307 }
@@ -432,7 +432,6 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
432 int o; 432 int o;
433 const EVP_CIPHER *enc=NULL; 433 const EVP_CIPHER *enc=NULL;
434 char *p,c; 434 char *p,c;
435 char **header_pp = &header;
436 435
437 cipher->cipher=NULL; 436 cipher->cipher=NULL;
438 if ((header == NULL) || (*header == '\0') || (*header == '\n')) 437 if ((header == NULL) || (*header == '\0') || (*header == '\n'))
@@ -479,16 +478,15 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
479 PEMerr(PEM_F_PEM_GET_EVP_CIPHER_INFO,PEM_R_UNSUPPORTED_ENCRYPTION); 478 PEMerr(PEM_F_PEM_GET_EVP_CIPHER_INFO,PEM_R_UNSUPPORTED_ENCRYPTION);
480 return(0); 479 return(0);
481 } 480 }
482 if (!load_iv(header_pp,&(cipher->iv[0]),enc->iv_len)) 481 if (!load_iv((unsigned char **)&header,&(cipher->iv[0]),enc->iv_len)) return(0);
483 return(0);
484 482
485 return(1); 483 return(1);
486 } 484 }
487 485
488static int load_iv(char **fromp, unsigned char *to, int num) 486static int load_iv(unsigned char **fromp, unsigned char *to, int num)
489 { 487 {
490 int v,i; 488 int v,i;
491 char *from; 489 unsigned char *from;
492 490
493 from= *fromp; 491 from= *fromp;
494 for (i=0; i<num; i++) to[i]=0; 492 for (i=0; i<num; i++) to[i]=0;
@@ -625,9 +623,6 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,
625 dataB=BUF_MEM_new(); 623 dataB=BUF_MEM_new();
626 if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL)) 624 if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL))
627 { 625 {
628 BUF_MEM_free(nameB);
629 BUF_MEM_free(headerB);
630 BUF_MEM_free(dataB);
631 PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE); 626 PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE);
632 return(0); 627 return(0);
633 } 628 }