summaryrefslogtreecommitdiff
path: root/ssh-pkcs11-client.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-09-13 02:08:33 +0000
committerDamien Miller <djm@mindrot.org>2018-09-13 12:12:33 +1000
commit482d23bcacdd3664f21cc82a5135f66fc598275f (patch)
tree362f697a94da0a765d1dabcfbf33370b2a4df121 /ssh-pkcs11-client.c
parentd70d061828730a56636ab6f1f24fe4a8ccefcfc1 (diff)
upstream: hold our collective noses and use the openssl-1.1.x API in
OpenSSH; feedback and ok tb@ jsing@ markus@ OpenBSD-Commit-ID: cacbcac87ce5da0d3ca7ef1b38a6f7fb349e4417
Diffstat (limited to 'ssh-pkcs11-client.c')
-rw-r--r--ssh-pkcs11-client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index 028b272cb..bcc18c6bc 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -156,12 +156,14 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa,
156static int 156static int
157wrap_key(RSA *rsa) 157wrap_key(RSA *rsa)
158{ 158{
159 static RSA_METHOD helper_rsa; 159 static RSA_METHOD *helper_rsa;
160 160
161 memcpy(&helper_rsa, RSA_get_default_method(), sizeof(helper_rsa)); 161 if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) == NULL)
162 helper_rsa.name = "ssh-pkcs11-helper"; 162 fatal("%s: RSA_meth_dup failed", __func__);
163 helper_rsa.rsa_priv_enc = pkcs11_rsa_private_encrypt; 163 if (!RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper") ||
164 RSA_set_method(rsa, &helper_rsa); 164 !RSA_meth_set_priv_enc(helper_rsa, pkcs11_rsa_private_encrypt))
165 fatal("%s: failed to prepare method", __func__);
166 RSA_set_method(rsa, helper_rsa);
165 return (0); 167 return (0);
166} 168}
167 169