From fa4f716917e545a98e7c22469c51e980aa79443d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 18 Apr 2023 17:04:58 +0200 Subject: gpg: Make sure that we are not accidently working with the PIV app. * g10/call-agent.c (agent_scd_switchapp): New. * g10/card-util.c (get_info_for_key_operation): Call it. -- It may happen that the active card was last used for PIV and in that case certain commands will fail because they assume the OpenPGP app. Fortunately we have a pretty central place to assure that the right app has been selected. The bug can be easily noticed on Windows. GnuPG-bug-id: 6378 --- g10/card-util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'g10/card-util.c') diff --git a/g10/card-util.c b/g10/card-util.c index 6451b31e7..d8f1b960a 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -1289,6 +1289,7 @@ get_info_for_key_operation (struct agent_card_info_s *info) int rc; memset (info, 0, sizeof *info); + agent_scd_switchapp ("openpgp"); rc = agent_scd_getattr ("SERIALNO", info); if (rc || !info->serialno || strncmp (info->serialno, "D27600012401", 12) || strlen (info->serialno) != 32 ) -- cgit v1.2.3