Fix Yubikey 5 detection
This commit is contained in:
parent
56c2f82ba3
commit
772294f7de
60
gnupg2-yk5.patch
Normal file
60
gnupg2-yk5.patch
Normal file
@ -0,0 +1,60 @@
|
||||
From f34b9147eb3070bce80d53febaa564164cd6c977 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Wed, 13 Jul 2022 10:40:55 +0900
|
||||
Subject: [PATCH GnuPG] scd:openpgp: Fix workaround for Yubikey heuristics.
|
||||
|
||||
* scd/app-openpgp.c (parse_algorithm_attribute): Handle the case
|
||||
of firmware 5.4, too.
|
||||
|
||||
--
|
||||
|
||||
GnuPG-bug-id: 6070
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
scd/app-openpgp.c | 29 +++++++++++++++++++++--------
|
||||
1 file changed, 21 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
|
||||
index 8bb346a86..4667416df 100644
|
||||
--- a/scd/app-openpgp.c
|
||||
+++ b/scd/app-openpgp.c
|
||||
@@ -6259,15 +6259,28 @@ parse_algorithm_attribute (app_t app, int keyno)
|
||||
app->app_local->keyattr[keyno].ecc.algo = *buffer;
|
||||
app->app_local->keyattr[keyno].ecc.flags = 0;
|
||||
|
||||
- if (APP_CARD(app)->cardtype == CARDTYPE_YUBIKEY
|
||||
- || buffer[buflen-1] == 0x00 || buffer[buflen-1] == 0xff)
|
||||
- { /* Found "pubkey required"-byte for private key template. */
|
||||
- oidlen--;
|
||||
- if (buffer[buflen-1] == 0xff)
|
||||
- app->app_local->keyattr[keyno].ecc.flags |= ECC_FLAG_PUBKEY;
|
||||
+ if (APP_CARD(app)->cardtype == CARDTYPE_YUBIKEY)
|
||||
+ {
|
||||
+ /* Yubikey implementations vary.
|
||||
+ * Firmware version 5.2 returns "pubkey required"-byte with
|
||||
+ * 0x00, but after removal and second time insertion, it
|
||||
+ * returns bogus value there.
|
||||
+ * Firmware version 5.4 returns none.
|
||||
+ */
|
||||
+ curve = ecc_curve (buffer + 1, oidlen);
|
||||
+ if (!curve)
|
||||
+ curve = ecc_curve (buffer + 1, oidlen - 1);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (buffer[buflen-1] == 0x00 || buffer[buflen-1] == 0xff)
|
||||
+ { /* Found "pubkey required"-byte for private key template. */
|
||||
+ oidlen--;
|
||||
+ if (buffer[buflen-1] == 0xff)
|
||||
+ app->app_local->keyattr[keyno].ecc.flags |= ECC_FLAG_PUBKEY;
|
||||
+ }
|
||||
+ curve = ecc_curve (buffer + 1, oidlen);
|
||||
}
|
||||
-
|
||||
- curve = ecc_curve (buffer + 1, oidlen);
|
||||
|
||||
if (!curve)
|
||||
{
|
||||
--
|
||||
2.37.1
|
||||
|
@ -27,6 +27,9 @@ Patch21: gnupg-2.2.18-gpg-allow-import-of-previously-known-keys-even-without-UI.
|
||||
Patch22: gnupg-2.2.18-gpg-accept-subkeys-with-a-good-revocation-but-no-self-sig.patch
|
||||
# Fixes for issues found in Coverity scan - reported upstream
|
||||
Patch30: gnupg-2.2.21-coverity.patch
|
||||
# Fix Yubikey 5 detection (#2107766)
|
||||
# https://dev.gnupg.org/rGf34b9147eb3070bce80d53febaa564164cd6c977
|
||||
Patch31: gnupg2-yk5.patch
|
||||
|
||||
|
||||
URL: https://www.gnupg.org/
|
||||
@ -111,6 +114,7 @@ to the base GnuPG package
|
||||
%patch22 -p1 -b .good_revoc
|
||||
|
||||
%patch30 -p1 -b .coverity
|
||||
%patch31 -p1 -b .yk5
|
||||
|
||||
# pcsc-lite library major: 0 in 1.2.0, 1 in 1.2.9+ (dlopen()'d in pcsc-wrapper)
|
||||
# Note: this is just the name of the default shared lib to load in scdaemon,
|
||||
|
Loading…
Reference in New Issue
Block a user