We should add a comment at the caller side, that this takes a lock in apdu.c.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
May 10 2021
Make the lock holding narrower, and it allows no exposing reader_table_lock.
Exposing reader_table_lock would be better.
I found a dead-lock condition when apdu_close_reader is called during apdu_dev_list_start/finish.
I wonder if PCSC_SHARE_SHARED is related or not.
And if the coding style of hiding mutex_lock/mutex_unlock inside different functions matters, we can expose the mutex to its user.
Last commit will be:
The second commit is replacing a use case of close_pcsc_reader by clearing pcsc.rdrname and calling release_pcsc_context.
This makes the use of close_pcsc_reader to its original purpose only (== closing PC/SC reader as a method of close_reader).
OK. As I pointed out a commit having multiple things may make analysis difficult, I should have been careful.
So, let me fix the problem by multiple commits.
May 7 2021
Ah, great. Thanks!
Keeping the lock over the call to the function does not look very robust to me. This is why I removed it. And since then PC/SC worked on Windows for me. Modulo this:
All these changes don't tackle the real problem that windows gets struck in a removed-card state.
Technical commentary on smartcard operation and/or Windows is going to be over my head, so I can't help (just in case you're looking for anything from me). But always happy to drive-test another build. (I've still had no issues, personally, with the build above.) I'll assume you don't need me unless you link another binary build to test or tag me. Thanks again, all.
The problem is accesses to reader_table by
(1) scanning reader(s) to open new one
(2) closing reader
I'm testing D531: Keep holding READER_LOCK_TABLE and make clear distinction among close/releasing_PCSC_context/nullify_rdrname, but I'm not sure about the impact on Windows.
The commit rGbb8e3996e44f: scd: Fix problem with reader list becoming empty. removed READER_TABLE_LOCK holding between apdu_dev_list_start and apdu_dev_list_finish, that opens possible stale resource access for CCID driver: reader_table[slot].ccid.handle
May 6 2021
I am also a MacOS Big Sur user who recently upgraded to 2.3.1 and had problems after upgrading. In my use case, I use the yubikey as the authentication for pass password manager which uses gpg under the hood.
May 5 2021
Thanks for testing. I hope to get 2.3.2 out in two weeks.
May 4 2021
After upgrade:
May 3 2021
Meanwhile we did some more tests on Windows and so you many want to try our betas at
I'm referring to this: https://www.gnupg.org/howtos/card-howto/en/ch02s03.html
@colemickens We don't maintain any ccid udev rules in GnuPG. What do you refer?
Apr 28 2021
@gniibe can you provide any commentary on why the gnupg ccid udev rule is so much smaller than the one debian maintains? Is the debian one considered authoritative these days?
Thanks @gniibe, that's very helpful advice and pointers. Very appreciated, cheers.
Perhaps, if a distro haven't offered setting of USB, it would be better to configure GnuPG build with --disable-ccid-driver and only support scdaemon with PC/SC. GPG for Windows does so.
- It's a breaking change for system with both of PC/SC and CCID. T4673 due to T3300
- If you configure with no libusb, users don't need 'disable-ccid' option.
- I don't know how "wide".
- In Debian, it is maintained here: https://salsa.debian.org/debian/gnupg2/-/blob/debian/main/debian/scdaemon.udev
- Yes.
Apr 27 2021
Apr 26 2021
Hi, as a contributor to NixOS I'd also like some guidance. I'm testing the 2.3 upgrade ahead of 2.4, and it "breaks" Yubikey UX that I know many of us use. This might be because we appear to not yet install gnupg's CCID udev rules installed. A few questions:
Apr 25 2021
Thank you for the suggestion of disable-ccid that seems to have solved the problem.
Apr 23 2021
I can confirm disable-ccid works, thank you!
Please have a look at the log:
Apr 21 2021
Fixed in GnuPG 2.3.1, so, add the tag for GnuPG 2.2.
Apr 19 2021
Apr 16 2021
Apr 15 2021
Making this task up to HIGH priority, so that people can easily find this change in 2.3.0.
Apr 13 2021
The PKCS#15 support has meanwhile received a major update. Thus we need to test with the other cards again. If there is something special for to do for a certain task, a new subtask should be created.
Apr 8 2021
Thank you.
Applied both to STABLE-BRANCH-2-2 and master (changing new function name).
Mar 26 2021
Looks good to me, it no longer returns immediately with the error when there are no readers and the command itself seems to work. Thanks.
Ah, I see that when there is no card reader, it returns "Service is not running" with PC/SC.
Let's fix that.
Mar 25 2021
When testing under Windows "scd devinfo --watch" returns immediately with ERR 100663614 Service is not running <SCD>
Probably also if you would use PC/SC on Linux but I have not tested this.
Mar 5 2021
So far -- unlike the previous patch -- this seem to help (but since the issues are infrequent I can't be entirely sure yet).
Feb 13 2021
Feb 10 2021
The now used /var/run thingy solves all these problems nicely. In fact we may eventually remove the use fallback of using sockets in the GNUPGHOMEDIR.
Jan 28 2021
Jan 26 2021
T4702 is our release info task for 2.3.0
@gniibe Hi! Can you estimate, when this feature will be released?
I have not found this patch in the latest GnuPG release tags (in the Git repository) either by the name or the commit hash.
Jan 11 2021
Lowered priority because in reality it is not possible to get a certificate for an arbitrary SigG key on the card. Only accredited CAs may issue certs and they want to keep full control over the key generation.
Jan 8 2021
Jan 7 2021
do_sign() calls find_fid_by_keyref() which does a switch_application(). So, I think the SigG application should already be active. But, yes, please have a look at it.
We need to switch to the SigG application. Shall I look at it?
Jan 6 2021
Jan 5 2021
It seems you have a pretty good understanding and also test cases at hand. May I ask you to apply the suggested pacthes to master?
Dec 25 2020
Dec 23 2020
Already have set another, thanks gnibe! See ya!
Please change your passphrase for your card, BTW.
Good. The error recovery worked well.
Dec 22 2020
$ gpg --card-status $ gpgconf --kill scdaemon $ git fetch << (Used my PIN, I have reverted to my previous code other day, is not anymore 123456)
Dec 21 2020
Yes, that worked. Thanks for the tip and sorry for the noise ;-)
I think that ... For some reason, your private key file under .gnupg/private-keys-v1.d has wrong serial number.
Thank you for your testing.
May I ask more test, please?
Dec 20 2020
Hi, I have applied both patch and appears Yubikey is now working correct. I have uploaded the log here.
Dec 18 2020
Yes, makes sense. Although, you should use datalen = indatalen; in the last line (to prevent typos in the numbers).
IIUC, for completeness, it would be good to add the lines like:
Dec 17 2020
Dec 16 2020
In T5167#140229, @gbschenkel wrote:Nice, I gonna apply the patch and see if resolves for me!
Nice, I gonna apply the patch and see if resolves for me!
Dec 11 2020
Reading the code again, I think that some configuration of NKS card doesn't work well, when it has no certificates but keys (e.g. IDLM config).
I'm going to fix do_readkey as well (the approach #1).
Dec 10 2020
In T5150#140039, @gniibe wrote:With little (mostly no) knowledge of NKS card, I think I fixed this issue.
With my Yubikey NEO, when I use OTP (touching the button to generate OTP output as key input), I observed "card eject" event:
2020-12-10 11:23:05 scdaemon[7254] DBG: ccid-driver: CCID: interrupt callback 0 (2) 2020-12-10 11:23:05 scdaemon[7254] DBG: ccid-driver: CCID: NotifySlotChange: 02 2020-12-10 11:23:05 scdaemon[7254] DBG: ccid-driver: CCID: card removed 2020-12-10 11:23:05 scdaemon[7254] DBG: enter: apdu_get_status: slot=0 hang=0 2020-12-10 11:23:05 scdaemon[7254] DBG: leave: apdu_get_status => sw=0x1000c status=0 2020-12-10 11:23:05 scdaemon[7254] DBG: Removal of a card: 0
Thanks a lot for your time to locate the problem. I took the approach of #2.
Dec 9 2020
This works now. Thanks.
I'm not sure why I thought that it would work now. With current master I get
$ gpg-connect-agent "SCD READKEY --info-only -- 39400430E38BB96F105B740A7119FE113578B59D" /bye ERR 100663414 Invalid ID <SCD>
I checked the development log for the addition of:
libusb_clear_halt (handle->idev, handle->ep_intr);
In T5167#139966, @gbschenkel wrote:I have another yubikey neo but its clean. Can it help it?