aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-01-19 00:21:12 +0000
committerDr. Stephen Henson <steve@openssl.org>2016-01-20 03:24:59 +0000
commit3aeb93486588e7dd01379c50b8fd496d55cf8858 (patch)
treee5d5793ef4786dbfac5c724e8235a3aa1ce323b2 /crypto/pem
parenta8eda4312db1f98cffda38670e2d40d36566785a (diff)
downloadopenssl-3aeb93486588e7dd01379c50b8fd496d55cf8858.tar.gz
make EVP_PKEY opaque
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_info.c2
-rw-r--r--crypto/pem/pem_pkey.c1
-rw-r--r--crypto/pem/pvkfmt.c15
3 files changed, 10 insertions, 8 deletions
diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c
index 67cd99d13f..982dc161b9 100644
--- a/crypto/pem/pem_info.c
+++ b/crypto/pem/pem_info.c
@@ -362,7 +362,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
#ifndef OPENSSL_NO_RSA
/* normal optionally encrypted stuff */
if (PEM_write_bio_RSAPrivateKey(bp,
- xi->x_pkey->dec_pkey->pkey.rsa,
+ EVP_PKEY_get0_RSA(xi->x_pkey->dec_pkey),
enc, kstr, klen, cb, u) <= 0)
goto err;
#endif
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c
index 1a249f5588..e90f201bfa 100644
--- a/crypto/pem/pem_pkey.c
+++ b/crypto/pem/pem_pkey.c
@@ -72,6 +72,7 @@
# include <openssl/dh.h>
#endif
#include "internal/asn1_int.h"
+#include "internal/evp_int.h"
int pem_check_suffix(const char *pem_str, const char *suffix);
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index 8aceb2bc03..625b488e34 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -450,11 +450,12 @@ static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub)
unsigned char *p;
unsigned int bitlen, magic = 0, keyalg;
int outlen, noinc = 0;
- if (pk->type == EVP_PKEY_DSA) {
- bitlen = check_bitlen_dsa(pk->pkey.dsa, ispub, &magic);
+ int pktype = EVP_PKEY_id(pk);
+ if (pktype == EVP_PKEY_DSA) {
+ bitlen = check_bitlen_dsa(EVP_PKEY_get0_DSA(pk), ispub, &magic);
keyalg = MS_KEYALG_DSS_SIGN;
- } else if (pk->type == EVP_PKEY_RSA) {
- bitlen = check_bitlen_rsa(pk->pkey.rsa, ispub, &magic);
+ } else if (pktype == EVP_PKEY_RSA) {
+ bitlen = check_bitlen_rsa(EVP_PKEY_get0_RSA(pk), ispub, &magic);
keyalg = MS_KEYALG_RSA_KEYX;
} else
return -1;
@@ -484,9 +485,9 @@ static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub)
write_ledword(&p, magic);
write_ledword(&p, bitlen);
if (keyalg == MS_KEYALG_DSS_SIGN)
- write_dsa(&p, pk->pkey.dsa, ispub);
+ write_dsa(&p, EVP_PKEY_get0_DSA(pk), ispub);
else
- write_rsa(&p, pk->pkey.rsa, ispub);
+ write_rsa(&p, EVP_PKEY_get0_RSA(pk), ispub);
if (!noinc)
*out += outlen;
return outlen;
@@ -797,7 +798,7 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY *pk, int enclevel,
write_ledword(&p, MS_PVKMAGIC);
write_ledword(&p, 0);
- if (pk->type == EVP_PKEY_DSA)
+ if (EVP_PKEY_id(pk) == EVP_PKEY_DSA)
write_ledword(&p, MS_KEYTYPE_SIGN);
else
write_ledword(&p, MS_KEYTYPE_KEYX);