diff options
author | Matt Caswell <matt@openssl.org> | 2019-02-28 14:47:26 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-03-01 15:11:10 +0100 |
commit | ed86f884ba10c93a0beb53492c5db463e31a6884 (patch) | |
tree | 05dfe4d78798e759e73ae45c937277409ed48bb9 /apps/pkeyutl.c | |
parent | Add section order check in util/find-doc-nits (diff) | |
download | openssl-ed86f884ba10c93a0beb53492c5db463e31a6884.tar.xz openssl-ed86f884ba10c93a0beb53492c5db463e31a6884.zip |
Fix no-ec, no-sm2 and no-sm3
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8372)
Diffstat (limited to 'apps/pkeyutl.c')
-rw-r--r-- | apps/pkeyutl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c index b3452d31ca..c084525cd5 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -526,14 +526,16 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize, } ctx = EVP_PKEY_CTX_new_id(kdfnid, impl); } else { - EC_KEY *eckey = NULL; - const EC_GROUP *group = NULL; - int nid; - if (pkey == NULL) goto end; + +#ifndef OPENSSL_NO_EC /* SM2 needs a special treatment */ if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) { + EC_KEY *eckey = NULL; + const EC_GROUP *group = NULL; + int nid; + if ((eckey = EVP_PKEY_get0_EC_KEY(pkey)) == NULL || (group = EC_KEY_get0_group(eckey)) == NULL || (nid = EC_GROUP_get_curve_name(group)) == 0) @@ -541,6 +543,7 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize, if (nid == NID_sm2) EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2); } +#endif *pkeysize = EVP_PKEY_size(pkey); ctx = EVP_PKEY_CTX_new(pkey, impl); if (ppkey != NULL) |