-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/src/dev.c b/src/dev.c | ||
index 2d662a6..eabdec4 100644 | ||
--- a/src/dev.c | ||
+++ b/src/dev.c | ||
@@ -268,6 +268,7 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | ||
run_manifest(devlist, ilen, olen, "nfc", fido_nfc_manifest); | ||
#endif | ||
#ifdef USE_PCSC | ||
+ if (getenv("FIDO2_USE_PCSC")) | ||
run_manifest(devlist, ilen, olen, "pcsc", fido_pcsc_manifest); | ||
#endif | ||
#ifdef USE_WINHELLO | ||
diff --git a/src/pcsc.c b/src/pcsc.c | ||
index d7bd6c6..125c0d2 100644 | ||
--- a/src/pcsc.c | ||
+++ b/src/pcsc.c | ||
@@ -183,6 +183,8 @@ fido_pcsc_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | ||
|
||
*olen = 0; | ||
|
||
+ if (!getenv("FIDO2_USE_PCSC")) return FIDO_OK; | ||
+ | ||
if (ilen == 0) | ||
return FIDO_OK; | ||
if (devlist == NULL) | ||
@@ -247,6 +249,8 @@ fido_pcsc_open(const char *path) | ||
DWORD prot = 0; | ||
LONG s; | ||
|
||
+ if (!getenv("FIDO2_USE_PCSC")) goto fail; | ||
+ | ||
memset(&req, 0, sizeof(req)); | ||
|
||
if ((s = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
pkgname=libfido2-pcsc | ||
pkgver=1.12.0 | ||
pkgrel=1 | ||
pkgdesc='Library functionality for FIDO 2.0, with env-var-enabled support for PCSC devices' | ||
url='https://developers.yubico.com/libfido2/' | ||
arch=(x86_64) | ||
license=(BSD) | ||
depends=(glibc openssl libcbor libcbor.so hidapi systemd-libs libudev.so zlib pcsclite) | ||
makedepends=(cmake systemd) | ||
provides=(libfido2.so libfido2) | ||
conflicts=(libfido2) | ||
source=( "https://developers.yubico.com/libfido2/Releases/libfido2-${pkgver}.tar.gz" ) | ||
sha256sums=( 813d6d25116143d16d2e96791718a74825da16b774a8d093d96f06ae1730d9c5 ) | ||
|
||
_patches=( 0001_enable-pcsc-via-env-var.patch ) | ||
for p in ${_patches[@]}; do source+=($p); sha256sums+=(SKIP); done | ||
|
||
prepare() { | ||
cd libfido2-${pkgver} | ||
for p in ${_patches[@]} | ||
do patch --dry-run -tNp1 -i "$srcdir"/$p >/dev/null && patch -tNp1 -i "$srcdir"/$p | ||
done | ||
} | ||
|
||
build() { | ||
cd libfido2-${pkgver} | ||
# do not use bundled udev rules superseded by systemd | ||
cmake -B build \ | ||
-DCMAKE_INSTALL_PREFIX=/usr \ | ||
-DCMAKE_INSTALL_LIBDIR=lib \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_C_FLAGS="${CFLAGS} ${CPPFLAGS}" \ | ||
-Wno-dev \ | ||
-DUSE_PCSC=1 \ | ||
-DNFC_LINUX=1 \ | ||
-S . | ||
make -C build VERBOSE=1 | ||
} | ||
|
||
package() { | ||
cd libfido2-${pkgver} | ||
make -C build DESTDIR="${pkgdir}" install | ||
install -Dm 644 NEWS README.adoc -t "${pkgdir}/usr/share/doc/${pkgname}" | ||
install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" | ||
} |