use asn1 callbacks for new, free and d2i
[oweals/openssl.git] / crypto / pem / pem_all.c
index a9ac52de02b9d543b0c6c7073f3386a8c356072e..d696f15b8752c5f6af905d9ea708f0b3703c224d 100644 (file)
 #include <openssl/x509.h>
 #include <openssl/pkcs7.h>
 #include <openssl/pem.h>
+#ifndef OPENSSL_NO_RSA
 #include <openssl/rsa.h>
+#endif
+#ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
+#endif
+#ifndef OPENSSL_NO_DH
 #include <openssl/dh.h>
+#endif
 
 #ifndef OPENSSL_NO_RSA
 static RSA *pkey_get_rsa(EVP_PKEY *key, RSA **rsa);
@@ -215,7 +221,7 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb,
 {
        EVP_PKEY *pktmp;
        pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u);
-       return pkey_get_dsa(pktmp, dsa);
+       return pkey_get_dsa(pktmp, dsa);        /* will free pktmp */
 }
 
 IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey)
@@ -228,7 +234,7 @@ DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **dsa, pem_password_cb *cb,
 {
        EVP_PKEY *pktmp;
        pktmp = PEM_read_PrivateKey(fp, NULL, cb, u);
-       return pkey_get_dsa(pktmp, dsa);
+       return pkey_get_dsa(pktmp, dsa);        /* will free pktmp */
 }
 
 #endif
@@ -259,7 +265,7 @@ EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb,
 {
        EVP_PKEY *pktmp;
        pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u);
-       return pkey_get_eckey(pktmp, key);
+       return pkey_get_eckey(pktmp, key);      /* will free pktmp */
 }
 
 IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters)
@@ -275,7 +281,7 @@ EC_KEY *PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb,
 {
        EVP_PKEY *pktmp;
        pktmp = PEM_read_PrivateKey(fp, NULL, cb, u);
-       return pkey_get_eckey(pktmp, eckey);
+       return pkey_get_eckey(pktmp, eckey);    /* will free pktmp */
 }
 
 #endif