diff options
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r-- | src/common/crypto.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 4289f48395..c4a06c7c11 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -246,6 +246,17 @@ _crypto_new_pk_env_rsa(RSA *rsa) return env; } +/** used by tortls.c: wrap the RSA from an evp_pkey in a crypto_pk_env_t. + * returns NULL if this isn't an RSA key. */ +crypto_pk_env_t * +_crypto_new_pk_env_evp_pkey(EVP_PKEY *pkey) +{ + RSA *rsa; + if (!(rsa = EVP_PKEY_get1_RSA(pkey))) + return NULL; + return _crypto_new_pk_env_rsa(rsa); +} + /** used by tortls.c: get an equivalent EVP_PKEY* for a crypto_pk_env_t. Iff * private is set, include the private-key portion of the key. */ EVP_PKEY * |