summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>1999-11-23 19:50:28 +0100
committerDr. Stephen Henson <steve@openssl.org>1999-11-23 19:50:28 +0100
commit6d3724d3b0e0b2dff99feb815d46ef41e65db0d2 (patch)
tree5cee2e488fc75e51ea04dc52d7a366120a017ee9 /crypto/evp
parentTransparent support for PKCS#8 private keys in RSA/DSA. (diff)
downloadopenssl-6d3724d3b0e0b2dff99feb815d46ef41e65db0d2.tar.xz
openssl-6d3724d3b0e0b2dff99feb815d46ef41e65db0d2.zip
Support for authority information access extension.
Fix so EVP_PKEY_rset_*() check return codes.
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/evp.h6
-rw-r--r--crypto/evp/evp_err.c6
-rw-r--r--crypto/evp/p_lib.c21
3 files changed, 18 insertions, 15 deletions
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
index eb592f0752..414387d2b1 100644
--- a/crypto/evp/evp.h
+++ b/crypto/evp/evp.h
@@ -682,10 +682,10 @@ void EVP_PBE_cleanup(void);
#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
#define EVP_F_EVP_PKEY_DECRYPT 104
#define EVP_F_EVP_PKEY_ENCRYPT 105
-#define EVP_F_EVP_PKEY_GET_DH 119
-#define EVP_F_EVP_PKEY_GET_DSA 120
-#define EVP_F_EVP_PKEY_GET_RSA 121
#define EVP_F_EVP_PKEY_NEW 106
+#define EVP_F_EVP_PKEY_RGET_DH 119
+#define EVP_F_EVP_PKEY_RGET_DSA 120
+#define EVP_F_EVP_PKEY_RGET_RSA 121
#define EVP_F_EVP_SIGNFINAL 107
#define EVP_F_EVP_VERIFYFINAL 108
#define EVP_F_PKCS5_PBE_KEYIVGEN 117
diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c
index 7d21938ec5..6ef158ca95 100644
--- a/crypto/evp/evp_err.c
+++ b/crypto/evp/evp_err.c
@@ -77,10 +77,10 @@ static ERR_STRING_DATA EVP_str_functs[]=
{ERR_PACK(0,EVP_F_EVP_PKEY_COPY_PARAMETERS,0), "EVP_PKEY_copy_parameters"},
{ERR_PACK(0,EVP_F_EVP_PKEY_DECRYPT,0), "EVP_PKEY_decrypt"},
{ERR_PACK(0,EVP_F_EVP_PKEY_ENCRYPT,0), "EVP_PKEY_encrypt"},
-{ERR_PACK(0,EVP_F_EVP_PKEY_GET_DH,0), "EVP_PKEY_get_DH"},
-{ERR_PACK(0,EVP_F_EVP_PKEY_GET_DSA,0), "EVP_PKEY_get_DSA"},
-{ERR_PACK(0,EVP_F_EVP_PKEY_GET_RSA,0), "EVP_PKEY_get_RSA"},
{ERR_PACK(0,EVP_F_EVP_PKEY_NEW,0), "EVP_PKEY_new"},
+{ERR_PACK(0,EVP_F_EVP_PKEY_RGET_DH,0), "EVP_PKEY_rget_DH"},
+{ERR_PACK(0,EVP_F_EVP_PKEY_RGET_DSA,0), "EVP_PKEY_rget_DSA"},
+{ERR_PACK(0,EVP_F_EVP_PKEY_RGET_RSA,0), "EVP_PKEY_rget_RSA"},
{ERR_PACK(0,EVP_F_EVP_SIGNFINAL,0), "EVP_SignFinal"},
{ERR_PACK(0,EVP_F_EVP_VERIFYFINAL,0), "EVP_VerifyFinal"},
{ERR_PACK(0,EVP_F_PKCS5_PBE_KEYIVGEN,0), "PKCS5_PBE_keyivgen"},
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 14ad90cec5..94c4047a5e 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -208,14 +208,15 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
#ifndef NO_RSA
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);
+ int ret = EVP_PKEY_assign_RSA(pkey, key);
+ if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_RSA);
+ return ret;
}
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);
+ EVPerr(EVP_F_EVP_PKEY_RGET_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
return NULL;
}
CRYPTO_add(&pkey->pkey.rsa->references, 1, CRYPTO_LOCK_RSA);
@@ -226,14 +227,15 @@ RSA *EVP_PKEY_rget_RSA(EVP_PKEY *pkey)
#ifndef NO_DSA
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);
+ int ret = EVP_PKEY_assign_DSA(pkey, key);
+ if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DSA);
+ return ret;
}
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);
+ EVPerr(EVP_F_EVP_PKEY_RGET_DSA, EVP_R_EXPECTING_A_DSA_KEY);
return NULL;
}
CRYPTO_add(&pkey->pkey.dsa->references, 1, CRYPTO_LOCK_DSA);
@@ -245,14 +247,15 @@ DSA *EVP_PKEY_rget_DSA(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);
+ int ret = EVP_PKEY_assign_DH(pkey, key);
+ if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DH);
+ return ret;
}
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);
+ EVPerr(EVP_F_EVP_PKEY_RGET_DH, EVP_R_EXPECTING_A_DH_KEY);
return NULL;
}
CRYPTO_add(&pkey->pkey.dh->references, 1, CRYPTO_LOCK_DH);