1 2019-02-24 NIIBE Yutaka <gniibe@fsij.org>
3 * src/usb-ccid.c (ccid_thread): Clean up the ack button state
4 at reset (by SET_INTERFACE).
6 * tool/gnuk_token.py (gnuk_token.__init__): Add back
7 setAltInterface to issue SET_INTERFACE control transfer.
9 2019-02-22 NIIBE Yutaka <gniibe@fsij.org>
11 * tool/gnuk_get_random.py: New.
13 * src/openpgp.c (cmd_external_authenticate): move
15 (cmd_get_challenge): ... here.
17 * src/gnuk.h (EV_*): Change the values.
19 * src/usb-ccid.c (GPG_ACK_TIMEOUT): New.
20 (ccid_thread): Implement timout for the user interaction.
22 2019-02-21 NIIBE Yutaka <gniibe@fsij.org>
24 * GNUK_USB_DEVICE_ID: Add 1209:2440.
26 2018-12-26 NIIBE Yutaka <gniibe@fsij.org>
30 2018-12-22 Peter Lebbing <peter@digitalbrains.com>
32 * src/main.c (device_initialize_once): Fill the stack address and
33 reset vector of Gnuk application (was the one of old SYS).
34 Reset the board after updating the first five pages of flash.
36 2018-12-21 Peter Lebbing <peter@digitalbrains.com>
38 * src/main.c [DFU_SUPPORT] (flash_write_any): New.
39 (device_initialize_once): Overwrite DFU bootloader by SYS.
40 (main): Use SYS at ORIGIN_REAL.
42 * src/stdaln-sys.ld.in: New.
44 * src/Makefile [USE_DFU] (OBJS_ADD): Add standalone SYS object.
45 Add rules for stdaln-sys-bin.o and src/stdaln-sys.ld.
47 * src/configure: Generate stdaln-sys.ld.
48 [MAPLE_MINI]: Tweak ORIGIN and FLASH_SIZE.
49 (ORIGIN_DEFINE, ORIGIN_REAL_DEFINE): New macros.
50 (USE_DFU): New make variable.
52 * src/config.h.in (ORIGIN_DEFINE, ORIGIN_REAL_DEFINE): New.
54 2018-12-20 NIIBE Yutaka <gniibe@fsij.org>
56 * chopstx: Update to 1.13.
58 2018-12-07 NIIBE Yutaka <gniibe@fsij.org>
60 * src/gnuk.h (EV_EXEC_ACK_REQUIRED): Have precedence
61 than EV_EXEC_FINISHED.
63 2018-12-06 NIIBE Yutaka <gniibe@fsij.org>
65 * src/usb-ccid.c (ccid_thread): Priority of handling
66 EV_TX_FINISHED is most important. Don't handle
67 Ack button event when c->tx_busy = 1.
69 2018-12-05 NIIBE Yutaka <gniibe@fsij.org>
71 * src/openpgp.c (cmd_external_authenticate): Support
72 ACK button for firmware update.
74 2018-12-04 NIIBE Yutaka <gniibe@fsij.org>
76 * src/openpgp-do.c (gpg_data_copy): Fix for NR_DO_UIF_SIG.
78 2018-11-25 NIIBE Yutaka <gniibe@fsij.org>
82 2018-11-21 NIIBE Yutaka <gniibe@fsij.org>
84 * src/usb-ccid.c (ccid_thread): Fix a race condition sending
85 result APDU by ack button, time out, sending time extension block
86 again while tx_busy=1.
88 2018-11-17 NIIBE Yutaka <gniibe@fsij.org>
90 * src/main.c (device_initialize_once): Depends on MHZ to
92 * src/openpgp-do.c (do_openpgpcard_aid): Ditto.
94 2018-11-12 NIIBE Yutaka <gniibe@fsij.org>
98 * chopstx: Update to 1.12.
99 * src/configure (ackbtn_support): Always yes.
100 * src/usb-ccid.c: Fix comma separator.
102 2018-11-09 NIIBE Yutaka <gniibe@fsij.org>
104 * tool/kdf_calc.py (kdf_calc): Use libgcrypt.so.20.
106 2018-11-09 NIIBE Yutaka <gniibe@fsij.org>
108 * src/openpgp.c (cmd_pso, cmd_internal_authenticate): Use
111 * src/usb-ccid.c (struct ccid): New field tx_busy.
112 (ccid_error, ccid_power_on, ccid_send_status, ccid_power_off)
113 (ccid_send_data_block_internal, ccid_send_data_block_0x9000)
114 (ccid_send_data_block_gr, ccid_send_params): Set c->tx_busy.
115 (ccid_state_p): Remove.
116 (ccid_get_ccid_state): New.
117 (ccid_thread): Only handle EV_TX_FINISHED event when c->tx_busy.
119 * src/usb_ctrl.c (usb_setup, usb_ctrl_write_finish): Use
121 * src/main.c (display_status_code): Likewise.
123 2018-11-09 NIIBE Yutaka <gniibe@fsij.org>
125 * src/usb-ccid.c (ccid_handle_data): Set c->state for pinpad input.
126 (ccid_send_data_block_internal): Fix the case of len == 0.
128 * src/main.c (display_status_code): There is
129 no case where ccid_state == CCID_STATE_RECEIVE.
130 * src/gnuk.h (CCID_STATE_RECEIVE): Remove.
131 (CCID_STATE_SEND): Remove.
133 2018-10-12 NIIBE Yutaka <gniibe@fsij.org>
135 * src/usb-ccid.c (ccid_thread): Notify host about ack button.
137 2018-10-02 NIIBE Yutaka <gniibe@fsij.org>
139 * src/stack-def.h (SIZE_0): Increase.
141 * chopstx: Update to 1.11.
143 2018-10-01 NIIBE Yutaka <gniibe@fsij.org>
145 * src/gnuk.h (EV_EXEC_ACK_REQUIRED): New.
146 (EV_EXEC_FINISHED_ACK): Remove.
147 (CCID_STATE_CONFIRM_ACK): Remove.
148 (CCID_STATE_ACK_REQUIRED_0, CCID_STATE_ACK_REQUIRED_1): New.
149 * src/openpgp.c (cmd_pso): Send EV_EXEC_ACK_REQUIRED, if needed.
150 (cmd_internal_authenticate): Likewise.
151 (process_command_apdu): No return value.
152 (openpgp_card_thread): Always send EV_EXEC_FINISHED.
153 * src/usb-ccid.c (ccid_send_data_block_time_extension): Follow the
155 (ccid_handle_data, ccid_handle_timeout): Likewise.
156 (ccid_thread): Handle EV_EXEC_ACK_REQUIRED.
157 Change for LED blink.
158 * src/main.c (main): LED blink during waiting ACK.
160 2018-09-27 NIIBE Yutaka <gniibe@fsij.org>
162 * src/gnuk.h (NR_DO_UIF_SIG, NR_DO_UIF_DEC, NR_DO_UIF_AUT): New.
163 * src/openpgp-do.c (rw_uif) [ACKBTN_SUPPORT]: New.
164 (GPG_DO_UIF_SIG, GPG_DO_UIF_DEC, GPG_DO_UIF_AUT): New.
165 (feature_mngmnt) [ACKBTN_SUPPORT]: New.
166 (cmp_app_data, cmp_discretionary): Add ACKBTN_SUPPORT.
167 (gpg_do_table): Add for GPG_DO_UIF_SIG, GPG_DO_UIF_DEC,
168 GPG_DO_UIF_AUT, and GPG_DO_FEATURE_MNGMNT.
169 (gpg_do_get_uif) [ACKBTN_SUPPORT]: New.
170 (gpg_data_scan): Handle uif_flags.
171 * src/openpgp.c (process_command_apdu) [ACKBTN_SUPPORT]: Add user
172 interaction handling.
174 2018-09-27 NIIBE Yutaka <gniibe@fsij.org>
176 * src/gnuk.h (LED_WAIT_FOR_BUTTON): New.
177 * src/main.c (main): Blink rapidly when asking ACK.
178 * src/usb-ccid.c (ccid_thread): Use LED_WAIT_FOR_BUTTON.
180 2018-09-27 NIIBE Yutaka <gniibe@fsij.org>
182 * src/config.h.in: Add @ACKBTN_DEFINE@.
183 * src/configure: Add ACKBTN_SUPPORT.
184 * src/gnuk.h (EV_EXEC_FINISHED_ACK): New.
185 (CCID_STATE_CONFIRM_ACK): New.
186 * src/openpgp.c (process_command_apdu): Change for cmd_pso, and
187 cmd_internal_authenticate.
188 * src/usb-ccid.c (ccid_send_data_block_time_extension): Report
189 time extension differently when waiting ack button.
190 (ccid_handle_data): Support case of CCID_STATE_CONFIRM_ACK.
191 (ccid_handle_timeout): Likewise.
192 (ack_intr) [ACKBTN_SUPPORT]: New.
193 (ccid_thread) [ACKBTN_SUPPORT]: Add ack button handling.
195 2018-09-26 NIIBE Yutaka <gniibe@fsij.org>
198 * src/usb-ccid.c (usb_event_handle): Fix for chopstx_intr_done.
199 * src/pin-cir.c (tim_main, ext_main): Likewise.
201 * src/configure (FST_01SZ): Set MHZ=96.
203 2018-07-04 Szczepan Zalega <szczepan@nitrokey.com>
205 * tool/upgrade_by_passwd.py: Catch exception, when no KDF data is
207 Output 'second' for 1 second.
209 2018-05-10 NIIBE Yutaka <gniibe@fsij.org>
213 * src/Makefile (build/gnuk.elf): New target.
214 (build/gnuk-vidpid.elf): Remove.
216 * chopstx: Update to 1.9.
218 2018-04-26 NIIBE Yutaka <gniibe@fsij.org>
220 * src/usb_ctrl.c (usb_device_reset): Don't stop the endpoints.
222 * src/configure (MHZ, def_mhz): New.
224 2018-04-05 NIIBE Yutaka <gniibe@fsij.org>
228 * tests: Add test cases for admin-less mode.
230 * src/openpgp.c (cmd_change_password): Care admin-less mode.
232 2018-04-04 NIIBE Yutaka <gniibe@fsij.org>
234 * tests: Add more tests, key generation and KDF support.
236 * src/openpgp.c (cmd_reset_user_password): Check length of
239 * src/openpgp-do.c (proc_resetting_code): Support removal.
240 (gpg_do_kdf_check): Fix for the case of resetting PW3.
242 * tests/test_004_reset_pw3.py: New.
244 2018-04-03 NIIBE Yutaka <gniibe@fsij.org>
246 * src/openpgp-do.c (rw_kdf): Clear all auth state.
248 * tool/upgrade_by_passwd.py (main): Fix for byte compare.
249 * tool/gnuk_remove_keys_libusb.py (main): Likewise.
251 2018-04-02 NIIBE Yutaka <gniibe@fsij.org>
253 * tool/gnuk_token.py (parse_kdf_data): New.
254 * tool/kdf_calc.py: New.
256 * tool/gnuk_remove_keys_libusb.py (main): Support KDF auth.
257 * tool/upgrade_by_passwd.py (main): Likewise.
259 2018-03-30 NIIBE Yutaka <gniibe@fsij.org>
261 * src/openpgp-do.c (rw_kdf): Support single-salt KDF.
262 (gpg_do_get_initial_pw_setting): Likewise.
263 (gpg_do_kdf_check): Likewise.
265 2018-03-22 NIIBE Yutaka <gniibe@fsij.org>
267 * src/openpgp-do.c (rw_kdf): Do format validation earlier.
269 2018-03-13 NIIBE Yutaka <gniibe@fsij.org>
271 * src/flash.c [FLASH_UPGRADE_SUPPORT] (flash_terminate): Erase
272 the page for upgrade public keys.
274 2018-02-12 NIIBE Yutaka <gniibe@fsij.org>
276 * src/openpgp-do.c (rw_kdf): Return 0 when NULL.
278 2018-01-23 NIIBE Yutaka <gniibe@fsij.org>
282 * src/Makefile (build/gnuk-vidpid.elf): Supply FILE here.
283 * src/configure (output_vendor_product_serial_strings): For
284 generating put-vid-pid-ver.sh, don't set FILE.
286 * regnual/regnual.c (regnual_device_desc): Make this array as a
288 * regnual/Makefile (regnual.elf): Substitute VID:PID.
290 2018-01-22 NIIBE Yutaka <gniibe@fsij.org>
292 * src/openpgp.c (USER_PASSWD_MINLEN): New.
293 (cmd_change_password): Check passphrase length.
295 2018-01-22 NIIBE Yutaka <gniibe@fsij.org>
297 * src/openpgp.c (cmd_change_password): Remove access to private
298 key with BY_ADMIN when it's becoming admin-less mode.
300 2018-01-19 NIIBE Yutaka <gniibe@fsij.org>
302 * src/binary-edit.sh: Copied from NeuG 1.0.8. Exclude FILE.
303 * src/configure (output_vid_pid_version): Generate a shell script.
304 * src/Makefile (build/gnuk-vidpid.elf): New target.
305 * src/usb_desc.c (device_desc): Make this array as a template.
307 * chopstx: Update to 1.8.
309 2018-01-18 NIIBE Yutaka <gniibe@fsij.org>
311 * src/neug.c: Update from NeuG.
313 2018-01-09 NIIBE Yutaka <gniibe@fsij.org>
315 * tests/card_reader.py (CardReader.ccid_power_on): Fix for
316 other card readers for Gemalto's.
318 2017-12-19 NIIBE Yutaka <gniibe@fsij.org>
320 * chopstx: Update to 1.7.
322 2017-11-26 NIIBE Yutaka <gniibe@fsij.org>
324 * src/openpgp.c (cmd_change_password): Bug fix for admin-less
327 2017-11-26 NIIBE Yutaka <gniibe@fsij.org>
331 2017-11-24 NIIBE Yutaka <gniibe@fsij.org>
333 * regnual/regnual.c (calc_crc32): Enable CRC module fix.
335 * chopstx: Update to 1.6.
337 2017-11-17 NIIBE Yutaka <gniibe@fsij.org>
339 * src/stack-def.h (SIZE_0): Decrease.
341 * src/main.c (emit_led, display_status_code, main): Use
342 chopstx_poll instead of eventflag_wait_timeout.
344 2017-11-17 NIIBE Yutaka <gniibe@fsij.org>
346 * src/stack-def.h (SIZE_0): Increase.
348 * src/main.c (emit_led, display_status_code, main): Use
349 eventflag_wait_timeout instead of chopstx_usec_wait.
351 2017-11-17 NIIBE Yutaka <gniibe@fsij.org>
353 * regnual/regnual.c (calc_crc32): Enable CRC module.
355 * src/neug.c (crc32_rv_stop): New.
356 (neug_fini): Call crc32_rv_stop.
358 * src/main.c (main): Call chopstx_conf_idle.
360 * src/usb-ccid.c (usb_event_handle): Use 2 for call of
361 chopstx_conf_idle on suspend. Call random_fini on suspend
362 to stop ADC module. Call random_init on wakeup.
363 Sleep a bit to switch main thread.
365 2017-11-16 NIIBE Yutaka <gniibe@fsij.org>
367 * src/gnuk.h (LED_OFF): New.
369 * src/usb-ccid.c (usb_event_handle): LED off on sleep.
370 (ccid_thread): Use constant pointer for chopstx_poll.
371 (poll_event_intr): Remove.
373 2017-11-15 NIIBE Yutaka <gniibe@fsij.org>
375 * src/usb-ccid.c (usb_event_handle): Allow sleep on suspend.
377 * src/usb_ctrl.c (usb_device_reset): Fix device state.
379 2017-11-14 NIIBE Yutaka <gniibe@fsij.org>
381 * src/usb-ccid.c (ccid_usb_reset): Remove
382 (usb_event_handle): Return value change to notify
383 caller about needs for going out of the loop.
384 Support USB suspend/resume.
385 (ccid_thread): Supporting USB suspend, sleep forever with
388 * src/main.c (main): Add USB_DEVICE_STATE_ prefix.
389 * src/usb_ctrl.c: Likewise.
390 (usb_device_reset): Don't call ccid_usb_reset.
391 (usb_set_configuration, usb_set_interface): Likewise.
393 * src/usb_desc.c (device_desc): bcdUSB = 2.0, supporting
396 2017-11-13 NIIBE Yutaka <gniibe@fsij.org>
398 * src/usb_ctrl.c: Use new const USB_DEVICE_STATE_*
399 * src/main.c (main): Likewise.
400 * src/usb-ccid.c: Likewise.
401 (INTR_REQ_USB): Remove. Use the definition
404 2017-11-08 NIIBE Yutaka <gniibe@fsij.org>
406 * src/openpgp-do.c (gpg_do_kdf_check): New.
407 (proc_resetting_code): Use gpg_do_kdf_check.
408 * src/openpgp.c (cmd_verify, cmd_change_password)
409 (cmd_reset_user_password): Likewise.
411 2017-11-07 NIIBE Yutaka <gniibe@fsij.org>
413 * src/openpgp-do.c (proc_resetting_code): Error when
416 * src/openpgp.c (cmd_verify, cmd_change_password)
417 (cmd_reset_user_password): Avoid authentication error
418 by old GnuPG which doesn't support KDF.
420 2017-11-06 NIIBE Yutaka <gniibe@fsij.org>
422 * tests/test_empty_card.py (test_extended_capabilities): Support
424 * test/features/802_get_data_static.feature: Likewise.
425 * test/features/402_get_data_static.feature: Likewise.
426 * test/features/002_get_data_static.feature: Likewise.
428 2017-11-02 NIIBE Yutaka <gniibe@fsij.org>
430 * src/openpgp-do.c (rw_kdf): Only writable when no keys.
431 (gpg_do_get_initial_pw_setting): New.
432 (gpg_do_write_prvkey): Use gpg_do_get_initial_pw_setting.
433 (gpg_do_keygen): Likewise.
434 (extended_capabilities): Enable KDF-DO available bit.
436 * src/openpgp.c (cmd_change_password): Use
437 gpg_do_get_initial_pw_setting.
438 * src/ac.c (verify_user_0, verify_admin_0): Likewise.
440 2017-11-01 NIIBE Yutaka <gniibe@fsij.org>
442 * src/openpgp-do.c (GPG_DO_KDF): New.
443 (GPG_DO_FEATURE_MNGMNT): New.
444 (do_tag_to_nr): Support GPG_DO_KDF.
445 (GPG_DO_UIF_SIG, GPG_DO_UIF_DEC, GPG_DO_UIF_AUT): New.
447 (gpg_do_table): Add an entry for GPG_DO_KDF.
449 * src/gnuk.h (NR_DO_KDF): New.
451 2017-10-31 NIIBE Yutaka <gniibe@fsij.org>
453 * src/openpgp-do.c (gpg_do_keygen): Bug fix for memory alignment.
455 2017-10-24 NIIBE Yutaka <gniibe@fsij.org>
457 * tests/card_reader.py (CardReader.ccid_power_on): Setting
458 PPS only for Gemalto GemPC reader.
460 2017-10-18 Aurelien Jarno <aurelien@aurel32.net>
462 * src/gnuk.ld.in: Fix keystore_pool size.
464 2017-10-12 Aurelien Jarno <aurelien@aurel32.net>
466 * polarssl/include/polarssl/bn_mul.h (MULADDC_HUIT_DEAD): Rename
468 [__ARM_FEATURE_DSP] (MULADDC_1024_CORE, MULADDC_1024_LOOP)
469 (MULADDC_INIT, MULADDC_CORE, MULADDC_HUIT, MULADDC_STOP): New.
471 * polarssl/library/bignum.c (mpi_montsqr): Check on
472 POLARSSL_HAVE_ASM and __arm__.
473 [__ARM_FEATURE_DSP] (mpi_montsqr): New.
475 (mpi_exp_mod): Use MAX_WSIZE.
477 * src/Makefile (DEFS): Remove BIGNUM_C_IMPLEMENTATION.
479 * src/main.c (HEAP_SIZE): Rename from MEMORY_SIZE.
480 (HEAP_END, HEAP_ALIGNMENT, HEAP_ALIGN): Likewise.
482 * src/stack-def.h (SIZE_3): Depend on MEMORY_SIZE.
483 * src/configure: Emit DEFS with MEMORY_SIZE.
485 2017-10-11 NIIBE Yutaka <gniibe@fsij.org>
489 * regnual/Makefile (LDSCRIPT): Move after include.
490 * regnual/types.h: Add uintptr_t.
492 * test/features/002_get_data_static.feature (data object AID): Fix
493 for any binary value.
494 * 402_get_data_static.feature: Likewise.
495 * 802_get_data_static.feature: Likewise.
497 2017-10-10 NIIBE Yutaka <gniibe@fsij.org>
499 * src/main.c (main): Support --debug option.
500 * chopstx: Update to 1.5.
502 2017-10-06 NIIBE Yutaka <gniibe@fsij.org>
504 * src/configure (flash_override): Fix suggested by Jeremy Drake.
505 (help): STM8S_DISCOVERY is supported again.
507 2017-10-06 NIIBE Yutaka <gniibe@fsij.org>
509 * src/gnuk.ld.in (.stacks): Specify NOLOAD type.
511 * src/configure: Allow not specifying VIDPID.
513 * src/main.c [GNU_LINUX_EMULATION] (main): Handle "--vidpid"
514 option to assign vendor ID and product ID of USB.
516 * src/usb_desc.c [GNU_LINUX_EMULATION] (device_desc): Export.
518 * GNUK_USB_DEVICE_ID (0000:0000): New.
520 2017-10-05 NIIBE Yutaka <gniibe@fsij.org>
522 * src/stack-def.h (SIZE_1, SIZE_3): Tweak the size.
524 * src/call-rsa.c (rsa_genkey): Single step.
525 * src/openpgp-do.c (gpg_do_keygen): Do RSA key generation in single
526 step, using APDU buffer.
527 * src/openpgp.c (cmd_pgp_gakp): Supply the APDU as a buffer.
529 * src/Makefile (install): New target.
531 * src/configure (prefix. exec_prefix, libexecdir): Add.
533 * src/main.c [GNU_LINUX_EMULATION] (main): Option handling.
535 * tool/gnuk-emulation-setup: New.
537 * polarssl/library/bignum.c (M_LIMBS, limbs_M, MAX_A_LIMBS)
538 (limbs_MAX_A, mpi_gen_prime): Fix for 64-bit machine.
540 2017-10-04 NIIBE Yutaka <gniibe@fsij.org>
542 * src/configure (output_vendor_product_serial_strings): Support
545 * polarssl/library/bignum.c (mpi_div_mpi): Fix for 64-bit machine.
547 * src/main.c (gnuk_malloc, gnuk_free): Fix for 64-bit machine.
549 * src/stack-def.h (SIZE_3): Tweak the size.
551 * src/openpgp-do.c (gpg_do_keygen): Do RSA key generation in two
554 * src/call-rsa.c (rsa_genkey_start, rsa_genkey_finish): New.
555 (rsa_genkey): Remove.
557 2017-10-03 NIIBE Yutaka <gniibe@fsij.org>
559 * src/call-ec.c (ecc_compute_public): No use of malloc.
560 * src/call-rsa.c (modulus_calc, rsa_genkey): Likewise.
561 * src/ecc-edwards.c (eddsa_compute_public_25519): Likewise.
562 * src/ecc-mont.c (ecdh_compute_public_25519): Likewise.
563 * src/openpgp-do.c (gpg_do_write_prvkey, gpg_do_chks_prvkey)
564 (proc_key_import, gpg_do_keygen): Likewise.
566 * polarssl/library/rsa.c: Don't include stdlib.h.
567 * src/gnuk-malloc.h: Rename from stdlib.h.
568 * polarssl/library/bignum.c: Include gnuk-malloc.h.
570 * src/Makefile (build/flash.data): Generate.
572 * src/main.c (flash_addr_key_storage_start)
573 (flash_addr_data_storage_start): New.
574 (main): Determine flash address.
576 * src/flash.c (FLASH_ADDR_KEY_STORAGE_START)
577 (FLASH_ADDR_DATA_STORAGE_START): New.
578 (flash_do_storage_init, flash_terminate, flash_activate)
579 (flash_key_storage_init, flash_copying_gc, flash_do_release)
580 (flash_key_getpage): Use new macros.
582 2017-10-02 NIIBE Yutaka <gniibe@fsij.org>
584 * src/main.c (device_initialize_once): Not for GNU/Linux.
586 * src/openpgp.c, src/flash.c: Distinguish FLASH_UPGRADE_SUPPORT.
588 * src/main.c [GNU_LINUX_EMULATION]: Use emulated_main.
589 (MEMORY_SIZE, MEMORY_END): Fix for GNU/Linux.
591 * src/usb-ccid.c (INTR_REQ_USB): Fix for GNU/Linux.
593 * polarssl/library/bignum.c (mpi_montsqr): Easy C implementation.
595 2017-09-30 NIIBE Yutaka <gniibe@fsij.org>
597 * src/flash.c (flash_terminate, flash_activate)
598 (flash_copying_gc, flash_do_write_internal, flash_do_release)
599 (flash_key_write, flash_check_all_other_keys_released)
600 (flash_key_fill_zero_as_released, flash_key_release)
601 (flash_key_release_page, flash_clear_halfword)
602 (flash_put_data_internal, flash_put_data, flash_bool_clear)
603 (flash_bool_write_internal, flash_bool_write)
604 (flash_enum_write_internal, flash_enum_write)
605 (flash_cnt123_write_internal, flash_cnt123_increment)
606 (flash_cnt123_clear, flash_erase_binary, flash_write_binary): Fix
609 * src/usb-ccid.c (ccid_tx_done): Rename from EP1_IN_Callback.
610 (ccid_rx_ready): Rename from EP1_OUT_Callback.
612 2017-09-29 NIIBE Yutaka <gniibe@fsij.org>
614 * src/usb-ccid.c (epo_init, epi_init, ccid_thread): Simplify.
615 (EP1_IN_Callback, ccid_prepare_receive, EP1_OUT_Callback)
616 (usb_rx_ready, ccid_error, ccid_power_on, ccid_send_status)
617 (ccid_send_data_block_internal, ccid_send_data_block_0x9000)
618 (ccid_send_data_block_gr, ccid_send_params)
619 (ccid_notify_slot_change, _write) [GNU_LINUX_EMULATION]: Use
620 different usb driver API.
622 * src/usb_ctrl.c (usb_device_reset): Fix control endpoint init.
623 (gnuk_setup_endpoints_for_interface): Add DEV
625 (usb_device_reset) [GNU_LINUX_EMULATION]: Use usb_lld_setup_endp.
627 2017-09-29 NIIBE Yutaka <gniibe@fsij.org>
629 * src/main.c [FLASH_UPGRADE_SUPPORT] (main): Factor out flash ROM
631 (calculate_regnual_entry_address): Likewise.
632 * src/usb_ctrl.c (usb_setup, download_check_crc32): Likewise.
634 * src/openpgp.c (modify_binary): Fix for 64-bit machine.
635 * src/openpgp-do.c (encrypt, decrypt): Likewise.
636 (gpg_data_scan): Likewise.
637 (gpg_do_chks_prvkey): Fix error return path.
639 * src/stack-def.h: New.
641 * src/gnuk.ld.in: Remove stack definitions.
642 * src/configure: Remove stack size modifications.
644 * src/main.c (STACK_MAIN, STACK_PROCESS_1): Use stack-def.h.
645 * src/usb-ccid.c (STACK_PROCESS_3): Likewise.
646 * src/usb-msc.c (STACK_PROCESS_5): Likewise.
647 * src/pin-cir.c (STACK_PROCESS_6, STACK_PROCESS_7): Likewise.
649 * src/usb_ctrl.c (download_check_crc32): Use chrc32_rv_ functions.
651 * src/mcu-stm32f103.c (rbit, check_crc32): Remove.
653 * src/neug.c: Update from NeuG.
656 2017-09-28 NIIBE Yutaka <gniibe@fsij.org>
658 * src/ec_p256k1.c (coefficient_a): Remove.
660 * polarssl/library/bignum.c (mpi_fill_pseudo_random): Fix for
663 * src/call-rsa.c (rsa_decrypt): Fix for 64-bit machine.
665 * src/flash.c (flash_do_storage_init): Rename from flash_init.
666 (flash_key_storage_init): Rename from flash_init_keys.
667 * src/openpgp.c (gpg_init): Use new function names.
669 * src/stdlib.h: Update for GNU/Linux emulation.
671 * src/Makefile: Support GNU/Linux emulation.
672 * src/configure: Support GNU/Linux emulation.
675 2017-08-11 NIIBE Yutaka <gniibe@fsij.org>
678 * chopstx: Update to 1.4.
680 * src/gnuk.ld.in (__process3_stack_size__): Tweak the size.
682 * src/configure: Define STM32F103_OVERRIDE_FLASH_SIZE_KB for
685 * src/configure: Let generate src/config.mk.
686 * src/Makefile: Rename from src/Makefile.in.
687 * regnual/Makefile: Use src/config.mk.
689 2017-08-03 NIIBE Yutaka <gniibe@fsij.org>
691 * src/openpgp.c (cmd_terminate_df): Fix for admin-less mode.
693 2017-08-03 Jeremy Drake <jeremydrake+gnuk@eacceleration.com>
695 * regnual/regnual.c (main): Allow compile time
696 flash size definition by STM32F103_OVERRIDE_FLASH_SIZE_KB.
698 2017-08-02 Jeremy Drake <jeremydrake+gnuk@eacceleration.com>
700 * src/flash.c (flash_terminate): Erase Certificate DO, too.
702 2017-08-01 NIIBE Yutaka <gniibe@fsij.org>
704 * src/openpgp.c (FILE_CARD_TERMINATED_OPENPGP): Remove.
705 (cmd_select_file): Don't change file_selection.
707 2017-07-19 NIIBE Yutaka <gniibe@fsij.org>
709 * src/mod.c (mod_inv): Clear TMP.
711 * src/configure (REVISION): Generate even when no git.
713 * polarssl/library/bignum.c (mpi_exp_mod): Call mpi_grow for X
714 after the initialization of RR.
716 2017-07-18 NIIBE Yutaka <gniibe@fsij.org>
718 * src/configure: Bark when no git available.
720 2017-07-18 Anthony Romano <anthony.romano@coreos.com>
724 2017-07-18 Anthony Romano <anthony.romano@coreos.com>
726 * src/main.c (MEMORY_SIZE, MEM_HEAD_IS_CORRUPT, MEM_HEAD_CHECK):
728 (gnuk_malloc, gnuk_free): Add calls to MEM_HEAD_CHECK.
730 * src/gnuk.h (FATAL_HEAP): New.
732 2017-07-18 Anthony Romano <anthony.romano@coreos.com>
734 * src/openpgp-do.c (gpg_reset_algo_attr): New.
735 (rw_algorithm_attr): Use gpg_reset_algo_attr.
736 Fix null dereference.
738 2017-07-18 Anthony Romano <anthony.romano@coreos.com>
740 * src/mod.c (mod_reduce): Clean up unused code.
742 2017-07-18 Anthony Romano <anthony.romano@coreos.com>
744 * src/call-rsa.c (modulus_calc): Free modulus on error.
745 (rsa_genkey): Remove bogus check, and call chopstx_cleanup_pop
746 with 1 to release p_q_modulus on error. Assign NULL to clp.arg
747 when it's goes with no error.
749 * src/main.c (gnuk_free): Allow NULL.
751 2017-07-18 NIIBE Yutaka <gniibe@fsij.org>
753 * Update chopstx (with USBIP emulation).
755 2017-05-12 NIIBE Yutaka <gniibe@fsij.org>
759 2017-04-28 NIIBE Yutaka <gniibe@fsij.org>
761 * src/mcu-stm32f103.c: New.
762 (check_crc32, sram_address): New.
764 * src/usb_ctrl.c (download_check_crc32): Use check_crc32 and
767 * src/openpgp-do.c (gpg_write_digital_signature_counter): Fix
768 writing lower 10-bit.
770 2017-04-27 NIIBE Yutaka <gniibe@fsij.org>
772 * src/gnuk.ld.in (_data_pool): Move to the end.
774 * src/flash.c (flash_init): Return address of end of data object.
775 * src/openpgp.c (gpg_init): Get address of end of data object.
776 * src/openpgp-do.c (gpg_data_scan): Check the end address.
778 2017-02-02 NIIBE Yutaka <gniibe@fsij.org>
782 * src/gnuk.ld.in (__process1_stack_size__): Increase by 0x20.
783 * chopstx: Update to 1.3.
784 * src/configure: Add BLUE_PILL in the help message.
786 2017-02-01 NIIBE Yutaka <gniibe@fsij.org>
788 * README: Update README. Thanks to Paul Fertser.
790 2017-01-02 Szczepan Zalega <szczepan@nitrokey.com>
792 * tool/upgrade_by_passwd.py: Add file extention check.
794 2017-02-01 NIIBE Yutaka <gniibe@fsij.org>
796 * tool/upgrade_by_passwd.py (main): More verbose messages
797 suggested by Szczepan Zalega <szczepan@nitrokey.com>.
799 * tool/gnuk_token.py (USB_PRODUCT_LIST): New.
800 (gnuk_devices_by_vidpid): Support searching by USB_PRODUCT_LIST.
801 Thanks to Szczepan Zalega <szczepan@nitrokey.com>.
803 * tool/usb_strings.py: Use gnuk_token.py.
805 2016-10-21 Niibe Yutaka <gniibe@fsij.org>
807 * src/ecc.c (check_secret): Fix condition.
809 2016-10-15 NIIBE Yutaka <gniibe@fsij.org>
813 * tool/gnuk_put_binary_libusb.py (main): Likewise.
814 * tool/upgrade_by_passwd.py (main): Add call of cmd_select_openpgp
817 * src/openpgp.c (gpg_init): flash_init_keys shoule be after
818 gpg_data_scan since flash_init_keys accesses Data Object for
821 * src/usb-ccid.c (ccid_power_on): Don't waste stack.
823 2016-10-14 Niibe Yutaka <gniibe@fsij.org>
825 * src/usb-ccid.c (ccid_power_on) [LIFE_CYCLE_MANAGEMENT_SUPPORT]:
826 Change LCS value in ATR at run time.
828 * src/openpgp.c (gpg_init): Handle FILE_CARD_TERMINATED.
829 (cmd_select_file): Don't return AID.
830 (cmd_activate_file, cmd_terminate_df): New.
831 (process_command_apdu): Let return GPG_NO_RECORD() when
834 * src/openpgp-do.c (gpg_do_terminate): New.
835 (gpg_data_scan): Handle p_start is NULL.
836 (do_hist_bytes): Remove.
838 * src/flash.c (flash_data): Change the value from 0x0000.
839 (flash_init): Support termination state. Fix handling
840 of the boundary case where gen0 is 0xfffe.
841 (flash_terminate, flash_activate): New.
842 (flash_copying_gc): Skip 0xffff for generation number.
844 2016-10-13 Niibe Yutaka <gniibe@fsij.org>
846 * src/status-code.h: Rename from openpgp.h.
848 * chopstx: Update to 1.2.
850 * tests: New test suite for OpenPGP card with PyTest.
852 * src/configure (factory_reset): New.
854 * src/usb-ccid.c (ccid_power_on): Use ATR_head and historical
857 * src/openpgp-do.c (rw_algorithm_attr): Clear fingerprint, timestamp,
858 and possibly ds_counter.
860 2016-10-12 Niibe Yutaka <gniibe@fsij.org>
862 * test/features/steps.py (cmd_reset_retry_counter): Fix.
863 * tool/gnuk_token.py (gnuk_token.cmd_reset_retry_counter): Fix.
864 (gnuk_token.cmd_select_openpgp): Fix P2.
866 2016-09-02 Niibe Yutaka <gniibe@fsij.org>
868 * src/configure (REVISION): Fix the detection of .git.
869 It may be a regular file (if it's created by worktree).
871 2016-08-24 Niibe Yutaka <gniibe@fsij.org>
873 * test/features/steps.py (ini): Use GLC (the global context),
874 instead of FTC (the feature context), so that token only is
877 2016-08-03 Niibe Yutaka <gniibe@fsij.org>
879 * tool/hub_ctrl.py: Port to Python 3.
881 2016-07-11 NIIBE Yutaka <gniibe@fsij.org>
885 * src/usb-ccid.c (ccid_power_on): Fix call of chopstx_create.
886 * src/usb-msc.c (msc_init): Ditto.
887 * src/pin-cir.c (cir_init): Ditto.
888 * src/neug.c (neug_init): Ditto.
889 * src/main.c (main): Ditto.
891 * src/usb-ccid.c (struct ccid): Arrange for smaller footprint.
892 * src/gnuk.h (struct apdu): Likewise.
894 * src/usb-ccid.c (ccid_card_change_signal): Don't touch ccid_state_p.
895 (ccid_state_p): This is constant.
897 * src/configure (output_vendor_product_serial_strings): Add const
900 * src/usb-ccid.c (epo_init, epi_init): Simplify without notify method.
901 (EP1_IN_Callback, EP1_OUT_Callback): Call notify_tx and notify_icc
904 2016-07-09 NIIBE Yutaka <gniibe@fsij.org>
906 * src/openpgp.c (openpgp_card_thread): Don't need to get SELF.
908 2016-07-06 NIIBE Yutaka <gniibe@fsij.org>
910 * src/pin-cir.c (cir_getchar): Use chopstx_poll.
911 * src/usb-ccid.c (usb_tx_done): Fix ifdef condition.
912 * src/usb_ctrl.c (usb_ctrl_write_finish): Fix ifdef nesting.
914 2016-07-04 NIIBE Yutaka <gniibe@fsij.org>
916 * doc/conf.py: Remove 'sphinx.ext.pngmath' and 'sphinx.ext.mathjax'.
917 Reported by Kenji Rikitake.
919 2016-07-01 NIIBE Yutaka <gniibe@fsij.org>
921 * chopstx: Update to 1.1.
922 * src/usb-ccid.c (poll_event_intr, ccid_thread): Follow the
925 2016-06-21 Niibe Yutaka <gniibe@fsij.org>
927 * doc/index.rst: Update documentation by an example
930 2016-06-17 Niibe Yutaka <gniibe@fsij.org>
932 * chopstx: Update to 1.0.
934 2016-06-15 NIIBE Yutaka <gniibe@fsij.org>
936 * src/gnuk.ld.in (__process2_stack_size__): Update
937 thread size for rng by examining NeuG.
939 * src/usb-ccid.c (poll_event_intr): New.
941 2016-06-14 Niibe Yutaka <gniibe@fsij.org>
943 * regnual/regnual.c (usb_device_reset): Rename from
945 (usb_ctrl_write_finish): Rename from usb_cb_ctrl_write_finish.
946 (usb_setup): Rename from usb_cb_setup.
947 (usb_get_descriptor): Rename from usb_cb_get_descriptor.
948 (usb_set_configuration): New.
949 (usb_interrupt_handler): New.
951 * src/usb-ccid.c (usb_tx_done): Rename from usb_cb_tx_done.
952 (usb_rx_ready): Rename from usb_cb_rx_ready.
953 (usb_event_handle): New.
954 (ccid_thread): Use usb_event_handle.
956 * src/usb-msc.c (EP6_IN_Callback): Update to new USB API.
957 (EP6_OUT_Callback): Likewise.
959 * src/usb_ctrl.c (usb_device_reset): Rename from
961 (vcom_port_data_setup): Update to new USB API.
962 (usb_ctrl_write_finish): Rename from usb_cb_ctrl_write_finish.
963 (usb_setup): Rename from usb_cb_setup.
964 (usb_set_configuration): New, based on usb_cb_handle_event.
965 (usb_set_interface): Rename from usb_cb_interface.
966 (usb_get_interface): New.
967 (usb_get_status_interface): New.
969 * src/usb_desc.c (usb_get_descriptor): Rename from
970 usb_cb_get_descriptor.
972 2016-06-02 Niibe Yutaka <gniibe@fsij.org>
974 * regnual/regnual.c (usb_cb_tx_done): Follow the change of USB
977 * regnual/reset.c: Rename from sys.c.
979 2016-06-01 Niibe Yutaka <gniibe@fsij.org>
981 * tool/stlinkv2.py (stlinkv2.__init__): Don't
982 call setConfiguration.
984 * tool/gnuk_token.py (gnuk_token, regnual): Don't
985 call setAltInterface, it's not needed.
987 * src/usb-ccid.c (ccid_notify_slot_change): New.
988 (ccid_thread): Call ccid_notify_slot_change at
989 interface_reset and EV_CARD_CHANGE.
991 2016-05-31 NIIBE Yutaka <gniibe@fsij.org>
993 * src/usb_stm32f103.c, src/stm32f103.h: Remove.
994 * src/adc_stm32f103.c, src/sys.c: Remove.
996 * src/usb_ctrl.c (usb_cb_interface): call ccid_usb_reset.
997 (usb_cb_handle_event): Likewise.
999 * src/usb-ccid.c (ccid_thread): Handle RESET->CONFIGURE process
1001 (ccid_thread): Handle SET_INTERFACE correctly.
1003 * polarssl/library/aes.c (FT0, FT1, FT2): Add "weak" flag.
1005 * src/neug.c: Update from NeuG.
1007 * src/usb_desc.c (usb_cb_get_descriptor): Only valid if USE_SYS3.
1009 * src/Makefile.in (USE_SYS, USE_USB, USE_ADC): Enabled.
1012 * src/sys.c, src/sys.h: Remove.
1013 * src/usb_stm32f103.c, src/usb_lld.h: Remove.
1014 * src/adc_stm32f103.c, src/adc.h: Remove.
1016 * chopstx: Update to 0.12.
1018 2016-05-21 Niibe Yutaka <gniibe@fsij.org>
1020 * src/main.c (led_blink, main): Fix LED blink protocol.
1022 2016-05-20 NIIBE Yutaka <gniibe@fsij.org>
1025 * src/usb-ccid.c (ccid_thread): Fix timeout.
1026 (icc_handle_timeout, icc_send_status): Tweak.
1028 2016-05-19 Niibe Yutaka <gniibe@fsij.org>
1030 * src/usb_ctrl.c (usb_cb_ctrl_write_finish): Set bDeviceState.
1032 * src/usb-ccid.c: Rename from usb-icc.c.
1033 (ccid_thread): Handle reGNUal upgrade.
1035 * src/Makefile.in (CSRC): Follow the change.
1037 * chopstx: Update to 0.11.
1039 2016-05-18 Niibe Yutaka <gniibe@fsij.org>
1041 * src/gnuk.ld.in: Tweak thread size.
1042 * src/main.c (main): Use chopstx_setpriority.
1043 * src/usb-icc.c (ccid_init): Use new eventflag API.
1045 * regnual/regnual.c (nvic_enable_intr): New.
1046 (main): Call nvic_enable_intr.
1050 2016-05-16 Niibe Yutaka <gniibe@fsij.org>
1052 * regnual/regnual.c (usb_cb_rx_ready, usb_cb_tx_done)
1053 (usb_cb_device_reset): Follow the change of USB API.
1056 * src/sys.c: Update from Chopstx.
1058 2016-05-13 Niibe Yutaka <gniibe@fsij.org>
1060 * src/neug.c (rng): Call chopstx_claim_irq before adc_start.
1061 Remove call of chopstx_release_irq.
1063 2016-05-12 Niibe Yutaka <gniibe@fsij.org>
1066 * src/sys.c: Update from Chopstx.
1067 * src/usb_lld.h: Likewise.
1068 * src/usb_stm32f103.c: Likewise.
1070 * src/usb_ctrl.c (usb_intr): Follow the change of USB API.
1071 (usb_cb_rx_ready, usb_cb_tx_done): Likewise.
1073 * src/adc.h: Remove unused declarations.
1075 2016-03-08 Niibe Yutaka <gniibe@fsij.org>
1077 * tool/gnuk_token.py (gnuk_token.__init__, regnual.__init__):
1078 Don't call setConfiguration method.
1080 * src/usb_lld.h (usb_cb_ctrl_write_finish): Change the API of
1081 callback, which possibly needs INDEX, VALUE, and LEN parameters.
1082 (usb_lld_set_data_to_recv): Fix the type of P.
1083 (USB_DEVICE_DESCRIPTOR_TYPE, USB_CONFIGURATION_DESCRIPTOR_TYPE)
1084 (USB_STRING_DESCRIPTOR_TYPE, USB_INTERFACE_DESCRIPTOR_TYPE)
1085 (USB_ENDPOINT_DESCRIPTOR_TYPE): Remove, as we have the enumeration
1086 values for same things.
1088 * src/usb_stm32f103.c (handle_in0): Follow the change.
1089 * src/usb_ctrl.c (usb_cb_ctrl_write_finish): Likewise.
1091 * src/usb_desc.c (usb_cb_get_descriptor): Use HID_INTERFACE.
1092 (device_desc, config_desc, string_descriptors)
1093 (usb_cb_get_descriptor): Use the enumeration types.
1094 * src/configure: Use the enumeration types.
1096 * regnual/regnual.c: Follow the change of usb_lld.h.
1098 2016-02-09 Niibe Yutaka <gniibe@fsij.org>
1100 * src/openpgp.c (cmd_verify): Support VERIFY reset, which is
1101 described in the specification V2.2 and V3.1.
1103 * polarssl/library/bignum.c (mpi_exp_mod): Fix to our local
1104 change. Thanks to Aidan Thornton for the failure test case.
1106 Fix of mpi_div_mpi from upstream.
1107 * polarssl/library/bignum.c (int_clz, int_div_int): New.
1108 (mpi_div_mpi): Use int_div_int.
1110 2016-02-09 Niibe Yutaka <gniibe@fsij.org>
1112 * src/openpgp.c (s2k): Include the unique ID of MCU into the
1113 computation of S2K function.
1115 2016-02-08 Niibe Yutaka <gniibe@fsij.org>
1117 * src/modp256r1.c (modp256r1_add, modp256r1_sub): Keep the result
1119 (modp256r1_reduce): Fix wrong calculation.
1120 * src/modp256k1.c (modp256k1_add, modp256k1_sub): Likewise.
1121 Thanks to Aidan Thornton.
1123 2016-02-05 Niibe Yutaka <gniibe@fsij.org>
1125 * src/configure: Add submodule check suggested by Elliott
1128 2015-11-30 perillamint <perillamint@gentoo.moe>
1130 * src/openpgp.c (card_thread): Fix offset of bConfirmPIN.
1132 2015-09-18 Niibe Yutaka <gniibe@fsij.org>
1136 * src/openpgp-do.c (proc_key_import): Fix error return.
1137 (rw_algorithm_attr): Check it's not ALGO_RSA2K.
1139 2015-09-17 Niibe Yutaka <gniibe@fsij.org>
1143 2015-09-15 Niibe Yutaka <gniibe@fsij.org>
1145 * chopstx: Update to 0.10.
1147 * src/main.c (main): Don't join after calling ccid_usb_reset.
1148 * src/usb-icc.c (ccid_thread): Don't finish on reset, but
1151 * src/usb_ctrl.c (usb_cb_device_reset): Stop the interface.
1153 * src/usb_stm32f103.c (std_set_interface): Bug fix for conf.
1155 * src/gnuk.ld.in (__process3_stack_size__): Increase stack size of
1157 (__process2_stack_size__): Increase stack size of RNG.
1158 (__process4_stack_size__): Increase stack size of USB.
1159 (__main_stack_size__): Decrease stack size of exception handlers.
1160 (__process1_stack_size__): Decrease stack size of CCID.
1162 2015-09-14 Niibe Yutaka <gniibe@fsij.org>
1164 * src/gnuk.h (LED_GNUK_EXEC): New.
1165 * src/main.c, src/usb-icc.c, src/usb_ctrl.c: icc_state_p access
1168 2015-09-11 Niibe Yutaka <gniibe@fsij.org>
1170 * tool/upgrade_by_passwd.py (main): Loop until finding reGNUal
1173 2015-09-10 Niibe Yutaka <gniibe@fsij.org>
1175 * src/call-rsa.c (rsa_cleanup): New.
1176 (rsa_sign, rsa_decrypt, rsa_genkey): Allow cancellation.
1177 * src/openpgp.c (cmd_pso, cmd_internal_authenticate): Cancellation
1178 is handled by each functions in case of RSA.
1180 2015-09-09 Niibe Yutaka <gniibe@fsij.org>
1182 * src/sys.h: Update from Chopstx.
1183 * src/adc_stm32f103.c: Update from NeuG.
1185 * src/openpgp.c (process_command_apdu): Protect command execution
1186 against cancelling the execution thread.
1187 (cmd_pso, cmd_internal_authenticate): Allow cancellation.
1189 * src/main.c (main): Handle LED_USB_RESET.
1191 * src/usb-icc.c (ccid_usb_reset): New.
1192 (ccid_thread): Upon receival of EV_USB_RESET, finish
1193 the thread, canceling the card thread.
1195 2015-09-08 Niibe Yutaka <gniibe@fsij.org>
1197 * src/gnuk.h (EV_USB_RESET, LED_USB_RESET): New.
1199 * src/usb_ctrl.c (CDC_CTRL_DTR): New.
1200 (vcom_port_data_setup): Distinguish detail->value for DTR.
1202 * src/configure (help): Add ST_DONGLE and ST_NUCLEO_F103.
1204 2015-09-04 Niibe Yutaka <gniibe@fsij.org>
1206 * src/openpgp-do.c (do_openpgpcard_aid): Use upper bytes of unique
1207 ID of MCU; same as USB serial number.
1209 * src/configure (help): Add NITROKEY_START.
1211 2015-08-26 Mateusz Zalega <mateusz@nitrokey.com>
1213 * GNUK_USB_DEVICE_ID: Add Nitrokey Start.
1215 2015-08-05 Niibe Yutaka <gniibe@fsij.org>
1219 2015-08-04 Niibe Yutaka <gniibe@fsij.org>
1221 * src/adc_stm32f103.c: Update from NeuG 1.0.3.
1223 * chopstx: Update to 0.08.
1224 * src/sys.h: Update.
1226 2015-08-03 Niibe Yutaka <gniibe@fsij.org>
1228 * test/features/steps.py (set_msg): Python3 fix.
1229 * test/generate_keys.py: Likewise.
1230 * test/rsa_keys.py: Likewise.
1232 * tool/gnuk_token.py (gnuk_token.download, gnuk_token.execute)
1233 (regnual.download): Python3 fix.
1234 (list_to_string): Remove.
1236 * tool/upgrade_by_passwd.py (maian): Python3 fix.
1237 * tool/usb_strings.py (main): Python3 fix.
1239 2015-07-31 Niibe Yutaka <gniibe@fsij.org>
1241 * src/configure (output_vendor_product_serial_strings): Fix sed
1242 script when string is short. Remove empty line.
1244 * regnual/regnual.c (usb_cb_ctrl_write_finish, usb_cb_setup)
1245 (usb_cb_get_descriptor, usb_cb_interface): Follow the change
1248 * tool/stlinkv2.py: Support ST-Link/V2-1.
1250 2015-07-28 Niibe Yutaka <gniibe@fsij.org>
1252 * tool/stlinkv2.py: Fix for Python3. Thanks to Bertrand Jacquin.
1254 * tool/gpg_agent.py: Fix for Python3.
1256 * src/usb-msc.c: Update from Fraucheky.
1258 * src/usb_stm32f103.c (struct DATA_INFO): Remove offset.
1259 (struct DEVICE_INFO): Integrate CONTROL_INFO.
1261 2015-07-27 Niibe Yutaka <gniibe@fsij.org>
1263 * src/usb_stm32f103.c (usb_lld_reply_request): New.
1264 (usb_lld_set_data_to_send): Remove.
1265 (usb_lld_set_data_to_recv): Not a macro but a function.
1266 (std_get_status): Don't use statically allocated memory.
1267 (std_get_configuration): Use usb_lld_reply_request.
1268 (handle_setup0): Follow the change.
1269 * src/usb_ctrl.c (vcom_port_data_setup, usb_cb_setup)
1270 (usb_cb_interface): Use usb_lld_reply_request.
1271 * src/usb_desc.c (usb_cb_get_descriptor): Likewise.
1273 2015-07-24 Niibe Yutaka <gniibe@fsij.org>
1275 * tool/gnuk_put_binary.py: Remove.
1276 * tool/gnuk_remove_keys.py: Remove.
1278 2015-07-23 Niibe Yutaka <gniibe@fsij.org>
1280 * src/configure (nl): New. Follow the change of NeuG.
1282 2015-07-21 Niibe Yutaka <gniibe@fsij.org>
1286 2015-07-20 Niibe Yutaka <gniibe@fsij.org>
1288 * src/openpgp-do.c (gpg_do_keygen): Support ECC.
1289 * src/call-ec.c (ecc_check_secret): New.
1290 * src/ecc.c (check_secret): New.
1292 2015-07-18 Niibe Yutaka <gniibe@fsij.org>
1294 * src/configure (keygen): It's always enabled.
1295 * src/openpgp-do.c (gpg_do_keygen): Support key generation.
1296 * src/openpgp.c (cmd_pgp_gakp): Likewise.
1297 * src/call-rsa.c (rsa_genkey): Likewise.
1298 * src/random.c (random_gen): Likewise.
1299 * src/Makefile.in (KEYGEN_SUPPORT): Remove.
1300 * polarssl/include/polarssl/config.h (POLARSSL_GENPRIME): Define.
1302 2015-07-16 Niibe Yutaka <gniibe@fsij.org>
1304 * src/configure (FLASH_PAGE_SIZE, FLASH_SIZE, MEMORY_SIZE)
1305 [sys1_compat]: Use safe values for common binary.
1306 (TARGET_DEFINE): Remove.
1308 2015-07-15 Niibe Yutaka <gniibe@fsij.org>
1310 * tool/usb_strings.py (field): Add 'Board'.
1312 * regnual/regnual.c (usb_cb_get_descriptor): Update.
1313 * src/usb_ctrl.c (usb_cb_interface): Call usb_lld_write.
1314 * src/usb_desc.c (usb_cb_get_descriptor): Support sys_board_name,
1315 using usb_lld_write.
1316 * src/usb_lld.h (usb_cb_get_descriptor): Add last argument length
1318 * src/usb_stm32f103.c (handle_setup0): Allow setup callback to
1319 call usb_lld_write with ENDP0.
1320 * src/usb_conf.h (NUM_STRING_DESC): Remove.
1322 * src/configure [!sys1_compat] (CONFIG): Don't include target
1325 * src/flash.c: Detect flash_page_size at runtime.
1327 * src/main.c: Remove dependency to board.h.
1329 * src/neug.c: Update from NeuG 1.0.2.
1330 * src/adc_stm32f103.c: Update.
1332 * chopstx: Update to 0.07.
1333 * src/sys.c: Update.
1334 * src/sys.h: Update.
1335 * src/gnuk.ld.in: Update.
1337 * tool/stlinkv2.py (stlinkv2.get_chip_id): New. Detect flash
1339 (main): Call stlinkv2.get_chip_id after MCU reset and stop.
1340 Verify read out fix.
1342 2015-07-11 Niibe Yutaka <gniibe@fsij.org>
1344 * src/configure (help): Add STM32_PRIMER2 and CQ_STARM.
1346 * chopstx: Update to 0.06.
1348 * tool/stlinkv2.py: Support 512kB version of STM32F103.
1349 The size of executable file should be even.
1351 2015-07-07 Niibe Yutaka <gniibe@fsij.org>
1353 * src/Makefile.in (CSRC): Add ecc-mont.c.
1355 * src/ecc-mont.c (mod25638_mul_121665): Fix.
1356 (ecdh_compute_public_25519, ecdh_decrypt_curve25519): New.
1358 * src/openpgp.c (cmd_pso): Support ALGO_CURVE25519.
1360 * src/openpgp-do.c (algorithm_attr_cv25519): New.
1361 (rw_algorithm_attr, get_algo_attr_data_object)
1362 (gpg_get_algo_attr_key_size, gpg_do_write_prvkey)
1363 (proc_key_import, gpg_do_public_key): Support ALGO_CURVE25519.
1365 * src/gnuk.h (ALGO_CURVE25519): New.
1367 2015-07-06 Niibe Yutaka <gniibe@fsij.org>
1369 Enhancement for FSM-55.
1370 * tool/stlinkv2.py (stlinkv2.control_nrst): New.
1371 (stlinkv2.get_rdp_key,has_spi_flash,has_protection): New.
1372 (stlinkv2.get_core_id): Rename.
1373 (stlinkv2.blank_check): Use self.flash_size.
1374 (stlinkv2.start): Call control_nrst. Call get_core_id.
1375 Distinguishing chip, and set rdp_key, flash_size and require_nrst.
1376 (stlinkv2.flash_write): Use self.flash_block_size.
1377 (main): Call control_nrst.
1378 (prog_flash_write_body, prog_option_bytes_write_body)
1379 (prog_blank_check_body): Support Cortex-M0.
1380 (main): Call API V2 halt twice.
1381 * tool/asm-thumb/*.S: Updated for Cortex-M0.
1383 2015-06-30 Niibe Yutaka <gniibe@fsij.org>
1385 * src/sys.c: Update from chopstx/example-cdc/sys.c.
1387 * src/main.c (device_initialize_once): Apply change of NeuG.
1389 2015-06-03 Niibe Yutaka <gniibe@fsij.org>
1393 * test/ecc_nistp256_keys.py: New.
1395 * tool/upgrade_by_passwd.py: Remove -p option and add -f option.
1397 * tool/gnuk_token.py (gnuk_token.download): Add verbose flag.
1398 (regnual.download): Ditto.
1400 * tool/gnuk_upgrade.py: Use gnuk_token module.
1402 2015-06-02 Niibe Yutaka <gniibe@fsij.org>
1404 * src/openpgp.c (cmd_pso): Support OpenPGPcard spec v3.0.
1406 2015-04-20 Niibe Yutaka <gniibe@fsij.org>
1408 * chopstx: Upgrade to 0.05.
1410 2015-04-19 Niibe Yutaka <gniibe@fsij.org>
1412 * src/gnuk.h (CCID_CARD_INIT): New.
1413 * src/usb_desc.c (gnukConfigDescriptor): Update dwDefaultClock,
1414 dwMaximumClock, dwFeatures, and bClassEnvelope.
1415 * src/usb_ctrl.c (freq_table): Change the value to 4000MHz.
1416 (usb_cb_handle_event): Call ccid_card_change_signal after configure.
1417 * src/usb-icc.c (ccid_thread): Change EV_CARD_CHANGE handling.
1419 2015-04-18 Niibe Yutaka <gniibe@fsij.org>
1421 * src/main.c (main): Call chopstx_main_init.
1422 * src/Makefile.in (DEFS): Remove CHX_PRIO_MAIN.
1424 2015-04-17 Niibe Yutaka <gniibe@fsij.org>
1426 * src/configure: Fix shell syntax.
1428 2015-03-31 Niibe Yutaka <gniibe@fsij.org>
1430 * src/usb_conf.h (ICC_NUM_INTERFACES, HID_NUM_INTERFACES)
1431 (HID_NUM_INTERFACES, VCOM_NUM_INTERFACES, MSC_NUM_INTERFACES)
1432 (NUM_INTERFACES): Define here (moved from usb_desc.c).
1433 (ICC_INTERFACE, HID_INTERFACE, VCOM_INTERFACE_0, VCOM_INTERFACE_1)
1434 (MSC_INTERFACE): New.
1435 * src/usb_ctrl.c (gnuk_setup_endpoints_for_interface)
1436 (usb_cb_setup, usb_cb_ctrl_write_finish): Use *_INTERFACE.
1437 * src/usb_desc.c (gnukConfigDescriptor): Likewise.
1439 2015-03-06 Niibe Yutaka <gniibe@fsij.org>
1441 * src/ecc-edwards.c (eddsa_sign_25519): Return 0.
1443 2015-02-25 Niibe Yutaka <gniibe@fsij.org>
1445 * src/openpgp.c (cmd_internal_authenticate): Fix storing to
1448 2015-02-10 Niibe Yutaka <gniibe@fsij.org>
1450 * src/openpgp.c (cmd_pso): Fix counter update for EdDSA. Thanks
1451 to Jonathan Schleifer.
1453 * src/call-rsa.c (rsa_sign): Don't set res_APDU_len.
1454 (rsa_decrypt): Likewise, but get OUTPUT_LEN_P as an argument.
1456 2015-02-09 Niibe Yutaka <gniibe@fsij.org>
1458 * src/openpgp.c (cmd_pso): Fix EdDSA. Use GPG_KEY_FOR_SIGNING.
1460 2014-12-15 Niibe Yutaka <gniibe@fsij.org>
1464 2014-12-13 Niibe Yutaka <gniibe@fsij.org>
1466 * src/flash.c (flash_key_getpage, flash_key_release_page): New.
1468 * src/openpgp-do.c (gpg_do_delete_prvkey): New arg.
1469 (rw_algorithm_attr): Call gpg_do_delete_prvkey with CLEAN_PAGE_FULL.
1471 2014-12-12 Niibe Yutaka <gniibe@fsij.org>
1473 * src/Makefile.in (build/bignum.o): Specific OPT for this target.
1475 * src/configure (target): Default is FST-01.
1476 (--with-dfu): FST-01 doesn't have DFU. If set, it must be
1479 * boards/STBEE_MINI: Remove, since it is now supported by Chopstx.
1481 * test/features/802_get_data_static.feature: Reflect the change
1482 of extended capabilities.
1483 * test/features/402_get_data_static.feature: Ditto.
1484 * test/features/002_get_data_static.feature: Ditto.
1486 * test/features/003_keyattr_change.feature: New test.
1488 * src/usb_lld.h: Don't use 'extern' for function declarations.
1489 * src/usb-icc.c (end_cmd_apdu_data): Fix Le handling.
1491 2014-12-11 Niibe Yutaka <gniibe@fsij.org>
1493 * chopstx: Upgrade to 0.04.
1494 * src/syc.c: Update from 0.04.
1496 2014-12-10 Niibe Yutaka <gniibe@fsij.org>
1498 * src/ecc-cdh.c: Remove as smartcard only does
1499 a part of ECDH computation as gpg-agent does.
1501 * src/chconf.h, src/halconf.h: Remove files needed for ChibiOS/RT.
1503 2014-12-09 Niibe Yutaka <gniibe@fsij.org>
1505 * src/call-ec.c (ecc_compute_public): Rename, as we share
1506 same routine among ECDSA and ECDH.
1507 (ecdh_decrypt): New.
1509 2014-12-09 Niibe Yutaka <gniibe@fsij.org>
1511 * src/ecc.c (compute_kP): Bug fix. It's P, not G.
1512 (point_is_on_the_curve): Bug fix.
1514 2014-12-03 Niibe Yutaka <gniibe@fsij.org>
1516 Changes for RSA-4096.
1518 * src/gnuk.h (MAX_CMD_APDU_DATA_SIZE, MAX_RES_APDU_DATA_SIZE):
1519 Send/Recv buffer should be bigger.
1520 * polarssl/library/bignum.c (mpi_exp_mod): Don't consume much.
1521 * polarssl/library/rsa.c (rsa_rsaes_pkcs1_v15_decrypt): buffer
1522 allocation size should be variable.
1524 2014-12-01 Niibe Yutaka <gniibe@fsij.org>
1526 * src/Makefile.in (DEFS): Don't define compile time preference of
1527 key algo attributes.
1529 * src/openpgp-do.c (proc_key_import): Support modifiable key algo
1532 2014-11-21 Niibe Yutaka <gniibe@fsij.org>
1534 * src/gnuk.h (ALGO_RSA4K, ALGO_NISTP256R1, ALGO_SECP256K1)
1535 (ALGO_ED25519, ALGO_RSA2K): New.
1536 (struct key_data_internal): Move to ...
1537 * src/openpgp-do.c (struct key_data_internal): ... here.
1538 (CHECKSUM_ADDR, kdi_len): New.
1539 (CKDC_CALC, CKDC_CHECK): New.
1540 (compute_key_data_checksum): Add arg PRVKEY_LEN.
1541 (gpg_do_load_prvkey, gpg_do_delete_prvkey): Support modifiable key
1543 (gpg_do_write_prvkey, gpg_do_public_key, gpg_do_keygen): Likewise.
1544 (gpg_do_clear_prvkey): Use MAX_PRVKEY_LEN.
1546 * src/openpgp.c (gpg_init): Call flash_init_keys after
1548 (cmd_pso): Support modifiable key algo attributes.
1549 (cmd_internal_authenticate): Likewise.
1551 2014-11-21 Niibe Yutaka <gniibe@fsij.org>
1553 * src/openpgp-do.c (algorithm_attr_rsa2k): Rename from *_rsa.
1554 (algorithm_attr_rsa4k): New.
1555 (get_algo_attr_pointer, kk_to_nr, gpg_get_algo_attr)
1556 (get_algo_attr_data_object, gpg_get_algo_attr_key_size): New.
1557 (rw_algorithm_attr): New.
1558 (gpg_do_table): Register rw_algorithm_attr for GPG_DO_ALG_*.
1559 (gpg_data_scan, gpg_data_copy): Handle algo attributes.
1561 (rw_pw_status): Fix checking against redundant write.
1563 2014-11-20 Niibe Yutaka <gniibe@fsij.org>
1565 * src/openpgp-do.c (extended_capabilities): Key attributes can be
1568 2014-11-20 Niibe Yutaka <gniibe@fsij.org>
1570 * src/gnuk.h (NR_NONE, NR_DO__FIRST__): Remove.
1571 (NR_DO_*): Redefine.
1572 (NR_KEY_ALGO_ATTR_SIG, NR_KEY_ALGO_ATTR_DEC)
1573 (NR_KEY_ALGO_ATTR_AUT): New.
1575 * src/openpgp-do.c (gpg_do_load_prvkey, gpg_do_delete_prvkey)
1576 (gpg_do_write_prvkey, gpg_do_chks_prvkey, gpg_data_scan)
1577 (gpg_data_copy, gpg_do_read_simple)
1578 (gpg_do_write_simple): Don't use NR_DO__FIRST__.
1579 (gpg_do_put_data): Don't use NR_NONE any more.
1580 (do_tag_to_nr): Use -1 to specify NONE.
1582 * src/flash.c (flash_enum_clear, flash_enum_write_internal)
1583 (flash_enum_write): New.
1585 2014-11-19 Niibe Yutaka <gniibe@fsij.org>
1587 * src/gnuk.h (FIRMWARE_UPDATE_KEY_CONTENT_LEN): New.
1588 (size_of_key): New enum.
1590 * src/openpgp.c (gpg_get_firmware_update_key)
1591 (cmd_read_binary, cmd_external_authenticate): Use
1592 FIRMWARE_UPDATE_KEY_CONTENT_LEN.
1594 * src/flash.c (KEY_SIZE): Remove.
1595 (key_available_at): Add new arg as KEY_SIZE.
1596 (flash_check_all_other_keys_released): Likewise.
1597 (flash_key_fill_zero_as_released, flash_key_release): Likewise.
1599 (flash_init): Move initializing keys into another function.
1600 (flash_init_keys): New function.
1602 (flash_key_alloc): Use gpg_get_algo_attr_key_size.
1603 (flash_key_write): Add new arg as KEY_DATA_LEN.
1605 (flash_write_binary): Use FIRMWARE_UPDATE_KEY_CONTENT_LEN.
1607 2014-09-16 Niibe Yutaka <gniibe@fsij.org>
1609 * src/gnuk.h (MAX_PRVKEY_LEN): New.
1610 (KEY_CONTENT_LEN): Remove.
1612 * src/call-rsa.c (RSA_SIGNATURE_LENGTH): Remove.
1613 (rsa_sign, rsa_verify, rsa_genkey): Add new arg: PUBKEY_LEN.
1614 (rsa_decrypt): Don't use KEY_CONTENT_LEN.
1616 2014-06-19 Niibe Yutaka <gniibe@fsij.org>
1618 * src/ecc-mont.c (compute_nQ): Add comment.
1620 * src/mod.c (mod_inv): Fix comment. X^-1 = 0 when X=0
1621 is important for Montgomery curve computation.
1623 2014-06-05 Niibe Yutaka <gniibe@fsij.org>
1625 * tool/add_openpgp_authkey_from_gpgssh.py: New.
1627 2014-04-17 Niibe Yutaka <gniibe@fsij.org>
1629 * src/muladd_256.h (MULADD_256_ASM): New.
1630 (MULADD_256): Use MULADD_256_ASM.
1631 * src/ecc-mont.c (mod25638_mul_121665): Add asm implementation.
1633 * src/bn.c (bn256_add_uint, bn256_sub_uint): Simplify.
1634 * src/mod25638.c (mod25638_add, mod25638_sub): Simplify.
1635 (n25638, add19): Remove.
1636 (ADDWORD_256): Add s_ as source pointer.
1637 (mod25519_reduce): Remove a call to memcpy. Use bn256_add_uint.
1638 * src/ecc-edwards.c (point_double): Simplify.
1640 2014-04-16 Niibe Yutaka <gniibe@fsij.org>
1644 2014-04-15 Niibe Yutaka <gniibe@fsij.org>
1646 * src/ecc-mont.c: New.
1648 * src/mod25638.c (p25519): Move from ecc-edwards.c.
1649 (mod25519_reduce, add19): Likewise.
1650 (mod25638_reduce) [!ASM_IMPLEMENTATION]: Use bn256_add_uint.
1652 2014-04-14 Niibe Yutaka <gniibe@fsij.org>
1654 * src/jpc.c (jpc_to_ac): Error check before mod_inv.
1656 * src/mod.c (mod_inv): No return value (if N==0 returns ZERO).
1658 * src/bn.c [BN256_NO_RANDOM]: Only include "random.h" if needed.
1660 2014-04-08 Niibe Yutaka <gniibe@fsij.org>
1662 * src/mod.c (mod_inv): Use MAX_GCD_STEPS_BN256.
1663 Return failure or success.
1664 * src/jpc.c (jpc_to_ac): Use mod_inv.
1665 * src/modp256k1.c (modp256k1_inv): Remove.
1666 * src/modp256r1.c (modp256r1_inv): Remove.
1668 2014-04-07 Niibe Yutaka <gniibe@fsij.org>
1670 * src/openpgp-do.c (algorithm_attr_ed25519): It's OID only.
1672 2014-04-03 Niibe Yutaka <gniibe@fsij.org>
1674 * src/ecc-edwards.c (eddsa_sign_25519): Change type of OUT.
1675 * src/openpgp.c (cmd_internal_authenticate): Have a buffer.
1677 * src/flash.c (flash_init): Fix key address finder.
1679 2014-04-02 Niibe Yutaka <gniibe@fsij.org>
1681 * src/openpgp-do.c (proc_key_import): Handle EdDSA.
1682 (algorithm_attr_ed25519): Fix OID and add ID for SHA512.
1684 2014-04-01 Niibe Yutaka <gniibe@fsij.org>
1686 * src/ecc-edwards.c (eddsa_compute_public_25519): New.
1688 * src/openpgp-do.c (algorithm_attr_ed25519): New.
1689 (gpg_do_write_prvkey, proc_key_import, gpg_do_public_key): Add
1692 2014-03-31 Niibe Yutaka <gniibe@fsij.org>
1694 * src/ecc-edwards.c (eddsa_sign_25519): Rename and API change.
1696 * src/openpgp-do.c (gpg_do_load_prvkey, gpg_do_delete_prvkey)
1697 (gpg_do_write_prvkey, gpg_do_public_key, gpg_do_keygen): Follow
1698 the change of PRVKEY_DATA and KEY_DATA.
1700 * src/flash.c (key_available_at): New.
1701 (flash_init): Initilize KD.
1703 * src/gnuk.h (struct prvkey_data): Remove member KEY_ADDR.
1704 (struct key_data): Addd member KEY_ADDR.
1706 * src/openpgp-do.c (gpg_do_keygen): Bug fix. Reset the signature
1707 counter when new key is generated.
1709 * src/flash.c (flash_key_alloc): Change API, supply KK.
1711 2014-03-29 Niibe Yutaka <gniibe@fsij.org>
1713 * src/ecc-edwards.c (point_double, point_add): Rename.
1714 (mod25519_reduce): New.
1716 2014-03-28 Niibe Yutaka <gniibe@fsij.org>
1718 * misc/t-eddsa.c (main): Update for new API of eddsa_25519.
1720 * src/ecc-edwards.c (compute_kG_25519): Tune for 252-bit.
1721 (eddsa_25519): Public key should be provided by caller.
1722 (eddsa_public_key_25519): New.
1724 2014-03-27 Niibe Yutaka <gniibe@fsij.org>
1726 * src/ecc-edwards.c (ed_add_25638): Remove the third argument.
1727 (compute_kG_25519): The curve is complete, we don't need to avoid
1728 identity element as NIST curve or secp256k1 curve.
1729 (eddsa_25519): Change the API, with A and the seed.
1731 2014-03-26 Niibe Yutaka <gniibe@fsij.org>
1733 * src/mod25638.c (mod25638_reduce): New.
1734 (mod25638_mul, mod25638_sqr): Use mod25638_reduce.
1736 * src/ecc-edwards.c (ptc_to_ac_25519): No need to subtract p25519.
1738 2014-03-25 Niibe Yutaka <gniibe@fsij.org>
1740 * misc/t-eddsa.c: New.
1742 * src/ecc-edwards.c (bnX_mul_C, mod_reduce_M): New.
1745 2014-03-20 Niibe Yutaka <gniibe@fsij.org>
1747 * src/ecc-edwards.c (ed_add_25638): Fix for X == A.
1748 (main): Compute pre-computed tables.
1749 (precomputed_KG, precomputed_2E_KG): Add.
1750 (compute_kG_25519): New.
1752 2014-03-19 Niibe Yutaka <gniibe@fsij.org>
1754 * src/bn.c (bn256_add): Fix for X == B.
1755 (bn256_sub): Likewise.
1757 * src/ecc-edwards.c: New.
1759 2014-03-18 Niibe Yutaka <gniibe@fsij.org>
1761 * src/mod25638.c (mod25638_add, mod25638_sub, mod25638_sqr)
1762 (mod25638_shift): New.
1764 2014-03-13 Niibe Yutaka <gniibe@fsij.org>
1766 * src/mod25638.c: Rename from fe25519.c.
1767 * src/mod25638.h: Likewise.
1769 2014-03-07 Niibe Yutaka <gniibe@fsij.org>
1773 2014-02-25 Niibe Yutaka <gniibe@fsij.org>
1775 * src/openpgp-do.c (gpg_do_public_key): Don't put OID.
1777 * src/configure [certdo] (gnuk.ld): Add TIM_SIZE and EXT_SIZE.
1778 Thanks to Vasily Evseenko for the bug report.
1780 2014-02-21 Niibe Yutaka <gniibe@fsij.org>
1782 * src/ecc.c (compute_kG): Compute higer index at first.
1783 (point_is_on_the_curve): Don't use coefficient_a if it's zero.
1785 * src/jpc.c (jpc_double): Care coefficient A.
1787 * src/ec_p256r1.c (COEFFICIENT_A_IS_MINUS_3): New.
1788 * src/ec_p256k1.c (COEFFICIENT_A_IS_ZERO): New.
1789 * src/jpc_p256r1.c (COEFFICIENT_A_IS_MINUS_3): Likewise.
1790 * src/jpc_p256k1.c (COEFFICIENT_A_IS_MINUS_3): Likewise.
1792 * src/modp256k1.c (modp256k1_shift): Bug fix.
1794 2014-02-20 Niibe Yutaka <gniibe@fsij.org>
1796 * src/Makefile.in (CSRC): Add files of p256k1.
1798 * src/openpgp.c (cmd_pso): Support p256k1 for signature.
1800 * src/openpgp-do.c (algorithm_attr_p256k1): New.
1801 (gpg_do_write_prvkey): Support p256k1 for signature.
1802 (proc_key_import, gpg_do_table, gpg_do_public_key): Likewise.
1804 * src/Makefile.in (DEFS): Add -DRSA_SIG.
1806 * src/openpgp-do.c (gpg_do_write_prvkey): Use _p256r1.
1807 * src/openpgp.c (cmd_internal_authenticate): Likewise.
1809 * src/call-ec_p256k1.c: New. Use call-ec.c.
1810 * src/call-ec_p256r1.c: Use call-ec.c.
1811 * src/call-ec.c: New.
1812 (ecdsa_sign): Change the signature.
1814 2014-02-19 Niibe Yutaka <gniibe@fsij.org>
1816 * tool/calc_precompute_table_ecc.py: New.
1818 * src/ec_p256k1.c: New. Use ecc.c.
1819 * src/ec_p256k1.h: New.
1820 * src/ec_p256r1.c: Use ecc.c.
1823 2014-02-18 Niibe Yutaka <gniibe@fsij.org>
1825 * src/jpc_p256k1.c: New. Use jpc.c.
1826 * src/jpc_p256r1.c: Use jpc.c.
1829 * src/sha256.c (memcpy_output_bswap32): Bug fix.
1831 * src/modp256k1.h, src/modp256k1.c: New.
1833 2014-02-17 Niibe Yutaka <gniibe@fsij.org>
1835 * src/Makefile.in (CSRC): Follow the changes of filenames.
1837 * src/modp256r1.c (modp256r1_add, modp256r1_sub, S3)
1838 (modp256r1_mul, modp256r1_sqr, modp256r1_inv, modp256r1_shift):
1839 Use new function names.
1840 * src/jpc_p256r1.c (jpc_double_p256r1, jpc_add_ac_signed_p256r1)
1841 (jpc_to_ac_p256r1): Likewise.
1842 * src/ec_p256r1.c (point_is_on_the_curve)
1843 (compute_kG_p256r1, compute_kP_p256r1): Likewise.
1844 * src/call-ec_p256r1.c (ecdsa_sign): Likewise.
1846 * src/modp256r1.h: Rename from modp256.h.
1847 * src/jpc-ac_p256r1.h: Rename from jpc-ac.h.
1848 * src/ec_p256r1.h: Rename from ec_p256.h.
1850 * src/modp256r1.c: Rename from modp256.c.
1851 * src/jpc_p256r1.c: Rename from jpc.c.
1852 * src/ec_p256r1.c: Rename from ec_p256.c.
1853 * src/call-ec_p256r1.c: Rename from call-ec_p256.c.
1855 2014-02-05 NIIBE Yutaka <gniibe@fsij.org>
1857 * src/sha512.h, src/sha512.c: New.
1859 * src/sha256.c (initial_state): Don't export, it's internal.
1860 (memcpy_output_bswap32): Rename and remove last argument.
1862 2014-01-28 Niibe Yutaka <gniibe@fsij.org>
1864 * src/muladd_256.h: New.
1865 * src/bn.c (bn256_mul, bn256_sqr): Assembler implementation.
1867 * src/ec_p256.c (get_vk_kP): Bug fix.
1868 (compute_kP): Bug fix for index table.
1870 2014-01-27 Niibe Yutaka <gniibe@fsij.org>
1872 * src/ec_p256.c (get_vk_kP): New.
1873 (naf4_257_set, naf4_257_get, compute_naf4_257): Remove.
1874 (compute_kP): Change the argument, fixing for constant time.
1876 2014-01-24 Niibe Yutaka <gniibe@fsij.org>
1878 * src/ec_p256.c (get_vk): New.
1879 (compute_kG): Fix for constant time.
1880 (compute_kP): Simplify.
1882 2014-01-23 Niibe Yutaka <gniibe@fsij.org>
1884 * src/jpc.c (jpc_add_ac_signed): Fix for constant time.
1886 * src/ec_p256.c (ecdsa): Bug fix for k selection.
1888 2014-01-22 Niibe Yutaka <gniibe@fsij.org>
1890 * src/modp256.c (modp256_inv): Fix for constant time.
1892 * src/bn.c (bn256_sqr): Fix for constant time.
1894 * src/mod.c (mod_inv): Fix for constant time.
1896 * src/ec_p256.c (compute_kG): Simplify.
1898 * src/jpc.c (jpc_double): Support calling with A = infinity.
1900 2014-01-21 Niibe Yutaka <gniibe@fsij.org>
1902 * src/jpc.c (jpc_add_ac_signed): Bug fix for A check.
1904 * src/ec_p256.c (ecdsa): Fix for constant time.
1906 * src/modp256.c (modp256_add, modp256_sub, modp256_reduce)
1907 (modp256_shift): Fix for constant time.
1908 (modp256_inv): Likewise (not fully constant time, yet).
1910 * src/mod.c (mod_reduce): Fix for constant time.
1911 (mod_inv): Likewise (not fully constant time, yet).
1913 * src/bn.h (bn256, bn512): words -> word.
1914 * src/ec_p256.h (naf4_257): Likewise.
1916 2014-01-20 Niibe Yutaka <gniibe@fsij.org>
1918 * src/fe25519.h, src/fe25519.c: New.
1920 2014-01-15 Niibe Yutaka <gniibe@fsij.org>
1922 * src/bn.c (bn256_is_zero, bn256_is_ge, bn256_cmp): Computation
1923 should be constant time.
1925 2013-12-25 Niibe Yutaka <gniibe@fsij.org>
1929 * tool/gnuk_token.py (gnuk_token.__init__, regnual.__init__): Fix
1930 the argument of setAltInterface.
1931 * tool/gnuk_upgrade.py: Likewise.
1932 * tool/dfuse.py (DFU_STM32.__init__): Likewise.
1933 * tool/stlinkv2.py (stlinkv2.__init__): Likewise.
1935 2013-12-24 Niibe Yutaka <gniibe@fsij.org>
1937 * polarssl/include/polarssl/bn_mul.h (MULADDC_1024_CORE)
1938 (MULADDC_1024_LOOP): Use younger number registers more for shorter
1939 instructions and better performance.
1940 * polarssl/library/bignum.c (mpi_montsqr): Likewise. Change loop
1941 structure and conditional branch for better performance.
1943 2013-12-23 Niibe Yutaka <gniibe@fsij.org>
1945 * polarssl/library/bignum.c (mpi_montmul): Computation
1946 time should not depends on input.
1947 (mpi_montmul, mpi_montred, mpi_montsqr): Change the API.
1948 (mpi_exp_mod): Follow the change of the API. Allocate memory on
1949 stack instead of malloc.
1951 * src/gnuk.ld.in (__process3_stack_size__): Increase stack size.
1953 2013-12-20 Niibe Yutaka <gniibe@fsij.org>
1957 * src/usb_ctrl.c (USB_FSIJ_GNUK_CARD_CHANGE): New.
1958 (usb_cb_setup): Support USB_FSIJ_GNUK_CARD_CHANGE.
1959 * src/usb-icc.c (ccid_card_change_signal): New argument HOW.
1961 2013-12-20 Niibe Yutaka <gniibe@fsij.org>
1963 * polarssl/include/polarssl/bn_mul.h (MULADDC_1024_CORE)
1964 (MULADDC_CORE): Reorder instructions for more speed up.
1965 * polarssl/library/bignum.c (mpi_montsqr): Likewise.
1967 2013-12-19 Niibe Yutaka <gniibe@fsij.org>
1969 * src/configure (--enable-hid-card-change): New (experimental).
1970 * src/config.h.in (HID_CARD_CHANGE_DEFINE): New.
1971 * src/usb_ctrl.c (gnuk_setup_endpoints_for_interface)
1972 (usb_cb_setup, usb_cb_ctrl_write_finish): Conditionalize
1973 HID_CARD_CHANGE_SUPPORT.
1974 * src/usb_desc.c (gnukDeviceDescriptor, usb_cb_get_descriptor):
1977 2013-12-19 Niibe Yutaka <gniibe@fsij.org>
1979 * src/openpgp.c (S2KCOUNT): It's now 192, as the threat model
1980 of Gnuk Token is different.
1982 2013-12-19 Niibe Yutaka <gniibe@fsij.org>
1984 * polarssl/library/bignum.c (mpi_montsqr): New.
1985 (mpi_exp_mod): Use mpi_montsqr.
1987 Note that this change introduces a vulnerability by the
1988 Yarom/Falkner flush+reload cache side-channel attack. When this
1989 code is used on general purpose computer where we can observe
1990 which code is executed (sqr or mul), it's not safe.
1992 2013-12-16 Niibe Yutaka <gniibe@fsij.org>
1994 * polarssl/include/polarssl/bn_mul.h (MULADDC_1024_CORE)
1995 (MULADDC_1024_LOOP, MULADDC_HUIT, MULADDC_INIT, MULADDC_CORE)
1996 (MULADDC_STOP) [__arm__]: The value of input B won't change.
1997 More acculate specification for asm statement.
1999 * polarssl/library/bignum.c (mpi_cmp_abs_limbs): New.
2000 (mpi_montmul): Change the signature and use the upper half of T.
2001 (mpi_montred): Likewise.
2002 (mpi_exp_mod): Use improved mpi_montmul and mpi_montred.
2003 (mpi_sub_hlp, mpi_mul_hlp): Add const qualifier for S.
2005 2013-12-13 Niibe Yutaka <gniibe@fsij.org>
2007 * polarssl/library/bignum.c (mpi_exp_mod): Initialize lower
2008 half of T with zero.
2009 (mpi_montmul): Don't need to clear lower half of
2010 T, as we keep zero. Call mpi_sub_hlp with upper half of T.
2011 (mpi_montred): Ditto.
2013 * polarssl/library/bignum.c (mpi_montmul, mpi_montred): Minimize
2014 number of limbs for T.
2015 (mpi_exp_mod): Only allocate N-n * 2 for T.
2016 Only allocate N->n for X, W[i], and RR.
2018 2013-12-13 Niibe Yutaka <gniibe@fsij.org>
2020 * tool/upgrade_by_passwd.py (main): Support -k to specify KEYNO.
2022 2013-12-13 Niibe Yutaka <gniibe@fsij.org>
2024 * src/usb_ctrl.c (HID_LED_STATUS_CARDCHANGE): Rename from
2025 HID_LED_STATUS_NUMLOCK.
2027 * tool/gnuk_token.py (gnuk_token.stop_gnuk): Detach kernel
2030 2013-12-12 Niibe Yutaka <gniibe@fsij.org>
2032 * src/openpgp-do.c (do_openpgpcard_aid): Coerce to volatile to
2033 force memory access at run time.
2035 2013-12-11 Niibe Yutaka <gniibe@fsij.org>
2037 * regnual/sys.c (entry): Fix relocation calculation.
2039 2013-11-27 Niibe Yutaka <gniibe@fsij.org>
2041 * src/stm32f103.h (AFIO_MAPR_SWJ_CFG_DISABLE): New.
2042 * src/sys.c: Likewise.
2044 2013-11-26 Niibe Yutaka <gniibe@fsij.org>
2046 * src/usb_desc.c (hid_report_desc): New.
2047 (ICC_TOTAL_LENGTH): Update.
2048 (HID_TOTAL_LENGTH, HID_NUM_INTERFACES): New.
2049 (W_TOTAL_LENGTH, NUM_INTERFACES): Update.
2050 (gnukConfigDescriptor): Add IN2 interrupt endpoint descriptor.
2051 Add HID interface descriptor.
2052 (usb_cb_get_descriptor): Handle HID.
2054 * src/usb_ctrl.c (NUM_INTERFACES, MSC_INTERFACE_NO): Add 1.
2055 (USB_HID_REQ_*, HID_LED_STATUS_NUMLOCK): New.
2056 (gnuk_setup_endpoints_for_interface): Add ENDP2 interrupt
2058 (usb_cb_setup): Handle HID requests.
2059 (usb_cb_ctrl_write_finish): Likewise.
2061 * src/usb-icc.c (ccid_card_change_signal): New.
2062 (ccid_thread): Handle card change.
2063 (icc_error, icc_send_status): Handle ICC_STATE_NOCARD state.
2064 (icc_handle_data): Add the case of ICC_STATE_NOCARD.
2065 (EP2_IN_Callback): New.
2067 2013-11-26 Niibe Yutaka <gniibe@fsij.org>
2069 * src/pin-dial.c: Remove.
2070 * src/configure: Remove pin-dial support.
2072 2013-11-25 Niibe Yutaka <gniibe@fsij.org>
2074 * src/Makefile.in (HEXOUTPUT_MAKE_OPTION): New.
2075 * src/configure (HEXOUTPUT_MAKE_OPTION): New.
2076 * src/main.c: Include board.h.
2077 * src/stm32f103.h (EXTI0_IRQ, EXTI1_IRQ): New.
2079 2013-11-18 Niibe Yutaka <gniibe@fsij.org>
2081 * regnual/sys.c (entry): Bug fix of clearing BSS.
2083 * src/usb_stm32f103.c: Update from NeuG.
2084 (usb_handle_transfer): Add argument ISTR_VALUE.
2086 * src/openpgp.c (card_thread): Add noinline attribute.
2088 * src/usb-icc.c (ccid_thread): Join the OpenPGP thread.
2089 Add noinline attribute.
2091 2013-11-15 Niibe Yutaka <gniibe@fsij.org>
2093 * src/configure (options): Add --enable-sys1-compat.
2095 2013-11-12 Niibe Yutaka <gniibe@fsij.org>
2097 * chopstx: Upgrade to 0.03.
2099 * src/usb_desc.c (usb_initial_feature): Remove.
2100 (USB_SELF_POWERED): Move to ...
2101 * src/usb_conf.h (USB_SELF_POWERED): ... here.
2102 * src/usb_ctrl.c (usb_cb_device_reset, usb_intr): Follow the
2105 2013-11-11 Niibe Yutaka <gniibe@fsij.org>
2107 * src/adc_stm32f103.c (adc_wait_completion): Update from NeuG 1.0.
2109 2013-11-03 Niibe Yutaka <gniibe@fsij.org>
2111 * regnual/regnual.c (usb_cb_get_descriptor): Update to new API.
2113 * src/usb_lld.h (usb_initial_feature): Remove.
2115 * chopstx: Update to 0.01.
2116 * src/pin-cir.c: Chatter fix to 200ms.
2117 * src/main.c: Fix bDeviceState.
2119 2013-11-02 Niibe Yutaka <gniibe@fsij.org>
2121 * src/usb_lld.h, src/usb_stm32f103.c (std_get_descriptor): Change
2122 the API of usb_cb_get_descriptor.
2123 * src/usb_desc.c: Follow the change.
2124 * src/usb_conf.h: Modify for CCID INT and HID usage.
2126 2013-11-02 Niibe Yutaka <gniibe@fsij.org>
2128 * src/pin-cir.c: Port to Chopstx.
2131 * src/configure (TIM_SIZE, EXT_SIZE): New.
2132 * src/gnuk.ld.in (__process6_stack_size__)
2133 (__process7_stack_size__): New.
2134 * src/main.c (main): Call cir_init.
2135 * src/openpgp.c (openpgp_card_thread): Rename from GPGthread.
2136 * src/usb-icc.c (icc_power_on): Follow the change.
2138 2013-11-01 Niibe Yutaka <gniibe@fsij.org>
2140 * src/sys.c: Update from Chopstx.
2141 * src/usb_lld.h: Remove interrupt definition.
2142 * src/stm32f103.h: Add AFIO, EXTI, and TIMER constants.
2144 2013-10-31 Niibe Yutaka <gniibe@fsij.org>
2146 * src/main.c (main): Call msc_init before USB interrupt thread.
2147 * src/gnuk.h, src/usb-msc.h, src/usb-msc.c, src/pin-dnd.c: Port to
2149 * src/openpgp.c (get_pinpad_input): Follow the change.
2150 * src/usb_ctrl.c (gnuk_setup_endpoints_for_interface): Don't stall
2153 2013-10-24 Niibe Yutaka <gniibe@fsij.org>
2155 * src/Makefile.in (DEFS): Add -DCHX_PRIO_MAIN=5 for LED blink.
2156 * src/main.c (PRIO_CCID): It's now 3 (was: 2).
2158 2013-10-24 Niibe Yutaka <gniibe@fsij.org>
2160 * src/gnuk.ld.in (.gnuk_flash): Three pages for three keys.
2161 * src/flash.c (FLASH_KEYSTORE_SIZE): Likewise.
2162 (flash_keystore_release): Remove.
2163 (flash_key_fill_zero_as_released)
2164 (flash_check_all_other_keys_released, flash_key_release): New.
2165 (flash_init, flash_key_alloc): New method to handle free space.
2166 * src/openpgp-do.c (fetch_four_bytes): New.
2167 (gpg_do_load_prvkey, gpg_do_delete_prvkey, gpg_do_public_key): Use
2169 (gpg_do_delete_prvkey): Call flash_key_release.
2171 2013-10-23 Niibe Yutaka <gniibe@fsij.org>
2173 * test/features/010_setup_passphrase.feature
2174 * test/features/030_key_registration.feature
2175 * test/features/040_passphrase_change.feature
2176 * test/features/410_setup_passphrase.feature
2177 * test/features/430_key_registration.feature
2178 * test/features/201_keygen.feature
2179 * test/features/601_keygen.feature: Modified to support new way of
2180 pass phrase reset by key import / key generation.
2182 * test/features/201_keygen.feature
2183 * test/features/601_keygen.feature
2184 * test/features/202_setup_passphrase.feature
2185 * test/features/602_setup_passphrase.feature: Rename to change
2188 2013-10-23 Niibe Yutaka <gniibe@fsij.org>
2190 * src/openpgp-do.c (gpg_do_write_prvkey): Bug fix of adding
2193 2013-10-22 Niibe Yutaka <gniibe@fsij.org>
2195 * src/openpgp-do.c (gpg_do_write_prvkey): Bug fix.
2197 2013-10-15 Niibe Yutaka <gniibe@fsij.org>
2199 * src/openpgp.c (cmd_change_password, cmd_reset_user_password): It
2200 is now error to change User's pass phrase with no keys.
2202 * src/openpgp-do.c (proc_resetting_code): Likewise for resetting
2204 (gpg_do_delete_prvkey): New.
2205 (gpg_do_write_prvkey): Make sure to delete the key before writing.
2206 User's pass phrase is always the one of factory setting.
2207 (gpg_do_chks_prvkey): Support removing the key.
2208 (proc_key_import): Use gpg_do_delete_prvkey.
2209 (gpg_do_keygen): Use factory setting pass phrase.
2211 2013-10-11 Niibe Yutaka <gniibe@fsij.org>
2213 * src/ac.c (verify_user_0, verify_admin_00): Fix conditions.
2215 * src/openpgp-do.c (gpg_do_write_prvkey): Delete keystring
2216 information from data object of NR_DO_KEYSTRING_PW3.
2218 (gpg_do_keygen): Likewise.
2220 * src/openpgp.c (cmd_reset_user_password): Likewise.
2222 2013-10-10 Niibe Yutaka <gniibe@fsij.org>
2224 * src/gnuk.h (S2K_ITER): Remove. It's determined at compile time.
2226 * src/openpgp-do.c (proc_resetting_code, gpg_do_write_prvkey)
2227 (proc_key_import): Remove "iteration" field.
2229 * src/openpgp.c (cmd_change_password): Likewise.
2231 2013-10-10 Niibe Yutaka <gniibe@fsij.org>
2233 * src/openpgp-do.c (gpg_do_write_prvkey): Access of data object
2234 considering garbage collection.
2236 * src/openpgp.c (cmd_change_password): Call gpg_do_write_simple
2237 after accessing the data object (it may cause garbage collection).
2239 2013-10-10 Niibe Yutaka <gniibe@fsij.org>
2241 * polarssl/library/bignum.c (mpi_montred): Constant time for
2242 carry propagation. Bug fix for carry propagation.
2243 (mpi_exp_mod): Bug fix. Shrink the size of RR as same as X.
2245 2013-10-09 Niibe Yutaka <gniibe@fsij.org>
2247 * src/ac.c (verify_user_0, verify_admin_00, verify_admin_0): Add a
2248 flag to save into keystring_md_pw3. Add SALT handling.
2249 (decode_iterate_count, calc_md, gpg_set_pw3): Remove.
2251 * src/openpgp-do.c (proc_resetting_code, gpg_do_write_prvkey)
2252 (gpg_do_keygen): Add SALT handling.
2253 * src/openpgp.c (cmd_change_password, cmd_reset_user_password)
2255 * src/random.c (random_get_salt): Rename from get_salt.
2257 2013-10-09 Niibe Yutaka <gniibe@fsij.org>
2259 * src/openpgp-do.c (gpg_do_write_prvkey): Remove information (but
2260 pass phrase length) for admin from keystring data object.
2261 (proc_key_import): Recover admin keystring to DO when key deletion.
2263 2013-10-09 Niibe Yutaka <gniibe@fsij.org>
2265 * src/ac.c (verify_user_0, verify_admin_00): Handle PW_LEN_MASK.
2266 * src/openpgp-do.c (proc_resetting_code, gpg_do_write_prvkey):
2269 * src/openpgp.c (cmd_change_password, cmd_reset_user_password):
2270 Handle PW_LEN_KEYSTRING_BIT.
2272 2013-10-09 Niibe Yutaka <gniibe@fsij.org>
2274 * src/ac.c (verify_admin_00): New. Add authentication by loading
2276 (verify_admin_0): Use verify_admin_00.
2278 * src/openpgp.c (cmd_change_password): Admin keystring handling as
2281 2013-10-08 Niibe Yutaka <gniibe@fsij.org>
2283 * src/openpgp.c (modify_binary): Allow odd size of certificate.
2285 * polarssl/library/rsa.c: Update from PolarSSL 1.2.10.
2286 * polarssl/include/polarssl/rsa.h: Ditto.
2288 2013-10-07 Niibe Yutaka <gniibe@fsij.org>
2290 * polarssl/library/bignum.c (mpi_sub_hlp): Return CARRY.
2291 (mpi_sub_abs): Carry propagatoin is done here.
2292 (mpi_mul_hlp_mm): Remove.
2293 (mpi_mul_hlp): Return CARRY, computation in constant time.
2294 (mpi_mul_mpi): Change the order of computation not to propagate
2296 (mpi_montmul): Minimum zero-ing of D and reduce usage of temporary
2297 memory, by one word. Use carry of mpi_mul_hlp. Use
2298 NEED_SUBTRACTION against timing attack.
2299 (mpi_exp_mod): Minimum usage of temporary memory.
2301 2013-10-06 Niibe Yutaka <gniibe@fsij.org>
2303 * polarssl/library/bignum.c (mpi_mul_hlp_mm): New. Handle
2304 extra-carry in constant time to mitigate timing attack.
2305 (mpi_montmul): Use mpi_mul_hlp_mm.
2306 * src/call-rsa.c (rsa_sign, rsa_decrypt, rsa_verify): Don't
2309 2013-10-05 Niibe Yutaka <gniibe@fsij.org>
2311 * polarssl/include/polarssl/aes.h: Update from PolarSSL 1.2.9.
2312 * polarssl/include/polarssl/bignum.h: Ditto.
2313 * polarssl/include/polarssl/config.h: Ditto.
2314 * polarssl/include/polarssl/rsa.h: Ditto.
2315 * polarssl/library/aes.c, polarssl/library/bignum.c: Ditto.
2316 * polarssl/library/rsa.c: Ditto. Fix rsa_free.
2317 * src/call-rsa.c (rsa_sign, modulus_calc, rsa_decrypt)
2318 (rsa_verify): Follow changes of PolarSSL 1.2.9 with RSA blinding.
2319 Better error checking.
2321 2013-10-04 Niibe Yutaka <gniibe@fsij.org>
2323 * src/main.c (gnuk_malloc): Update ->neighbor field of a chunk on
2325 (gnuk_free): Access free list after getting the lock.
2327 2013-10-01 Niibe Yutaka <gniibe@fsij.org>
2329 * src/random.c (random_gen): Bug fix for INDEXed copy.
2331 * src/call-rsa.c (rsa_genkey): Call neug_flush and prng_seed.
2332 * polarssl/library/bignum.c (small_prime): More constants.
2333 (prng_seed, jkiss, mpi_fill_pseudo_random): New.
2334 (mpi_is_prime): Use mpi_fill_pseudo_random.
2336 2013-09-30 Niibe Yutaka <gniibe@fsij.org>
2338 * polarssl/library/bignum.c (mpi_is_prime): Enable trial divisions
2340 Add Fermat primality test.
2341 (mpi_gen_prime): Limit random value so that two MSBs of result will
2344 2013-09-27 Niibe Yutaka <gniibe@fsij.org>
2346 * polarssl/include/polarssl/bignum.h (mpi_is_prime): ifdef-out.
2347 * polarssl/library/bignum.c (mpi_is_prime): It's now internal
2348 function, assuming we already know its coprime to small primes.
2349 (M): New constant MPI. Multiply primes 2*...*691.
2350 (MAX_A): New constant MPI. 2^1024 / M - 1.
2351 (mpi_gen_prime): Specialize for 1024-bit, using Fouque-Tibouchi
2354 2013-09-25 Niibe Yutaka <gniibe@fsij.org>
2356 * src/sha256.h, src/adc.h
2357 * src/neug.c, src/adc_stm32f103.c: Update from NeuG 0.11.
2359 * chopstx: Upgrade to new Chopstx 0.00.
2361 * VERSION: New file.
2363 * src/configure (SERIALNO, SERIALNO_STR_LEN_DEFINE): New.
2364 (REVISION): Use the file VERSION if it doesn't have .git.
2365 Thanks to Sumedha Widyadharma for the bug report.
2367 * src/config.h.in (SERIALNO_STR_LEN_DEFINE): New.
2368 * src/main.c (ID_OFFSET): Use SERIALNO_STR_LEN.
2369 * src/usb_desc.c (gnukStringSerial): Remove. It's now
2370 generated in usb-strings.c.inc.
2372 * src/ec_p256.c (compute_kP): Fix for impossible cases.
2373 (point_is_on_the_curve): New.
2374 (coefficient_a, coefficient_b): New.
2376 2013-09-20 Niibe Yutaka <gniibe@fsij.org>
2378 * src/call-ec_p256.c (ecdsa_compute_public): Handle possible
2379 error (where key_data is the order).
2381 * src/ec_p256.c (compute_kG, compute_kP): Handle errors.
2383 * src/jpc.c (jpc_to_ac): Return -1 on error.
2384 (jpc_add_ac_signed): Handle the case where A=inf.
2386 * src/modp256.c (modp256_inv): Handle error case.
2388 * src/bn.c (bn256_cmp): New.
2390 2013-07-19 Niibe Yutaka <gniibe@fsij.org>
2392 * src/gnuk.ld.in: Layout change following NeuG.
2393 (_end): Add alignment of 16.
2395 * src/neug.c, src/adc.h, src/adc_stm32f103.c: Update from NeuG.
2397 * src/main.c [DFU_SUPPORT] (main): Fix calling
2398 flash_erase_all_and_exec.
2400 * src/openpgp-do.c (gpg_do_write_prvkey, gpg_do_keygen): Fix
2401 allocated memory handling. Clean up before free.
2402 * src/call-rsa.c (modulus_calc, rsa_genkey): Fix removing const.
2403 * src/call-ec_p256.c (ecdsa_compute_public): Likewise.
2405 2013-07-18 Niibe Yutaka <gniibe@fsij.org>
2408 * src/Makefile.in: Change for Chopstx.
2409 * src/configure: Likewise.
2410 * src/gnuk.h, src/gnuk.ld.in: Likewise.
2411 * src/ac.c: Include stdint.h and string.h, not ch.h.
2412 * src/call-rsa.c, src/debug.c, src/flash.c: Likewise.
2413 * src/call-ec_p256.c, src/usb_desc.c
2414 * src/openpgp-do.c, src/random.c: Likewise.
2415 * src/openpgp.c: Likewise. Use eventflag of Chopstx.
2416 * src/usb-icc.c: Likewise.
2417 * src/usb_ctrl.c: Update for Chopstx.
2419 * src/stdlib.h: Use gnuk_malloc and gnuk_free for malloc/free.
2420 * src/config.h.in: Move FLASH_PAGE_SIZE in board.h.
2421 * polarssl/library/aes.c (FT0, FT1, FT2): Export (for sys 2.0).
2422 * src/main.c (struct stdout, _write, EP3_IN_Callback)
2423 (EP5_OUT_Callback): Rewrite for Chopstx. No independent thread
2425 (display_fatal_code, emit_led, display_status_code, led_blink):
2426 Use primitives of Chopstx.
2427 (main): Changes for Chopstx.
2428 (gnuk_malloc_init, sbrk, gnuk_malloc, gnuk_free): New.
2430 2013-06-20 Niibe Yutaka <gniibe@fsij.org>
2432 * src/sys.c, src/sys.h, src/neug.c, src/adc.h
2433 * src/adc_stm32f103.c, src/usb_stm32f103.c: Update from NeuG 0.10.
2434 * src/stm32f103.h: New. From NeuG 0.10.
2436 2013-06-18 Niibe Yutaka <gniibe@fsij.org>
2438 * src/openpgp-do.c (gpg_do_write_prvkey, proc_key_import, gpg_do_table)
2439 (gpg_do_public_key) [RSA_AUTH]: Conditional compilation for RSA/ECDSA.
2440 * src/openpgp.c (cmd_internal_authenticate) [RSA_AUTH]: Likewise.
2442 * src/modp256.c (p256): Add const qualifier.
2444 2013-03-19 Niibe Yutaka <gniibe@fsij.org>
2446 * src/random.c (random_gen): New (was: random_byte).
2448 * src/call-rsa.c (rsa_sign): Follow change of API.
2449 (rsa_genkey): Use random_gen.
2450 (modulus_calc, rsa_decrypt, rsa_verify): Follow change of API.
2451 * src/openpgp-do.c (encrypt, decrypt): Likewise.
2453 * polarssl/include/polarssl/aes.h: Updated from PolarSSL 1.2.6.
2454 * polarssl/library/aes.c: Ditto.
2455 * polarssl/include/polarssl/rsa.h: Ditto.
2456 * polarssl/library/rsa.c: Ditto.
2457 * polarssl/include/polarssl/bignum.h: Ditto.
2458 * polarssl/library/bignum.c: Ditto.
2459 * polarssl: Move from polarssl-0.14.0, and needed files only.
2461 2013-03-15 Niibe Yutaka <gniibe@fsij.org>
2463 * regnual/regnual.ld (.bss): Put at RAM1. This makes reGNUal can
2464 be loaded on the lower address.
2466 * regnual/sys.c (entry): Don't change SP. Put alignment.
2468 * regnual/regnual.c (usb_cb_get_descriptor): Fix adding break.
2470 2013-03-14 Niibe Yutaka <gniibe@fsij.org>
2472 * tool/stlinkv2.py (stlinkv2.start): Call write_debug_reg to run
2475 2013-03-12 Niibe Yutaka <gniibe@fsij.org>
2477 * src/gnuk.ld.in (__process_stack_size__): Increase (was: 0x200).
2479 * tool/stlinkv2.py (stlinkv2.exit_from_debug_swd)
2480 (stlinkv2.exit_from_debug_swim): New.
2481 (stlinkv2.start): Call exit_from_debug_swd or
2482 exit_from_debug_swim.
2484 2013-03-09 Niibe Yutaka <gniibe@fsij.org>
2486 * src/openpgp-do.c (gpg_do_public_key): Add OID for ECDSA.
2487 (gpg_do_write_prvkey): Add PUBKEY_LEN for ECDSA.
2489 * src/flash.c (flash_key_write): Argument change for ECDSA key.
2491 * src/main.c (calculate_regnual_entry_address): New.
2492 (main): Use calculate_regnual_entry_address for entry point.
2494 * src/openpgp-do.c (gpg_do_write_prvkey): Coerce KDI.DATA to
2497 * src/usb_stm32f103.c (handle_setup0): Fix selecting handler.
2499 2013-03-08 Niibe Yutaka <gniibe@fsij.org>
2501 Relocatable reGNUal.
2503 * regnual/regnual.ld (MEMORY): 0x1400 was the value of Gnuk 1.0.1.
2505 (.text): Include .text.entry next to the .vectors.
2508 * regnual/sys.c (entry): Now, it's at .text.entry section.
2510 Don't use absolute values which causes relocations, but
2513 * regnual/Makefile (CFLAGS): Add -fpie.
2515 2013-03-07 Niibe Yutaka <gniibe@fsij.org>
2517 Follow the USB stack change.
2519 * regnual/regnual.c (usb_cb_device_reset): Rename from
2520 regnual_device_reset.
2521 (mem): Change type to uint32_t.
2522 (mem_info): Removed.
2523 (fetch): Avoid pointer punning.
2524 (usb_cb_ctrl_write_finish): Rename from regnual_ctrl_write_finish.
2525 (usb_cb_setup): Rename from regnual_setup.
2526 (usb_cb_get_descriptor): Rename from regnual_get_descriptor.
2527 (usb_cb_handle_event): Rename regnual_usb_event.
2528 (usb_cb_interface): Rename regnual_interface.
2529 (Device_Method): Remove.
2530 (usb_cb_get_descriptor): Not use struct Descriptor.
2532 2013-03-06 Niibe Yutaka <gniibe@fsij.org>
2534 USB stack implementation improvement.
2536 * src/usb_stm32f103.c (Device_Method, method_p): Remove.
2537 (usb_interrupt_handler): Call usb_cb_device_reset.
2538 (std_get_descriptor): Call usb_cb_get_descriptor.
2539 (std_set_configuration): Call usb_cb_handle_event.
2540 (std_get_status, std_get_interface, std_set_interface): Call
2542 (handle_setup0): Call usb_cb_setup.
2543 (handle_in0): Call usb_cb_handle_event and
2544 usb_cb_ctrl_write_finish.
2545 (request_handler): Remove.
2546 (handle_setup0): Call std_* directly, not indirectly by
2548 (ep_intr_handler_IN, ep_intr_handler_OUT): Remove.
2549 (usb_handle_transfer): Call EP*_Callback directly, not indirectly
2550 by ep_intr_handler_IN, ep_intr_handler_OUT.
2552 * src/usb_lld.h (struct usb_device_method, Device_Method): Remove.
2553 (usb_cb_device_reset, usb_cb_ctrl_write_finish)
2554 (usb_cb_setup, usb_cb_get_descriptor, usb_cb_handle_event)
2555 (usb_cb_interface): Define callbacks.
2556 (usb_initial_feature): New.
2557 (struct Descriptor): Move to ...
2558 * src/usb_desc.c: ... here.
2559 (usb_initial_feature): New.
2560 (usb_cb_get_descriptor): Rename from gnuk_get_descriptor and move
2563 * src/usb_ctrl.c (usb_cb_device_reset): Rename from
2565 (usb_cb_setup): Rename from gnuk_setup.
2566 (usb_cb_ctrl_write_finish): Rename from gnuk_ctrl_write_finish.
2567 (usb_cb_event): Rename from gnuk_usb_event.
2568 (usb_cb_interface): Rename from gnuk_interface.
2569 (Device_Method): Remove.
2571 * src/main.c (main): Use usb_initial_feature.
2573 2013-02-27 Niibe Yutaka <gniibe@fsij.org>
2575 * src/usb-icc.c (set_sw1sw2): Arguments are C and CHUNK_LEN.
2576 Fix reporting remaining bytes.
2577 (icc_send_data_block_gr): Follow the arguments change of
2580 2013-02-26 Niibe Yutaka <gniibe@fsij.org>
2582 * regnual/regnual.ld (MEMORY): Fix start address.
2584 * src/random.c (random_fini): New.
2585 * src/main.c (main): Call random_fini.
2587 2013-02-25 Niibe Yutaka <gniibe@fsij.org>
2589 * src/configure: Correct typo in help text.
2591 * src/gnuk.h (struct key_data_internal): Use uint32_t.
2592 * src/openpgp-do.c (do_openpgpcard_aid): Fix calculation of VID.
2593 (compute_key_data_checksum): Don't use type-punning pointer.
2594 (gpg_do_write_prvkey): Use coercing to char *.
2596 2013-02-22 Niibe Yutaka <gniibe@fsij.org>
2598 * src/openpgp-do.c (gpg_do_public_key): Add header of EC point.
2600 * src/openpgp-do.c (GPG_DO_DISCRETIONARY, cmp_discretionary): New.
2601 (cmp_app_data): Change to factor out GPG_DO_DISCRETIONARY.
2602 (gpg_do_table): Add GPG_DO_DISCRETIONARY.
2604 2013-02-21 Niibe Yutaka <gniibe@fsij.org>
2606 * src/gnuk.ld.in (MEMORY): Fix adding FLASH_SIZE unit.
2608 * src/call-ec_p256.c (ecdsa_sign): Fix secret key access.
2610 2013-02-20 Niibe Yutaka <gniibe@fsij.org>
2612 * src/openpgp.c (cmd_internal_authenticate): Support ECDSA for
2615 * src/openpgp-do.c (algorithm_attr_ecdsa): New.
2616 (algorithm_attr_rsa): Rename (was: algorithm_attr).
2617 (gpg_do_table): Change for GPG_DO_ALG_AUT.
2618 (gpg_do_write_prvkey): Support ECDSA key for authentication.
2619 (proc_key_import): Likewise.
2620 (gpg_do_public_key): Likewise.
2622 * src/call-ec_p256.c: New.
2623 * src/Makefile.in: Add call-ec_p256.c.
2624 * src/call-rsa.c (modulus_free): Remove.
2626 2013-02-19 Niibe Yutaka <gniibe@fsij.org>
2628 * regnual/regnual.ld (MEMORY): Fix address of regnual.
2630 * regnual/Makefile (MCFLAGS): Remove -mfix-cortex-m3-ldrd.
2631 (CFLAGS): Add output to .lst.
2632 * src/Makefile.in (MCFLAGS): Remove.
2634 * src/sha256.c: Update from NeuG 0.05.
2636 * ChibiOS_2.0.8: Remove.
2638 2013-02-18 Niibe Yutaka <gniibe@fsij.org>
2640 Changes for new ChibiOS/RT.
2641 * src/main.c: Include adc.h.
2642 (main): Call halInit, adc_init, and chSysInit (change for
2644 * src/random.h: New.
2645 * src/ac.c, src/bn.c, src/call-rsa.c, src/main.c: Include random.h.
2646 * src/openpgp.c, src/openpgp-do.c: Likewise.
2647 * src/configure, src/gnuk.ld.in: Add MEMORY_SIZE.
2648 * src/ec_p256.c: Fix call of bn256_add_uint.
2649 * boards/STM8S_DISCOVERY/*: Update for ChibiOS/RT 2.4.x.
2650 * boards/CQ_STARM/*: Likewise.
2651 * boards/FST_01_00/*: Likewise.
2652 * boards/OLIMEX_STM32_H103/*: Likewise.
2653 * boards/STBEE/*: Likewise.
2654 * boards/STBEE_MINI/*: Likewise.
2655 * boards/STM32_PRIMER2/*: Likewise.
2657 Merge ec_p256 branch.
2658 * src/Makefile.in: Add ECC files.
2659 * src/bn.h, src/bn.c: New.
2660 * src/jpc-ac.h, src/jpc.c: New.
2661 * src/ec_p256.h, src/ec_p256.c, src/ecc-cdh.c: New.
2662 * src/mod.h, src/mod.c, src/modp256.h, src/modp256.c: New.
2664 2013-02-17 Niibe Yutaka <gniibe@fsij.org>
2666 * chibios: New submodule for ChibioS/RT 2.4.x.
2667 * boards/FST_01/*: Update for ChibiOS/RT 2.4.x.
2668 * boards/common/mcuconf-common.h: Ditto.
2670 * src/chconf.h, src/halconf.h, src/Makefile.in, src/gnuk.ld.in:
2671 Update for ChibiOS/RT 2.4.x.
2673 * src/main.c, src/openpgp.c, src/usb-icc.c: Follow the change of
2675 * boards/common/board-common.c: Rename from hwinit.c.
2676 * src/usb_stm32f103.c: Rename from usb_lld.c.
2678 * src/neug.h, src/neug.c: Update NeuG 0.05.
2679 * src/adc_stm32f103.c, src/adc.h: New from NeuG 0.05.
2681 * src/random.c: Follow the change of NeuG 0.05.