1 |
commit: 3e50a2a015fe3d523bfc4e72ed2175d4d6033e97 |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 24 12:05:16 2018 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 24 12:05:48 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e50a2a0 |
7 |
|
8 |
sys-auth/pam_p11: Fixed build with openssl-1.1 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/658036 |
11 |
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org> |
12 |
Package-Manager: Portage-2.3.51, Repoman-2.3.11 |
13 |
|
14 |
.../pam_p11/files/pam_p11-0.2.0-openssl11.patch | 76 ++++++++++++++++++++++ |
15 |
sys-auth/pam_p11/pam_p11-0.2.0.ebuild | 10 ++- |
16 |
2 files changed, 84 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/sys-auth/pam_p11/files/pam_p11-0.2.0-openssl11.patch b/sys-auth/pam_p11/files/pam_p11-0.2.0-openssl11.patch |
19 |
new file mode 100644 |
20 |
index 00000000000..8c41e29bed1 |
21 |
--- /dev/null |
22 |
+++ b/sys-auth/pam_p11/files/pam_p11-0.2.0-openssl11.patch |
23 |
@@ -0,0 +1,76 @@ |
24 |
+From 46a6079817c67a09e5ac493af3381c655bd91c26 Mon Sep 17 00:00:00 2001 |
25 |
+From: Peter Popovec <popovec.peter@×××××.com> |
26 |
+Date: Tue, 21 Aug 2018 10:24:36 +0200 |
27 |
+Subject: [PATCH] Replacing deprecated OpenSSL API functions (#12) |
28 |
+ |
29 |
+fixes https://github.com/OpenSC/pam_p11/issues/10 |
30 |
+--- |
31 |
+ configure.ac | 5 +++++ |
32 |
+ src/pam_p11.c | 17 ++++++++++++++--- |
33 |
+ 2 files changed, 19 insertions(+), 3 deletions(-) |
34 |
+ |
35 |
+diff --git a/configure.ac b/configure.ac |
36 |
+index 5bcbdd6..2854a99 100644 |
37 |
+--- a/configure.ac |
38 |
++++ b/configure.ac |
39 |
+@@ -85,6 +85,11 @@ PKG_CHECK_MODULES( |
40 |
+ )] |
41 |
+ ) |
42 |
+ |
43 |
++saved_LIBS="$LIBS" |
44 |
++LIBS="$OPENSSL_LIBS $LIBS" |
45 |
++AC_CHECK_FUNCS(EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset) |
46 |
++LIBS="$saved_LIBS" |
47 |
++ |
48 |
+ if test -z "${PAM_LIBS}"; then |
49 |
+ AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam]) |
50 |
+ AC_ARG_VAR([PAM_LIBS], [linker flags for pam]) |
51 |
+diff --git a/src/pam_p11.c b/src/pam_p11.c |
52 |
+index 2b4bfbe..60380e5 100644 |
53 |
+--- a/src/pam_p11.c |
54 |
++++ b/src/pam_p11.c |
55 |
+@@ -31,6 +31,17 @@ |
56 |
+ #include <openssl/crypto.h> |
57 |
+ #include <libp11.h> |
58 |
+ |
59 |
++/* openssl deprecated API emulation */ |
60 |
++#ifndef HAVE_EVP_MD_CTX_NEW |
61 |
++#define EVP_MD_CTX_new() EVP_MD_CTX_create() |
62 |
++#endif |
63 |
++#ifndef HAVE_EVP_MD_CTX_FREE |
64 |
++#define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy((ctx)) |
65 |
++#endif |
66 |
++#ifndef HAVE_EVP_MD_CTX_RESET |
67 |
++#define EVP_MD_CTX_reset(ctx) EVP_MD_CTX_cleanup((ctx)) |
68 |
++#endif |
69 |
++ |
70 |
+ #ifdef ENABLE_NLS |
71 |
+ #include <libintl.h> |
72 |
+ #include <locale.h> |
73 |
+@@ -578,7 +589,7 @@ static int key_verify(pam_handle_t *pamh, int flags, PKCS11_KEY *authkey) |
74 |
+ unsigned char signature[256]; |
75 |
+ unsigned int siglen = sizeof signature; |
76 |
+ const EVP_MD *md = EVP_sha1(); |
77 |
+- EVP_MD_CTX *md_ctx = EVP_MD_CTX_create(); |
78 |
++ EVP_MD_CTX *md_ctx = EVP_MD_CTX_new(); |
79 |
+ EVP_PKEY *privkey = PKCS11_get_private_key(authkey); |
80 |
+ EVP_PKEY *pubkey = PKCS11_get_public_key(authkey); |
81 |
+ |
82 |
+@@ -596,7 +607,7 @@ static int key_verify(pam_handle_t *pamh, int flags, PKCS11_KEY *authkey) |
83 |
+ || !EVP_SignInit(md_ctx, md) |
84 |
+ || !EVP_SignUpdate(md_ctx, challenge, sizeof challenge) |
85 |
+ || !EVP_SignFinal(md_ctx, signature, &siglen, privkey) |
86 |
+- || !EVP_MD_CTX_cleanup(md_ctx) |
87 |
++ || !EVP_MD_CTX_reset(md_ctx) |
88 |
+ || !EVP_VerifyInit(md_ctx, md) |
89 |
+ || !EVP_VerifyUpdate(md_ctx, challenge, sizeof challenge) |
90 |
+ || 1 != EVP_VerifyFinal(md_ctx, signature, siglen, pubkey)) { |
91 |
+@@ -613,7 +624,7 @@ static int key_verify(pam_handle_t *pamh, int flags, PKCS11_KEY *authkey) |
92 |
+ if (NULL != privkey) |
93 |
+ EVP_PKEY_free(privkey); |
94 |
+ if (NULL != md_ctx) { |
95 |
+- EVP_MD_CTX_destroy(md_ctx); |
96 |
++ EVP_MD_CTX_free(md_ctx); |
97 |
+ } |
98 |
+ return ok; |
99 |
+ } |
100 |
|
101 |
diff --git a/sys-auth/pam_p11/pam_p11-0.2.0.ebuild b/sys-auth/pam_p11/pam_p11-0.2.0.ebuild |
102 |
index cc81b3a08cb..6156029daf1 100644 |
103 |
--- a/sys-auth/pam_p11/pam_p11-0.2.0.ebuild |
104 |
+++ b/sys-auth/pam_p11/pam_p11-0.2.0.ebuild |
105 |
@@ -1,9 +1,9 @@ |
106 |
-# Copyright 1999-2018 Gentoo Foundation |
107 |
+# Copyright 1999-2018 Gentoo Authors |
108 |
# Distributed under the terms of the GNU General Public License v2 |
109 |
|
110 |
EAPI=7 |
111 |
|
112 |
-inherit pam |
113 |
+inherit autotools pam |
114 |
|
115 |
DESCRIPTION="PAM module for authenticating against PKCS#11 tokens" |
116 |
HOMEPAGE="https://github.com/opensc/pam_p11/wiki" |
117 |
@@ -22,8 +22,14 @@ BDEPEND="virtual/pkgconfig" |
118 |
|
119 |
PATCHES=( |
120 |
"${FILESDIR}/${P}-build.patch" |
121 |
+ "${FILESDIR}/${P}-openssl11.patch" #658036 |
122 |
) |
123 |
|
124 |
+src_prepare() { |
125 |
+ default |
126 |
+ eautoreconf |
127 |
+} |
128 |
+ |
129 |
src_configure() { |
130 |
econf --with-pamdir="$(getpam_mod_dir)" |
131 |
} |