fix dfuse.py
[gnuk/gnuk.git] / ChangeLog
1 2011-04-11  NIIBE Yutaka  <gniibe@fsij.org>
2
3         * tool/dfuse.py (DFU_STM32.verify): support data size of non-1-KiB.
4
5 2011-02-24  NIIBE Yutaka  <gniibe@fsij.org>
6
7         * src/usb_prop.c (gnuk_device_SetInterface): Fix argument to
8         ClearDTOG_TX.
9
10 2011-02-10  NIIBE Yutaka  <gniibe@fsij.org>
11
12         * Version 0.10.
13
14         * src/configure, src/Makefile.in (BOARD_DIR): New.
15
16         * boards/CQ_STARM/board.mk, boards/OLIMEX_STM32_H103/board.mk:
17         Removed.
18         * boards/STBEE/board.mk, boards/STBEE_MINI/board.mk: Removed.
19         * boards/STM32_PRIMER2/board.mk, boards/STM8S_DISCOVERY/board.mk:
20         Removed.
21
22         * src/Makefile.in (OUTFILES): Don't include random_bits.
23
24 2011-02-09  NIIBE Yutaka  <gniibe@fsij.org>
25
26         * src/usb_prop.c (gnukStringSerial): Updated.
27
28         * tool/gnuk_put_binary.py (gnuk_token.__del__): Removed.
29         Releasing the interface is done in PyUSB.
30
31         * tool/dfuse.py (DFU_STM32.__del__): Removed.
32
33         * src/openpgp.c (cmd_write_binary): Support random bits and card
34         holder certificate as well.
35
36         * src/openpgp-do.c (do_openpgpcard_aid): Add volatile to prevent
37         compiler optimization to access AID.
38
39 2011-02-08  NIIBE Yutaka  <gniibe@fsij.org>
40
41         * tool/gnuk_put_binary.py: Renamed (was: gnuk_update_binary.py).
42         (gnuk_token.cmd_write_binary): New.
43         (main): Support writing serial number.
44
45         * GNUK_SERIAL_NUMBER: Renamed (was: FSIJ_SERIAL_NUMBER).
46
47         * src/config.h.in (@SERIAL_DEFINE@): Removed.
48
49         * src/gnuk.h (FILEID_SERIAL_NO): New.
50
51         * src/openpgp.c (INS_WRITE_BINARY, cmd_write_binary): New.
52
53         * src/configure: Remove --with-fixed-serial support.
54
55         * src/openpgp-do.c (do_openpgpcard_aid): Remove support of
56         SERIAL_NUMBER_IN_AID.
57
58         * src/flash.c (flash_write_binary): Support FILEID_SERIAL_NO.
59
60 2011-02-04  NIIBE Yutaka  <gniibe@fsij.org>
61
62         * tool/gnuk_update_binary.py: Support updating random bits.
63
64         * src/random.c (random_bits_start): Renamed.
65         (random_bytes_get): Check initial erased state.
66
67         * src/Makefile.in (random-data.o): Removed.
68
69         * src/gnuk.ld.in (.gnuk_random): Don't have .gnuk_random any more.
70
71         * src/flash.c (flash_erase_binary): Support FILEID_RANDOM.
72         (flash_write_binary): Ditto.
73
74         * src/openpgp.c (cmd_reset_user_password): Fix PINPAD_SUPPORT case
75         with reset code.
76
77 2011-02-01  NIIBE Yutaka  <gniibe@fsij.org>
78
79         * Version 0.9.
80
81         * src/openpgp-do.c (extended_capabilities): Change value for card
82         holder certificate.
83
84         * src/usb_prop.c (gnuk_device_SetInterface): New.
85
86 2011-01-29  NIIBE Yutaka  <gniibe@fsij.org>
87
88         * src/usb_prop.c (gnuk_device_Get_Interface_Setting): Handle the
89         case where we have multiple interfaces.
90
91 2011-01-28  NIIBE Yutaka  <gniibe@fsij.org>
92
93         * tool/gnuk_update_binary.py: New.
94
95         * src/openpgp-do.c (gpg_do_get_data): Fix length adding two for
96         status word at the end and adding four for the tag and the length.
97
98         * src/usb-icc.c (icc_handle_data): Fix decrementing res_APDU_size.
99         (icc_power_off): Status should be the one *after* power off.
100
101         * src/openpgp.c (cmd_update_binary): Fix return code.
102
103 2011-01-27  NIIBE Yutaka  <gniibe@fsij.org>
104
105         * src/usb-icc.c (res_APDU_pointer): New.
106         (icc_handle_data, USBthread): Handle res_APDU_pointer.
107
108         * src/openpgp.h (GPG_COMMAND_NOT_ALLOWED): New.
109
110         * src/openpgp.c (INS_UPDATE_BINARY, FILE_EF_CH_CERTIFICATE)
111         (FILE_EF_RANDOM, cmd_update_binary): New.
112         (process_command_apdu): Initialize res_APDU_pointer.
113
114         * src/openpgp-do.c (gpg_do_get_data): Handle GPG_DO_CH_CERTIFICATE.
115
116         * src/gnuk.ld.in (.gnuk_ch_certificate): New.
117
118         * src/flash.c (flash_check_blank, flash_erase_binary)
119         (flash_write_binary): New.
120
121         * src/openpgp-do.c (gpg_do_table): Exclude GPG_DO_CH_CERTIFICATE.
122
123         * src/openpgp.c (cmd_reset_user_password): Add PINPAD_SUPPORT.
124
125         * src/gnuk.ld.in: Fix alignment and filling.
126
127 2011-01-26  NIIBE Yutaka  <gniibe@fsij.org>
128
129         * boards/STBEE/mcuconf.h: New.
130         * boards/STBEE/board.mk: New.
131         * boards/STBEE/board.h: New.
132         * boards/STBEE/board.c: New.
133
134         * tool/dfuse.py (DFU_STM32.verify): Add double ll_clear_status.
135
136         * src/configure (target): Add STBEE.
137
138 2011-01-25  NIIBE Yutaka  <gniibe@fsij.org>
139
140         * src/openpgp.c (cmd_pso): Support DigestInfo by MD5 (for opensc).
141
142 2011-01-22  NIIBE Yutaka  <gniibe@fsij.org>
143
144         * src/openpgp.c (cmd_pgp_gakp): Handle case of non-extended Lc.
145         (cmd_select_file): Return DF name when FCI is requested.
146
147         * src/openpgp-do.c (copy_do): Don't add tag if not requested.
148
149         * src/gnuk.h (memmove): Add declaration.
150
151 2011-01-21  NIIBE Yutaka  <gniibe@fsij.org>
152
153         * src/openpgp-do.c (copy_do): Fix off-by-one error.
154
155         * src/openpgp.c (get_pinpad_input): Ifdef-out PINPAD_SUPPORT.
156
157 2011-01-19  NIIBE Yutaka  <gniibe@fsij.org>
158
159         * Version 0.8.
160
161         * src/pin-cir.c (pin_main): Fix typo, call cir_ext_disable.
162
163         * src/usb_prop.c (gnukStringSerial): Updated.
164
165         * src/pin-dial.c: New.
166
167         * boards/STBEE_MINI/board.c (hwinit1): Add PINPAD_DIAL_SUPPORT.
168         (dial_sw_disable, dial_sw_enable, EXTI2_IRQHandler): New.
169
170         * src/gnuk.h: Add PINPAD_DIAL_SUPPORT.
171
172         * src/usb-icc.c (icc_handle_data): Handle PIN modification.
173
174         * src/usb_desc.c (gnukConfigDescriptor): bPinSupport = 3 when
175         PINPAD_DIAL_SUPPORT is enabled.
176
177 2011-01-18  NIIBE Yutaka  <gniibe@fsij.org>
178
179         * src/pin-cir.c (pin_main): Call cir_ext_disable at the end.
180
181 2011-01-17  NIIBE Yutaka  <gniibe@fsij.org>
182
183         * src/gnuk.h (PIN_INPUT_CURRENT, PIN_INPUT_NEW)
184         (PIN_INPUT_CONFIRM): New.
185
186         * src/pin-cir.c (pin_main): New argument MSG_CODE.
187
188         * src/openpgp.c (get_pinpad_input): New.
189         (cmd_verify): Use get_pinpad_input.
190         (cmd_change_password): Added PINPAD_SUPPORT.
191
192         * src/openpgp.c (cmd_nop): Removed.
193
194         * src/config.h.in: ifdef-out (not for ASSEMBLER).
195
196 2011-01-15  NIIBE Yutaka  <gniibe@fsij.org>
197
198         * Version 0.7.
199
200         * src/usb-icc.c (icc_handle_data): Bug fix: add break for case
201         ICC_STATE_SEND.
202
203 2011-01-14  NIIBE Yutaka  <gniibe@fsij.org>
204
205         * Version 0.6.
206
207         * src/usb_prop.c (gnukStringSerial): Include version number (again).
208
209         * boards/STM8S_DISCOVERY/board.c (hwinit1): Initialize TIM3 and
210         remap TIM3.
211         (cir_ext_disable, cir_ext_enable, EXTI9_5_IRQHandler)
212         (TIM3_IRQHandler): New.
213
214         * boards/STBEE_MINI/board.h (HAVE_7SEGLED): New.
215
216         * boards/STM8S_DISCOVERY/board.h: Include "config.h".
217         (VAL_GPIOBODR): PB0 (TIM3_CH3) is pull-down for PINPAD_SUPPORT.
218
219         * src/pin-cir.c (pindisp): Handle the board with no 7 segment
220         display.
221
222 2011-01-11  NIIBE Yutaka  <gniibe@fsij.org>
223
224         * src/openpgp-do.c (do_openpgpcard_aid): Fix length of res_p;
225
226 2011-01-08  NIIBE Yutaka  <gniibe@fsij.org>
227
228         * src/usb-icc.c (icc_handle_data): Handle the case of
229         ICC_STATE_SEND (back again to the implementation of v0.4).
230         (USBthread): Don't send back larger block (for libccid 1.3.11).
231
232 2011-01-07  NIIBE Yutaka  <gniibe@fsij.org>
233
234         * src/openpgp.c (cmd_read_binary): Call gpg_do_get_data for AID.
235
236         * src/openpgp-do.c (gpg_do_get_data): Added new argument WITH_TAG.
237
238         * src/usb_prop.c (gnuk_device_init)
239         (gnuk_device_GetStringDescriptor): gnukStringSerial with unique
240         chip ID.
241
242         * src/openpgp-do.c (do_openpgpcard_aid): New.
243         (openpgpcard_aid): Removed.
244
245         * boards/common/hw_config.c (unique_device_id): New.
246
247 2011-01-06  NIIBE Yutaka  <gniibe@fsij.org>
248
249         * src/config.h.in (PINPAD_MORE_DEFINE): Added.
250
251         * src/configure: Requiring bash (for variable substitution), added
252         PINPAD.
253
254         * src/Makefile.in: Support PINPAD.
255
256         * src/pin-cir.c (cir_timer_interrupt): Support Sharp protocol.
257
258 2011-01-04  NIIBE Yutaka  <gniibe@fsij.org>
259
260         * src/chconf.h (CH_USE_DYNAMIC): It's TRUE now.
261
262         * src/usb_desc.c (gnukConfigDescriptor): Added PINPAD_SUPPORT.
263
264         * src/pin-cir.c (cir_timer_interrupt): Added CIR_PERIOD_INHIBIT_CHATTER.
265
266 2010-12-29  NIIBE Yutaka  <gniibe@fsij.org>
267
268         * src/pin-cir.c (cir_timer_interrupt): Support Philips RC-5 protocol.
269
270 2010-12-28  NIIBE Yutaka  <gniibe@fsij.org>
271
272         * src/pin-cir.c (cir_timer_interrupt): Support Philips RC-6 protocol.
273
274 2010-12-27  NIIBE Yutaka  <gniibe@fsij.org>
275
276         * src/pin-cir.c (cir_timer_interrupt): Support Sony protocol.
277
278 2010-12-24  NIIBE Yutaka  <gniibe@fsij.org>
279
280         * src/pin-cir.c: New file.
281
282 2010-12-20  NIIBE Yutaka  <gniibe@fsij.org>
283
284         * src/openpgp.c (GPGthread): Added PINPAD_SUPPORT.
285         * boards/STBEE_MINI/mcuconf.h: Simplified.
286         * boards/STBEE_MINI/board.h: Include config.h.
287         (PINPAD_SUPPORT): Added.
288         * boards/STBEE_MINI/board.c (hwinit1): Added PINPAD_SUPPORT.
289
290 2010-12-15  NIIBE Yutaka  <gniibe@fsij.org>
291
292         * src/configure (FLASH_SIZE): Without 'k'.
293         * src/gnuk.ld.in (MEMORY): Append "k" here.
294         (.gnuk_flash): End point should be aligned too.
295
296         * src/config.h.in (@PINPAD_DEFINE@): New.
297         * src/Makefile.in (@PINPAD_MAKE_OPTION@): New.
298         * src/configure (PINPAD_MAKE_OPTION, PINPAD_DEFINE): New.
299
300 2010-12-14  NIIBE Yutaka  <gniibe@fsij.org>
301
302         * src/configure (FLASH_PAGE_SIZE): Always set.
303
304 2010-12-13  NIIBE Yutaka  <gniibe@fsij.org>
305
306         * Version 0.5.
307
308         * src/usb_desc.c (gnukStringSerial): Updated.
309
310 2010-12-10  NIIBE Yutaka  <gniibe@fsij.org>
311
312         * src/usb-cdc-vport.c (Virtual_Com_Port_Data_Setup)
313         (Virtual_Com_Port_NoData_Setup): No check for class&interface
314         request.
315
316         * src/usb-icc.c (ATR): Fixed.
317
318         * src/usb_desc.c (/* ICC Descriptor*/): bcdCCID = 1.1.
319         dwDefaultClock = dwMaximumClock = 3571.
320         dwFeatures 0x00040842.
321
322         * src/usb_prop.c (gnuk_clock_frequencies, gnuk_data_rates): New.
323         (gnuk_nothing_todo): Removed.
324         (gnuk_setup_with_data, gnuk_setup_with_nodata): New.
325         (Device_Property): Changed to call gnuk_setup_with_data and
326         gnuk_setup_with_nodata.
327
328 2010-12-09  NIIBE Yutaka  <gniibe@fsij.org>
329
330         * src/usb-icc.c (icc_power_off): Set icc_data_size = 0 to specify
331         no command APDU.  Signal GPGThread.
332         (icc_handle_data, USBthread): Don't signal main thread any more.
333
334         * src/openpgp.c (GPGthread): Only process the command APDU, if any.
335
336         * src/openpgp-do.c (do_tag_to_nr): Don't call fatal.
337         * src/main.c (fatal_code): New.
338         (main): Implemented 1-bit LED status display.
339         (fatal): Added argument CODE.
340         * src/flash.c (flash_data_pool_allocate): Supply argument FATAL_FLASH.
341         * src/random.c (random_bytes_get): Supply argument FATAL_RANDOM.
342         * src/ac.c (auth_status): Added volatile, and remove static.
343
344 2010-12-08  NIIBE Yutaka  <gniibe@fsij.org>
345
346         * src/gnuk.h (AC_OTHER_AUTHORIZED): Renamed (was:
347         AC_PSO_OTHER_AUTHORIZED).
348         * src/ac.c (ac_reset_other): Renamed (was: ac_reset_pso_other).
349         (verify_other): Renamed (was: verify_pso_other).
350         (ac_reset_admin): New.
351         * src/openpgp.c (cmd_change_password): Call ac_reset_admin.
352
353         * src/main.c (main): Don't create GPGThread here.
354         * src/usb-icc.c (icc_power_on): But create here, when requested.
355         (icc_power_off): Terminate GPGThread.
356         * src/openpgp.c (gpg_init, gpg_fini): New.
357         (GPGthread): Check chThdShouldTerminate.  Call gpg_init and gpg_fini.
358
359 2010-12-07  NIIBE Yutaka  <gniibe@fsij.org>
360
361         USB CCID/ICC implementation changes.
362         * src/usb_desc.c (dwMaxCCIDMessageLength): Updated.
363         * src/usb-icc.c (EV_TX_FINISHED): New.
364         (icc_rcv_data, icc_tx_data): Removed.
365         (icc_buffer, icc_seq): New.
366         (icc_next_p, icc_chain_p): New.
367         (icc_tx_ready): Removed.
368         (EP1_IN_Callback): Handle multiple transactions.
369         (icc_prepare_receive): New.
370         (EP2_OUT_Callback): Handle multiple transactions.
371         (icc_error, icc_send_status): Handle the case of receive in chain.
372         (icc_power_on, icc_send_params): Specify it's a single transaction.
373         (icc_send_data_block_filling_header): New.
374         (icc_send_data_block): Simplify.
375         (icc_handle_data): Removed the case of ICC_STATE_SEND.
376         Handle buffer of multiple transactions.
377         (USBthread): Don't use sending in chain.
378         * src/gnuk.h (USB_LL_BUF_SIZE): New.
379         (USB_BUF_SIZE): Now, it's larger value.
380         * src/configure: Echo for --enable-debug.
381         * src/call-rsa.c (rsa_sign): Use temp[] buffer as rsa_pkcs1_sign
382         writes OUTPUT in early stage.
383
384 2010-12-04  NIIBE Yutaka  <gniibe@fsij.org>
385
386         * src/flash.c (flash_keystore_release): Reset keystore storage.
387
388 2010-12-03  NIIBE Yutaka  <gniibe@fsij.org>
389
390         Keystore management changes.
391         * src/flash.c (flash_key_alloc): Check FLASH_KEYSTORE_SIZE.
392         (flash_key_release): Removed.
393         (flash_keystore_release): New function.
394         * src/openpgp-do.c (gpg_do_write_prvkey): Make it static.
395         When there is a key already, return as error.
396         (proc_key_import): Call flash_keystore_release when all keys removed.
397         * src/gnuk.ld.in (_keystore_pool): Size of keystore is now 1.5KB.
398
399 2010-11-30  NIIBE Yutaka  <gniibe@fsij.org>
400
401         Flash ROM fixes for STM32F10X_HD.
402         * src/gnuk.ld.in (.gnuk_flash): Use FLASH_PAGE_SIZE.
403         * src/configure (FLASH_PAGE_SIZE): Defined for gnuk.ld.
404         * src/flash.c (FLASH_PAGE_SIZE): New define.
405         (FLASH_DATA_POOL_SIZE): Use FLASH_PAGE_SIZE.
406
407         Import changes of ChibiOS_2.0.8.
408         * ChibiOS_2.0.8/os/hal/include/pwm.h
409         * ChibiOS_2.0.8/os/hal/platforms/STM32/pwm_lld.c
410         * ChibiOS_2.0.8/os/hal/platforms/STM32/pwm_lld.h
411         * ChibiOS_2.0.8/os/hal/src/pwm.c
412         * ChibiOS_2.0.8/os/hal/templates/pwm_lld.c
413         * ChibiOS_2.0.8/os/hal/templates/pwm_lld.h
414         * ChibiOS_2.0.8/os/kernel/include/ch.h
415         * ChibiOS_2.0.8/os/kernel/src/chevents.c
416         * ChibiOS_2.0.8/os/kernel/src/chthreads.c
417         * ChibiOS_2.0.8/boards/OLIMEX_LPC_P2148/board.h
418         * ChibiOS_2.0.8/readme.txt
419         * ChibiOS_2.0.8/test/testdyn.c
420         * ChibiOS_2.0.8/docs/*/*: Updated.
421
422         New private key management.
423         * src/ac.c (ac_reset_pso_cds, ac_reset_pso_other): Call
424         gpg_do_clear_prvkey.
425         (verify_pso_other): load private keys here.
426         * src/openpgp-do.c (kd): Keydata for Signing, Decryption, and
427         Authentication.
428         (gpg_do_load_prvkey, gpg_do_write_prvkey): Use kd[].
429         (gpg_do_clear_prvkey): New function.
430         * src/openpgp.c (cmd_pso, cmd_internal_authenticate): Use new API
431         of rsa_sign and rsa_decrypt.
432         (cmd_pso): Fixed bug of checking return value of gpg_get_pw1_lifetime.
433         * src/call-rsa.c (rsa_sign): New argument KD.
434         (rsa_decrypt): Likewise.
435
436         Don't use malloc/free in C library.
437         * src/stdlib.h (malloc, free): Use chHeapAlloc and chHeapFree.
438
439 2010-11-26  NIIBE Yutaka  <gniibe@fsij.org>
440
441         * boards/STM8S_DISCOVERY/*: New.
442         * src/configure: STM8S_DISCOVERY only has 64KB flash memory.
443
444         * boards/STBEE_MINI/board.h (CPU_WITH_NO_GPIOE): New define.
445         * ChibiOS_2.0.6/os/hal/platforms/STM32/hal_lld.c: Use it.
446         * ChibiOS_2.0.6/os/hal/platforms/STM32/pal_lld.c: Likewise.
447         * ChibiOS_2.0.6/os/hal/platforms/STM32/pal_lld.h: Likewise.
448
449         * src/openpgp.c (cmd_pso): DigestInfo by SHA224/SHA384/SHA512 is
450         supported.
451
452 2010-11-22  NIIBE Yutaka  <gniibe@fsij.org>
453
454         Import changes of ChibiOS_2.0.6.
455         * ChibiOS_2.0.6/demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h
456         * ChibiOS_2.0.6/os/hal/include/can.h
457         * ChibiOS_2.0.6/os/hal/platforms/AT91SAM7/hal_lld.c
458         * ChibiOS_2.0.6/os/hal/platforms/AT91SAM7/serial_lld.c
459         * ChibiOS_2.0.6/os/hal/platforms/LPC214x/serial_lld.c
460         * ChibiOS_2.0.6/os/hal/platforms/STM32/hal_lld_f103.h
461         * ChibiOS_2.0.6/os/hal/platforms/STM32/hal_lld_f105_f107.h
462         * ChibiOS_2.0.6/os/hal/platforms/STM32/pwm_lld.c
463         * ChibiOS_2.0.6/os/hal/platforms/STM32/serial_lld.h
464         * ChibiOS_2.0.6/os/hal/platforms/STM32/spi_lld.h
465         * ChibiOS_2.0.6/os/hal/src/adc.c
466         * ChibiOS_2.0.6/os/hal/src/spi.c
467         * ChibiOS_2.0.6/os/kernel/include/ch.h
468         * ChibiOS_2.0.6/os/kernel/include/chinline.h
469         * ChibiOS_2.0.6/os/kernel/include/chioch.h
470         * ChibiOS_2.0.6/os/kernel/include/chstreams.h
471         * ChibiOS_2.0.6/os/kernel/include/chthreads.h
472         * ChibiOS_2.0.6/os/kernel/src/chlists.c
473         * ChibiOS_2.0.6/os/kernel/src/chschd.c
474         * ChibiOS_2.0.6/os/kernel/src/chthreads.c
475         * ChibiOS_2.0.6/os/ports/GCC/ARM/rules.mk
476         * ChibiOS_2.0.6/os/ports/GCC/ARM7/chcore.h
477         * ChibiOS_2.0.6/os/ports/GCC/ARM7/port.dox
478         * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v6m.c
479         * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v6m.h
480         * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v7m.c
481         * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v7m.h
482         * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/old/chcore_v7m.h
483         * ChibiOS_2.0.6/os/ports/GCC/AVR/chcore.h
484         * ChibiOS_2.0.6/os/ports/GCC/AVR/port.dox
485         * ChibiOS_2.0.6/os/ports/GCC/MSP430/chcore.c
486         * ChibiOS_2.0.6/os/ports/GCC/MSP430/chcore.h
487         * ChibiOS_2.0.6/os/ports/GCC/MSP430/port.dox
488         * ChibiOS_2.0.6/os/ports/GCC/PPC/chcore.h
489         * ChibiOS_2.0.6/os/ports/GCC/PPC/port.dox
490         * ChibiOS_2.0.6/os/ports/RC/STM8/port.dox
491         * ChibiOS_2.0.6/os/various/memstreams.h
492         * ChibiOS_2.0.6/readme.txt
493         * ChibiOS_2.0.6/docs/*/*: Updated
494
495 2010-11-14  NIIBE Yutaka  <gniibe@fsij.org>
496
497         * src/openpgp.c (cmd_pso): DigestInfo by SHA256 is supported.
498
499 2010-11-12  NIIBE Yutaka  <gniibe@fsij.org>
500
501         * src/usb_desc.c (gnukConfigDescriptor): Change dwFeatures.
502
503         * src/usb-icc.c (icc_send_params): Always return fixed result.
504         (icc_handle_data): Support ICC_GET_PARAMS.
505
506 2010-11-10  NIIBE Yutaka  <gniibe@fsij.org>
507
508         * src/usb_desc.c (gnukConfigDescriptor): Fix bmAttributes.
509
510 2010-11-09  NIIBE Yutaka  <gniibe@fsij.org>
511
512         * Version 0.4.
513
514         * src/usb_desc.c (gnukStringSerial): Updated.
515
516         * ChibiOS_2.0.2/os/hal/platforms/STM32/pal_lld.h (PALConfig):
517         STBee Mini uses STM32F103CBT6 which expose no GPIO E port.
518         * ChibiOS_2.0.2/os/hal/platforms/STM32/pal_lld.c (_pal_lld_init):
519         Likewise.
520
521 2010-11-08  NIIBE Yutaka  <gniibe@fsij.org>
522
523         * tool/dump_mem.py: New tool.
524
525         Implement GC for data pool in flash memory.
526         * src/openpgp-do.c (gpg_write_digital_signature_counter): New.
527         (gpg_increment_digital_signature_counter): Fix for GC.
528         (gpg_data_scan): Rename from gpg_do_table_init.
529         (gpg_data_copy): New function for copying GC.
530         * src/main.c (main): Call gpg_data_scan with the address which
531         flash_init returns.
532         * src/flash.c (flash_erase_page): New function.
533         (FLASH_DATA_POOL_SIZE): data_pool is 2KiB now.
534         (flash_data): Put a header (GC generation).
535         (flash_init): Implement choosing a data pool page.
536         (flash_data_pool): Removed.
537         (flash_copying_gc): New function.
538         (flash_data_pool_allocate): Call flash_copying_gc when full.
539         (flash_do_write_internal, flash_put_data_internal)
540         (flash_bool_write_internal, flash_cnt123_write_internal): New
541         * src/gnuk.ld.in (gnuk_flash): data_pool is 2KiB now.
542
543         Bug fixes.
544         * src/openpgp.c (cmd_change_password, cmd_reset_user_password):
545         Write to APDU correctly.
546         * src/flash.c (flash_warning): Make it public.
547         * src/openpgp-do.c (do_hist_bytes, do_fp_all, do_cafp_all)
548         (do_kgtime_all, do_ds_count): Fix return value.
549         (rw_pw_status): Correctly return value.
550         (proc_resetting_code): Change func proto. to return success/failure.
551         (proc_key_import): Ditto.
552         (gpg_do_put_data): Handle return values.
553         (gpg_do_write_simple): Don't write to APDU.
554
555 2010-11-05  NIIBE Yutaka  <gniibe@fsij.org>
556
557         Bug fixes.
558         * src/openpgp.c (gpg_change_keystring): Handle
559         GPG_KEY_FOR_AUTHENTICATION.
560         * src/openpgp-do.c (gpg_do_write_prvkey): Remove multiple call
561         of flash_do_release.
562
563         Bug fix.
564         * src/openpgp-do.c (gpg_do_write_prvkey): Don't hardcode 6, but
565         use strlen.
566
567         * src/flash.c, src/gnuk.ld.in: Rename "Flash DO Pool" to "Flash
568         Data Pool", because it's not only DO.
569         * src/gnuk.h, src/opengpg-do.c: Cleanup.
570
571         Digital Signature Counter implementation improvement.
572         * src/gnuk.h (NR_DO_DS_COUNT): Removed.
573         (NR_COUNTER_DS, NR_COUNTER_DS_LSB): New.
574         * src/openpgp-do.c (do_ds_count_initial_value): Removed.
575         (gpg_do_increment_digital_signature_counter): Removed.
576         (digital_signature_counter): New variable.
577         (do_ds_count, gpg_increment_digital_signature_counter): New functions.
578         (gpg_do_table): Change the entry for GPG_DO_DS_COUNT as DO_PROC_READ.
579         (gpg_do_table_init): Handle digital_signature_counter.
580         * src/flash.c (flash_data_pool_allocate, flash_put_data): New.
581
582         Password status implementation improvement.
583         * src/gnuk.h (PW_STATUS_PW1, PW_STATUS_RC, PW_STATUS_PW3): Removed.
584         (PW_ERR_PW1, PW_ERR_RC, PW_ERR_PW3): New define.
585         (NR_COUNTER_123, NR_BOOL_PW1_LIFETIME): New define.
586         (NR_NONE, NR_EMPTY): New define.
587         * src/flash.c (flash_bool_clear, flash_bool_write)
588         (flash_cnt123_get_value, flash_cnt123_increment)
589         (flash_cnt123_clear): New functions.
590         * src/openpgp-do.c (do_pw_status_bytes_template): Removed.
591         (PW_STATUS_BYTES_TEMPLATE, gpg_do_reset_pw_counter): Removed.
592         (PASSWORD_ERRORS_MAX, PW_LEN_MAX): New define.
593         (pw1_lifetime_p, pw_err_counter_p): New variables.
594         (gpg_get_pw1_lifetime): New function.
595         (gpg_get_pw_err_counter, gpg_passwd_locked, gpg_reset_pw_counter)
596         (gpg_increment_pw_counter): New functions.
597         (rw_pw_status): Use pw1_lifetime_p and pw_err_counter_p.
598         (gpg_do_table_init): Handle NR_COUNTER_123 and NR_BOOL_PW1_LIFETIME.
599         * src/ac.c (verify_pso_cds, verify_pso_other, verify_admin_0):
600         Follow the changes.
601         * src/openpgp.c (cmd_change_password, cmd_reset_user_password)
602         (cmd_pso, cmd_internal_authenticate): Likewise.
603
604 2010-11-04  NIIBE Yutaka  <gniibe@fsij.org>
605
606         * src/flash.c (flash_warning): New.
607         (flash_do_pool): Added header for DO pool.
608         (flash_do_release): Fill zero.
609         (flash_do_write): Change DO format in flash.
610         * src/openpgp-do.c (gpg_do_table_init, copy_do_1)
611         (gpg_do_read_simple): Follow the change of DO format in flash.
612
613         * src/openpgp-do.c (DO_CMP_READ): Renamed.
614         (cmp_ch_data, cmp_app_data, cmp_ss_temp): Likewise.
615         (with_tag): Removed static global variable.
616         (do_hist_bytes, do_fp_all, do_cafp_all, do_kgtime_all)
617         (rw_pw_status, copy_do_1, copy_do, gpg_do_get_data): Added
618         with_tag argument.
619         (gpg_do_put_data): length > 255 will be error.
620
621 2010-11-03  NIIBE Yutaka  <gniibe@fsij.org>
622
623         Bug fixes.
624         * src/ac.c (verify_admin_0): Initialize pwsb earlier.
625         * src/openpgp-do.c (copy_do_1): Access do_data[0] (was: do_data[1]).
626
627 2010-11-02  NIIBE Yutaka  <gniibe@fsij.org>
628
629         DfuSe support.
630         * tool/dfuse.py (DFU_STM32.download): Put '#' for each 4-KiB.
631         Added 0-length write to finish download.
632         Take intel_hex object as argument.
633         (DFU_STM32.ll_upload_block): New method.
634         (DFU_STM32.dfuse_read_memory): New method.
635         (DFU_STM32.verify): New method.
636         (get_device): Support DFU_STM32PROTOCOL_0 too (for CQ STARM).
637
638         * tool/dfuse.py: Renamed from dfu_stmicroelectronics_extention.py.
639
640 2010-11-01  NIIBE Yutaka  <gniibe@fsij.org>
641
642         * tool/intel_hex.py: New file.
643         * tool/dfu_stmicroelectronics_extention.py: New file.
644
645 2010-10-28  NIIBE Yutaka  <gniibe@fsij.org>
646
647         * src/gnuk.h (OPENPGP_CARD_INITIAL_PW3): New.
648         * src/ac.c (verify_admin_0): Use OPENPGP_CARD_INITIAL_PW3.
649
650 2010-10-23  NIIBE Yutaka  <gniibe@fsij.org>
651
652         * Version 0.3.
653
654         * src/usb_desc.c (gnukStringSerial): Updated.
655
656 2010-10-22  NIIBE Yutaka  <gniibe@fsij.org>
657
658         * src/gnuk.ld.in (.gnuk_random): Fix description so that
659         padding with 0xffffffff will be in gnuk.hex.
660
661         * src/openpgp.c (file_selection): Change type (was: int).
662         (FILE_NONE..FILE_EF_SERIAL): Change the values.
663
664         * src/configure: Added STBee Mini support.
665         * boards/STBEE_MINI/mcuconf.h: New.
666         * boards/STBEE_MINI/board.mk: New.
667         * boards/STBEE_MINI/board.h: New.
668         * boards/STBEE_MINI/board.c: New.
669
670         * ChibiOS_2.0.2/os/hal/platforms/STM32/hal_lld.c
671         (pal_default_config): STBee Mini uses STM32F103CBT6 which expose
672         no GPIO E port.
673
674 2010-10-21  NIIBE Yutaka  <gniibe@fsij.org>
675
676         * boards/common/hw_config.c (Get_SerialNum): Removed.
677         * src/usb_prop.c (gnuk_device_init): Remove calling Get_SerialNum.
678         * src/usb_desc.c (gnukStringSerial): Updated.
679         * boards/CQ_STARM/board.c (set_led): Fix polarity.
680
681 2010-10-20  NIIBE Yutaka  <gniibe@fsij.org>
682
683         * FSIJ_SERIAL_NUMBER: New.
684         * src/configure (with_fsij): Added FSIJ serial number support.
685         * src/config.h.in (@FSIJ_DEFINE@, @SERIAL_NUMBER_FOUR_BYTES@): New.
686
687         * src/configure: Added CQ STARM target.
688         * boards/CQ_STARM/mcuconf.h: New.
689         * boards/CQ_STARM/board.mk: New.
690         * boards/CQ_STARM/board.h: New.
691         * boards/CQ_STARM/board.c: New.
692
693 2010-10-19  NIIBE Yutaka  <gniibe@fsij.org>
694
695         * boards/STM32_PRIMER2/board.mk (BOARDSRC): Use common/hw_config.c.
696         * boards/OLIMEX_STM32_H103/board.mk (BOARDSRC): Likewise.
697
698         * boards/common/hw_config.c: Move board specific functions to ...
699         * boards/STM32_PRIMER2/board.c (USB_Cable_Config, set_led): ... here.
700         * boards/OLIMEX_STM32_H103/board.c (USB_Cable_Config, set_led): Ditto.
701
702         * boards/{OLIMEX_STM32_H103,STM32_PRIMER2}/hw_config.c: Removed.
703         * boards/common/hw_config.c: New file (was: boards/*/hw_config.c).
704
705         * .gitignore: New file.
706
707 2010-10-16  NIIBE Yutaka  <gniibe@fsij.org>
708
709         Implement "INTERNAL AUTHENTICATE" command.
710
711         * src/gnuk.h (BY_USER, BY_RESETCODE, BY_ADMIN): New defines.
712         (NUM_ALL_PRV_KEYS): Now it's 3 (was: 2).
713
714         * src/openpgp.c (INS_INTERNAL_AUTHENTICATE): New define.
715         (cmd_internal_authenticate): New function.
716         (cmds): Added INS_INTERNAL_AUTHENTICATE.
717         (cmd_change_password): Use BY_USER.
718         (cmd_reset_user_password): Use BY_USER, BY_RESETCODE, BY_ADMIN.
719         (cmd_pso): Load GPG_KEY_FOR_DECRYPTION here.
720         (cmd_pso): Removed adding status word into res_APDU...
721         * src/call-rsa.c (rsa_sign): and moved adding status word into
722         res_APDU here.
723
724         * src/ac.c (pw1_keystring): New variable.
725         (ac_reset_pso_other): Clear pw1_keystring.
726         (verify_pso_cds): Use BY_USER.
727         (verify_pso_other): Just check the length of password here, and
728         defer real check to cmd_pso or cmd_internal_authenticate.
729
730 2010-10-14  NIIBE Yutaka  <gniibe@fsij.org>
731
732         Adding 'configure' support.
733         * src/configure: New file.
734         * src/Makefile.in: Renamed from src/Makefile.
735         * src/config.h: Renamed from src/config.h.
736         * src/gnuk.ld: Renamed from src/gnuk.ld.
737
738         Adding DFU_SUPPORT.
739         * boards/common/hwinit0.c: New file adding DFU_SUPPORT.
740         * boards/common/hwinit1.c: New file.
741         * boards/OLIMEX_STM32_H103/board.c: Include config.h.
742         Use common/hwinit0.c and common/hwinit1.c.
743         * boards/STM32_PRIMER2/board.c: Likewise.
744
745 2010-09-16  NIIBE Yutaka  <gniibe@fsij.org>
746
747         * src/usb-icc.c (icc_error): New function.
748         (icc_handle_data): Call icc_error.
749         Don't go to STATE_START on errors.
750
751 2010-09-13  NIIBE Yutaka  <gniibe@fsij.org>
752
753         * Version 0.2.
754
755         * src/openpgp.c (cmd_select_file): Override data of number_of_bytes.
756
757         * src/openpgp-do.c (gpg_do_table_init): Calculate number of byte
758         which Data Objects consumes.
759
760 2010-09-12  Kaz Kojima <kkojima@rr.iij4u.or.jp>
761
762         * src/call-rsa.c (rsa_decrypt): Debug output only when DEBUG.
763
764         * boards/STM32_PRIMER2/hw_config.c (USB_Cable_Config): Fix GPIO.
765         (set_led): Ditto.
766
767         * boards/STM32_PRIMER2/board.c (hwinit1): Added LED initialization.
768
769 2010-09-11  NIIBE Yutaka  <gniibe@fsij.org>
770
771         * src/usb-icc.c (ATR): Fixed.
772         (icc_send_params): New function.
773         (icc_handle_data): Handle ICC_SET_PARAMS request.
774
775         * src/random.c (random_bytes_get, random_bytes_free, get_random):
776         Clear used random bytes.
777
778         * src/flash.c (flash_clear_halfword): New function.
779
780 2010-09-10  NIIBE Yutaka  <gniibe@fsij.org>
781
782         * Version 0.1.
783
784         * src/usb_desc.c (gnukStringSerial): Change the value so that
785         libccid doesn't get confused.
786
787         * src/openpgp.c (gpg_change_keystring): Support key for decryption
788         as well.
789         (cmd_read_binary): Use openpgpcard_aid.
790         (cmd_pso): call ac_reset_pso_other.
791
792         * src/openpgp-do.c (openpgpcard_aid): Renamed from aid, and exported.
793         (do_ds_count_initial_value): New const variable.
794         (num_prv_keys): New variable.
795         (gpg_do_write_prvkey): Remove contents of keystring only if
796         ++num_prv_keys == NUM_ALL_PRV_KEYS.
797         (gpg_do_chks_prvkey): Call flash_do_release.
798         (gpg_do_table_init): Initialize with do_ds_count_initial_value.
799         Initialize num_prv_keys.
800         (gpg_do_write_simple): Support removing DO.
801         (gpg_do_increment_digital_signature_counter): Call flash_do_release.
802
803         * src/gnuk.h (NUM_ALL_PRV_KEYS): New definition.
804         (OPENPGP_CARD_INITIAL_PW1): New definition.
805         (enum kind_of_key): Rename.
806
807         * src/ac.c (ac_reset_pso_cds): New function.
808
809 2010-09-09  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
810
811         * boards/STM32_PRIMER2/{board.c,board.h,board.mk,hw_config.c,mcuconf.h}:
812         New files.
813
814         * boards/OLIMEX_STM32_H103/{mcuconf.h,hw_config.c}: Moved from src.
815
816         * src/main.c (main): Use set_led instead of palClearPad directly.
817
818 2010-09-08  NIIBE Yutaka  <gniibe@fsij.org>
819
820         * src/ac.c (calc_md): Make SHA1 variable auto.
821
822         * src/debug.c (put_int): New.
823
824         * src/gnuk.ld (__process_stack_size__): Removed.
825
826         * src/main.c (STDOUTthread): Use Event.
827         (main): Make LED ON during command execution, blink usually.
828
829         * src/openpgp-do.c (encrypt, decrypt): Make AES variables auto.
830         (gpg_do_table): GPG_DO_ALG_AUT is NULL.
831
832         * src/openpgp.c (cmd_pso): Bug fix for extended Lc.
833
834         * src/usb-icc.c (icc_power_off): Make LED ON during command
835         execution.
836         (USB_ICC_TIMEOUT): Longer value (was: 1000).
837
838         * src/usb_desc.c (gnukConfigDescriptor): Fix bcdCCID value.
839
840         * src/vcomport.mk (VCOMSRC): Use our own usb_endp.c.
841
842         * src/usb_desc.c (gnukConfigDescriptor): ICC Descriptor is
843         Revision 1.0.
844
845         * polarssl-0.14.0/include/polarssl/config.h: Commend out
846         POLARSSL_SELF_TEST.
847
848         * polarssl-0.14.0/library/rsa.c (rsa_private): Don't check input,
849         so that we don't access ctx->N.
850         (rsa_pkcs1_decrypt): size of BUF is enough as 256.
851
852         * polarssl-0.14.0/library/sha1.c (sha1_file): #if-out to avoid
853         stdio of libc.
854
855         * polarssl-0.14.0/library/bignum.c (mpi_write_hlp)
856         (mpi_write_string, mpi_read_file, mpi_read_file): #if-out to avoid
857         stdio of libc.
858
859 2010-09-07  NIIBE Yutaka  <gniibe@fsij.org>
860
861         * gnuk.svg: New file.
862
863 2010-09-06  NIIBE Yutaka  <gniibe@fsij.org>
864
865         * Initial version 0.0.