version 0.4

This commit is contained in:
NIIBE Yutaka 2010-11-09 14:32:41 +09:00
parent 203153bcdb
commit 9ed509951c
9 changed files with 294 additions and 6 deletions

10
.gitignore vendored
View File

@ -2,3 +2,13 @@
src/Makefile
src/config.h
src/gnuk.ld
*.lst
*.o
*.pyc
src/.dep
src/gnuk.bin
src/gnuk.dmp
src/gnuk.elf
src/gnuk.hex
src/gnuk.map
src/random_bits

View File

@ -1,5 +1,18 @@
2010-11-09 NIIBE Yutaka <gniibe@fsij.org>
* 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 <gniibe@fsij.org>
* 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.

View File

@ -114,7 +114,7 @@ void _pal_lld_init(const PALConfig *config) {
IOPORT4->ODR = config->PDData.odr;
IOPORT4->CRH = config->PDData.crh;
IOPORT4->CRL = config->PDData.crl;
#if !defined(STM32F10X_LD) || defined(__DOXYGEN__)
#if !(defined(STM32F10X_LD) || defined(BOARD_STBEE_MINI)) || defined(__DOXYGEN__)
IOPORT5->ODR = config->PEData.odr;
IOPORT5->CRH = config->PEData.crh;
IOPORT5->CRL = config->PEData.crl;

View File

@ -83,7 +83,7 @@ typedef struct {
stm32_gpio_setup_t PCData;
/** @brief Port D setup data.*/
stm32_gpio_setup_t PDData;
#if !defined(STM32F10X_LD) || defined(__DOXYGEN__)
#if !(defined(STM32F10X_LD) || defined(BOARD_STBEE_MINI)) || defined(__DOXYGEN__)
/** @brief Port E setup data.*/
stm32_gpio_setup_t PEData;
#endif

6
NEWS
View File

@ -2,10 +2,14 @@ Gnuk NEWS - User visible changes
* Major changes in Gnuk 0.4
Released 2010-11-XX, by NIIBE Yutaka
Released 2010-11-09, by NIIBE Yutaka
** New board support "STBee Mini".
** Flash writing tool for "DfuSe" is included now.
** Since Flash GC is now implemented, it can be used longer.
* Major changes in Gnuk 0.3

4
README
View File

@ -1,7 +1,7 @@
Gnuk - software for GPG USB Token
Version 0.4
2010-11-XX
2010-11-09
Niibe Yutaka
Free Software Initiative of Japan
@ -26,7 +26,7 @@ USB Token by Gnuk everywhere.
Release notes
=============
This is fourth release of Gnuk. While it works well for specific
This is fifth release of Gnuk. While it works well for specific
usages, it is still experimental.
Tested features are:

233
doc/DEMO-2 Normal file
View File

@ -0,0 +1,233 @@
$ unset GPG_AGENT_INFO
$ gpg --card-edit
gpg: detected reader `FSIJ USB Token (20101023) 00 00'
Application ID ...: D276000124010200F517000000010000
Version ..........: 2.0
Manufacturer .....: unknown
Serial number ....: 00000001
Name of cardholder: [not set]
Language prefs ...: [not set]
Sex ..............: unspecified
URL of public key : [not set]
Login data .......: [not set]
Signature PIN ....: forced
Key attributes ...: 2048R 2048R 2048R
Max. PIN lengths .: 127 127 127
PIN retry counter : 3 0 3
Signature counter : 0
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]
gpg/card> passwd
gpg: OpenPGP card no. D276000124010200F517000000010000 detected
gpg: gpg-agent is not available in this session
Please enter the PIN
Enter PIN: 123456
New PIN
Enter New PIN: *************
New PIN
Repeat this PIN: *************
PIN changed.
gpg/card> admin
Admin commands are allowed
gpg/card> sex
Sex ((M)ale, (F)emale or space): m
gpg: 3 Admin PIN attempts remaining before card is permanently locked
Please enter the Admin PIN
Enter Admin PIN: 12345678
gpg/card> name
Cardholder's surname: Niibe
Cardholder's given name: Yutaka
gpg/card> login
Login data (account name): gniibe
gpg/card> url
URL to retrieve public key: http://www.gniibe.org/gniibe.asc
gpg/card> lang
Language preferences: ja
gpg/card> passwd
gpg: OpenPGP card no. D276000124010200F517000000010000 detected
1 - change PIN
2 - unblock PIN
3 - change Admin PIN
4 - set the Reset Code
Q - quit
Your selection? 3
gpg: 3 Admin PIN attempts remaining before card is permanently locked
Please enter the Admin PIN
Enter Admin PIN: 12345678
New Admin PIN
Enter New Admin PIN: ***************
New Admin PIN
Repeat this PIN: ***************
PIN changed.
1 - change PIN
2 - unblock PIN
3 - change Admin PIN
4 - set the Reset Code
Q - quit
Your selection? 4
gpg: 3 Admin PIN attempts remaining before card is permanently locked
Please enter the Admin PIN
Enter Admin PIN: ***************
New Reset Code
Enter New PIN: ************
New Reset Code
Repeat this PIN: ************
Reset Code set.
1 - change PIN
2 - unblock PIN
3 - change Admin PIN
4 - set the Reset Code
Q - quit
Your selection? q
gpg/card> quit
$ gpg --edit-key 4CA7BABE
gpg (GnuPG) 1.4.10; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
pub 2048R/4CA7BABE created: 2010-10-15 expires: never usage: SC
trust: ultimate validity: ultimate
sub 2048R/084239CF created: 2010-10-15 expires: never usage: E
sub 2048R/5BB065DC created: 2010-10-22 expires: never usage: A
[ultimate] (1). NIIBE Yutaka <gniibe@fsij.org>
gpg> toggle
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
ssb 2048R/084239CF created: 2010-10-15 expires: never
ssb 2048R/5BB065DC created: 2010-10-22 expires: never
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> keytocard
Really move the primary key? (y/N) y
gpg: detected reader `FSIJ USB Token (20101023) 00 00'
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
Please select where to store the key:
(1) Signature key
(3) Authentication key
Your selection? 1
You need a passphrase to unlock the secret key for
user: "NIIBE Yutaka <gniibe@fsij.org>"
2048-bit RSA key, ID 4CA7BABE, created 2010-10-15
gpg: gpg-agent is not available in this session
gpg: writing new key
gpg: 3 Admin PIN attempts remaining before card is permanently locked
Please enter the Admin PIN
Enter Admin PIN: ***************
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
card-no: F517 00000001
ssb 2048R/084239CF created: 2010-10-15 expires: never
ssb 2048R/5BB065DC created: 2010-10-22 expires: never
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> key 1
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
card-no: F517 00000001
ssb* 2048R/084239CF created: 2010-10-15 expires: never
ssb 2048R/5BB065DC created: 2010-10-22 expires: never
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> keytocard
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
Please select where to store the key:
(2) Encryption key
Your selection? 2
You need a passphrase to unlock the secret key for
user: "NIIBE Yutaka <gniibe@fsij.org>"
2048-bit RSA key, ID 084239CF, created 2010-10-15
gpg: writing new key
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
card-no: F517 00000001
ssb* 2048R/084239CF created: 2010-10-15 expires: never
card-no: F517 00000001
ssb 2048R/5BB065DC created: 2010-10-22 expires: never
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> key 1
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
card-no: F517 00000001
ssb 2048R/084239CF created: 2010-10-15 expires: never
card-no: F517 00000001
ssb 2048R/5BB065DC created: 2010-10-22 expires: never
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> key 2
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
card-no: F517 00000001
ssb 2048R/084239CF created: 2010-10-15 expires: never
card-no: F517 00000001
ssb* 2048R/5BB065DC created: 2010-10-22 expires: never
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> keytocard
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
Please select where to store the key:
(3) Authentication key
Your selection? 3
You need a passphrase to unlock the secret key for
user: "NIIBE Yutaka <gniibe@fsij.org>"
2048-bit RSA key, ID 5BB065DC, created 2010-10-22
gpg: writing new key
sec 2048R/4CA7BABE created: 2010-10-15 expires: never
card-no: F517 00000001
ssb 2048R/084239CF created: 2010-10-15 expires: never
card-no: F517 00000001
ssb* 2048R/5BB065DC created: 2010-10-22 expires: never
card-no: F517 00000001
(1) NIIBE Yutaka <gniibe@fsij.org>
gpg> quit
Save changes? (y/N) y
$

View File

@ -207,7 +207,7 @@ static const uint8_t gnukStringSerial[] = {
8*2+2, /* bLength */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
'2', 0, '0', 0, '1', 0, '0', 0,
'1', 0, '0', 0, '2', 0, '3', 0
'1', 0, '1', 0, '0', 0, '9', 0
};
const ONE_DESCRIPTOR Device_Descriptor = {

28
tool/dump_mem.py Executable file
View File

@ -0,0 +1,28 @@
#! /usr/bin/python
import sys
from dfuse import *
dev, config, intf = get_device()
dfu = DFU_STM32(dev, config, intf)
print dfu.ll_get_string(intf.iInterface)
s = dfu.ll_get_status()
dfu.ll_clear_status()
s = dfu.ll_get_status()
print s
dfu.dfuse_set_address_pointer(int(sys.argv[1], 16))
s = dfu.ll_get_status()
dfu.ll_clear_status()
s = dfu.ll_get_status()
dfu.ll_clear_status()
s = dfu.ll_get_status()
print s
block = dfu.dfuse_read_memory()
count = 0
for d in block:
print "%02x" % d,
if count & 0x0f == 0x0f:
print
count += 1
dfu.ll_clear_status()
s = dfu.ll_get_status()