From 482d23bcacdd3664f21cc82a5135f66fc598275f Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Thu, 13 Sep 2018 02:08:33 +0000 Subject: 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 --- ssh-pkcs11-client.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ssh-pkcs11-client.c') 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, static int wrap_key(RSA *rsa) { - static RSA_METHOD helper_rsa; + static RSA_METHOD *helper_rsa; - memcpy(&helper_rsa, RSA_get_default_method(), sizeof(helper_rsa)); - helper_rsa.name = "ssh-pkcs11-helper"; - helper_rsa.rsa_priv_enc = pkcs11_rsa_private_encrypt; - RSA_set_method(rsa, &helper_rsa); + if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) == NULL) + fatal("%s: RSA_meth_dup failed", __func__); + if (!RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper") || + !RSA_meth_set_priv_enc(helper_rsa, pkcs11_rsa_private_encrypt)) + fatal("%s: failed to prepare method", __func__); + RSA_set_method(rsa, helper_rsa); return (0); } -- cgit v1.2.3