2015-07-07 Niibe Yutaka * src/Makefile.in (CSRC): Add ecc-mont.c. * src/ecc-mont.c (mod25638_mul_121665): Fix. (ecdh_compute_public_25519, ecdh_decrypt_curve25519): New. * src/openpgp.c (cmd_pso): Support ALGO_CURVE25519. * src/openpgp-do.c (algorithm_attr_cv25519): New. (rw_algorithm_attr, get_algo_attr_data_object) (gpg_get_algo_attr_key_size, gpg_do_write_prvkey) (proc_key_import, gpg_do_public_key): Support ALGO_CURVE25519. * src/gnuk.h (ALGO_CURVE25519): New. 2015-07-06 Niibe Yutaka Enhancement for FSM-55. * tool/stlinkv2.py (stlinkv2.control_nrst): New. (stlinkv2.get_rdp_key,has_spi_flash,has_protection): New. (stlinkv2.get_core_id): Rename. (stlinkv2.blank_check): Use self.flash_size. (stlinkv2.start): Call control_nrst. Call get_core_id. Distinguishing chip, and set rdp_key, flash_size and require_nrst. (stlinkv2.flash_write): Use self.flash_block_size. (main): Call control_nrst. (prog_flash_write_body, prog_option_bytes_write_body) (prog_blank_check_body): Support Cortex-M0. (main): Call API V2 halt twice. * tool/asm-thumb/*.S: Updated for Cortex-M0. 2015-06-30 Niibe Yutaka * chopstx: Update. * src/sys.c: Update from chopstx/example-cdc/sys.c. * src/main.c (device_initialize_once): Apply change of NeuG. 2015-06-03 Niibe Yutaka * VERSION: 1.1.5. * test/ecc_nistp256_keys.py: New. * tool/upgrade_by_passwd.py: Remove -p option and add -f option. * tool/gnuk_token.py (gnuk_token.download): Add verbose flag. (regnual.download): Ditto. * tool/gnuk_upgrade.py: Use gnuk_token module. 2015-06-02 Niibe Yutaka * src/openpgp.c (cmd_pso): Support OpenPGPcard spec v3.0. 2015-04-20 Niibe Yutaka * chopstx: Upgrade to 0.05. 2015-04-19 Niibe Yutaka * src/gnuk.h (CCID_CARD_INIT): New. * src/usb_desc.c (gnukConfigDescriptor): Update dwDefaultClock, dwMaximumClock, dwFeatures, and bClassEnvelope. * src/usb_ctrl.c (freq_table): Change the value to 4000MHz. (usb_cb_handle_event): Call ccid_card_change_signal after configure. * src/usb-icc.c (ccid_thread): Change EV_CARD_CHANGE handling. 2015-04-18 Niibe Yutaka * src/main.c (main): Call chopstx_main_init. * src/Makefile.in (DEFS): Remove CHX_PRIO_MAIN. 2015-04-17 Niibe Yutaka * src/configure: Fix shell syntax. 2015-03-31 Niibe Yutaka * src/usb_conf.h (ICC_NUM_INTERFACES, HID_NUM_INTERFACES) (HID_NUM_INTERFACES, VCOM_NUM_INTERFACES, MSC_NUM_INTERFACES) (NUM_INTERFACES): Define here (moved from usb_desc.c). (ICC_INTERFACE, HID_INTERFACE, VCOM_INTERFACE_0, VCOM_INTERFACE_1) (MSC_INTERFACE): New. * src/usb_ctrl.c (gnuk_setup_endpoints_for_interface) (usb_cb_setup, usb_cb_ctrl_write_finish): Use *_INTERFACE. * src/usb_desc.c (gnukConfigDescriptor): Likewise. 2015-03-06 Niibe Yutaka * src/ecc-edwards.c (eddsa_sign_25519): Return 0. 2015-02-25 Niibe Yutaka * src/openpgp.c (cmd_internal_authenticate): Fix storing to res_APDU_size. 2015-02-10 Niibe Yutaka * src/openpgp.c (cmd_pso): Fix counter update for EdDSA. Thanks to Jonathan Schleifer. * src/call-rsa.c (rsa_sign): Don't set res_APDU_len. (rsa_decrypt): Likewise, but get OUTPUT_LEN_P as an argument. 2015-02-09 Niibe Yutaka * src/openpgp.c (cmd_pso): Fix EdDSA. Use GPG_KEY_FOR_SIGNING. 2014-12-15 Niibe Yutaka * VERSION: 1.1.4. 2014-12-13 Niibe Yutaka * src/flash.c (flash_key_getpage, flash_key_release_page): New. * src/openpgp-do.c (gpg_do_delete_prvkey): New arg. (rw_algorithm_attr): Call gpg_do_delete_prvkey with CLEAN_PAGE_FULL. 2014-12-12 Niibe Yutaka * src/Makefile.in (build/bignum.o): Specific OPT for this target. * src/configure (target): Default is FST-01. (--with-dfu): FST-01 doesn't have DFU. If set, it must be mistake. * boards/STBEE_MINI: Remove, since it is now supported by Chopstx. * test/features/802_get_data_static.feature: Reflect the change of extended capabilities. * test/features/402_get_data_static.feature: Ditto. * test/features/002_get_data_static.feature: Ditto. * test/features/003_keyattr_change.feature: New test. * src/usb_lld.h: Don't use 'extern' for function declarations. * src/usb-icc.c (end_cmd_apdu_data): Fix Le handling. 2014-12-11 Niibe Yutaka * chopstx: Upgrade to 0.04. * src/syc.c: Update from 0.04. 2014-12-10 Niibe Yutaka * src/ecc-cdh.c: Remove as smartcard only does a part of ECDH computation as gpg-agent does. * src/chconf.h, src/halconf.h: Remove files needed for ChibiOS/RT. 2014-12-09 Niibe Yutaka * src/call-ec.c (ecc_compute_public): Rename, as we share same routine among ECDSA and ECDH. (ecdh_decrypt): New. 2014-12-09 Niibe Yutaka * src/ecc.c (compute_kP): Bug fix. It's P, not G. (point_is_on_the_curve): Bug fix. 2014-12-03 Niibe Yutaka Changes for RSA-4096. * src/gnuk.h (MAX_CMD_APDU_DATA_SIZE, MAX_RES_APDU_DATA_SIZE): Send/Recv buffer should be bigger. * polarssl/library/bignum.c (mpi_exp_mod): Don't consume much. * polarssl/library/rsa.c (rsa_rsaes_pkcs1_v15_decrypt): buffer allocation size should be variable. 2014-12-01 Niibe Yutaka * src/Makefile.in (DEFS): Don't define compile time preference of key algo attributes. * src/openpgp-do.c (proc_key_import): Support modifiable key algo attributes. 2014-11-21 Niibe Yutaka * src/gnuk.h (ALGO_RSA4K, ALGO_NISTP256R1, ALGO_SECP256K1) (ALGO_ED25519, ALGO_RSA2K): New. (struct key_data_internal): Move to ... * src/openpgp-do.c (struct key_data_internal): ... here. (CHECKSUM_ADDR, kdi_len): New. (CKDC_CALC, CKDC_CHECK): New. (compute_key_data_checksum): Add arg PRVKEY_LEN. (gpg_do_load_prvkey, gpg_do_delete_prvkey): Support modifiable key algo attributes. (gpg_do_write_prvkey, gpg_do_public_key, gpg_do_keygen): Likewise. (gpg_do_clear_prvkey): Use MAX_PRVKEY_LEN. * src/openpgp.c (gpg_init): Call flash_init_keys after gpg_data_scan. (cmd_pso): Support modifiable key algo attributes. (cmd_internal_authenticate): Likewise. 2014-11-21 Niibe Yutaka * src/openpgp-do.c (algorithm_attr_rsa2k): Rename from *_rsa. (algorithm_attr_rsa4k): New. (get_algo_attr_pointer, kk_to_nr, gpg_get_algo_attr) (get_algo_attr_data_object, gpg_get_algo_attr_key_size): New. (rw_algorithm_attr): New. (gpg_do_table): Register rw_algorithm_attr for GPG_DO_ALG_*. (gpg_data_scan, gpg_data_copy): Handle algo attributes. (rw_pw_status): Fix checking against redundant write. 2014-11-20 Niibe Yutaka * src/openpgp-do.c (extended_capabilities): Key attributes can be modifid now. 2014-11-20 Niibe Yutaka * src/gnuk.h (NR_NONE, NR_DO__FIRST__): Remove. (NR_DO_*): Redefine. (NR_KEY_ALGO_ATTR_SIG, NR_KEY_ALGO_ATTR_DEC) (NR_KEY_ALGO_ATTR_AUT): New. * src/openpgp-do.c (gpg_do_load_prvkey, gpg_do_delete_prvkey) (gpg_do_write_prvkey, gpg_do_chks_prvkey, gpg_data_scan) (gpg_data_copy, gpg_do_read_simple) (gpg_do_write_simple): Don't use NR_DO__FIRST__. (gpg_do_put_data): Don't use NR_NONE any more. (do_tag_to_nr): Use -1 to specify NONE. * src/flash.c (flash_enum_clear, flash_enum_write_internal) (flash_enum_write): New. 2014-11-19 Niibe Yutaka * src/gnuk.h (FIRMWARE_UPDATE_KEY_CONTENT_LEN): New. (size_of_key): New enum. * src/openpgp.c (gpg_get_firmware_update_key) (cmd_read_binary, cmd_external_authenticate): Use FIRMWARE_UPDATE_KEY_CONTENT_LEN. * src/flash.c (KEY_SIZE): Remove. (key_available_at): Add new arg as KEY_SIZE. (flash_check_all_other_keys_released): Likewise. (flash_key_fill_zero_as_released, flash_key_release): Likewise. (flash_init): Move initializing keys into another function. (flash_init_keys): New function. (flash_key_alloc): Use gpg_get_algo_attr_key_size. (flash_key_write): Add new arg as KEY_DATA_LEN. (flash_write_binary): Use FIRMWARE_UPDATE_KEY_CONTENT_LEN. 2014-09-16 Niibe Yutaka * src/gnuk.h (MAX_PRVKEY_LEN): New. (KEY_CONTENT_LEN): Remove. * src/call-rsa.c (RSA_SIGNATURE_LENGTH): Remove. (rsa_sign, rsa_verify, rsa_genkey): Add new arg: PUBKEY_LEN. (rsa_decrypt): Don't use KEY_CONTENT_LEN. 2014-06-19 Niibe Yutaka * src/ecc-mont.c (compute_nQ): Add comment. * src/mod.c (mod_inv): Fix comment. X^-1 = 0 when X=0 is important for Montgomery curve computation. 2014-06-05 Niibe Yutaka * tool/add_openpgp_authkey_from_gpgssh.py: New. 2014-04-17 Niibe Yutaka * src/muladd_256.h (MULADD_256_ASM): New. (MULADD_256): Use MULADD_256_ASM. * src/ecc-mont.c (mod25638_mul_121665): Add asm implementation. * src/bn.c (bn256_add_uint, bn256_sub_uint): Simplify. * src/mod25638.c (mod25638_add, mod25638_sub): Simplify. (n25638, add19): Remove. (ADDWORD_256): Add s_ as source pointer. (mod25519_reduce): Remove a call to memcpy. Use bn256_add_uint. * src/ecc-edwards.c (point_double): Simplify. 2014-04-16 Niibe Yutaka * VERSION: 1.1.3. 2014-04-15 Niibe Yutaka * src/ecc-mont.c: New. * src/mod25638.c (p25519): Move from ecc-edwards.c. (mod25519_reduce, add19): Likewise. (mod25638_reduce) [!ASM_IMPLEMENTATION]: Use bn256_add_uint. 2014-04-14 Niibe Yutaka * src/jpc.c (jpc_to_ac): Error check before mod_inv. * src/mod.c (mod_inv): No return value (if N==0 returns ZERO). * src/bn.c [BN256_NO_RANDOM]: Only include "random.h" if needed. 2014-04-08 Niibe Yutaka * src/mod.c (mod_inv): Use MAX_GCD_STEPS_BN256. Return failure or success. * src/jpc.c (jpc_to_ac): Use mod_inv. * src/modp256k1.c (modp256k1_inv): Remove. * src/modp256r1.c (modp256r1_inv): Remove. 2014-04-07 Niibe Yutaka * src/openpgp-do.c (algorithm_attr_ed25519): It's OID only. 2014-04-03 Niibe Yutaka * src/ecc-edwards.c (eddsa_sign_25519): Change type of OUT. * src/openpgp.c (cmd_internal_authenticate): Have a buffer. * src/flash.c (flash_init): Fix key address finder. 2014-04-02 Niibe Yutaka * src/openpgp-do.c (proc_key_import): Handle EdDSA. (algorithm_attr_ed25519): Fix OID and add ID for SHA512. 2014-04-01 Niibe Yutaka * src/ecc-edwards.c (eddsa_compute_public_25519): New. * src/openpgp-do.c (algorithm_attr_ed25519): New. (gpg_do_write_prvkey, proc_key_import, gpg_do_public_key): Add EdDSA handling. 2014-03-31 Niibe Yutaka * src/ecc-edwards.c (eddsa_sign_25519): Rename and API change. * src/openpgp-do.c (gpg_do_load_prvkey, gpg_do_delete_prvkey) (gpg_do_write_prvkey, gpg_do_public_key, gpg_do_keygen): Follow the change of PRVKEY_DATA and KEY_DATA. * src/flash.c (key_available_at): New. (flash_init): Initilize KD. * src/gnuk.h (struct prvkey_data): Remove member KEY_ADDR. (struct key_data): Addd member KEY_ADDR. * src/openpgp-do.c (gpg_do_keygen): Bug fix. Reset the signature counter when new key is generated. * src/flash.c (flash_key_alloc): Change API, supply KK. 2014-03-29 Niibe Yutaka * src/ecc-edwards.c (point_double, point_add): Rename. (mod25519_reduce): New. 2014-03-28 Niibe Yutaka * misc/t-eddsa.c (main): Update for new API of eddsa_25519. * src/ecc-edwards.c (compute_kG_25519): Tune for 252-bit. (eddsa_25519): Public key should be provided by caller. (eddsa_public_key_25519): New. 2014-03-27 Niibe Yutaka * src/ecc-edwards.c (ed_add_25638): Remove the third argument. (compute_kG_25519): The curve is complete, we don't need to avoid identity element as NIST curve or secp256k1 curve. (eddsa_25519): Change the API, with A and the seed. 2014-03-26 Niibe Yutaka * src/mod25638.c (mod25638_reduce): New. (mod25638_mul, mod25638_sqr): Use mod25638_reduce. * src/ecc-edwards.c (ptc_to_ac_25519): No need to subtract p25519. 2014-03-25 Niibe Yutaka * misc/t-eddsa.c: New. * src/ecc-edwards.c (bnX_mul_C, mod_reduce_M): New. (eddsa_25519): New. 2014-03-20 Niibe Yutaka * src/ecc-edwards.c (ed_add_25638): Fix for X == A. (main): Compute pre-computed tables. (precomputed_KG, precomputed_2E_KG): Add. (compute_kG_25519): New. 2014-03-19 Niibe Yutaka * src/bn.c (bn256_add): Fix for X == B. (bn256_sub): Likewise. * src/ecc-edwards.c: New. 2014-03-18 Niibe Yutaka * src/mod25638.c (mod25638_add, mod25638_sub, mod25638_sqr) (mod25638_shift): New. 2014-03-13 Niibe Yutaka * src/mod25638.c: Rename from fe25519.c. * src/mod25638.h: Likewise. 2014-03-07 Niibe Yutaka * VERSION: 1.1.2. 2014-02-25 Niibe Yutaka * src/openpgp-do.c (gpg_do_public_key): Don't put OID. * src/configure [certdo] (gnuk.ld): Add TIM_SIZE and EXT_SIZE. Thanks to Vasily Evseenko for the bug report. 2014-02-21 Niibe Yutaka * src/ecc.c (compute_kG): Compute higer index at first. (point_is_on_the_curve): Don't use coefficient_a if it's zero. * src/jpc.c (jpc_double): Care coefficient A. * src/ec_p256r1.c (COEFFICIENT_A_IS_MINUS_3): New. * src/ec_p256k1.c (COEFFICIENT_A_IS_ZERO): New. * src/jpc_p256r1.c (COEFFICIENT_A_IS_MINUS_3): Likewise. * src/jpc_p256k1.c (COEFFICIENT_A_IS_MINUS_3): Likewise. * src/modp256k1.c (modp256k1_shift): Bug fix. 2014-02-20 Niibe Yutaka * src/Makefile.in (CSRC): Add files of p256k1. * src/openpgp.c (cmd_pso): Support p256k1 for signature. * src/openpgp-do.c (algorithm_attr_p256k1): New. (gpg_do_write_prvkey): Support p256k1 for signature. (proc_key_import, gpg_do_table, gpg_do_public_key): Likewise. * src/Makefile.in (DEFS): Add -DRSA_SIG. * src/openpgp-do.c (gpg_do_write_prvkey): Use _p256r1. * src/openpgp.c (cmd_internal_authenticate): Likewise. * src/call-ec_p256k1.c: New. Use call-ec.c. * src/call-ec_p256r1.c: Use call-ec.c. * src/call-ec.c: New. (ecdsa_sign): Change the signature. 2014-02-19 Niibe Yutaka * tool/calc_precompute_table_ecc.py: New. * src/ec_p256k1.c: New. Use ecc.c. * src/ec_p256k1.h: New. * src/ec_p256r1.c: Use ecc.c. * src/ecc.c: New. 2014-02-18 Niibe Yutaka * src/jpc_p256k1.c: New. Use jpc.c. * src/jpc_p256r1.c: Use jpc.c. * src/jpc.c: New. * src/sha256.c (memcpy_output_bswap32): Bug fix. * src/modp256k1.h, src/modp256k1.c: New. 2014-02-17 Niibe Yutaka * src/Makefile.in (CSRC): Follow the changes of filenames. * src/modp256r1.c (modp256r1_add, modp256r1_sub, S3) (modp256r1_mul, modp256r1_sqr, modp256r1_inv, modp256r1_shift): Use new function names. * src/jpc_p256r1.c (jpc_double_p256r1, jpc_add_ac_signed_p256r1) (jpc_to_ac_p256r1): Likewise. * src/ec_p256r1.c (point_is_on_the_curve) (compute_kG_p256r1, compute_kP_p256r1): Likewise. * src/call-ec_p256r1.c (ecdsa_sign): Likewise. * src/modp256r1.h: Rename from modp256.h. * src/jpc-ac_p256r1.h: Rename from jpc-ac.h. * src/ec_p256r1.h: Rename from ec_p256.h. * src/modp256r1.c: Rename from modp256.c. * src/jpc_p256r1.c: Rename from jpc.c. * src/ec_p256r1.c: Rename from ec_p256.c. * src/call-ec_p256r1.c: Rename from call-ec_p256.c. 2014-02-05 NIIBE Yutaka * src/sha512.h, src/sha512.c: New. * src/sha256.c (initial_state): Don't export, it's internal. (memcpy_output_bswap32): Rename and remove last argument. 2014-01-28 Niibe Yutaka * src/muladd_256.h: New. * src/bn.c (bn256_mul, bn256_sqr): Assembler implementation. * src/ec_p256.c (get_vk_kP): Bug fix. (compute_kP): Bug fix for index table. 2014-01-27 Niibe Yutaka * src/ec_p256.c (get_vk_kP): New. (naf4_257_set, naf4_257_get, compute_naf4_257): Remove. (compute_kP): Change the argument, fixing for constant time. 2014-01-24 Niibe Yutaka * src/ec_p256.c (get_vk): New. (compute_kG): Fix for constant time. (compute_kP): Simplify. 2014-01-23 Niibe Yutaka * src/jpc.c (jpc_add_ac_signed): Fix for constant time. * src/ec_p256.c (ecdsa): Bug fix for k selection. 2014-01-22 Niibe Yutaka * src/modp256.c (modp256_inv): Fix for constant time. * src/bn.c (bn256_sqr): Fix for constant time. * src/mod.c (mod_inv): Fix for constant time. * src/ec_p256.c (compute_kG): Simplify. * src/jpc.c (jpc_double): Support calling with A = infinity. 2014-01-21 Niibe Yutaka * src/jpc.c (jpc_add_ac_signed): Bug fix for A check. * src/ec_p256.c (ecdsa): Fix for constant time. * src/modp256.c (modp256_add, modp256_sub, modp256_reduce) (modp256_shift): Fix for constant time. (modp256_inv): Likewise (not fully constant time, yet). * src/mod.c (mod_reduce): Fix for constant time. (mod_inv): Likewise (not fully constant time, yet). * src/bn.h (bn256, bn512): words -> word. * src/ec_p256.h (naf4_257): Likewise. 2014-01-20 Niibe Yutaka * src/fe25519.h, src/fe25519.c: New. 2014-01-15 Niibe Yutaka * src/bn.c (bn256_is_zero, bn256_is_ge, bn256_cmp): Computation should be constant time. 2013-12-25 Niibe Yutaka * VERSION: 1.1.1. * tool/gnuk_token.py (gnuk_token.__init__, regnual.__init__): Fix the argument of setAltInterface. * tool/gnuk_upgrade.py: Likewise. * tool/dfuse.py (DFU_STM32.__init__): Likewise. * tool/stlinkv2.py (stlinkv2.__init__): Likewise. 2013-12-24 Niibe Yutaka * polarssl/include/polarssl/bn_mul.h (MULADDC_1024_CORE) (MULADDC_1024_LOOP): Use younger number registers more for shorter instructions and better performance. * polarssl/library/bignum.c (mpi_montsqr): Likewise. Change loop structure and conditional branch for better performance. 2013-12-23 Niibe Yutaka * polarssl/library/bignum.c (mpi_montmul): Computation time should not depends on input. (mpi_montmul, mpi_montred, mpi_montsqr): Change the API. (mpi_exp_mod): Follow the change of the API. Allocate memory on stack instead of malloc. * src/gnuk.ld.in (__process3_stack_size__): Increase stack size. 2013-12-20 Niibe Yutaka * Version 1.1.0. * src/usb_ctrl.c (USB_FSIJ_GNUK_CARD_CHANGE): New. (usb_cb_setup): Support USB_FSIJ_GNUK_CARD_CHANGE. * src/usb-icc.c (ccid_card_change_signal): New argument HOW. 2013-12-20 Niibe Yutaka * polarssl/include/polarssl/bn_mul.h (MULADDC_1024_CORE) (MULADDC_CORE): Reorder instructions for more speed up. * polarssl/library/bignum.c (mpi_montsqr): Likewise. 2013-12-19 Niibe Yutaka * src/configure (--enable-hid-card-change): New (experimental). * src/config.h.in (HID_CARD_CHANGE_DEFINE): New. * src/usb_ctrl.c (gnuk_setup_endpoints_for_interface) (usb_cb_setup, usb_cb_ctrl_write_finish): Conditionalize HID_CARD_CHANGE_SUPPORT. * src/usb_desc.c (gnukDeviceDescriptor, usb_cb_get_descriptor): Likewise. 2013-12-19 Niibe Yutaka * src/openpgp.c (S2KCOUNT): It's now 192, as the threat model of Gnuk Token is different. 2013-12-19 Niibe Yutaka * polarssl/library/bignum.c (mpi_montsqr): New. (mpi_exp_mod): Use mpi_montsqr. Note that this change introduces a vulnerability by the Yarom/Falkner flush+reload cache side-channel attack. When this code is used on general purpose computer where we can observe which code is executed (sqr or mul), it's not safe. 2013-12-16 Niibe Yutaka * polarssl/include/polarssl/bn_mul.h (MULADDC_1024_CORE) (MULADDC_1024_LOOP, MULADDC_HUIT, MULADDC_INIT, MULADDC_CORE) (MULADDC_STOP) [__arm__]: The value of input B won't change. More acculate specification for asm statement. * polarssl/library/bignum.c (mpi_cmp_abs_limbs): New. (mpi_montmul): Change the signature and use the upper half of T. (mpi_montred): Likewise. (mpi_exp_mod): Use improved mpi_montmul and mpi_montred. (mpi_sub_hlp, mpi_mul_hlp): Add const qualifier for S. 2013-12-13 Niibe Yutaka * polarssl/library/bignum.c (mpi_exp_mod): Initialize lower half of T with zero. (mpi_montmul): Don't need to clear lower half of T, as we keep zero. Call mpi_sub_hlp with upper half of T. (mpi_montred): Ditto. * polarssl/library/bignum.c (mpi_montmul, mpi_montred): Minimize number of limbs for T. (mpi_exp_mod): Only allocate N-n * 2 for T. Only allocate N->n for X, W[i], and RR. 2013-12-13 Niibe Yutaka * tool/upgrade_by_passwd.py (main): Support -k to specify KEYNO. 2013-12-13 Niibe Yutaka * src/usb_ctrl.c (HID_LED_STATUS_CARDCHANGE): Rename from HID_LED_STATUS_NUMLOCK. * tool/gnuk_token.py (gnuk_token.stop_gnuk): Detach kernel driver of HID. 2013-12-12 Niibe Yutaka * src/openpgp-do.c (do_openpgpcard_aid): Coerce to volatile to force memory access at run time. 2013-12-11 Niibe Yutaka * regnual/sys.c (entry): Fix relocation calculation. 2013-11-27 Niibe Yutaka * src/stm32f103.h (AFIO_MAPR_SWJ_CFG_DISABLE): New. * src/sys.c: Likewise. 2013-11-26 Niibe Yutaka * src/usb_desc.c (hid_report_desc): New. (ICC_TOTAL_LENGTH): Update. (HID_TOTAL_LENGTH, HID_NUM_INTERFACES): New. (W_TOTAL_LENGTH, NUM_INTERFACES): Update. (gnukConfigDescriptor): Add IN2 interrupt endpoint descriptor. Add HID interface descriptor. (usb_cb_get_descriptor): Handle HID. * src/usb_ctrl.c (NUM_INTERFACES, MSC_INTERFACE_NO): Add 1. (USB_HID_REQ_*, HID_LED_STATUS_NUMLOCK): New. (gnuk_setup_endpoints_for_interface): Add ENDP2 interrupt endpoint. (usb_cb_setup): Handle HID requests. (usb_cb_ctrl_write_finish): Likewise. * src/usb-icc.c (ccid_card_change_signal): New. (ccid_thread): Handle card change. (icc_error, icc_send_status): Handle ICC_STATE_NOCARD state. (icc_handle_data): Add the case of ICC_STATE_NOCARD. (EP2_IN_Callback): New. 2013-11-26 Niibe Yutaka * src/pin-dial.c: Remove. * src/configure: Remove pin-dial support. 2013-11-25 Niibe Yutaka * src/Makefile.in (HEXOUTPUT_MAKE_OPTION): New. * src/configure (HEXOUTPUT_MAKE_OPTION): New. * src/main.c: Include board.h. * src/stm32f103.h (EXTI0_IRQ, EXTI1_IRQ): New. 2013-11-18 Niibe Yutaka * regnual/sys.c (entry): Bug fix of clearing BSS. * src/usb_stm32f103.c: Update from NeuG. (usb_handle_transfer): Add argument ISTR_VALUE. * src/openpgp.c (card_thread): Add noinline attribute. * src/usb-icc.c (ccid_thread): Join the OpenPGP thread. Add noinline attribute. 2013-11-15 Niibe Yutaka * src/configure (options): Add --enable-sys1-compat. 2013-11-12 Niibe Yutaka * chopstx: Upgrade to 0.03. * src/usb_desc.c (usb_initial_feature): Remove. (USB_SELF_POWERED): Move to ... * src/usb_conf.h (USB_SELF_POWERED): ... here. * src/usb_ctrl.c (usb_cb_device_reset, usb_intr): Follow the change. 2013-11-11 Niibe Yutaka * src/adc_stm32f103.c (adc_wait_completion): Update from NeuG 1.0. 2013-11-03 Niibe Yutaka * regnual/regnual.c (usb_cb_get_descriptor): Update to new API. * src/usb_lld.h (usb_initial_feature): Remove. * chopstx: Update to 0.01. * src/pin-cir.c: Chatter fix to 200ms. * src/main.c: Fix bDeviceState. 2013-11-02 Niibe Yutaka * src/usb_lld.h, src/usb_stm32f103.c (std_get_descriptor): Change the API of usb_cb_get_descriptor. * src/usb_desc.c: Follow the change. * src/usb_conf.h: Modify for CCID INT and HID usage. 2013-11-02 Niibe Yutaka * src/pin-cir.c: Port to Chopstx. * chopstx: Update. * src/configure (TIM_SIZE, EXT_SIZE): New. * src/gnuk.ld.in (__process6_stack_size__) (__process7_stack_size__): New. * src/main.c (main): Call cir_init. * src/openpgp.c (openpgp_card_thread): Rename from GPGthread. * src/usb-icc.c (icc_power_on): Follow the change. 2013-11-01 Niibe Yutaka * src/sys.c: Update from Chopstx. * src/usb_lld.h: Remove interrupt definition. * src/stm32f103.h: Add AFIO, EXTI, and TIMER constants. 2013-10-31 Niibe Yutaka * src/main.c (main): Call msc_init before USB interrupt thread. * src/gnuk.h, src/usb-msc.h, src/usb-msc.c, src/pin-dnd.c: Port to Chipstx. * src/openpgp.c (get_pinpad_input): Follow the change. * src/usb_ctrl.c (gnuk_setup_endpoints_for_interface): Don't stall RX of ENDP6. 2013-10-24 Niibe Yutaka * src/Makefile.in (DEFS): Add -DCHX_PRIO_MAIN=5 for LED blink. * src/main.c (PRIO_CCID): It's now 3 (was: 2). 2013-10-24 Niibe Yutaka * src/gnuk.ld.in (.gnuk_flash): Three pages for three keys. * src/flash.c (FLASH_KEYSTORE_SIZE): Likewise. (flash_keystore_release): Remove. (flash_key_fill_zero_as_released) (flash_check_all_other_keys_released, flash_key_release): New. (flash_init, flash_key_alloc): New method to handle free space. * src/openpgp-do.c (fetch_four_bytes): New. (gpg_do_load_prvkey, gpg_do_delete_prvkey, gpg_do_public_key): Use fetch_four_bytes. (gpg_do_delete_prvkey): Call flash_key_release. 2013-10-23 Niibe Yutaka * test/features/010_setup_passphrase.feature * test/features/030_key_registration.feature * test/features/040_passphrase_change.feature * test/features/410_setup_passphrase.feature * test/features/430_key_registration.feature * test/features/201_keygen.feature * test/features/601_keygen.feature: Modified to support new way of pass phrase reset by key import / key generation. * test/features/201_keygen.feature * test/features/601_keygen.feature * test/features/202_setup_passphrase.feature * test/features/602_setup_passphrase.feature: Rename to change order of execution. 2013-10-23 Niibe Yutaka * src/openpgp-do.c (gpg_do_write_prvkey): Bug fix of adding num_prv_keys. 2013-10-22 Niibe Yutaka * src/openpgp-do.c (gpg_do_write_prvkey): Bug fix. 2013-10-15 Niibe Yutaka * src/openpgp.c (cmd_change_password, cmd_reset_user_password): It is now error to change User's pass phrase with no keys. * src/openpgp-do.c (proc_resetting_code): Likewise for resetting code. (gpg_do_delete_prvkey): New. (gpg_do_write_prvkey): Make sure to delete the key before writing. User's pass phrase is always the one of factory setting. (gpg_do_chks_prvkey): Support removing the key. (proc_key_import): Use gpg_do_delete_prvkey. (gpg_do_keygen): Use factory setting pass phrase. 2013-10-11 Niibe Yutaka * src/ac.c (verify_user_0, verify_admin_00): Fix conditions. * src/openpgp-do.c (gpg_do_write_prvkey): Delete keystring information from data object of NR_DO_KEYSTRING_PW3. Fix conditions. (gpg_do_keygen): Likewise. * src/openpgp.c (cmd_reset_user_password): Likewise. 2013-10-10 Niibe Yutaka * src/gnuk.h (S2K_ITER): Remove. It's determined at compile time. * src/openpgp-do.c (proc_resetting_code, gpg_do_write_prvkey) (proc_key_import): Remove "iteration" field. * src/openpgp.c (cmd_change_password): Likewise. 2013-10-10 Niibe Yutaka * src/openpgp-do.c (gpg_do_write_prvkey): Access of data object considering garbage collection. * src/openpgp.c (cmd_change_password): Call gpg_do_write_simple after accessing the data object (it may cause garbage collection). 2013-10-10 Niibe Yutaka * polarssl/library/bignum.c (mpi_montred): Constant time for carry propagation. Bug fix for carry propagation. (mpi_exp_mod): Bug fix. Shrink the size of RR as same as X. 2013-10-09 Niibe Yutaka * src/ac.c (verify_user_0, verify_admin_00, verify_admin_0): Add a flag to save into keystring_md_pw3. Add SALT handling. (decode_iterate_count, calc_md, gpg_set_pw3): Remove. * src/openpgp-do.c (proc_resetting_code, gpg_do_write_prvkey) (gpg_do_keygen): Add SALT handling. * src/openpgp.c (cmd_change_password, cmd_reset_user_password) (s2k): Ditto. * src/random.c (random_get_salt): Rename from get_salt. 2013-10-09 Niibe Yutaka * src/openpgp-do.c (gpg_do_write_prvkey): Remove information (but pass phrase length) for admin from keystring data object. (proc_key_import): Recover admin keystring to DO when key deletion. 2013-10-09 Niibe Yutaka * src/ac.c (verify_user_0, verify_admin_00): Handle PW_LEN_MASK. * src/openpgp-do.c (proc_resetting_code, gpg_do_write_prvkey): Likewise. * src/openpgp.c (cmd_change_password, cmd_reset_user_password): Handle PW_LEN_KEYSTRING_BIT. 2013-10-09 Niibe Yutaka * src/ac.c (verify_admin_00): New. Add authentication by loading signature key. (verify_admin_0): Use verify_admin_00. * src/openpgp.c (cmd_change_password): Admin keystring handling as same as user's. 2013-10-08 Niibe Yutaka * src/openpgp.c (modify_binary): Allow odd size of certificate. * polarssl/library/rsa.c: Update from PolarSSL 1.2.10. * polarssl/include/polarssl/rsa.h: Ditto. 2013-10-07 Niibe Yutaka * polarssl/library/bignum.c (mpi_sub_hlp): Return CARRY. (mpi_sub_abs): Carry propagatoin is done here. (mpi_mul_hlp_mm): Remove. (mpi_mul_hlp): Return CARRY, computation in constant time. (mpi_mul_mpi): Change the order of computation not to propagate carry. (mpi_montmul): Minimum zero-ing of D and reduce usage of temporary memory, by one word. Use carry of mpi_mul_hlp. Use NEED_SUBTRACTION against timing attack. (mpi_exp_mod): Minimum usage of temporary memory. 2013-10-06 Niibe Yutaka * polarssl/library/bignum.c (mpi_mul_hlp_mm): New. Handle extra-carry in constant time to mitigate timing attack. (mpi_montmul): Use mpi_mul_hlp_mm. * src/call-rsa.c (rsa_sign, rsa_decrypt, rsa_verify): Don't use RSA blinding. 2013-10-05 Niibe Yutaka * polarssl/include/polarssl/aes.h: Update from PolarSSL 1.2.9. * polarssl/include/polarssl/bignum.h: Ditto. * polarssl/include/polarssl/config.h: Ditto. * polarssl/include/polarssl/rsa.h: Ditto. * polarssl/library/aes.c, polarssl/library/bignum.c: Ditto. * polarssl/library/rsa.c: Ditto. Fix rsa_free. * src/call-rsa.c (rsa_sign, modulus_calc, rsa_decrypt) (rsa_verify): Follow changes of PolarSSL 1.2.9 with RSA blinding. Better error checking. 2013-10-04 Niibe Yutaka * src/main.c (gnuk_malloc): Update ->neighbor field of a chunk on the free list. (gnuk_free): Access free list after getting the lock. 2013-10-01 Niibe Yutaka * src/random.c (random_gen): Bug fix for INDEXed copy. * src/call-rsa.c (rsa_genkey): Call neug_flush and prng_seed. * polarssl/library/bignum.c (small_prime): More constants. (prng_seed, jkiss, mpi_fill_pseudo_random): New. (mpi_is_prime): Use mpi_fill_pseudo_random. 2013-09-30 Niibe Yutaka * polarssl/library/bignum.c (mpi_is_prime): Enable trial divisions by small integers. Add Fermat primality test. (mpi_gen_prime): Limit random value so that two MSBs of result will be 0x11. 2013-09-27 Niibe Yutaka * polarssl/include/polarssl/bignum.h (mpi_is_prime): ifdef-out. * polarssl/library/bignum.c (mpi_is_prime): It's now internal function, assuming we already know its coprime to small primes. (M): New constant MPI. Multiply primes 2*...*691. (MAX_A): New constant MPI. 2^1024 / M - 1. (mpi_gen_prime): Specialize for 1024-bit, using Fouque-Tibouchi method. 2013-09-25 Niibe Yutaka * src/sha256.h, src/adc.h * src/neug.c, src/adc_stm32f103.c: Update from NeuG 0.11. * chopstx: Upgrade to new Chopstx 0.00. * VERSION: New file. * src/configure (SERIALNO, SERIALNO_STR_LEN_DEFINE): New. (REVISION): Use the file VERSION if it doesn't have .git. Thanks to Sumedha Widyadharma for the bug report. * src/config.h.in (SERIALNO_STR_LEN_DEFINE): New. * src/main.c (ID_OFFSET): Use SERIALNO_STR_LEN. * src/usb_desc.c (gnukStringSerial): Remove. It's now generated in usb-strings.c.inc. * src/ec_p256.c (compute_kP): Fix for impossible cases. (point_is_on_the_curve): New. (coefficient_a, coefficient_b): New. 2013-09-20 Niibe Yutaka * src/call-ec_p256.c (ecdsa_compute_public): Handle possible error (where key_data is the order). * src/ec_p256.c (compute_kG, compute_kP): Handle errors. * src/jpc.c (jpc_to_ac): Return -1 on error. (jpc_add_ac_signed): Handle the case where A=inf. * src/modp256.c (modp256_inv): Handle error case. * src/bn.c (bn256_cmp): New. 2013-07-19 Niibe Yutaka * src/gnuk.ld.in: Layout change following NeuG. (_end): Add alignment of 16. * src/neug.c, src/adc.h, src/adc_stm32f103.c: Update from NeuG. * src/main.c [DFU_SUPPORT] (main): Fix calling flash_erase_all_and_exec. * src/openpgp-do.c (gpg_do_write_prvkey, gpg_do_keygen): Fix allocated memory handling. Clean up before free. * src/call-rsa.c (modulus_calc, rsa_genkey): Fix removing const. * src/call-ec_p256.c (ecdsa_compute_public): Likewise. 2013-07-18 Niibe Yutaka Port to Chopstx. * src/Makefile.in: Change for Chopstx. * src/configure: Likewise. * src/gnuk.h, src/gnuk.ld.in: Likewise. * src/ac.c: Include stdint.h and string.h, not ch.h. * src/call-rsa.c, src/debug.c, src/flash.c: Likewise. * src/call-ec_p256.c, src/usb_desc.c * src/openpgp-do.c, src/random.c: Likewise. * src/openpgp.c: Likewise. Use eventflag of Chopstx. * src/usb-icc.c: Likewise. * src/usb_ctrl.c: Update for Chopstx. * src/debug.h: New. * src/stdlib.h: Use gnuk_malloc and gnuk_free for malloc/free. * src/config.h.in: Move FLASH_PAGE_SIZE in board.h. * polarssl/library/aes.c (FT0, FT1, FT2): Export (for sys 2.0). * src/main.c (struct stdout, _write, EP3_IN_Callback) (EP5_OUT_Callback): Rewrite for Chopstx. No independent thread any more. (display_fatal_code, emit_led, display_status_code, led_blink): Use primitives of Chopstx. (main): Changes for Chopstx. (gnuk_malloc_init, sbrk, gnuk_malloc, gnuk_free): New. 2013-06-20 Niibe Yutaka * src/sys.c, src/sys.h, src/neug.c, src/adc.h * src/adc_stm32f103.c, src/usb_stm32f103.c: Update from NeuG 0.10. * src/stm32f103.h: New. From NeuG 0.10. 2013-06-18 Niibe Yutaka * src/openpgp-do.c (gpg_do_write_prvkey, proc_key_import, gpg_do_table) (gpg_do_public_key) [RSA_AUTH]: Conditional compilation for RSA/ECDSA. * src/openpgp.c (cmd_internal_authenticate) [RSA_AUTH]: Likewise. * src/modp256.c (p256): Add const qualifier. 2013-03-19 Niibe Yutaka * src/random.c (random_gen): New (was: random_byte). * src/call-rsa.c (rsa_sign): Follow change of API. (rsa_genkey): Use random_gen. (modulus_calc, rsa_decrypt, rsa_verify): Follow change of API. * src/openpgp-do.c (encrypt, decrypt): Likewise. * polarssl/include/polarssl/aes.h: Updated from PolarSSL 1.2.6. * polarssl/library/aes.c: Ditto. * polarssl/include/polarssl/rsa.h: Ditto. * polarssl/library/rsa.c: Ditto. * polarssl/include/polarssl/bignum.h: Ditto. * polarssl/library/bignum.c: Ditto. * polarssl: Move from polarssl-0.14.0, and needed files only. 2013-03-15 Niibe Yutaka * regnual/regnual.ld (.bss): Put at RAM1. This makes reGNUal can be loaded on the lower address. * regnual/sys.c (entry): Don't change SP. Put alignment. * regnual/regnual.c (usb_cb_get_descriptor): Fix adding break. 2013-03-14 Niibe Yutaka * tool/stlinkv2.py (stlinkv2.start): Call write_debug_reg to run the core again. 2013-03-12 Niibe Yutaka * src/gnuk.ld.in (__process_stack_size__): Increase (was: 0x200). * tool/stlinkv2.py (stlinkv2.exit_from_debug_swd) (stlinkv2.exit_from_debug_swim): New. (stlinkv2.start): Call exit_from_debug_swd or exit_from_debug_swim. 2013-03-09 Niibe Yutaka * src/openpgp-do.c (gpg_do_public_key): Add OID for ECDSA. (gpg_do_write_prvkey): Add PUBKEY_LEN for ECDSA. * src/flash.c (flash_key_write): Argument change for ECDSA key. * src/main.c (calculate_regnual_entry_address): New. (main): Use calculate_regnual_entry_address for entry point. * src/openpgp-do.c (gpg_do_write_prvkey): Coerce KDI.DATA to uint8_t *. * src/usb_stm32f103.c (handle_setup0): Fix selecting handler. 2013-03-08 Niibe Yutaka Relocatable reGNUal. * regnual/regnual.ld (MEMORY): 0x1400 was the value of Gnuk 1.0.1. Keep this value. (.text): Include .text.entry next to the .vectors. (.got): New. * regnual/sys.c (entry): Now, it's at .text.entry section. Do relocations. Don't use absolute values which causes relocations, but access at GOT. * regnual/Makefile (CFLAGS): Add -fpie. 2013-03-07 Niibe Yutaka Follow the USB stack change. * regnual/regnual.c (usb_cb_device_reset): Rename from regnual_device_reset. (mem): Change type to uint32_t. (mem_info): Removed. (fetch): Avoid pointer punning. (usb_cb_ctrl_write_finish): Rename from regnual_ctrl_write_finish. (usb_cb_setup): Rename from regnual_setup. (usb_cb_get_descriptor): Rename from regnual_get_descriptor. (usb_cb_handle_event): Rename regnual_usb_event. (usb_cb_interface): Rename regnual_interface. (Device_Method): Remove. (usb_cb_get_descriptor): Not use struct Descriptor. 2013-03-06 Niibe Yutaka USB stack implementation improvement. * src/usb_stm32f103.c (Device_Method, method_p): Remove. (usb_interrupt_handler): Call usb_cb_device_reset. (std_get_descriptor): Call usb_cb_get_descriptor. (std_set_configuration): Call usb_cb_handle_event. (std_get_status, std_get_interface, std_set_interface): Call usb_cb_interface. (handle_setup0): Call usb_cb_setup. (handle_in0): Call usb_cb_handle_event and usb_cb_ctrl_write_finish. (request_handler): Remove. (handle_setup0): Call std_* directly, not indirectly by request_handler. (ep_intr_handler_IN, ep_intr_handler_OUT): Remove. (usb_handle_transfer): Call EP*_Callback directly, not indirectly by ep_intr_handler_IN, ep_intr_handler_OUT. * src/usb_lld.h (struct usb_device_method, Device_Method): Remove. (usb_cb_device_reset, usb_cb_ctrl_write_finish) (usb_cb_setup, usb_cb_get_descriptor, usb_cb_handle_event) (usb_cb_interface): Define callbacks. (usb_initial_feature): New. (struct Descriptor): Move to ... * src/usb_desc.c: ... here. (usb_initial_feature): New. (usb_cb_get_descriptor): Rename from gnuk_get_descriptor and move from usb_ctrl.c. * src/usb_ctrl.c (usb_cb_device_reset): Rename from gnuk_device_reset. (usb_cb_setup): Rename from gnuk_setup. (usb_cb_ctrl_write_finish): Rename from gnuk_ctrl_write_finish. (usb_cb_event): Rename from gnuk_usb_event. (usb_cb_interface): Rename from gnuk_interface. (Device_Method): Remove. * src/main.c (main): Use usb_initial_feature. 2013-02-27 Niibe Yutaka * src/usb-icc.c (set_sw1sw2): Arguments are C and CHUNK_LEN. Fix reporting remaining bytes. (icc_send_data_block_gr): Follow the arguments change of set_sw1sw2. 2013-02-26 Niibe Yutaka * regnual/regnual.ld (MEMORY): Fix start address. * src/random.c (random_fini): New. * src/main.c (main): Call random_fini. 2013-02-25 Niibe Yutaka * src/configure: Correct typo in help text. * src/gnuk.h (struct key_data_internal): Use uint32_t. * src/openpgp-do.c (do_openpgpcard_aid): Fix calculation of VID. (compute_key_data_checksum): Don't use type-punning pointer. (gpg_do_write_prvkey): Use coercing to char *. 2013-02-22 Niibe Yutaka * src/openpgp-do.c (gpg_do_public_key): Add header of EC point. * src/openpgp-do.c (GPG_DO_DISCRETIONARY, cmp_discretionary): New. (cmp_app_data): Change to factor out GPG_DO_DISCRETIONARY. (gpg_do_table): Add GPG_DO_DISCRETIONARY. 2013-02-21 Niibe Yutaka * src/gnuk.ld.in (MEMORY): Fix adding FLASH_SIZE unit. * src/call-ec_p256.c (ecdsa_sign): Fix secret key access. 2013-02-20 Niibe Yutaka * src/openpgp.c (cmd_internal_authenticate): Support ECDSA for authentication. * src/openpgp-do.c (algorithm_attr_ecdsa): New. (algorithm_attr_rsa): Rename (was: algorithm_attr). (gpg_do_table): Change for GPG_DO_ALG_AUT. (gpg_do_write_prvkey): Support ECDSA key for authentication. (proc_key_import): Likewise. (gpg_do_public_key): Likewise. * src/call-ec_p256.c: New. * src/Makefile.in: Add call-ec_p256.c. * src/call-rsa.c (modulus_free): Remove. 2013-02-19 Niibe Yutaka * regnual/regnual.ld (MEMORY): Fix address of regnual. * regnual/Makefile (MCFLAGS): Remove -mfix-cortex-m3-ldrd. (CFLAGS): Add output to .lst. * src/Makefile.in (MCFLAGS): Remove. * src/sha256.c: Update from NeuG 0.05. * ChibiOS_2.0.8: Remove. 2013-02-18 Niibe Yutaka Changes for new ChibiOS/RT. * src/main.c: Include adc.h. (main): Call halInit, adc_init, and chSysInit (change for ChibiOS/RT 2.4.x). * src/random.h: New. * src/ac.c, src/bn.c, src/call-rsa.c, src/main.c: Include random.h. * src/openpgp.c, src/openpgp-do.c: Likewise. * src/configure, src/gnuk.ld.in: Add MEMORY_SIZE. * src/ec_p256.c: Fix call of bn256_add_uint. * boards/STM8S_DISCOVERY/*: Update for ChibiOS/RT 2.4.x. * boards/CQ_STARM/*: Likewise. * boards/FST_01_00/*: Likewise. * boards/OLIMEX_STM32_H103/*: Likewise. * boards/STBEE/*: Likewise. * boards/STBEE_MINI/*: Likewise. * boards/STM32_PRIMER2/*: Likewise. Merge ec_p256 branch. * src/Makefile.in: Add ECC files. * src/bn.h, src/bn.c: New. * src/jpc-ac.h, src/jpc.c: New. * src/ec_p256.h, src/ec_p256.c, src/ecc-cdh.c: New. * src/mod.h, src/mod.c, src/modp256.h, src/modp256.c: New. 2013-02-17 Niibe Yutaka * chibios: New submodule for ChibioS/RT 2.4.x. * boards/FST_01/*: Update for ChibiOS/RT 2.4.x. * boards/common/mcuconf-common.h: Ditto. * src/chconf.h, src/halconf.h, src/Makefile.in, src/gnuk.ld.in: Update for ChibiOS/RT 2.4.x. * src/main.c, src/openpgp.c, src/usb-icc.c: Follow the change of ChibiOS/RT 2.4.x. * boards/common/board-common.c: Rename from hwinit.c. * src/usb_stm32f103.c: Rename from usb_lld.c. * src/neug.h, src/neug.c: Update NeuG 0.05. * src/adc_stm32f103.c, src/adc.h: New from NeuG 0.05. * src/random.c: Follow the change of NeuG 0.05.