[PATCH] fix wLangId in ccid-driver.c
gniibe at fsij.org
Thu Jan 13 08:38:31 CET 2011
This is not a part of pin pad support series of mine.
As I found the bug while I am preparing the patches, I report this.
As CCID protocol is little endian, wLangId of US English = 0x0409
is represented as two bytes of 0x09 then 0x04.
It is really confusing that the code like following is floating
pin_verify -> wLangId = HOST_TO_CCID_16(0x0904);
But, it is 0x0409 (not 0x0904). It is defined in the documentation:
and origin of this table is Microsoft. We can see it at:
Yes, it would be better not to hard-code 0x0409. It would be better
to try current locale of the user, or to use the first entry of string
descriptor. I don't have time to implement such a thing...
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 98268c0..413a535 100644
@@ -3136,8 +3136,8 @@ ccid_transceive_secure (ccid_driver_t handle,
if (pinlen_min && pinlen_max && pinlen_min == pinlen_max)
msg |= 0x01; /* Max size reached. */
msg = 0xff; /* bNumberMessage: Default. */
- msg = 0x04; /* wLangId-High. */
- msg = 0x09; /* wLangId-Low: English FIXME: use the first entry. */
+ msg = 0x09; /* wLangId-Low: English FIXME: use the first entry. */
+ msg = 0x04; /* wLangId-High. */
msg = 0; /* bMsgIndex. */
/* bTeoProlog follows: */
msg = handle->nonnull_nad? ((1 << 4) | 0): 0;
More information about the Gnupg-devel