diff options
Diffstat (limited to 'ssh-pkcs11-client.c')
-rw-r--r-- | ssh-pkcs11-client.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c index 028b272cb..d1241ce67 100644 --- a/ssh-pkcs11-client.c +++ b/ssh-pkcs11-client.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | #include <openssl/rsa.h> | 33 | #include <openssl/rsa.h> |
34 | 34 | ||
35 | #include "openbsd-compat/openssl-compat.h" | ||
36 | |||
35 | #include "pathnames.h" | 37 | #include "pathnames.h" |
36 | #include "xmalloc.h" | 38 | #include "xmalloc.h" |
37 | #include "sshbuf.h" | 39 | #include "sshbuf.h" |
@@ -156,12 +158,14 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, | |||
156 | static int | 158 | static int |
157 | wrap_key(RSA *rsa) | 159 | wrap_key(RSA *rsa) |
158 | { | 160 | { |
159 | static RSA_METHOD helper_rsa; | 161 | static RSA_METHOD *helper_rsa; |
160 | 162 | ||
161 | memcpy(&helper_rsa, RSA_get_default_method(), sizeof(helper_rsa)); | 163 | if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) == NULL) |
162 | helper_rsa.name = "ssh-pkcs11-helper"; | 164 | fatal("%s: RSA_meth_dup failed", __func__); |
163 | helper_rsa.rsa_priv_enc = pkcs11_rsa_private_encrypt; | 165 | if (!RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper") || |
164 | RSA_set_method(rsa, &helper_rsa); | 166 | !RSA_meth_set_priv_enc(helper_rsa, pkcs11_rsa_private_encrypt)) |
167 | fatal("%s: failed to prepare method", __func__); | ||
168 | RSA_set_method(rsa, helper_rsa); | ||
165 | return (0); | 169 | return (0); |
166 | } | 170 | } |
167 | 171 | ||