upg p11-kit

This commit is contained in:
joborun linux 2023-09-16 01:14:10 +03:00
parent fc411b3688
commit 79da60d067
4 changed files with 67 additions and 12 deletions

View file

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Thu, 27 Jul 2023 12:18:15 +0800
Subject: [PATCH] Fix probing of C_GetInterface
`p11_dl_symbol (dl, "C_GetInterface")` uses dlsym() to find
C_GetInterface in the loaded pkcs11 module. For legacy (pre-3.0) pkcs11
modules, C_GetInterface is not defined in the module. But according to
the documentation of dlsym():
The search performed by dlsym() is breadth first through the
dependency tree of these shared objects.
So if a pkcs11 module links to libp11-kit.so, the C_GetInterface
implementation in libp11-kit.so itself will be found. This
C_GetInterface will return the metadata of p11-kit-proxy.so, causing
"Refuse to load the p11-kit-proxy.so as a registered module".
To solve the issue, if p11_dl_symbol() returns the C_GetInterface in
libp11-kit.so itself, we should ignore it and continue trying
C_GetFunctionList.
---
p11-kit/modules.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/p11-kit/modules.c b/p11-kit/modules.c
index 8ad88ae01d5d..da0a7f04d68f 100644
--- a/p11-kit/modules.c
+++ b/p11-kit/modules.c
@@ -383,6 +383,12 @@ dlopen_and_get_function_list (Module *mod,
mod->loaded_module = dl;
gi = p11_dl_symbol (dl, "C_GetInterface");
+
+#ifndef OS_WIN32
+ if (gi == C_GetInterface)
+ gi = NULL;
+#endif
+
if (gi) {
/* Get the default standard interface */
rv = gi ((unsigned char *)"PKCS 11", NULL, &interface, 0);

View file

@ -8,15 +8,20 @@
pkgbase=p11-kit
pkgname=(p11-kit libp11-kit) # p11-kit-docs)
pkgver=0.25.0
pkgrel=01
pkgrel=02
pkgdesc="Loads and enumerates PKCS#11 modules - w/o systemd"
url="https://p11-glue.freedesktop.org"
depends=(glibc libffi libtasn1)
makedepends=(bash-completion gtk-doc meson)
source=(https://github.com/p11-glue/p11-kit/releases/download/$pkgver/p11-kit-$pkgver.tar.xz{,.sig})
source=(https://github.com/p11-glue/p11-kit/releases/download/$pkgver/p11-kit-$pkgver.tar.xz{,.sig}
0001-Fix-probing-of-C_GetInterface.patch)
prepare() {
cd p11-kit-$pkgver
# https://gitlab.gnome.org/GNOME/libsoup/-/issues/352
# https://github.com/p11-glue/p11-kit/pull/535
patch -Np1 -i ../0001-Fix-probing-of-C_GetInterface.patch
}
build() {
@ -92,9 +97,9 @@ validpgpkeys=(C0F67099B808FB063E2C81117BFB1108D92765AF # Stef Walter <stef@the
5D46CB0F763405A7053556F47A75A648B3F9220C) # Zoltan Fridrich <zfridric@redhat.com>
sha256sums=(d55583bcdde83d86579cabe3a8f7f2638675fef01d23cace733ff748fc354706 # p11-kit-0.25.0.tar.xz
c4778a5b5009b8c31cb7342b728ba696ca97a03219fb965cbb48e6aea85db31c) # p11-kit-0.25.0.tar.xz.sig
## a3f23523f5b48a9e3212a86f694864c73e1248bcd9b9a9de9664449de6611ded libp11-kit-0.25.0-01-x86_64.pkg.tar.lz
## a8f885b81b166dab14820dbd22e15c9875d8ac310fc8905a89d283d906cec65e p11-kit-0.25.0-01-x86_64.pkg.tar.lz
c4778a5b5009b8c31cb7342b728ba696ca97a03219fb965cbb48e6aea85db31c # p11-kit-0.25.0.tar.xz.sig
1297c121817c84fca27e3697c925f80abbc429c857015976693ff38f253fbac4) # 0001-Fix-probing-of-C_GetInterface.patch
## 48e3f68e1c76ba60be9c4e7609ea4ceddd0a107b5b9ec9eef128a36321332b7a libp11-kit-0.25.0-02-x86_64.pkg.tar.lz
## 668a5826376ef727541a596849d20d4c431f2d969d0a9486d8a537b198491042 p11-kit-0.25.0-02-x86_64.pkg.tar.lz

View file

@ -8,7 +8,7 @@ pkgname=(
p11-kit-docs
)
pkgver=0.25.0
pkgrel=1
pkgrel=2
pkgdesc="Loads and enumerates PKCS#11 modules"
url="https://p11-glue.freedesktop.org"
arch=(x86_64)
@ -24,9 +24,13 @@ makedepends=(
meson
systemd
)
source=(https://github.com/p11-glue/p11-kit/releases/download/$pkgver/p11-kit-$pkgver.tar.xz{,.sig})
source=(
https://github.com/p11-glue/p11-kit/releases/download/$pkgver/p11-kit-$pkgver.tar.xz{,.sig}
0001-Fix-probing-of-C_GetInterface.patch
)
b2sums=('6ffce977f86c516a327afe50f4cc5a36e86ba7f43c6cb555db419d9e4ba7543a9f1847ba83da348cd6d7bbebe55dfa26cfe3a3aaa3e1d5420a4b8dc6cbbff088'
'SKIP')
'SKIP'
'7d93f7bf86840e256480d6fa3efb5c933f8081fe7f64d803d44670724bc8171515474fe43f089e772a1207ba675149a040a8c07a3ba4dfe79bb9effd8e524648')
validpgpkeys=(
C0F67099B808FB063E2C81117BFB1108D92765AF # Stef Walter <stef@thewalter.net>
462225C3B46F34879FC8496CD605848ED7E69871 # Daiki Ueno <ueno@unixuser.org>
@ -35,6 +39,10 @@ validpgpkeys=(
prepare() {
cd p11-kit-$pkgver
# https://gitlab.gnome.org/GNOME/libsoup/-/issues/352
# https://github.com/p11-glue/p11-kit/pull/535
patch -Np1 -i ../0001-Fix-probing-of-C_GetInterface.patch
}
build() {

View file

@ -1,6 +1,6 @@
real 3m42.256s
user 13m21.998s
sys 0m28.368s
real 4m8.741s
user 14m52.228s
sys 0m39.834s