summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p_lib.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>1999-11-21 22:28:31 +0000
committerDr. Stephen Henson <steve@openssl.org>1999-11-21 22:28:31 +0000
commit52664f5081939c96c5867fd02278f7575f1cab2d (patch)
treef2a5a01dcf50d2f54aa8114adf8ed59867754ed6 /crypto/evp/p_lib.c
parenta716d727347d6cd81534327901b509c6f5763f83 (diff)
Transparent support for PKCS#8 private keys in RSA/DSA.
New universal public key format. Fix CRL+cert load problem in by_file.c Make verify report errors when loading files or dirs
Diffstat (limited to 'crypto/evp/p_lib.c')
-rw-r--r--crypto/evp/p_lib.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index dba08525a3..14ad90cec5 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -206,7 +206,13 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
}
#ifndef NO_RSA
-RSA *EVP_PKEY_get_RSA(EVP_PKEY *pkey)
+int EVP_PKEY_rset_RSA(EVP_PKEY *pkey, RSA *key)
+{
+ CRYPTO_add(&key->references, 1, CRYPTO_LOCK_RSA);
+ return EVP_PKEY_assign_RSA(pkey, key);
+}
+
+RSA *EVP_PKEY_rget_RSA(EVP_PKEY *pkey)
{
if(pkey->type != EVP_PKEY_RSA) {
EVPerr(EVP_F_EVP_PKEY_GET_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
@@ -218,19 +224,32 @@ RSA *EVP_PKEY_get_RSA(EVP_PKEY *pkey)
#endif
#ifndef NO_DSA
-DSA *EVP_PKEY_get_DSA(EVP_PKEY *pkey)
+int EVP_PKEY_rset_DSA(EVP_PKEY *pkey, DSA *key)
+{
+ CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DSA);
+ return EVP_PKEY_assign_DSA(pkey, key);
+}
+
+DSA *EVP_PKEY_rget_DSA(EVP_PKEY *pkey)
{
if(pkey->type != EVP_PKEY_DSA) {
EVPerr(EVP_F_EVP_PKEY_GET_DSA, EVP_R_EXPECTING_A_DSA_KEY);
return NULL;
}
- CRYPTO_add(&pkey->pkey.rsa->references, 1, CRYPTO_LOCK_DSA);
+ CRYPTO_add(&pkey->pkey.dsa->references, 1, CRYPTO_LOCK_DSA);
return pkey->pkey.dsa;
}
#endif
#ifndef NO_DH
-DH *EVP_PKEY_get_DH(EVP_PKEY *pkey)
+
+int EVP_PKEY_rset_DH(EVP_PKEY *pkey, DH *key)
+{
+ CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DH);
+ return EVP_PKEY_assign_DH(pkey, key);
+}
+
+DH *EVP_PKEY_rget_DH(EVP_PKEY *pkey)
{
if(pkey->type != EVP_PKEY_DH) {
EVPerr(EVP_F_EVP_PKEY_GET_DH, EVP_R_EXPECTING_A_DH_KEY);