From 98048620ec3f56f0de67cf463c908f278cd1fde9 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 1 Feb 2011 15:25:36 +0900 Subject: [PATCH] version 0.9 --- ChangeLog | 9 +++++++++ NEWS | 7 +++++-- README | 2 +- src/openpgp-do.c | 6 +++++- src/usb_prop.c | 29 +++++++++++++++++++++++++++-- tool/gnuk_update_binary.py | 2 +- 6 files changed, 48 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53cd95e..e5a4489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-02-01 NIIBE Yutaka + + * Version 0.9. + + * src/openpgp-do.c (extended_capabilities): Change value for card + holder certificate. + + * src/usb_prop.c (gnuk_device_SetInterface): New. + 2011-01-29 NIIBE Yutaka * src/usb_prop.c (gnuk_device_Get_Interface_Setting): Handle the diff --git a/NEWS b/NEWS index 5d888fe..2329bea 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,12 @@ Gnuk NEWS - User visible changes * Major changes in Gnuk 0.9 - Released 2011-01-XX, by NIIBE Yutaka + Released 2011-02-01, by NIIBE Yutaka -** Card Holder Certificate is supported. +** Card Holder Certificate is supported (still this is experimental). +Gnuk can support card holder certificate now. Note that GnuPG is not +ready yet. The tool/gnuk_update_binary.py is for writing card holder +certificate to Gnuk Token. ** Better interoperability to OpenSC. Gnuk is not yet supported by OpenSC, but it could be. With the diff --git a/README b/README index 1dc0f31..e576604 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ Gnuk - software for GPG USB Token Version 0.9 - 2011-01-30 + 2011-02-01 Niibe Yutaka Free Software Initiative of Japan diff --git a/src/openpgp-do.c b/src/openpgp-do.c index e5ef24e..7df6bc9 100644 --- a/src/openpgp-do.c +++ b/src/openpgp-do.c @@ -143,11 +143,15 @@ static const uint8_t extended_capabilities[] __attribute__ ((aligned (1))) = { */ 0, /* Secure Messaging Algorithm: N/A (TDES=0, AES=1) */ 0x00, 0x00, /* Max get challenge */ - 0x00, 0x00, /* max. length of cardholder certificate */ + 0x07, 0xfe, /* max. length of cardholder certificate (2KB - 2)*/ /* Max. length of command data */ (MAX_CMD_APDU_SIZE>>8), (MAX_CMD_APDU_SIZE&0xff), /* Max. length of response data */ +#if 0 (MAX_RES_APDU_SIZE>>8), (MAX_RES_APDU_SIZE&0xff), +#else + 0x08, 0x00, /* the case of cardholder ceritificate */ +#endif }; /* Algorithm Attributes */ diff --git a/src/usb_prop.c b/src/usb_prop.c index b75b597..0298729 100644 --- a/src/usb_prop.c +++ b/src/usb_prop.c @@ -149,6 +149,31 @@ gnuk_device_SetConfiguration (void) bDeviceState = CONFIGURED; } +static void +gnuk_device_SetInterface (void) +{ + uint16_t intf = pInformation->USBwIndex0; + + /* alternateSetting: pInformation->USBwValue0 should be 0 */ + + if (intf == 0) + { + ClearDTOG_RX (0x02); + ClearDTOG_TX (0x81); + } +#ifdef ENABLE_VIRTUAL_COM_PORT + else if (intf == 1) + { + ClearDTOG_TX (0x84); + } + else if (intf == 2) + { + ClearDTOG_RX (0x05); + ClearDTOG_TX (0x83); + } +#endif +} + static void gnuk_device_SetDeviceAddress (void) { @@ -205,7 +230,7 @@ gnuk_device_GetStringDescriptor (uint16_t Length) #ifdef ENABLE_VIRTUAL_COM_PORT #define NUM_INTERFACES 3 /* two for CDC, one for CCID */ -#define +#else #define NUM_INTERFACES 1 /* CCID only */ #endif @@ -338,7 +363,7 @@ const USER_STANDARD_REQUESTS User_Standard_Requests = { NOP_Process, /* GetConfiguration */ gnuk_device_SetConfiguration, NOP_Process, /* GetInterface */ - NOP_Process, /* SetInterface */ + gnuk_device_SetInterface, NOP_Process, /* GetStatus */ NOP_Process, /* ClearFeature */ NOP_Process, /* SetEndPointFeature */ diff --git a/tool/gnuk_update_binary.py b/tool/gnuk_update_binary.py index a634720..0ef16e7 100755 --- a/tool/gnuk_update_binary.py +++ b/tool/gnuk_update_binary.py @@ -232,7 +232,7 @@ def main(filename): if icc.icc_get_status() == 2: raise ValueError, "No ICC present" elif icc.icc_get_status() == 1: - print icc.icc_power_on() + icc.icc_power_on() icc.cmd_verify(3, "12345678") icc.cmd_update_binary(0, data) icc.cmd_select_openpgp()