1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-01 16:33:02 +01:00

scd:openpgp: Handle wrong error return code of Yubikey.

* scd/app-openpgp.c (get_public_key): Handle wrong error code by
Yubikeys.
--

This has been taken from commits
  0db9c83555b4a8a0c52f96e96ec20dbfd3d75272
  946555ea3ceb823b95ed13654ae4fd667daa4337
This commit is contained in:
Werner Koch 2023-10-10 15:58:06 +02:00
parent d938abcc5e
commit d25e960652
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1887,10 +1887,11 @@ get_public_key (app_t app, int keyno)
if (err)
{
/* Yubikey returns wrong code. Fix it up. */
/*
* NOTE: It's not correct to blindly change the error code,
* however, for our experiences, it is only Yubikey...
*/
if (APP_CARD(app)->cardtype == CARDTYPE_YUBIKEY)
err = gpg_error (GPG_ERR_NO_OBJ);
/* Yubikey NEO (!CARDTYPE_YUBIKEY) also returns wrong code.
* Fix it up. */
else if (gpg_err_code (err) == GPG_ERR_CARD)
err = gpg_error (GPG_ERR_NO_OBJ);
log_error (_("reading public key failed: %s\n"), gpg_strerror (err));
goto leave;