Straightforward conversion. Note that EVP_PKEY_get0_RSA() can't fail
after checking that we have an RSA key.

Index: x509.c
===================================================================
RCS file: /cvs/src/sbin/isakmpd/x509.c,v
retrieving revision 1.123
diff -u -p -r1.123 x509.c
--- x509.c      31 Oct 2021 16:45:04 -0000      1.123
+++ x509.c      19 Nov 2021 21:42:18 -0000
@@ -1264,12 +1264,12 @@ x509_cert_get_key(void *scert, void *key
        key = X509_get_pubkey(cert);
 
        /* Check if we got the right key type.  */
-       if (key->type != EVP_PKEY_RSA) {
+       if (EVP_PKEY_id(key) != EVP_PKEY_RSA) {
                log_print("x509_cert_get_key: public key is not a RSA key");
                X509_free(cert);
                return 0;
        }
-       *(RSA **)keyp = RSAPublicKey_dup(key->pkey.rsa);
+       *(RSA **)keyp = RSAPublicKey_dup(EVP_PKEY_get0_RSA(key));
 
        return *(RSA **)keyp == NULL ? 0 : 1;
 }

Reply via email to