diff --git a/ChangeLog b/ChangeLog index b444239..cb254cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/src/chconf.h b/src/chconf.h deleted file mode 100644 index 2e767f7..0000000 --- a/src/chconf.h +++ /dev/null @@ -1,74 +0,0 @@ -/* ChibiOS/RT configuration file */ - -#ifndef _CHCONF_H_ -#define _CHCONF_H_ - -#include -#ifdef DFU_SUPPORT -#define CORTEX_VTOR_INIT (0x00003000+0x00001000) -#else -#define CORTEX_VTOR_INIT 0x00001000 -#endif - -#define CH_FREQUENCY 1000 -#define CH_TIME_QUANTUM 20 -#define CH_USE_NESTED_LOCKS FALSE -#define CH_MEMCORE_SIZE 0 /* Whole RAM */ -#define CH_NO_IDLE_THREAD FALSE -#define CH_OPTIMIZE_SPEED TRUE -#define CH_USE_REGISTRY TRUE -#define CH_USE_WAITEXIT TRUE -#define CH_USE_SEMAPHORES TRUE -#define CH_USE_SEMAPHORES_PRIORITY FALSE -#define CH_USE_SEMSW FALSE -#define CH_USE_MUTEXES TRUE -#define CH_USE_CONDVARS TRUE -#define CH_USE_CONDVARS_TIMEOUT TRUE -#define CH_USE_EVENTS TRUE /* We use this! */ -#define CH_USE_EVENTS_TIMEOUT TRUE /* We use this! */ -#define CH_USE_MESSAGES FALSE -#define CH_USE_MESSAGES_PRIORITY FALSE -#define CH_USE_MAILBOXES FALSE -#define CH_USE_QUEUES FALSE -#define CH_USE_MEMCORE TRUE -#define CH_USE_HEAP TRUE -#define CH_USE_MALLOC_HEAP FALSE -#define CH_USE_MEMPOOLS FALSE -#define CH_USE_DYNAMIC TRUE - -/* Debug options */ -#define CH_DBG_ENABLE_CHECKS FALSE -#define CH_DBG_ENABLE_ASSERTS FALSE -#define CH_DBG_ENABLE_TRACE FALSE -#define CH_DBG_ENABLE_STACK_CHECK TRUE -#define CH_DBG_FILL_THREADS FALSE -#define CH_DBG_THREADS_PROFILING FALSE - -#define THREAD_EXT_FIELDS \ - /* Add threads custom fields here.*/ \ - -#define THREAD_EXT_INIT(tp) { \ - /* Add threads initialization code here.*/ \ -} - -#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - /* System halt code here.*/ \ -} - -#define THREAD_EXT_EXIT(tp) { \ - /* Add threads finalization code here.*/ \ -} - -#define IDLE_LOOP_HOOK() { \ - /* Idle loop code here.*/ \ -} - -#define SYSTEM_TICK_EVENT_HOOK() { \ - /* System tick event code here.*/ \ -} - -#define SYSTEM_HALT_HOOK() { \ - /* System halt code here.*/ \ -} - -#endif /* _CHCONF_H_ */ diff --git a/src/ecc-cdh.c b/src/ecc-cdh.c deleted file mode 100644 index a169bd3..0000000 --- a/src/ecc-cdh.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ecc-cdh.c - One-Pass Diffie-Hellman method implementation - * C(1, 1, ECC CDH) for EC DH of OpenPGP ECC - * - * Copyright (C) 2013 Free Software Initiative of Japan - * Author: NIIBE Yutaka - * - * This file is a part of Gnuk, a GnuPG USB Token implementation. - * - * Gnuk is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Gnuk is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/* - * References: - * - * [1] A. Jivsov, Elliptic Curve Cryptography (ECC) in OpenPGP, RFC 6637, - * June 2012. - * - * [2] Suite B Implementer's Guide to NIST SP 800-56A, July 28, 2009. - * - */ - -static const char param[] = { - /**/ - curve_OID_len, - curve_OID, - public-key_alg_ID, /*ecdh*/ - 0x03, - 0x01, - KDF_hash_ID, /*sha256*/ - KEK_alg_ID, /*aes128*/ - "Anonymous Sender ", - my_finger_print /*20-byte*/ -}; - -/* - * - */ -int -ecdh (unsigned char *key, - const unsigned char *key_encrypted, const ac *P, - const naf4_257 *naf_d, const unsigned char *fp) -{ - ac S[1]; - sha256_context ctx; - unsigned char kek[32]; - unsigned char x[32]; - int i; - const unsigned char *p; - - compute_kP (S, naf_d, P); /* Get shared secret. */ - - /* Endian change from big to little. */ - p = (const unsigned char *)S->x; - for (i = 0; i < 32; i++) - x[31-i] = p[i]; - - /* kdf (kek, S, parameter) */ - sha256_start (&ctx); - sha256_update (&ctx, "\x00\x00\x00\x01", 4); - sha256_update (&ctx, x, size of x); - sha256_update (&ctx, (const char *)param, size of param); - sha256_finish (&ctx, kek); -} diff --git a/src/halconf.h b/src/halconf.h deleted file mode 100644 index 80a7475..0000000 --- a/src/halconf.h +++ /dev/null @@ -1,29 +0,0 @@ -/* HAL configuration file for ChibiOS/RT */ - -#ifndef _HALCONF_H_ -#define _HALCONF_H_ - -#include "mcuconf.h" - -#define HAL_USE_PAL TRUE -#define HAL_USE_ADC FALSE -#define HAL_USE_CAN FALSE -#define HAL_USE_EXT FALSE -#define HAL_USE_GPT FALSE -#define HAL_USE_I2C FALSE -#define HAL_USE_ICU FALSE -#define HAL_USE_MAC FALSE -#define HAL_USE_MMC_SPI FALSE -#define HAL_USE_PWM FALSE -#define HAL_USE_RTC FALSE -#define HAL_USE_SDC FALSE -#define HAL_USE_SERIAL FALSE -#define HAL_USE_SERIAL_USB FALSE -#define HAL_USE_SPI FALSE -#define HAL_USE_UART FALSE -#define HAL_USE_USB FALSE - -/* Define manually, as we implement ADC driver by ourselves. */ -#define STM32_DMA_REQUIRED 1 - -#endif /* _HALCONF_H_ */