2011-11-22 Niibe Yutaka * tool/dfuse.py (DFU_STM32.download, DFU_STM32.verify): Support unaligned write and hole. 2011-11-14 Niibe Yutaka * boards/FST_01/{mcuconf.h,board.h,board.c}: New. 2011-11-01 Niibe Yutaka * src/pin-dial.c (pinpad_getline): New. (pin_main): Remove. * boards/STBEE_MINI/board.h (TIMx): Define. boards/STBEE/board.h (TIMx): Ditto. boards/STM8S_DISCOVERY/board.h: Ditto. * src/pin-cir.c (pinpad_getline): New. (cir_timer_interrupt, cir_ext_interrupt): Use TIMx. (cir_key_is_backspace, cir_key_is_enter, pin_main, pindisp): Remove. (cir_codetable_dell_mr425, cir_codetable_aquos) (cir_codetable_regza, cir_codetable_bravia, ch_is_backspace) (ch_is_enter, find_char_codetable, hex, cir_getchar): New. (cir_timer_interrupt): Don't filter out ADDRESS. * src/openpgp.c (get_pinpad_input): Don't invoke thread, but just call pinpad_getline. * src/main.c (display_interaction, display_fatal_code) (display_status_code, led_blink): New. (main): Call display_* routine. (fatal): Notify main thread. * src/usb_prop.c (gnuk_device_SetConfiguration): Notify main thread. * src/pin-cir.c (pindisp): Remove. * boards/FST_01_00: New (for 8MHz FST-01). * src/ac.c (calc_md): Fix comparison. * src/call-rsa.c (RSA_SIGNATURE_LENGTH): Use KEY_CONTENT_LEN. (rsa_sign, rsa_decrypt): Likewise. (modulus_calc): Don't assume it's 2048-bit. * src/ac.c (verify_user_0): Fix for non-initialized PW1. * src/Makefile.in (MCFLAGS): Override MCFLAGS option for newer GCC of summon-arm-toolchain to add -mfix-cortex-m3-ldrd. NOTE: This should not be needed (as -mcpu=cortex-m3 defaults to -mfix-cortex-m3-ldrd for GCC-proper), but it is needed to select arm-none-eabi/lib/thumb2/libc.a correctly. 2011-10-14 NIIBE Yutaka * src/gnuk.ld.in (__main_stack_size__): It's 1KB (was 512 byte). 2011-10-07 NIIBE Yutaka * Version 0.14. * src/usb_desc.c (gnukStringSerial): Updated. * src/random.c (random_init): Call neug_prng_reseed. 2011-10-06 NIIBE Yutaka * src/Makefile.in (random_bits): Remove. * src/openpgp.c (GPGthread): Remove unused event message. * src/main.c (main): Call random_init. * src/gnuk.ld.in (__process_stack_size__): Fix. (.gnuk_random): Removed. * src/flash.c (flash_erase_binary, flash_write_binary): Remove support of random_byte in flash ROM. * src/neug.c (adccb): Use old API (was: chEvtSignalFlagsI). (adccb_err): Remove. (rng_gen, rng): Add the last argument adccb for adcStartConversion: This is old API of ADC driver. (adcgrpcfg): Remove callbacks, add CONT and SWSTART: This is old API of ADC driver. (adccb): Remove the first argument: This is old API of ADC driver. (neug_wait_full): New. * ChibiOS_2.0.8/os/hal/platforms/STM32/adc_lld.h (ADC_SAMPLE_1P5): Add (from new API). * src/random.c (random_init): New. (random_bytes_get, random_bytes_free, get_salt): Use NeuG. * src/Makefile.in (CSRC): Add neug.c. * src/neug.c: New. Verbatim copy of NeuG/src/random.c. * boards/common/mcuconf-common.h (USE_STM32_ADC1): TRUE for NewG RNG. * src/chconf.h (CH_USE_SEMAPHORES): TRUE as ADC driver requires it. * src/halconf.h (CH_HAL_USE_ADC); TRUE for NewG RNG. 2011-07-22 NIIBE Yutaka * boards/OLIMEX_STM32_H103/board.h (BOARD_NAME): Fixed. * boards/STBEE_MINI/mcuconf.h: Added missing include of mcuconf-common.h. 2011-07-04 NIIBE Yutaka * ChibiOS_2.0.8/os/ports/GCC/ARMCMx/chcore_v7m.c (_port_irq_epilogue, _port_switch_from_isr): Apply a patch of 2.2.6. * ChibiOS_2.0.8/os/hal/platforms/STM32/adc_lld.h: Apply a patch of ADC from the branch of ChibiOS_2.0.X. 2011-06-15 NIIBE Yutaka * Version 0.13. * src/usb_desc.c (gnukStringSerial): Updated. 2011-06-08 NIIBE Yutaka * polarssl-0.14.0/include/polarssl/bn_mul.h [__arm__] (MULADDC_1024_CORE, MULADDC_1024_LOOP): New. * polarssl-0.14.0/library/bignum.c (mpi_mul_hlp): Use MULADDC_1024_LOOP. 2011-05-31 NIIBE Yutaka * polarssl-0.14.0/include/polarssl/bn_mul.h [__arm__] (MULADDC_HUIT, MULADDC_INIT, MULADDC_CORE, MULADDC_STOP): Tweak. 2011-05-27 NIIBE Yutaka * tool/gnuk_put_binary.py (main): Confirm Serial ID is written correctly. * src/openpgp.c (cmd_write_binary): Fix FILE_EF_SERIAL comparison. * src/gnuk.ld.in (.gnuk_random, .gnuk_ch_certificate): Put LONG to have CONTENTS. * polarssl-0.14.0/include/polarssl/bn_mul.h [__arm__] (MULADDC_HUIT): New. 2011-05-26 NIIBE Yutaka * polarssl-0.14.0/include/polarssl/bn_mul.h [__arm__] (MULADDC_INIT): Add ADDS instruction to clear of carry flag. (MULADDC_CORE): Tune to 6 instructions and less registers. (MULADDC_STOP): Add ADC instruction to save carry flag. 2011-05-25 NIIBE Yutaka * tool/hub_ctrl.py: New. Port of original C implementation. 2011-05-16 NIIBE Yutaka * src/main.c (main): Call flash_unlock at the beginning. (device_initialize_once): Don't call flash_unlock here. * src/flash.c (flash_init): Likewise. * src/openpgp.c (cmd_select_file): Don't use write_res_apdu. (set_res_apdu): Rename from write_res_apdu. Just SW1 and SW2. 2011-05-13 NIIBE Yutaka * Version 0.12. 2011-05-12 NIIBE Yutaka * src/openpgp.c (cmd_pso, cmd_internal_authenticate) (cmd_update_binary, cmd_write_binary): Don't check pw locked. * tool/dfuse.py (DFU_STM32.verify): Add missing colon. * tool/dfuse.py (get_device): Restrict to STMicro DfuSe. * tool/gnuk_put_binary.py (main): Add -p option to enter password. * src/ac.c (verify_user_0): New. (verify_pso_cds, verify_admin_0): Use verify_user_0. * src/openpgp.c (cmd_change_password): Use verify_user_0. * src/random.c (get_salt): Rename from get_random. (random_bytes_get, random_bytes_free): It's 16-byte. * src/ac.c (verify_admin_0): Use PW_ERR_PW1 counter when authenticated by PW1. 2011-05-11 NIIBE Yutaka * src/ac.c (verify_pso_cds, verify_other): Fail (with no counter update) if key is not registered yet. (verify_admin_0): Compare to OPENPGP_CARD_INITIAL_PW3 when empty PW3 and non-empty PW1 but signing key is not registered yet. * tool/gnuk_put_binary.py: New implementation by pyscard. * src/main.c (device_initialize_once): New. * src/usb_prop.c (gnukStringSerial): Move to... * src/usb_desc.c (gnukStringSerial): here. Bump version to 0.12. Fill by 0xff. * src/usb_prop.c (gnuk_device_init) (gnuk_device_GetStringDescriptor): Don't use RAM for gnukStringSerial, use ROM like other string descriptor. * src/usb_desc.c (String_Descriptor): Add gnukStringSerial. * src/openpgp-do.c (gpg_get_pw1_lifetime): Make static. (gpg_do_load_prvkey, gpg_do_write_prvkey): Use kdi. (gpg_increment_digital_signature_counter): Call gpg_get_pw1_lifetime. * src/openpgp.c (cmd_pso): Follow the change. * src/flash.c (keystore_pool): Remove. Use &_keystore_pool. * src/ac.c (auth_status): Don't assign 0 as it's automatically cleared. 2011-05-10 NIIBE Yutaka * src/openpgp-do.c (gpg_pw_locked): Rename from gpg_passwd_locked. (gpg_pw_get_err_counter): Rename from gpg_get_pw_err_counter. (gpg_pw_reset_err_counter): Rename from gpg_reset_pw_err_counter. (gpg_pw_increment_err_counter): Rename from gpg_increment_err_counter. * src/ac.c, src/openpgp.c, src/gnuk.h: Follow the change. Bug fixes. * src/openpgp.c (cmd_reset_user_password, cmd_change_password) * src/openpgp-do.c (proc_resetting_code): Fix check of return value. * src/ac.c (ac_fini): Clear keystring_md_pw3. Prevent observation of PW3 is emptiness by PW3's error counter. Support verify_admin by PW1 when PW3 is empty. * src/ac.c (admin_authorized): New. (verify_admin_0): Set admin_authorized. * src/openpgp-do.c (proc_resetting_code): Use admin_authorized. (gpg_do_write_prvkey): Clear dek_encrypted_3 when keystring_admin is NULL. (proc_key_import): Checking admin_authorized, set keystring_admin. * src/openpgp.c (cmd_reset_user_password): Use admin_authorized. 2011-04-18 NIIBE Yutaka * gnuk.svg: Updated. 2011-04-15 NIIBE Yutaka * Version 0.11. * src/usb_prop.c (gnukStringSerial): Updated. 2011-04-11 NIIBE Yutaka * tool/dfuse.py (DFU_STM32.verify): support data size of non-1-KiB. 2011-02-24 NIIBE Yutaka * src/usb_prop.c (gnuk_device_SetInterface): Fix argument to ClearDTOG_TX. 2011-02-10 NIIBE Yutaka * Version 0.10. * src/configure, src/Makefile.in (BOARD_DIR): New. * boards/CQ_STARM/board.mk, boards/OLIMEX_STM32_H103/board.mk: Removed. * boards/STBEE/board.mk, boards/STBEE_MINI/board.mk: Removed. * boards/STM32_PRIMER2/board.mk, boards/STM8S_DISCOVERY/board.mk: Removed. * src/Makefile.in (OUTFILES): Don't include random_bits. 2011-02-09 NIIBE Yutaka * src/usb_prop.c (gnukStringSerial): Updated. * tool/gnuk_put_binary.py (gnuk_token.__del__): Removed. Releasing the interface is done in PyUSB. * tool/dfuse.py (DFU_STM32.__del__): Removed. * src/openpgp.c (cmd_write_binary): Support random bits and card holder certificate as well. * src/openpgp-do.c (do_openpgpcard_aid): Add volatile to prevent compiler optimization to access AID. 2011-02-08 NIIBE Yutaka * tool/gnuk_put_binary.py: Renamed (was: gnuk_update_binary.py). (gnuk_token.cmd_write_binary): New. (main): Support writing serial number. * GNUK_SERIAL_NUMBER: Renamed (was: FSIJ_SERIAL_NUMBER). * src/config.h.in (@SERIAL_DEFINE@): Removed. * src/gnuk.h (FILEID_SERIAL_NO): New. * src/openpgp.c (INS_WRITE_BINARY, cmd_write_binary): New. * src/configure: Remove --with-fixed-serial support. * src/openpgp-do.c (do_openpgpcard_aid): Remove support of SERIAL_NUMBER_IN_AID. * src/flash.c (flash_write_binary): Support FILEID_SERIAL_NO. 2011-02-04 NIIBE Yutaka * tool/gnuk_update_binary.py: Support updating random bits. * src/random.c (random_bits_start): Renamed. (random_bytes_get): Check initial erased state. * src/Makefile.in (random-data.o): Removed. * src/gnuk.ld.in (.gnuk_random): Don't have .gnuk_random any more. * src/flash.c (flash_erase_binary): Support FILEID_RANDOM. (flash_write_binary): Ditto. * src/openpgp.c (cmd_reset_user_password): Fix PINPAD_SUPPORT case with reset code. 2011-02-01 NIIBE Yutaka * Version 0.9. * src/openpgp-do.c (extended_capabilities): Change value for card holder certificate. * src/usb_prop.c (gnuk_device_SetInterface): New. 2011-01-29 NIIBE Yutaka * src/usb_prop.c (gnuk_device_Get_Interface_Setting): Handle the case where we have multiple interfaces. 2011-01-28 NIIBE Yutaka * tool/gnuk_update_binary.py: New. * src/openpgp-do.c (gpg_do_get_data): Fix length adding two for status word at the end and adding four for the tag and the length. * src/usb-icc.c (icc_handle_data): Fix decrementing res_APDU_size. (icc_power_off): Status should be the one *after* power off. * src/openpgp.c (cmd_update_binary): Fix return code. 2011-01-27 NIIBE Yutaka * src/usb-icc.c (res_APDU_pointer): New. (icc_handle_data, USBthread): Handle res_APDU_pointer. * src/openpgp.h (GPG_COMMAND_NOT_ALLOWED): New. * src/openpgp.c (INS_UPDATE_BINARY, FILE_EF_CH_CERTIFICATE) (FILE_EF_RANDOM, cmd_update_binary): New. (process_command_apdu): Initialize res_APDU_pointer. * src/openpgp-do.c (gpg_do_get_data): Handle GPG_DO_CH_CERTIFICATE. * src/gnuk.ld.in (.gnuk_ch_certificate): New. * src/flash.c (flash_check_blank, flash_erase_binary) (flash_write_binary): New. * src/openpgp-do.c (gpg_do_table): Exclude GPG_DO_CH_CERTIFICATE. * src/openpgp.c (cmd_reset_user_password): Add PINPAD_SUPPORT. * src/gnuk.ld.in: Fix alignment and filling. 2011-01-26 NIIBE Yutaka * boards/STBEE/mcuconf.h: New. * boards/STBEE/board.mk: New. * boards/STBEE/board.h: New. * boards/STBEE/board.c: New. * tool/dfuse.py (DFU_STM32.verify): Add double ll_clear_status. * src/configure (target): Add STBEE. 2011-01-25 NIIBE Yutaka * src/openpgp.c (cmd_pso): Support DigestInfo by MD5 (for opensc). 2011-01-22 NIIBE Yutaka * src/openpgp.c (cmd_pgp_gakp): Handle case of non-extended Lc. (cmd_select_file): Return DF name when FCI is requested. * src/openpgp-do.c (copy_do): Don't add tag if not requested. * src/gnuk.h (memmove): Add declaration. 2011-01-21 NIIBE Yutaka * src/openpgp-do.c (copy_do): Fix off-by-one error. * src/openpgp.c (get_pinpad_input): Ifdef-out PINPAD_SUPPORT. 2011-01-19 NIIBE Yutaka * Version 0.8. * src/pin-cir.c (pin_main): Fix typo, call cir_ext_disable. * src/usb_prop.c (gnukStringSerial): Updated. * src/pin-dial.c: New. * boards/STBEE_MINI/board.c (hwinit1): Add PINPAD_DIAL_SUPPORT. (dial_sw_disable, dial_sw_enable, EXTI2_IRQHandler): New. * src/gnuk.h: Add PINPAD_DIAL_SUPPORT. * src/usb-icc.c (icc_handle_data): Handle PIN modification. * src/usb_desc.c (gnukConfigDescriptor): bPinSupport = 3 when PINPAD_DIAL_SUPPORT is enabled. 2011-01-18 NIIBE Yutaka * src/pin-cir.c (pin_main): Call cir_ext_disable at the end. 2011-01-17 NIIBE Yutaka * src/gnuk.h (PIN_INPUT_CURRENT, PIN_INPUT_NEW) (PIN_INPUT_CONFIRM): New. * src/pin-cir.c (pin_main): New argument MSG_CODE. * src/openpgp.c (get_pinpad_input): New. (cmd_verify): Use get_pinpad_input. (cmd_change_password): Added PINPAD_SUPPORT. * src/openpgp.c (cmd_nop): Removed. * src/config.h.in: ifdef-out (not for ASSEMBLER). 2011-01-15 NIIBE Yutaka * Version 0.7. * src/usb-icc.c (icc_handle_data): Bug fix: add break for case ICC_STATE_SEND. 2011-01-14 NIIBE Yutaka * Version 0.6. * src/usb_prop.c (gnukStringSerial): Include version number (again). * boards/STM8S_DISCOVERY/board.c (hwinit1): Initialize TIM3 and remap TIM3. (cir_ext_disable, cir_ext_enable, EXTI9_5_IRQHandler) (TIM3_IRQHandler): New. * boards/STBEE_MINI/board.h (HAVE_7SEGLED): New. * boards/STM8S_DISCOVERY/board.h: Include "config.h". (VAL_GPIOBODR): PB0 (TIM3_CH3) is pull-down for PINPAD_SUPPORT. * src/pin-cir.c (pindisp): Handle the board with no 7 segment display. 2011-01-11 NIIBE Yutaka * src/openpgp-do.c (do_openpgpcard_aid): Fix length of res_p; 2011-01-08 NIIBE Yutaka * src/usb-icc.c (icc_handle_data): Handle the case of ICC_STATE_SEND (back again to the implementation of v0.4). (USBthread): Don't send back larger block (for libccid 1.3.11). 2011-01-07 NIIBE Yutaka * src/openpgp.c (cmd_read_binary): Call gpg_do_get_data for AID. * src/openpgp-do.c (gpg_do_get_data): Added new argument WITH_TAG. * src/usb_prop.c (gnuk_device_init) (gnuk_device_GetStringDescriptor): gnukStringSerial with unique chip ID. * src/openpgp-do.c (do_openpgpcard_aid): New. (openpgpcard_aid): Removed. * boards/common/hw_config.c (unique_device_id): New. 2011-01-06 NIIBE Yutaka * src/config.h.in (PINPAD_MORE_DEFINE): Added. * src/configure: Requiring bash (for variable substitution), added PINPAD. * src/Makefile.in: Support PINPAD. * src/pin-cir.c (cir_timer_interrupt): Support Sharp protocol. 2011-01-04 NIIBE Yutaka * src/chconf.h (CH_USE_DYNAMIC): It's TRUE now. * src/usb_desc.c (gnukConfigDescriptor): Added PINPAD_SUPPORT. * src/pin-cir.c (cir_timer_interrupt): Added CIR_PERIOD_INHIBIT_CHATTER. 2010-12-29 NIIBE Yutaka * src/pin-cir.c (cir_timer_interrupt): Support Philips RC-5 protocol. 2010-12-28 NIIBE Yutaka * src/pin-cir.c (cir_timer_interrupt): Support Philips RC-6 protocol. 2010-12-27 NIIBE Yutaka * src/pin-cir.c (cir_timer_interrupt): Support Sony protocol. 2010-12-24 NIIBE Yutaka * src/pin-cir.c: New file. 2010-12-20 NIIBE Yutaka * src/openpgp.c (GPGthread): Added PINPAD_SUPPORT. * boards/STBEE_MINI/mcuconf.h: Simplified. * boards/STBEE_MINI/board.h: Include config.h. (PINPAD_SUPPORT): Added. * boards/STBEE_MINI/board.c (hwinit1): Added PINPAD_SUPPORT. 2010-12-15 NIIBE Yutaka * src/configure (FLASH_SIZE): Without 'k'. * src/gnuk.ld.in (MEMORY): Append "k" here. (.gnuk_flash): End point should be aligned too. * src/config.h.in (@PINPAD_DEFINE@): New. * src/Makefile.in (@PINPAD_MAKE_OPTION@): New. * src/configure (PINPAD_MAKE_OPTION, PINPAD_DEFINE): New. 2010-12-14 NIIBE Yutaka * src/configure (FLASH_PAGE_SIZE): Always set. 2010-12-13 NIIBE Yutaka * Version 0.5. * src/usb_desc.c (gnukStringSerial): Updated. 2010-12-10 NIIBE Yutaka * src/usb-cdc-vport.c (Virtual_Com_Port_Data_Setup) (Virtual_Com_Port_NoData_Setup): No check for class&interface request. * src/usb-icc.c (ATR): Fixed. * src/usb_desc.c (/* ICC Descriptor*/): bcdCCID = 1.1. dwDefaultClock = dwMaximumClock = 3571. dwFeatures 0x00040842. * src/usb_prop.c (gnuk_clock_frequencies, gnuk_data_rates): New. (gnuk_nothing_todo): Removed. (gnuk_setup_with_data, gnuk_setup_with_nodata): New. (Device_Property): Changed to call gnuk_setup_with_data and gnuk_setup_with_nodata. 2010-12-09 NIIBE Yutaka * src/usb-icc.c (icc_power_off): Set icc_data_size = 0 to specify no command APDU. Signal GPGThread. (icc_handle_data, USBthread): Don't signal main thread any more. * src/openpgp.c (GPGthread): Only process the command APDU, if any. * src/openpgp-do.c (do_tag_to_nr): Don't call fatal. * src/main.c (fatal_code): New. (main): Implemented 1-bit LED status display. (fatal): Added argument CODE. * src/flash.c (flash_data_pool_allocate): Supply argument FATAL_FLASH. * src/random.c (random_bytes_get): Supply argument FATAL_RANDOM. * src/ac.c (auth_status): Added volatile, and remove static. 2010-12-08 NIIBE Yutaka * src/gnuk.h (AC_OTHER_AUTHORIZED): Renamed (was: AC_PSO_OTHER_AUTHORIZED). * src/ac.c (ac_reset_other): Renamed (was: ac_reset_pso_other). (verify_other): Renamed (was: verify_pso_other). (ac_reset_admin): New. * src/openpgp.c (cmd_change_password): Call ac_reset_admin. * src/main.c (main): Don't create GPGThread here. * src/usb-icc.c (icc_power_on): But create here, when requested. (icc_power_off): Terminate GPGThread. * src/openpgp.c (gpg_init, gpg_fini): New. (GPGthread): Check chThdShouldTerminate. Call gpg_init and gpg_fini. 2010-12-07 NIIBE Yutaka USB CCID/ICC implementation changes. * src/usb_desc.c (dwMaxCCIDMessageLength): Updated. * src/usb-icc.c (EV_TX_FINISHED): New. (icc_rcv_data, icc_tx_data): Removed. (icc_buffer, icc_seq): New. (icc_next_p, icc_chain_p): New. (icc_tx_ready): Removed. (EP1_IN_Callback): Handle multiple transactions. (icc_prepare_receive): New. (EP2_OUT_Callback): Handle multiple transactions. (icc_error, icc_send_status): Handle the case of receive in chain. (icc_power_on, icc_send_params): Specify it's a single transaction. (icc_send_data_block_filling_header): New. (icc_send_data_block): Simplify. (icc_handle_data): Removed the case of ICC_STATE_SEND. Handle buffer of multiple transactions. (USBthread): Don't use sending in chain. * src/gnuk.h (USB_LL_BUF_SIZE): New. (USB_BUF_SIZE): Now, it's larger value. * src/configure: Echo for --enable-debug. * src/call-rsa.c (rsa_sign): Use temp[] buffer as rsa_pkcs1_sign writes OUTPUT in early stage. 2010-12-04 NIIBE Yutaka * src/flash.c (flash_keystore_release): Reset keystore storage. 2010-12-03 NIIBE Yutaka Keystore management changes. * src/flash.c (flash_key_alloc): Check FLASH_KEYSTORE_SIZE. (flash_key_release): Removed. (flash_keystore_release): New function. * src/openpgp-do.c (gpg_do_write_prvkey): Make it static. When there is a key already, return as error. (proc_key_import): Call flash_keystore_release when all keys removed. * src/gnuk.ld.in (_keystore_pool): Size of keystore is now 1.5KB. 2010-11-30 NIIBE Yutaka Flash ROM fixes for STM32F10X_HD. * src/gnuk.ld.in (.gnuk_flash): Use FLASH_PAGE_SIZE. * src/configure (FLASH_PAGE_SIZE): Defined for gnuk.ld. * src/flash.c (FLASH_PAGE_SIZE): New define. (FLASH_DATA_POOL_SIZE): Use FLASH_PAGE_SIZE. Import changes of ChibiOS_2.0.8. * ChibiOS_2.0.8/os/hal/include/pwm.h * ChibiOS_2.0.8/os/hal/platforms/STM32/pwm_lld.c * ChibiOS_2.0.8/os/hal/platforms/STM32/pwm_lld.h * ChibiOS_2.0.8/os/hal/src/pwm.c * ChibiOS_2.0.8/os/hal/templates/pwm_lld.c * ChibiOS_2.0.8/os/hal/templates/pwm_lld.h * ChibiOS_2.0.8/os/kernel/include/ch.h * ChibiOS_2.0.8/os/kernel/src/chevents.c * ChibiOS_2.0.8/os/kernel/src/chthreads.c * ChibiOS_2.0.8/boards/OLIMEX_LPC_P2148/board.h * ChibiOS_2.0.8/readme.txt * ChibiOS_2.0.8/test/testdyn.c * ChibiOS_2.0.8/docs/*/*: Updated. New private key management. * src/ac.c (ac_reset_pso_cds, ac_reset_pso_other): Call gpg_do_clear_prvkey. (verify_pso_other): load private keys here. * src/openpgp-do.c (kd): Keydata for Signing, Decryption, and Authentication. (gpg_do_load_prvkey, gpg_do_write_prvkey): Use kd[]. (gpg_do_clear_prvkey): New function. * src/openpgp.c (cmd_pso, cmd_internal_authenticate): Use new API of rsa_sign and rsa_decrypt. (cmd_pso): Fixed bug of checking return value of gpg_get_pw1_lifetime. * src/call-rsa.c (rsa_sign): New argument KD. (rsa_decrypt): Likewise. Don't use malloc/free in C library. * src/stdlib.h (malloc, free): Use chHeapAlloc and chHeapFree. 2010-11-26 NIIBE Yutaka * boards/STM8S_DISCOVERY/*: New. * src/configure: STM8S_DISCOVERY only has 64KB flash memory. * boards/STBEE_MINI/board.h (CPU_WITH_NO_GPIOE): New define. * ChibiOS_2.0.6/os/hal/platforms/STM32/hal_lld.c: Use it. * ChibiOS_2.0.6/os/hal/platforms/STM32/pal_lld.c: Likewise. * ChibiOS_2.0.6/os/hal/platforms/STM32/pal_lld.h: Likewise. * src/openpgp.c (cmd_pso): DigestInfo by SHA224/SHA384/SHA512 is supported. 2010-11-22 NIIBE Yutaka Import changes of ChibiOS_2.0.6. * ChibiOS_2.0.6/demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h * ChibiOS_2.0.6/os/hal/include/can.h * ChibiOS_2.0.6/os/hal/platforms/AT91SAM7/hal_lld.c * ChibiOS_2.0.6/os/hal/platforms/AT91SAM7/serial_lld.c * ChibiOS_2.0.6/os/hal/platforms/LPC214x/serial_lld.c * ChibiOS_2.0.6/os/hal/platforms/STM32/hal_lld_f103.h * ChibiOS_2.0.6/os/hal/platforms/STM32/hal_lld_f105_f107.h * ChibiOS_2.0.6/os/hal/platforms/STM32/pwm_lld.c * ChibiOS_2.0.6/os/hal/platforms/STM32/serial_lld.h * ChibiOS_2.0.6/os/hal/platforms/STM32/spi_lld.h * ChibiOS_2.0.6/os/hal/src/adc.c * ChibiOS_2.0.6/os/hal/src/spi.c * ChibiOS_2.0.6/os/kernel/include/ch.h * ChibiOS_2.0.6/os/kernel/include/chinline.h * ChibiOS_2.0.6/os/kernel/include/chioch.h * ChibiOS_2.0.6/os/kernel/include/chstreams.h * ChibiOS_2.0.6/os/kernel/include/chthreads.h * ChibiOS_2.0.6/os/kernel/src/chlists.c * ChibiOS_2.0.6/os/kernel/src/chschd.c * ChibiOS_2.0.6/os/kernel/src/chthreads.c * ChibiOS_2.0.6/os/ports/GCC/ARM/rules.mk * ChibiOS_2.0.6/os/ports/GCC/ARM7/chcore.h * ChibiOS_2.0.6/os/ports/GCC/ARM7/port.dox * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v6m.c * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v6m.h * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v7m.c * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/chcore_v7m.h * ChibiOS_2.0.6/os/ports/GCC/ARMCMx/old/chcore_v7m.h * ChibiOS_2.0.6/os/ports/GCC/AVR/chcore.h * ChibiOS_2.0.6/os/ports/GCC/AVR/port.dox * ChibiOS_2.0.6/os/ports/GCC/MSP430/chcore.c * ChibiOS_2.0.6/os/ports/GCC/MSP430/chcore.h * ChibiOS_2.0.6/os/ports/GCC/MSP430/port.dox * ChibiOS_2.0.6/os/ports/GCC/PPC/chcore.h * ChibiOS_2.0.6/os/ports/GCC/PPC/port.dox * ChibiOS_2.0.6/os/ports/RC/STM8/port.dox * ChibiOS_2.0.6/os/various/memstreams.h * ChibiOS_2.0.6/readme.txt * ChibiOS_2.0.6/docs/*/*: Updated 2010-11-14 NIIBE Yutaka * src/openpgp.c (cmd_pso): DigestInfo by SHA256 is supported. 2010-11-12 NIIBE Yutaka * src/usb_desc.c (gnukConfigDescriptor): Change dwFeatures. * src/usb-icc.c (icc_send_params): Always return fixed result. (icc_handle_data): Support ICC_GET_PARAMS. 2010-11-10 NIIBE Yutaka * src/usb_desc.c (gnukConfigDescriptor): Fix bmAttributes. 2010-11-09 NIIBE Yutaka * Version 0.4. * src/usb_desc.c (gnukStringSerial): Updated. * ChibiOS_2.0.2/os/hal/platforms/STM32/pal_lld.h (PALConfig): STBee Mini uses STM32F103CBT6 which expose no GPIO E port. * ChibiOS_2.0.2/os/hal/platforms/STM32/pal_lld.c (_pal_lld_init): Likewise. 2010-11-08 NIIBE Yutaka * tool/dump_mem.py: New tool. Implement GC for data pool in flash memory. * src/openpgp-do.c (gpg_write_digital_signature_counter): New. (gpg_increment_digital_signature_counter): Fix for GC. (gpg_data_scan): Rename from gpg_do_table_init. (gpg_data_copy): New function for copying GC. * src/main.c (main): Call gpg_data_scan with the address which flash_init returns. * src/flash.c (flash_erase_page): New function. (FLASH_DATA_POOL_SIZE): data_pool is 2KiB now. (flash_data): Put a header (GC generation). (flash_init): Implement choosing a data pool page. (flash_data_pool): Removed. (flash_copying_gc): New function. (flash_data_pool_allocate): Call flash_copying_gc when full. (flash_do_write_internal, flash_put_data_internal) (flash_bool_write_internal, flash_cnt123_write_internal): New * src/gnuk.ld.in (gnuk_flash): data_pool is 2KiB now. Bug fixes. * src/openpgp.c (cmd_change_password, cmd_reset_user_password): Write to APDU correctly. * src/flash.c (flash_warning): Make it public. * src/openpgp-do.c (do_hist_bytes, do_fp_all, do_cafp_all) (do_kgtime_all, do_ds_count): Fix return value. (rw_pw_status): Correctly return value. (proc_resetting_code): Change func proto. to return success/failure. (proc_key_import): Ditto. (gpg_do_put_data): Handle return values. (gpg_do_write_simple): Don't write to APDU. 2010-11-05 NIIBE Yutaka Bug fixes. * src/openpgp.c (gpg_change_keystring): Handle GPG_KEY_FOR_AUTHENTICATION. * src/openpgp-do.c (gpg_do_write_prvkey): Remove multiple call of flash_do_release. Bug fix. * src/openpgp-do.c (gpg_do_write_prvkey): Don't hardcode 6, but use strlen. * src/flash.c, src/gnuk.ld.in: Rename "Flash DO Pool" to "Flash Data Pool", because it's not only DO. * src/gnuk.h, src/opengpg-do.c: Cleanup. Digital Signature Counter implementation improvement. * src/gnuk.h (NR_DO_DS_COUNT): Removed. (NR_COUNTER_DS, NR_COUNTER_DS_LSB): New. * src/openpgp-do.c (do_ds_count_initial_value): Removed. (gpg_do_increment_digital_signature_counter): Removed. (digital_signature_counter): New variable. (do_ds_count, gpg_increment_digital_signature_counter): New functions. (gpg_do_table): Change the entry for GPG_DO_DS_COUNT as DO_PROC_READ. (gpg_do_table_init): Handle digital_signature_counter. * src/flash.c (flash_data_pool_allocate, flash_put_data): New. Password status implementation improvement. * src/gnuk.h (PW_STATUS_PW1, PW_STATUS_RC, PW_STATUS_PW3): Removed. (PW_ERR_PW1, PW_ERR_RC, PW_ERR_PW3): New define. (NR_COUNTER_123, NR_BOOL_PW1_LIFETIME): New define. (NR_NONE, NR_EMPTY): New define. * src/flash.c (flash_bool_clear, flash_bool_write) (flash_cnt123_get_value, flash_cnt123_increment) (flash_cnt123_clear): New functions. * src/openpgp-do.c (do_pw_status_bytes_template): Removed. (PW_STATUS_BYTES_TEMPLATE, gpg_do_reset_pw_counter): Removed. (PASSWORD_ERRORS_MAX, PW_LEN_MAX): New define. (pw1_lifetime_p, pw_err_counter_p): New variables. (gpg_get_pw1_lifetime): New function. (gpg_get_pw_err_counter, gpg_passwd_locked, gpg_reset_pw_counter) (gpg_increment_pw_counter): New functions. (rw_pw_status): Use pw1_lifetime_p and pw_err_counter_p. (gpg_do_table_init): Handle NR_COUNTER_123 and NR_BOOL_PW1_LIFETIME. * src/ac.c (verify_pso_cds, verify_pso_other, verify_admin_0): Follow the changes. * src/openpgp.c (cmd_change_password, cmd_reset_user_password) (cmd_pso, cmd_internal_authenticate): Likewise. 2010-11-04 NIIBE Yutaka * src/flash.c (flash_warning): New. (flash_do_pool): Added header for DO pool. (flash_do_release): Fill zero. (flash_do_write): Change DO format in flash. * src/openpgp-do.c (gpg_do_table_init, copy_do_1) (gpg_do_read_simple): Follow the change of DO format in flash. * src/openpgp-do.c (DO_CMP_READ): Renamed. (cmp_ch_data, cmp_app_data, cmp_ss_temp): Likewise. (with_tag): Removed static global variable. (do_hist_bytes, do_fp_all, do_cafp_all, do_kgtime_all) (rw_pw_status, copy_do_1, copy_do, gpg_do_get_data): Added with_tag argument. (gpg_do_put_data): length > 255 will be error. 2010-11-03 NIIBE Yutaka Bug fixes. * src/ac.c (verify_admin_0): Initialize pwsb earlier. * src/openpgp-do.c (copy_do_1): Access do_data[0] (was: do_data[1]). 2010-11-02 NIIBE Yutaka DfuSe support. * tool/dfuse.py (DFU_STM32.download): Put '#' for each 4-KiB. Added 0-length write to finish download. Take intel_hex object as argument. (DFU_STM32.ll_upload_block): New method. (DFU_STM32.dfuse_read_memory): New method. (DFU_STM32.verify): New method. (get_device): Support DFU_STM32PROTOCOL_0 too (for CQ STARM). * tool/dfuse.py: Renamed from dfu_stmicroelectronics_extention.py. 2010-11-01 NIIBE Yutaka * tool/intel_hex.py: New file. * tool/dfu_stmicroelectronics_extention.py: New file. 2010-10-28 NIIBE Yutaka * src/gnuk.h (OPENPGP_CARD_INITIAL_PW3): New. * src/ac.c (verify_admin_0): Use OPENPGP_CARD_INITIAL_PW3. 2010-10-23 NIIBE Yutaka * Version 0.3. * src/usb_desc.c (gnukStringSerial): Updated. 2010-10-22 NIIBE Yutaka * src/gnuk.ld.in (.gnuk_random): Fix description so that padding with 0xffffffff will be in gnuk.hex. * src/openpgp.c (file_selection): Change type (was: int). (FILE_NONE..FILE_EF_SERIAL): Change the values. * src/configure: Added STBee Mini support. * boards/STBEE_MINI/mcuconf.h: New. * boards/STBEE_MINI/board.mk: New. * boards/STBEE_MINI/board.h: New. * boards/STBEE_MINI/board.c: New. * ChibiOS_2.0.2/os/hal/platforms/STM32/hal_lld.c (pal_default_config): STBee Mini uses STM32F103CBT6 which expose no GPIO E port. 2010-10-21 NIIBE Yutaka * boards/common/hw_config.c (Get_SerialNum): Removed. * src/usb_prop.c (gnuk_device_init): Remove calling Get_SerialNum. * src/usb_desc.c (gnukStringSerial): Updated. * boards/CQ_STARM/board.c (set_led): Fix polarity. 2010-10-20 NIIBE Yutaka * FSIJ_SERIAL_NUMBER: New. * src/configure (with_fsij): Added FSIJ serial number support. * src/config.h.in (@FSIJ_DEFINE@, @SERIAL_NUMBER_FOUR_BYTES@): New. * src/configure: Added CQ STARM target. * boards/CQ_STARM/mcuconf.h: New. * boards/CQ_STARM/board.mk: New. * boards/CQ_STARM/board.h: New. * boards/CQ_STARM/board.c: New. 2010-10-19 NIIBE Yutaka * boards/STM32_PRIMER2/board.mk (BOARDSRC): Use common/hw_config.c. * boards/OLIMEX_STM32_H103/board.mk (BOARDSRC): Likewise. * boards/common/hw_config.c: Move board specific functions to ... * boards/STM32_PRIMER2/board.c (USB_Cable_Config, set_led): ... here. * boards/OLIMEX_STM32_H103/board.c (USB_Cable_Config, set_led): Ditto. * boards/{OLIMEX_STM32_H103,STM32_PRIMER2}/hw_config.c: Removed. * boards/common/hw_config.c: New file (was: boards/*/hw_config.c). * .gitignore: New file. 2010-10-16 NIIBE Yutaka Implement "INTERNAL AUTHENTICATE" command. * src/gnuk.h (BY_USER, BY_RESETCODE, BY_ADMIN): New defines. (NUM_ALL_PRV_KEYS): Now it's 3 (was: 2). * src/openpgp.c (INS_INTERNAL_AUTHENTICATE): New define. (cmd_internal_authenticate): New function. (cmds): Added INS_INTERNAL_AUTHENTICATE. (cmd_change_password): Use BY_USER. (cmd_reset_user_password): Use BY_USER, BY_RESETCODE, BY_ADMIN. (cmd_pso): Load GPG_KEY_FOR_DECRYPTION here. (cmd_pso): Removed adding status word into res_APDU... * src/call-rsa.c (rsa_sign): and moved adding status word into res_APDU here. * src/ac.c (pw1_keystring): New variable. (ac_reset_pso_other): Clear pw1_keystring. (verify_pso_cds): Use BY_USER. (verify_pso_other): Just check the length of password here, and defer real check to cmd_pso or cmd_internal_authenticate. 2010-10-14 NIIBE Yutaka Adding 'configure' support. * src/configure: New file. * src/Makefile.in: Renamed from src/Makefile. * src/config.h: Renamed from src/config.h. * src/gnuk.ld: Renamed from src/gnuk.ld. Adding DFU_SUPPORT. * boards/common/hwinit0.c: New file adding DFU_SUPPORT. * boards/common/hwinit1.c: New file. * boards/OLIMEX_STM32_H103/board.c: Include config.h. Use common/hwinit0.c and common/hwinit1.c. * boards/STM32_PRIMER2/board.c: Likewise. 2010-09-16 NIIBE Yutaka * src/usb-icc.c (icc_error): New function. (icc_handle_data): Call icc_error. Don't go to STATE_START on errors. 2010-09-13 NIIBE Yutaka * Version 0.2. * src/openpgp.c (cmd_select_file): Override data of number_of_bytes. * src/openpgp-do.c (gpg_do_table_init): Calculate number of byte which Data Objects consumes. 2010-09-12 Kaz Kojima * src/call-rsa.c (rsa_decrypt): Debug output only when DEBUG. * boards/STM32_PRIMER2/hw_config.c (USB_Cable_Config): Fix GPIO. (set_led): Ditto. * boards/STM32_PRIMER2/board.c (hwinit1): Added LED initialization. 2010-09-11 NIIBE Yutaka * src/usb-icc.c (ATR): Fixed. (icc_send_params): New function. (icc_handle_data): Handle ICC_SET_PARAMS request. * src/random.c (random_bytes_get, random_bytes_free, get_random): Clear used random bytes. * src/flash.c (flash_clear_halfword): New function. 2010-09-10 NIIBE Yutaka * Version 0.1. * src/usb_desc.c (gnukStringSerial): Change the value so that libccid doesn't get confused. * src/openpgp.c (gpg_change_keystring): Support key for decryption as well. (cmd_read_binary): Use openpgpcard_aid. (cmd_pso): call ac_reset_pso_other. * src/openpgp-do.c (openpgpcard_aid): Renamed from aid, and exported. (do_ds_count_initial_value): New const variable. (num_prv_keys): New variable. (gpg_do_write_prvkey): Remove contents of keystring only if ++num_prv_keys == NUM_ALL_PRV_KEYS. (gpg_do_chks_prvkey): Call flash_do_release. (gpg_do_table_init): Initialize with do_ds_count_initial_value. Initialize num_prv_keys. (gpg_do_write_simple): Support removing DO. (gpg_do_increment_digital_signature_counter): Call flash_do_release. * src/gnuk.h (NUM_ALL_PRV_KEYS): New definition. (OPENPGP_CARD_INITIAL_PW1): New definition. (enum kind_of_key): Rename. * src/ac.c (ac_reset_pso_cds): New function. 2010-09-09 Kaz Kojima * boards/STM32_PRIMER2/{board.c,board.h,board.mk,hw_config.c,mcuconf.h}: New files. * boards/OLIMEX_STM32_H103/{mcuconf.h,hw_config.c}: Moved from src. * src/main.c (main): Use set_led instead of palClearPad directly. 2010-09-08 NIIBE Yutaka * src/ac.c (calc_md): Make SHA1 variable auto. * src/debug.c (put_int): New. * src/gnuk.ld (__process_stack_size__): Removed. * src/main.c (STDOUTthread): Use Event. (main): Make LED ON during command execution, blink usually. * src/openpgp-do.c (encrypt, decrypt): Make AES variables auto. (gpg_do_table): GPG_DO_ALG_AUT is NULL. * src/openpgp.c (cmd_pso): Bug fix for extended Lc. * src/usb-icc.c (icc_power_off): Make LED ON during command execution. (USB_ICC_TIMEOUT): Longer value (was: 1000). * src/usb_desc.c (gnukConfigDescriptor): Fix bcdCCID value. * src/vcomport.mk (VCOMSRC): Use our own usb_endp.c. * src/usb_desc.c (gnukConfigDescriptor): ICC Descriptor is Revision 1.0. * polarssl-0.14.0/include/polarssl/config.h: Commend out POLARSSL_SELF_TEST. * polarssl-0.14.0/library/rsa.c (rsa_private): Don't check input, so that we don't access ctx->N. (rsa_pkcs1_decrypt): size of BUF is enough as 256. * polarssl-0.14.0/library/sha1.c (sha1_file): #if-out to avoid stdio of libc. * polarssl-0.14.0/library/bignum.c (mpi_write_hlp) (mpi_write_string, mpi_read_file, mpi_read_file): #if-out to avoid stdio of libc. 2010-09-07 NIIBE Yutaka * gnuk.svg: New file. 2010-09-06 NIIBE Yutaka * Initial version 0.0.