Loading CHANGES +5 −1 Original line number Diff line number Diff line Loading @@ -4,9 +4,13 @@ Changes between 0.9.4 and 0.9.5 [xx XXX 1999] *) Add d2i,i2d bio/fp functions for PrivateKey: these convert the traditional format into an EVP_PKEY structure. [Steve Henson] *) Add a password callback function PEM_cb() which either prompts for a password if usr_data is NULL or otherwise assumes it is a null terminate password. Allow passwords to be passed on command line terminated password. Allow passwords to be passed on command line environment or config files in a few more utilities. [Steve Henson] Loading crypto/asn1/asn1.h +2 −0 Original line number Diff line number Diff line Loading @@ -890,6 +890,8 @@ void ASN1_STRING_TABLE_cleanup(void); #define ASN1_F_D2I_POLICYINFO 269 #define ASN1_F_D2I_POLICYQUALINFO 270 #define ASN1_F_D2I_PRIVATEKEY 155 #define ASN1_F_D2I_PRIVATEKEY_BIO 293 #define ASN1_F_D2I_PRIVATEKEY_FP 294 #define ASN1_F_D2I_PUBLICKEY 156 #define ASN1_F_D2I_RSAPRIVATEKEY 157 #define ASN1_F_D2I_RSAPUBLICKEY 158 Loading crypto/asn1/asn1_err.c +2 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,8 @@ static ERR_STRING_DATA ASN1_str_functs[]= {ERR_PACK(0,ASN1_F_D2I_POLICYINFO,0), "d2i_POLICYINFO"}, {ERR_PACK(0,ASN1_F_D2I_POLICYQUALINFO,0), "d2i_POLICYQUALINFO"}, {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"}, {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY_BIO,0), "d2i_PrivateKey_bio"}, {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY_FP,0), "d2i_PrivateKey_fp"}, {ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"}, {ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "d2i_RSAPrivateKey"}, {ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "d2i_RSAPublicKey"}, Loading crypto/x509/x509.h +5 −1 Original line number Diff line number Diff line Loading @@ -658,13 +658,15 @@ DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); #endif X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO **p8inf); int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); #endif int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, int type, EVP_PKEY **a); #endif #ifdef HEADER_BIO_H Loading Loading @@ -694,6 +696,8 @@ PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO **p8inf); int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, int type, EVP_PKEY **a); #endif X509 *X509_dup(X509 *x509); Loading crypto/x509/x_all.c +71 −0 Original line number Diff line number Diff line Loading @@ -481,6 +481,24 @@ int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key) return ret; } int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey) { return(ASN1_i2d_fp(i2d_PrivateKey,fp,(unsigned char *)pkey)); } EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, int type, EVP_PKEY **a) { BIO *bp; EVP_PKEY *ret; if(!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) { ASN1err(ASN1_F_D2I_PRIVATEKEY_FP,ERR_R_MALLOC_FAILURE); return NULL; } ret = d2i_PrivateKey_bio(bp, type, a); BIO_free(bp); return ret; } #endif PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, Loading @@ -507,3 +525,56 @@ int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key) PKCS8_PRIV_KEY_INFO_free(p8inf); return ret; } int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey) { return(ASN1_i2d_bio(i2d_PrivateKey,bp,(unsigned char *)pkey)); } EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, int type, EVP_PKEY **a) { EVP_PKEY *ret; if ((a == NULL) || (*a == NULL)) { if ((ret=EVP_PKEY_new()) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ERR_R_EVP_LIB); return(NULL); } } else ret= *a; ret->save_type=type; ret->type=EVP_PKEY_type(type); switch (ret->type) { #ifndef NO_RSA case EVP_PKEY_RSA: if ((ret->pkey.rsa=d2i_RSAPrivateKey_bio(bp,NULL)) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ERR_R_ASN1_LIB); goto err; } break; #endif #ifndef NO_DSA case EVP_PKEY_DSA: if ((ret->pkey.dsa=d2i_DSAPrivateKey_bio(bp, NULL)) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ERR_R_ASN1_LIB); goto err; } break; #endif default: ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); goto err; /* break; */ } if (a != NULL) (*a)=ret; return(ret); err: if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret); return(NULL); } Loading
CHANGES +5 −1 Original line number Diff line number Diff line Loading @@ -4,9 +4,13 @@ Changes between 0.9.4 and 0.9.5 [xx XXX 1999] *) Add d2i,i2d bio/fp functions for PrivateKey: these convert the traditional format into an EVP_PKEY structure. [Steve Henson] *) Add a password callback function PEM_cb() which either prompts for a password if usr_data is NULL or otherwise assumes it is a null terminate password. Allow passwords to be passed on command line terminated password. Allow passwords to be passed on command line environment or config files in a few more utilities. [Steve Henson] Loading
crypto/asn1/asn1.h +2 −0 Original line number Diff line number Diff line Loading @@ -890,6 +890,8 @@ void ASN1_STRING_TABLE_cleanup(void); #define ASN1_F_D2I_POLICYINFO 269 #define ASN1_F_D2I_POLICYQUALINFO 270 #define ASN1_F_D2I_PRIVATEKEY 155 #define ASN1_F_D2I_PRIVATEKEY_BIO 293 #define ASN1_F_D2I_PRIVATEKEY_FP 294 #define ASN1_F_D2I_PUBLICKEY 156 #define ASN1_F_D2I_RSAPRIVATEKEY 157 #define ASN1_F_D2I_RSAPUBLICKEY 158 Loading
crypto/asn1/asn1_err.c +2 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,8 @@ static ERR_STRING_DATA ASN1_str_functs[]= {ERR_PACK(0,ASN1_F_D2I_POLICYINFO,0), "d2i_POLICYINFO"}, {ERR_PACK(0,ASN1_F_D2I_POLICYQUALINFO,0), "d2i_POLICYQUALINFO"}, {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"}, {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY_BIO,0), "d2i_PrivateKey_bio"}, {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY_FP,0), "d2i_PrivateKey_fp"}, {ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"}, {ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "d2i_RSAPrivateKey"}, {ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "d2i_RSAPublicKey"}, Loading
crypto/x509/x509.h +5 −1 Original line number Diff line number Diff line Loading @@ -658,13 +658,15 @@ DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); #endif X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO **p8inf); int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); #endif int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, int type, EVP_PKEY **a); #endif #ifdef HEADER_BIO_H Loading Loading @@ -694,6 +696,8 @@ PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO **p8inf); int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, int type, EVP_PKEY **a); #endif X509 *X509_dup(X509 *x509); Loading
crypto/x509/x_all.c +71 −0 Original line number Diff line number Diff line Loading @@ -481,6 +481,24 @@ int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key) return ret; } int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey) { return(ASN1_i2d_fp(i2d_PrivateKey,fp,(unsigned char *)pkey)); } EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, int type, EVP_PKEY **a) { BIO *bp; EVP_PKEY *ret; if(!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) { ASN1err(ASN1_F_D2I_PRIVATEKEY_FP,ERR_R_MALLOC_FAILURE); return NULL; } ret = d2i_PrivateKey_bio(bp, type, a); BIO_free(bp); return ret; } #endif PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, Loading @@ -507,3 +525,56 @@ int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key) PKCS8_PRIV_KEY_INFO_free(p8inf); return ret; } int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey) { return(ASN1_i2d_bio(i2d_PrivateKey,bp,(unsigned char *)pkey)); } EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, int type, EVP_PKEY **a) { EVP_PKEY *ret; if ((a == NULL) || (*a == NULL)) { if ((ret=EVP_PKEY_new()) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ERR_R_EVP_LIB); return(NULL); } } else ret= *a; ret->save_type=type; ret->type=EVP_PKEY_type(type); switch (ret->type) { #ifndef NO_RSA case EVP_PKEY_RSA: if ((ret->pkey.rsa=d2i_RSAPrivateKey_bio(bp,NULL)) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ERR_R_ASN1_LIB); goto err; } break; #endif #ifndef NO_DSA case EVP_PKEY_DSA: if ((ret->pkey.dsa=d2i_DSAPrivateKey_bio(bp, NULL)) == NULL) { ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ERR_R_ASN1_LIB); goto err; } break; #endif default: ASN1err(ASN1_F_D2I_PRIVATEKEY_BIO,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); goto err; /* break; */ } if (a != NULL) (*a)=ret; return(ret); err: if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret); return(NULL); }