summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-24 22:17:50 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-24 22:17:50 +0000
commitc44016e86ec8dfd9147b2ca58e5277cb03a92561 (patch)
tree98002278cf00e6c9373e96deb245e6661f890b8d /src/common/crypto.c
parent83081f5ad6fd3fd4450ce4f5a84c2873f5c4123b (diff)
downloadtor-c44016e86ec8dfd9147b2ca58e5277cb03a92561.tar.gz
tor-c44016e86ec8dfd9147b2ca58e5277cb03a92561.zip
Merge flagday into main branch.
svn:r1683
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 88330892bc..831aaaa2c2 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -127,13 +127,18 @@ RSA *_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
}
/* used by tortls.c */
-EVP_PKEY *_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env)
+EVP_PKEY *_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env, int private)
{
RSA *key = NULL;
EVP_PKEY *pkey = NULL;
assert(env->key);
- if (!(key = RSAPrivateKey_dup(env->key)))
- goto error;
+ if (private) {
+ if (!(key = RSAPrivateKey_dup(env->key)))
+ goto error;
+ } else {
+ if (!(key = RSAPublicKey_dup(env->key)))
+ goto error;
+ }
if (!(pkey = EVP_PKEY_new()))
goto error;
if (!(EVP_PKEY_assign_RSA(pkey, key)))