version 0.6
This commit is contained in:
6
AUTHORS
6
AUTHORS
@@ -7,6 +7,11 @@ Kaz Kojima:
|
|||||||
|
|
||||||
NIIBE Yutaka:
|
NIIBE Yutaka:
|
||||||
Founder of the project.
|
Founder of the project.
|
||||||
|
Added STM8S Discovery Kit support:
|
||||||
|
boards/STM8S_DISCOVERY/board.c
|
||||||
|
boards/STM8S_DISCOVERY/board.h
|
||||||
|
boards/STM8S_DISCOVERY/board.mk
|
||||||
|
boards/STM8S_DISCOVERY/mcuconf.mk
|
||||||
Added STBee Mini support:
|
Added STBee Mini support:
|
||||||
boards/STBEE_MINI/board.c
|
boards/STBEE_MINI/board.c
|
||||||
boards/STBEE_MINI/board.h
|
boards/STBEE_MINI/board.h
|
||||||
@@ -39,5 +44,6 @@ NIIBE Yutaka:
|
|||||||
src/openpgp.c
|
src/openpgp.c
|
||||||
src/call-rsa.c
|
src/call-rsa.c
|
||||||
src/random.c
|
src/random.c
|
||||||
|
src/pin-cir.c
|
||||||
*
|
*
|
||||||
and others.
|
and others.
|
||||||
|
|||||||
19
ChangeLog
19
ChangeLog
@@ -1,3 +1,22 @@
|
|||||||
|
2011-01-14 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* 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 <gniibe@fsij.org>
|
2011-01-11 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* src/openpgp-do.c (do_openpgpcard_aid): Fix length of res_p;
|
* src/openpgp-do.c (do_openpgpcard_aid): Fix length of res_p;
|
||||||
|
|||||||
25
NEWS
25
NEWS
@@ -1,5 +1,30 @@
|
|||||||
Gnuk NEWS - User visible changes
|
Gnuk NEWS - User visible changes
|
||||||
|
|
||||||
|
* Major changes in Gnuk 0.6
|
||||||
|
|
||||||
|
Released 2011-01-14, by NIIBE Yutaka
|
||||||
|
|
||||||
|
** Experimental PIN-pad support is added.
|
||||||
|
Local PIN-pad input is suppored for boards which have input hardware.
|
||||||
|
PIN input using consumer IR receive module is tested with STBee Mini
|
||||||
|
and STM8S Discovery.
|
||||||
|
|
||||||
|
** USB device serial number is virtually unique now.
|
||||||
|
STM32F103 has 96-bit unique chip identifier. We take advantage of
|
||||||
|
this, Gnuk Token has virtually unique USB serial number.
|
||||||
|
|
||||||
|
** Card serial number is determined at run time by chip identifier.
|
||||||
|
Until version 0.5, card serial number was compile time option. If we
|
||||||
|
used same binary for different devices, card serial number was same.
|
||||||
|
Now, we use STM32F103's 96-bit unique chip identifier for card serial
|
||||||
|
number (when you don't use --with-fixed-serial option).
|
||||||
|
|
||||||
|
** More improved USB-CCID/ICCD implementation.
|
||||||
|
The changes in 0.5 was not that good for libccid 1.3.11, which has
|
||||||
|
small buffer (only 262-byte APDU). Workaround for libccid 1.3.11 is
|
||||||
|
implemented.
|
||||||
|
|
||||||
|
|
||||||
* Major changes in Gnuk 0.5
|
* Major changes in Gnuk 0.5
|
||||||
|
|
||||||
Released 2010-12-13, by NIIBE Yutaka
|
Released 2010-12-13, by NIIBE Yutaka
|
||||||
|
|||||||
9
README
9
README
@@ -1,7 +1,7 @@
|
|||||||
Gnuk - software for GPG USB Token
|
Gnuk - software for GPG USB Token
|
||||||
|
|
||||||
Version 0.6
|
Version 0.6
|
||||||
2011-01-XX
|
2011-01-14
|
||||||
Niibe Yutaka
|
Niibe Yutaka
|
||||||
Free Software Initiative of Japan
|
Free Software Initiative of Japan
|
||||||
|
|
||||||
@@ -84,6 +84,13 @@ read protect using JTAG debugger.
|
|||||||
I think that it could run on Olimex STM32-P103, or STBee too.
|
I think that it could run on Olimex STM32-P103, or STBee too.
|
||||||
Besides, we are porting it to STM32 Primer 2.
|
Besides, we are porting it to STM32 Primer 2.
|
||||||
|
|
||||||
|
For PIN-pad support, I connect a consumer IR receive module to STBee
|
||||||
|
Mini and STM8S Discovery Kit, and use controller for TV. Yes, it is
|
||||||
|
not secure totally, since it is very easy to monitor IR output of the
|
||||||
|
controllers. It is experiment, and hardware needed for this
|
||||||
|
experiment is only a consumer IR receive module which is as cheap as
|
||||||
|
50 JPY.
|
||||||
|
|
||||||
|
|
||||||
Souce code
|
Souce code
|
||||||
==========
|
==========
|
||||||
|
|||||||
@@ -39,6 +39,10 @@
|
|||||||
#define BOARD_NAME "STBee Mini"
|
#define BOARD_NAME "STBee Mini"
|
||||||
#define CPU_WITH_NO_GPIOE 1
|
#define CPU_WITH_NO_GPIOE 1
|
||||||
|
|
||||||
|
#if defined(PINPAD_SUPPORT)
|
||||||
|
#define HAVE_7SEGLED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Board frequencies.
|
* Board frequencies.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,6 +14,36 @@ void
|
|||||||
hwinit1 (void)
|
hwinit1 (void)
|
||||||
{
|
{
|
||||||
hwinit1_common ();
|
hwinit1_common ();
|
||||||
|
|
||||||
|
#if defined(PINPAD_SUPPORT)
|
||||||
|
/* EXTI5 <= PB5 */
|
||||||
|
AFIO->EXTICR[1] = AFIO_EXTICR2_EXTI5_PB;
|
||||||
|
EXTI->IMR = 0;
|
||||||
|
EXTI->FTSR = EXTI_FTSR_TR5;
|
||||||
|
NVICEnableVector(EXTI9_5_IRQn,
|
||||||
|
CORTEX_PRIORITY_MASK(CORTEX_MINIMUM_PRIORITY));
|
||||||
|
|
||||||
|
/* TIM3 */
|
||||||
|
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
|
||||||
|
RCC->APB1RSTR = RCC_APB1RSTR_TIM3RST;
|
||||||
|
RCC->APB1RSTR = 0;
|
||||||
|
NVICEnableVector(TIM3_IRQn,
|
||||||
|
CORTEX_PRIORITY_MASK(CORTEX_MINIMUM_PRIORITY));
|
||||||
|
TIM3->CR1 = TIM_CR1_URS | TIM_CR1_ARPE; /* Don't enable TIM3 for now */
|
||||||
|
TIM3->CR2 = TIM_CR2_TI1S;
|
||||||
|
TIM3->SMCR = TIM_SMCR_TS_0 | TIM_SMCR_TS_2 | TIM_SMCR_SMS_2;
|
||||||
|
TIM3->DIER = 0; /* Disable interrupt for now */
|
||||||
|
TIM3->CCMR1 = TIM_CCMR1_CC1S_0 | TIM_CCMR1_IC1F_0 | TIM_CCMR1_IC1F_3
|
||||||
|
| TIM_CCMR1_CC2S_1 | TIM_CCMR1_IC2F_0 | TIM_CCMR1_IC2F_3;
|
||||||
|
TIM3->CCMR2 = 0;
|
||||||
|
TIM3->CCER = TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC2P;
|
||||||
|
TIM3->PSC = 72 - 1; /* 1 MHz */
|
||||||
|
TIM3->ARR = 18000; /* 18 ms */
|
||||||
|
/* Generate UEV to upload PSC and ARR */
|
||||||
|
TIM3->EGR = TIM_EGR_UG;
|
||||||
|
#endif
|
||||||
|
/* Remap (PB4, PB5) -> (TIM3_CH1, TIM3_CH2) */
|
||||||
|
AFIO->MAPR |= AFIO_MAPR_TIM3_REMAP_PARTIALREMAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -31,3 +61,43 @@ set_led (int value)
|
|||||||
else
|
else
|
||||||
palClearPad (IOPORT1, GPIOA_LED);
|
palClearPad (IOPORT1, GPIOA_LED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PINPAD_SUPPORT)
|
||||||
|
void
|
||||||
|
cir_ext_disable (void)
|
||||||
|
{
|
||||||
|
EXTI->PR = EXTI_PR_PR5;
|
||||||
|
EXTI->IMR &= ~EXTI_IMR_MR5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cir_ext_enable (void)
|
||||||
|
{
|
||||||
|
EXTI->IMR |= EXTI_IMR_MR5;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void cir_ext_interrupt (void);
|
||||||
|
extern void cir_timer_interrupt (void);
|
||||||
|
|
||||||
|
CH_IRQ_HANDLER (EXTI9_5_IRQHandler)
|
||||||
|
{
|
||||||
|
CH_IRQ_PROLOGUE ();
|
||||||
|
chSysLockFromIsr ();
|
||||||
|
|
||||||
|
cir_ext_interrupt ();
|
||||||
|
|
||||||
|
chSysUnlockFromIsr ();
|
||||||
|
CH_IRQ_EPILOGUE ();
|
||||||
|
}
|
||||||
|
|
||||||
|
CH_IRQ_HANDLER (TIM3_IRQHandler)
|
||||||
|
{
|
||||||
|
CH_IRQ_PROLOGUE();
|
||||||
|
chSysLockFromIsr();
|
||||||
|
|
||||||
|
cir_timer_interrupt ();
|
||||||
|
|
||||||
|
chSysUnlockFromIsr();
|
||||||
|
CH_IRQ_EPILOGUE();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#ifndef _BOARD_H_
|
#ifndef _BOARD_H_
|
||||||
#define _BOARD_H_
|
#define _BOARD_H_
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
/*
|
/*
|
||||||
* Setup for the ST-Link part of STM8S-Discovery board.
|
* Setup for the ST-Link part of STM8S-Discovery board.
|
||||||
*/
|
*/
|
||||||
@@ -90,6 +91,16 @@
|
|||||||
#define VAL_GPIOACRH 0x88888883 /* PA15...PA8 */
|
#define VAL_GPIOACRH 0x88888883 /* PA15...PA8 */
|
||||||
#define VAL_GPIOAODR 0xFFFFFFFF
|
#define VAL_GPIOAODR 0xFFFFFFFF
|
||||||
|
|
||||||
|
#if defined(PINPAD_SUPPORT)
|
||||||
|
/*
|
||||||
|
* Port B setup.
|
||||||
|
* Everything input with pull-up except:
|
||||||
|
* PB0 - (TIM3_CH3) input with pull-down
|
||||||
|
*/
|
||||||
|
#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
|
||||||
|
#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */
|
||||||
|
#define VAL_GPIOBODR 0xFFFFFFFE
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* Port B setup.
|
* Port B setup.
|
||||||
* Everything input with pull-up except:
|
* Everything input with pull-up except:
|
||||||
@@ -97,6 +108,7 @@
|
|||||||
#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
|
#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
|
||||||
#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */
|
#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */
|
||||||
#define VAL_GPIOBODR 0xFFFFFFFF
|
#define VAL_GPIOBODR 0xFFFFFFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Port C setup.
|
* Port C setup.
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ uint8_t pin_input_len;
|
|||||||
static void
|
static void
|
||||||
pindisp (uint8_t c)
|
pindisp (uint8_t c)
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_7SEGLED)
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 'G':
|
case 'G':
|
||||||
@@ -153,6 +154,9 @@ pindisp (uint8_t c)
|
|||||||
default:
|
default:
|
||||||
palWritePort (IOPORT2, 0xffff);
|
palWritePort (IOPORT2, 0xffff);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)c;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG_CIR)
|
#if defined(DEBUG_CIR)
|
||||||
|
|||||||
@@ -36,16 +36,17 @@
|
|||||||
#include "usb-cdc-vport.c"
|
#include "usb-cdc-vport.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SIZE_STRING_SERIAL 22
|
static uint8_t gnukStringSerial[] = {
|
||||||
static uint8_t gnukStringSerial[SIZE_STRING_SERIAL] = {
|
14*2+2, /* bLength */
|
||||||
10*2+2, /* bLength */
|
|
||||||
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
||||||
#if defined(SERIAL_NUMBER_IN_AID)
|
#if defined(SERIAL_NUMBER_IN_AID)
|
||||||
'F', 0, /* 'F' for Fixed */
|
'F', 0, /* 'F' for Fixed */
|
||||||
#else
|
#else
|
||||||
'C', 0, /* 'C' for Chip uniqure ID */
|
'C', 0, /* 'C' for Chip uniqure ID */
|
||||||
#endif
|
#endif
|
||||||
'-', 0,
|
'-', 0,
|
||||||
|
'0', 0, '.', 0, '6', 0, /* Version number of Gnuk */
|
||||||
|
'-', 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
@@ -58,10 +59,10 @@ gnuk_device_init (void)
|
|||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
gnukStringSerial[i*4+0x6] = (u[i*2] >> 4) + 'A';
|
gnukStringSerial[i*4+14] = (u[i*2] >> 4) + 'A';
|
||||||
gnukStringSerial[i*4+0x7] = 0;
|
gnukStringSerial[i*4+15] = 0;
|
||||||
gnukStringSerial[i*4+0x8] = (u[i*2+1] & 0x0f) + 'A';
|
gnukStringSerial[i*4+16] = (u[i*2+1] & 0x0f) + 'A';
|
||||||
gnukStringSerial[i*4+0x9] = 0;
|
gnukStringSerial[i*4+17] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pInformation->Current_Configuration = 0;
|
pInformation->Current_Configuration = 0;
|
||||||
@@ -190,7 +191,7 @@ gnuk_device_GetStringDescriptor (uint16_t Length)
|
|||||||
/* Serial number is requested */
|
/* Serial number is requested */
|
||||||
if (Length == 0)
|
if (Length == 0)
|
||||||
{
|
{
|
||||||
pInformation->Ctrl_Info.Usb_wLength = SIZE_STRING_SERIAL - wOffset;
|
pInformation->Ctrl_Info.Usb_wLength = sizeof gnukStringSerial - wOffset;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user