diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-01-19 00:21:12 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-01-20 03:24:59 +0000 |
commit | 3aeb93486588e7dd01379c50b8fd496d55cf8858 (patch) | |
tree | e5d5793ef4786dbfac5c724e8235a3aa1ce323b2 /crypto/evp | |
parent | a8eda4312db1f98cffda38670e2d40d36566785a (diff) |
make EVP_PKEY opaque
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/evp_pkey.c | 1 | ||||
-rw-r--r-- | crypto/evp/p_dec.c | 5 | ||||
-rw-r--r-- | crypto/evp/p_enc.c | 4 | ||||
-rw-r--r-- | crypto/evp/p_lib.c | 3 | ||||
-rw-r--r-- | crypto/evp/p_open.c | 4 |
5 files changed, 10 insertions, 7 deletions
diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c index e0c689f158..65ccd5bac4 100644 --- a/crypto/evp/evp_pkey.c +++ b/crypto/evp/evp_pkey.c @@ -63,6 +63,7 @@ #include <openssl/x509.h> #include <openssl/rand.h> #include "internal/asn1_int.h" +#include "internal/evp_int.h" /* Extract a private key from a PKCS8 structure */ diff --git a/crypto/evp/p_dec.c b/crypto/evp/p_dec.c index f232934b93..218c674bc3 100644 --- a/crypto/evp/p_dec.c +++ b/crypto/evp/p_dec.c @@ -72,7 +72,7 @@ int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, int ret = -1; #ifndef OPENSSL_NO_RSA - if (priv->type != EVP_PKEY_RSA) { + if (EVP_PKEY_id(priv) != EVP_PKEY_RSA) { #endif EVPerr(EVP_F_EVP_PKEY_DECRYPT_OLD, EVP_R_PUBLIC_KEY_NOT_RSA); #ifndef OPENSSL_NO_RSA @@ -80,7 +80,8 @@ int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, } ret = - RSA_private_decrypt(ekl, ek, key, priv->pkey.rsa, RSA_PKCS1_PADDING); + RSA_private_decrypt(ekl, ek, key, EVP_PKEY_get0_RSA(priv), + RSA_PKCS1_PADDING); err: #endif return (ret); diff --git a/crypto/evp/p_enc.c b/crypto/evp/p_enc.c index d4ab14b354..d2069c9c7d 100644 --- a/crypto/evp/p_enc.c +++ b/crypto/evp/p_enc.c @@ -72,14 +72,14 @@ int EVP_PKEY_encrypt_old(unsigned char *ek, const unsigned char *key, int ret = 0; #ifndef OPENSSL_NO_RSA - if (pubk->type != EVP_PKEY_RSA) { + if (EVP_PKEY_id(pubk) != EVP_PKEY_RSA) { #endif EVPerr(EVP_F_EVP_PKEY_ENCRYPT_OLD, EVP_R_PUBLIC_KEY_NOT_RSA); #ifndef OPENSSL_NO_RSA goto err; } ret = - RSA_public_encrypt(key_len, key, ek, pubk->pkey.rsa, + RSA_public_encrypt(key_len, key, ek, EVP_PKEY_get0_RSA(pubk), RSA_PKCS1_PADDING); err: #endif diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 7d255af582..c7a0b5ac4c 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -78,6 +78,7 @@ #endif #include "internal/asn1_int.h" +#include "internal/evp_int.h" static void EVP_PKEY_free_it(EVP_PKEY *x); @@ -275,7 +276,7 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) return (key != NULL); } -void *EVP_PKEY_get0(EVP_PKEY *pkey) +void *EVP_PKEY_get0(const EVP_PKEY *pkey) { return pkey->pkey.ptr; } diff --git a/crypto/evp/p_open.c b/crypto/evp/p_open.c index 2b5c7d870e..0f2bc02ad2 100644 --- a/crypto/evp/p_open.c +++ b/crypto/evp/p_open.c @@ -82,12 +82,12 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, if (!priv) return 1; - if (priv->type != EVP_PKEY_RSA) { + if (EVP_PKEY_id(priv) != EVP_PKEY_RSA) { EVPerr(EVP_F_EVP_OPENINIT, EVP_R_PUBLIC_KEY_NOT_RSA); goto err; } - size = RSA_size(priv->pkey.rsa); + size = EVP_PKEY_size(priv); key = OPENSSL_malloc(size + 2); if (key == NULL) { /* ERROR */ |