git: 6074b736dee1 - main - security/pks: unbreak the build against modern OpenSSL

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Thu, 23 Feb 2023 10:13:38 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6074b736dee149ea37d58e48968901118981b9fc

commit 6074b736dee149ea37d58e48968901118981b9fc
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-02-23 10:06:50 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-02-23 10:06:50 +0000

    security/pks: unbreak the build against modern OpenSSL
    
    Garbage-collect nowadays useless USE_GCC=yes while here.
---
 security/pks/Makefile              | 12 ------------
 security/pks/files/patch-pgputil.c | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/security/pks/Makefile b/security/pks/Makefile
index 614e53f98f89..90a249c889e2 100644
--- a/security/pks/Makefile
+++ b/security/pks/Makefile
@@ -12,13 +12,7 @@ WWW=		http://www.mit.edu/people/marc/pks/
 LICENSE=	BSD4CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_SSL=	openssl
-BROKEN_SSL_REASON_openssl=	member access into incomplete type 'EVP_PKEY' (aka 'evp_pkey_st')
-DEPRECATED=	Broken with recent ssl
-EXPIRATION_DATE=	2023-03-20
-
 USES=		bdb ssl
-USE_GCC=	yes
 USE_RC_SUBR=	pksd
 
 WRKSRC=		${WRKDIR}/${PORTNAME}
@@ -53,10 +47,4 @@ post-install-DOCS-on:
 	${MKDIR} ${STAGEDIR}${DOCSDIR}/
 	cd ${WRKSRC}/ && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}/
 
-.include <bsd.port.options.mk>
-
-.if ${OPSYS} == FreeBSD && ${SSL_DEFAULT} == base
-BROKEN=	Does not build with OpenSSL 1.1
-.endif
-
 .include <bsd.port.mk>
diff --git a/security/pks/files/patch-pgputil.c b/security/pks/files/patch-pgputil.c
new file mode 100644
index 000000000000..624635bcb56f
--- /dev/null
+++ b/security/pks/files/patch-pgputil.c
@@ -0,0 +1,20 @@
+--- pgputil.c.orig	2003-04-30 04:13:38 UTC
++++ pgputil.c
+@@ -221,14 +221,14 @@ decode_x509 (ddesc * data, long len, ddesc * keyid)
+     {
+       return (0);
+     }
+-  switch (pkey->type)
++  switch (EVP_PKEY_type(EVP_PKEY_id(pkey)))
+     {
+     case EVP_PKEY_RSA:
+       /* pkey->pkey.rsa->n is the modulus */
+-      b = BN_dup (pkey->pkey.rsa->n);
++      b = BN_dup (RSA_get0_n(EVP_PKEY_get0_RSA(pkey)));
+       break;
+     case EVP_PKEY_DSA:
+-      b = BN_dup (pkey->pkey.dsa->p);
++      b = BN_dup (RSA_get0_p(EVP_PKEY_get0_DSA(pkey)));
+       break;
+     }
+   EVP_PKEY_free (pkey);