diff options
Diffstat (limited to 'lib/libcrypto/pem')
-rw-r--r-- | lib/libcrypto/pem/Makefile.ssl | 87 | ||||
-rw-r--r-- | lib/libcrypto/pem/pem.h | 22 | ||||
-rw-r--r-- | lib/libcrypto/pem/pem2.h | 8 | ||||
-rw-r--r-- | lib/libcrypto/pem/pem_info.c | 12 | ||||
-rw-r--r-- | lib/libcrypto/pem/pem_lib.c | 26 | ||||
-rw-r--r-- | lib/libcrypto/pem/pem_seal.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/pem/pem_sign.c | 4 |
7 files changed, 97 insertions, 70 deletions
diff --git a/lib/libcrypto/pem/Makefile.ssl b/lib/libcrypto/pem/Makefile.ssl index b95b2b615ac..97af8255a3c 100644 --- a/lib/libcrypto/pem/Makefile.ssl +++ b/lib/libcrypto/pem/Makefile.ssl @@ -86,25 +86,29 @@ pem_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h pem_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h pem_all.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h pem_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h -pem_all.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +pem_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +pem_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h pem_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -pem_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -pem_all.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h -pem_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h -pem_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -pem_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h -pem_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -pem_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +pem_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +pem_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +pem_all.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h +pem_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +pem_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +pem_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +pem_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +pem_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h pem_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h pem_all.o: ../cryptlib.h pem_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h pem_err.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h -pem_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h -pem_err.o: ../../include/openssl/des.h ../../include/openssl/dh.h -pem_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h -pem_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h -pem_err.o: ../../include/openssl/idea.h ../../include/openssl/md2.h -pem_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +pem_err.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +pem_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +pem_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +pem_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h +pem_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h +pem_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h pem_err.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h @@ -112,7 +116,8 @@ pem_err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h pem_err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h pem_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h pem_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -pem_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +pem_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h +pem_err.o: ../../include/openssl/x509_vfy.h pem_info.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h pem_info.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h pem_info.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -120,17 +125,19 @@ pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h pem_info.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h pem_info.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h -pem_info.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +pem_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +pem_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h pem_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -pem_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +pem_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +pem_info.o: ../../include/openssl/opensslconf.h pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h pem_info.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h pem_info.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h pem_info.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h pem_info.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h pem_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -pem_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h -pem_info.o: ../cryptlib.h +pem_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h +pem_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h pem_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h pem_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -138,16 +145,18 @@ pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h pem_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h pem_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h -pem_lib.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +pem_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +pem_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h pem_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -pem_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -pem_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h -pem_lib.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h -pem_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h -pem_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -pem_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h -pem_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +pem_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +pem_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +pem_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h +pem_lib.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h +pem_lib.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h +pem_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +pem_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +pem_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +pem_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h pem_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h pem_lib.o: ../cryptlib.h pem_seal.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h @@ -157,17 +166,20 @@ pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/des.h pem_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h pem_seal.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h pem_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h -pem_seal.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +pem_seal.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +pem_seal.o: ../../include/openssl/md2.h ../../include/openssl/md4.h pem_seal.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -pem_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +pem_seal.o: ../../include/openssl/opensslconf.h pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h pem_seal.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h pem_seal.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h pem_seal.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h pem_seal.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h pem_seal.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -pem_seal.o: ../../include/openssl/stack.h ../../include/openssl/x509.h -pem_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +pem_seal.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +pem_seal.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +pem_seal.o: ../cryptlib.h pem_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h pem_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h pem_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -175,14 +187,17 @@ pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h pem_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h pem_sign.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h pem_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h -pem_sign.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +pem_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +pem_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h pem_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h -pem_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +pem_sign.o: ../../include/openssl/opensslconf.h pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h pem_sign.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h pem_sign.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h pem_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h pem_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h pem_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h -pem_sign.o: ../../include/openssl/stack.h ../../include/openssl/x509.h -pem_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +pem_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +pem_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +pem_sign.o: ../cryptlib.h diff --git a/lib/libcrypto/pem/pem.h b/lib/libcrypto/pem/pem.h index e4bae0b4aac..6d3c446577f 100644 --- a/lib/libcrypto/pem/pem.h +++ b/lib/libcrypto/pem/pem.h @@ -59,14 +59,20 @@ #ifndef HEADER_PEM_H #define HEADER_PEM_H -#ifdef __cplusplus -extern "C" { +#ifndef NO_BIO +#include <openssl/bio.h> +#endif +#ifndef NO_STACK +#include <openssl/stack.h> #endif - #include <openssl/evp.h> #include <openssl/x509.h> #include <openssl/pem2.h> +#ifdef __cplusplus +extern "C" { +#endif + #define PEM_BUFSIZE 1024 #define PEM_OBJ_UNDEF 0 @@ -165,7 +171,7 @@ typedef struct pem_ctx_st int num_recipient; PEM_USER **recipient; -#ifdef HEADER_STACK_H +#ifndef NO_STACK STACK *x509_chain; /* certificate chain */ #else char *x509_chain; /* certificate chain */ @@ -289,7 +295,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ #endif -#ifdef HEADER_BIO_H +#ifndef NO_BIO #define DECLARE_PEM_read_bio(name, type) \ type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); @@ -477,7 +483,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, pem_password_cb *callback,void *u); -#ifdef HEADER_BIO_H +#ifndef NO_BIO int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,long *len); int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data, @@ -525,9 +531,7 @@ void PEM_dek_info(char *buf, const char *type, int len, char *str); #ifndef SSLEAY_MACROS -#ifdef VMS -#include <openssl/vms_idhacks.h> -#endif +#include <openssl/symhacks.h> DECLARE_PEM_rw(X509, X509) diff --git a/lib/libcrypto/pem/pem2.h b/lib/libcrypto/pem/pem2.h index 4a016aacd2a..4e484bcd82a 100644 --- a/lib/libcrypto/pem/pem2.h +++ b/lib/libcrypto/pem/pem2.h @@ -57,4 +57,12 @@ * Ben 30 Jan 1999. */ +#ifdef __cplusplus +extern "C" { +#endif + void ERR_load_PEM_strings(void); + +#ifdef __cplusplus +} +#endif diff --git a/lib/libcrypto/pem/pem_info.c b/lib/libcrypto/pem/pem_info.c index b65239a9200..1c5c6dea000 100644 --- a/lib/libcrypto/pem/pem_info.c +++ b/lib/libcrypto/pem/pem_info.c @@ -237,9 +237,9 @@ start: else { /* unknown */ } - if (name != NULL) Free(name); - if (header != NULL) Free(header); - if (data != NULL) Free(data); + if (name != NULL) OPENSSL_free(name); + if (header != NULL) OPENSSL_free(header); + if (data != NULL) OPENSSL_free(data); name=NULL; header=NULL; data=NULL; @@ -268,9 +268,9 @@ err: ret=NULL; } - if (name != NULL) Free(name); - if (header != NULL) Free(header); - if (data != NULL) Free(data); + if (name != NULL) OPENSSL_free(name); + if (header != NULL) OPENSSL_free(header); + if (data != NULL) OPENSSL_free(data); return(ret); } diff --git a/lib/libcrypto/pem/pem_lib.c b/lib/libcrypto/pem/pem_lib.c index b5e0a650f8d..a17c3ed57f1 100644 --- a/lib/libcrypto/pem/pem_lib.c +++ b/lib/libcrypto/pem/pem_lib.c @@ -242,9 +242,9 @@ char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x, return(NULL); } if(check_pem(nm, name)) break; - Free(nm); - Free(header); - Free(data); + OPENSSL_free(nm); + OPENSSL_free(header); + OPENSSL_free(data); } if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err; if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err; @@ -289,9 +289,9 @@ p8err: if (ret == NULL) PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB); err: - Free(nm); - Free(header); - Free(data); + OPENSSL_free(nm); + OPENSSL_free(header); + OPENSSL_free(data); return(ret); } @@ -344,7 +344,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x, goto err; } /* dzise + 8 bytes are needed */ - data=(unsigned char *)Malloc((unsigned int)dsize+20); + data=(unsigned char *)OPENSSL_malloc((unsigned int)dsize+20); if (data == NULL) { PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE); @@ -405,7 +405,7 @@ err: memset((char *)&ctx,0,sizeof(ctx)); memset(buf,0,PEM_BUFSIZE); memset(data,0,(unsigned int)dsize); - Free(data); + OPENSSL_free(data); return(ret); } @@ -583,7 +583,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, goto err; } - buf=(unsigned char *)Malloc(PEM_BUFSIZE*8); + buf=(unsigned char *)OPENSSL_malloc(PEM_BUFSIZE*8); if (buf == NULL) { reason=ERR_R_MALLOC_FAILURE; @@ -603,7 +603,7 @@ int PEM_write_bio(BIO *bp, const char *name, char *header, unsigned char *data, } EVP_EncodeFinal(&ctx,buf,&outl); if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err; - Free(buf); + OPENSSL_free(buf); if ( (BIO_write(bp,"-----END ",9) != 9) || (BIO_write(bp,name,nlen) != nlen) || (BIO_write(bp,"-----\n",6) != 6)) @@ -784,9 +784,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, *header=headerB->data; *data=(unsigned char *)dataB->data; *len=bl; - Free(nameB); - Free(headerB); - Free(dataB); + OPENSSL_free(nameB); + OPENSSL_free(headerB); + OPENSSL_free(dataB); return(1); err: BUF_MEM_free(nameB); diff --git a/lib/libcrypto/pem/pem_seal.c b/lib/libcrypto/pem/pem_seal.c index 126e29d375d..2a6c5133481 100644 --- a/lib/libcrypto/pem/pem_seal.c +++ b/lib/libcrypto/pem/pem_seal.c @@ -84,7 +84,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, j=RSA_size(pubk[i]->pkey.rsa); if (j > max) max=j; } - s=(char *)Malloc(max*2); + s=(char *)OPENSSL_malloc(max*2); if (s == NULL) { PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE); @@ -108,7 +108,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, ret=npubk; err: - if (s != NULL) Free(s); + if (s != NULL) OPENSSL_free(s); memset(key,0,EVP_MAX_KEY_LENGTH); return(ret); } @@ -151,7 +151,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, } i=RSA_size(priv->pkey.rsa); if (i < 100) i=100; - s=(unsigned char *)Malloc(i*2); + s=(unsigned char *)OPENSSL_malloc(i*2); if (s == NULL) { PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE); @@ -172,7 +172,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, err: memset((char *)&(ctx->md),0,sizeof(ctx->md)); memset((char *)&(ctx->cipher),0,sizeof(ctx->cipher)); - if (s != NULL) Free(s); + if (s != NULL) OPENSSL_free(s); return(ret); } #else /* !NO_RSA */ diff --git a/lib/libcrypto/pem/pem_sign.c b/lib/libcrypto/pem/pem_sign.c index aabafb702df..42d598dd78c 100644 --- a/lib/libcrypto/pem/pem_sign.c +++ b/lib/libcrypto/pem/pem_sign.c @@ -82,7 +82,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, int i,ret=0; unsigned int m_len; - m=(unsigned char *)Malloc(EVP_PKEY_size(pkey)+2); + m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2); if (m == NULL) { 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, ret=1; err: /* ctx has been zeroed by EVP_SignFinal() */ - if (m != NULL) Free(m); + if (m != NULL) OPENSSL_free(m); return(ret); } |