This commit is contained in:
NIIBE Yutaka 2010-09-04 18:52:25 +09:00
parent b65ff2851a
commit ea96a32119
6 changed files with 24 additions and 548 deletions

View File

@ -94,7 +94,7 @@ CSRC = $(PORTSRC) \
# List ASM source files here
ASMSRC = $(PORTASM) \
$(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F10x/vectors.s gpg-data.s
$(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F10x/vectors.s
INCDIR = $(CRYPTINCDIR) $(STMUSBINCDIR) $(VCOMDIR) \
$(PORTINC) $(KERNINC) $(TESTINC) \

View File

@ -1,15 +0,0 @@
#! /bin/sh
arm-none-eabi-gcc -S -mcpu=cortex-m3 -O0 -ggdb -fomit-frame-pointer \
-falign-functions=16 -ffunction-sections \
-Wall -Wextra -Wstrict-prototypes -Wa,-alms=gpg-data.lst \
-DCORTEX_USE_BASEPRI=TRUE -DTHUMB_PRESENT -mno-thumb-interwork \
-DTHUMB_NO_INTERWORKING -mthumb -DTHUMB \
-I . -I../STM32_USB-FS-Device_Driver/inc -I../USBCDC \
-I../ChibiOS_2.0.2/os/ports/GCC/ARMCMx \
-I../ChibiOS_2.0.2/os/ports/GCC/ARMCMx/STM32F10x \
-I../ChibiOS_2.0.2/os/ports/GCC/ARMCMx/cmsis \
-I../ChibiOS_2.0.2/os/kernel/include -I../ChibiOS_2.0.2/test \
-I../ChibiOS_2.0.2/os/hal/include \
-I../ChibiOS_2.0.2/os/hal/platforms/STM32 -I../boards/OLIMEX_STM32_H103 \
-I../ChibiOS_2.0.2/os/various gpg-data.c

View File

@ -1,50 +0,0 @@
#include "config.h"
#include "ch.h"
#include "gnuk.h"
const char const select_file_TOP_result[] __attribute__ ((aligned (1))) = {
0x00, 0x00, /* unused */
0x0b, 0x10, /* number of bytes in this directory */
0x3f, 0x00, /* field of selected file: MF, 3f00 */
0x38, /* it's DF */
0xff, /* unused */
0xff, 0x44, 0x44, /* access conditions */
0x01, /* status of the selected file (OK, unblocked) */
0x05, /* number of bytes of data follow */
0x03, /* Features: unused */
0x01, /* number of subdirectories (OpenPGP) */
0x01, /* number of elementary files (SerialNo) */
0x00, /* number of secret codes */
0x00, /* Unused */
0x00, 0x00 /* PIN status: OK, PIN blocked?: No */
};
const char const do_5e[] __attribute__ ((aligned (1))) = {
6,
'g', 'n', 'i', 'i', 'b', 'e'
};
const char const do_5b[] __attribute__ ((aligned (1))) = {
12,
'N', 'I', 'I', 'B', 'E', ' ', 'Y', 'u', 't', 'a', 'k', 'a'
};
const char const do_5f2d[] __attribute__ ((aligned (1))) = {
2,
'j', 'a'
};
const char const do_5f35[] __attribute__ ((aligned (1))) = {
1,
'1'
};
const char const do_5f50[] __attribute__ ((aligned (1))) = {
20,
'h', 't', 't', 'p', ':', '/', '/', 'w', 'w', 'w',
'.', 'f', 's', 'i', 'j', '.', 'o', 'r', 'g', '/'
};
const char const get_data_rb_result[] __attribute__ ((aligned (1))) = {
0x5a, 0x4, 0x01, 0x02, 0x03, 0x04
};

View File

@ -1,468 +0,0 @@
.syntax unified
.cpu cortex-m3
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 6
.eabi_attribute 18, 4
.thumb
.file "gpg-data.c"
.section .debug_abbrev,"",%progbits
.Ldebug_abbrev0:
.section .debug_info,"",%progbits
.Ldebug_info0:
.section .debug_line,"",%progbits
.Ldebug_line0:
.text
.Ltext0:
.global select_file_TOP_result
.section .rodata
.type select_file_TOP_result, %object
.size select_file_TOP_result, 20
select_file_TOP_result:
.byte 0
.byte 0
.byte 11
.byte 16
.byte 63
.byte 0
.byte 56
.byte -1
.byte -1
.byte 68
.byte 68
.byte 1
.byte 5
.byte 3
.byte 1
.byte 1
.byte 0
.byte 0
.byte 0
.byte 0
.global do_5e
.type do_5e, %object
.size do_5e, 7
do_5e:
.byte 6
.byte 103
.byte 110
.byte 105
.byte 105
.byte 98
.byte 101
.global do_5b
.type do_5b, %object
.size do_5b, 13
do_5b:
.byte 12
.byte 78
.byte 73
.byte 73
.byte 66
.byte 69
.byte 32
.byte 89
.byte 117
.byte 116
.byte 97
.byte 107
.byte 97
.global do_5f2d
.type do_5f2d, %object
.size do_5f2d, 3
do_5f2d:
.byte 2
.byte 106
.byte 97
.global do_5f35
.type do_5f35, %object
.size do_5f35, 2
do_5f35:
.byte 1
.byte 49
.global do_5f50
.type do_5f50, %object
.size do_5f50, 21
do_5f50:
.byte 20
.byte 104
.byte 116
.byte 116
.byte 112
.byte 58
.byte 47
.byte 47
.byte 119
.byte 119
.byte 119
.byte 46
.byte 102
.byte 115
.byte 105
.byte 106
.byte 46
.byte 111
.byte 114
.byte 103
.byte 47
.global get_data_rb_result
.type get_data_rb_result, %object
.size get_data_rb_result, 6
get_data_rb_result:
.byte 90
.byte 4
.byte 1
.byte 2
.byte 3
.byte 4
.text
.Letext0:
.file 1 "gpg-data.c"
.section .debug_info
.4byte 0x183
.2byte 0x2
.4byte .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.4byte .LASF17
.byte 0x1
.4byte .LASF18
.4byte .LASF19
.4byte .Ltext0
.4byte .Letext0
.4byte .Ldebug_line0
.uleb128 0x2
.byte 0x4
.byte 0x5
.ascii "int\000"
.uleb128 0x3
.byte 0x4
.byte 0x7
.4byte .LASF0
.uleb128 0x3
.byte 0x1
.byte 0x6
.4byte .LASF1
.uleb128 0x3
.byte 0x1
.byte 0x8
.4byte .LASF2
.uleb128 0x3
.byte 0x2
.byte 0x5
.4byte .LASF3
.uleb128 0x3
.byte 0x2
.byte 0x7
.4byte .LASF4
.uleb128 0x3
.byte 0x4
.byte 0x5
.4byte .LASF5
.uleb128 0x3
.byte 0x4
.byte 0x7
.4byte .LASF6
.uleb128 0x3
.byte 0x8
.byte 0x5
.4byte .LASF7
.uleb128 0x3
.byte 0x8
.byte 0x7
.4byte .LASF8
.uleb128 0x4
.byte 0x4
.byte 0x7
.uleb128 0x3
.byte 0x1
.byte 0x8
.4byte .LASF9
.uleb128 0x5
.4byte 0x6e
.4byte 0x85
.uleb128 0x6
.4byte 0x6b
.byte 0x13
.byte 0x0
.uleb128 0x7
.4byte .LASF10
.byte 0x1
.byte 0x5
.4byte 0x97
.byte 0x1
.byte 0x5
.byte 0x3
.4byte select_file_TOP_result
.uleb128 0x8
.4byte 0x75
.uleb128 0x5
.4byte 0x6e
.4byte 0xac
.uleb128 0x6
.4byte 0x6b
.byte 0x6
.byte 0x0
.uleb128 0x7
.4byte .LASF11
.byte 0x1
.byte 0x16
.4byte 0xbe
.byte 0x1
.byte 0x5
.byte 0x3
.4byte do_5e
.uleb128 0x8
.4byte 0x9c
.uleb128 0x5
.4byte 0x6e
.4byte 0xd3
.uleb128 0x6
.4byte 0x6b
.byte 0xc
.byte 0x0
.uleb128 0x7
.4byte .LASF12
.byte 0x1
.byte 0x1b
.4byte 0xe5
.byte 0x1
.byte 0x5
.byte 0x3
.4byte do_5b
.uleb128 0x8
.4byte 0xc3
.uleb128 0x5
.4byte 0x6e
.4byte 0xfa
.uleb128 0x6
.4byte 0x6b
.byte 0x2
.byte 0x0
.uleb128 0x7
.4byte .LASF13
.byte 0x1
.byte 0x20
.4byte 0x10c
.byte 0x1
.byte 0x5
.byte 0x3
.4byte do_5f2d
.uleb128 0x8
.4byte 0xea
.uleb128 0x5
.4byte 0x6e
.4byte 0x121
.uleb128 0x6
.4byte 0x6b
.byte 0x1
.byte 0x0
.uleb128 0x7
.4byte .LASF14
.byte 0x1
.byte 0x25
.4byte 0x133
.byte 0x1
.byte 0x5
.byte 0x3
.4byte do_5f35
.uleb128 0x8
.4byte 0x111
.uleb128 0x5
.4byte 0x6e
.4byte 0x148
.uleb128 0x6
.4byte 0x6b
.byte 0x14
.byte 0x0
.uleb128 0x7
.4byte .LASF15
.byte 0x1
.byte 0x2a
.4byte 0x15a
.byte 0x1
.byte 0x5
.byte 0x3
.4byte do_5f50
.uleb128 0x8
.4byte 0x138
.uleb128 0x5
.4byte 0x6e
.4byte 0x16f
.uleb128 0x6
.4byte 0x6b
.byte 0x5
.byte 0x0
.uleb128 0x7
.4byte .LASF16
.byte 0x1
.byte 0x30
.4byte 0x181
.byte 0x1
.byte 0x5
.byte 0x3
.4byte get_data_rb_result
.uleb128 0x8
.4byte 0x15f
.byte 0x0
.section .debug_abbrev
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x10
.uleb128 0x6
.byte 0x0
.byte 0x0
.uleb128 0x2
.uleb128 0x24
.byte 0x0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.byte 0x0
.byte 0x0
.uleb128 0x3
.uleb128 0x24
.byte 0x0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.byte 0x0
.byte 0x0
.uleb128 0x4
.uleb128 0x24
.byte 0x0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.byte 0x0
.byte 0x0
.uleb128 0x5
.uleb128 0x1
.byte 0x1
.uleb128 0x49
.uleb128 0x13
.uleb128 0x1
.uleb128 0x13
.byte 0x0
.byte 0x0
.uleb128 0x6
.uleb128 0x21
.byte 0x0
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2f
.uleb128 0xb
.byte 0x0
.byte 0x0
.uleb128 0x7
.uleb128 0x34
.byte 0x0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x2
.uleb128 0xa
.byte 0x0
.byte 0x0
.uleb128 0x8
.uleb128 0x26
.byte 0x0
.uleb128 0x49
.uleb128 0x13
.byte 0x0
.byte 0x0
.byte 0x0
.section .debug_pubnames,"",%progbits
.4byte 0x78
.2byte 0x2
.4byte .Ldebug_info0
.4byte 0x187
.4byte 0x85
.ascii "select_file_TOP_result\000"
.4byte 0xac
.ascii "do_5e\000"
.4byte 0xd3
.ascii "do_5b\000"
.4byte 0xfa
.ascii "do_5f2d\000"
.4byte 0x121
.ascii "do_5f35\000"
.4byte 0x148
.ascii "do_5f50\000"
.4byte 0x16f
.ascii "get_data_rb_result\000"
.4byte 0x0
.section .debug_str,"MS",%progbits,1
.LASF7:
.ascii "long long int\000"
.LASF0:
.ascii "unsigned int\000"
.LASF13:
.ascii "do_5f2d\000"
.LASF6:
.ascii "long unsigned int\000"
.LASF8:
.ascii "long long unsigned int\000"
.LASF10:
.ascii "select_file_TOP_result\000"
.LASF17:
.ascii "GNU C 4.4.2\000"
.LASF2:
.ascii "unsigned char\000"
.LASF14:
.ascii "do_5f35\000"
.LASF9:
.ascii "char\000"
.LASF16:
.ascii "get_data_rb_result\000"
.LASF5:
.ascii "long int\000"
.LASF15:
.ascii "do_5f50\000"
.LASF18:
.ascii "gpg-data.c\000"
.LASF4:
.ascii "short unsigned int\000"
.LASF1:
.ascii "signed char\000"
.LASF19:
.ascii "/var/tmp/stm32/gnuk/src\000"
.LASF3:
.ascii "short int\000"
.LASF12:
.ascii "do_5b\000"
.LASF11:
.ascii "do_5e\000"
.ident "GCC: (GNU) 4.4.2"

View File

@ -769,24 +769,13 @@ gpg_do_table[] = {
#define NUM_DO_ENTRIES (int)(sizeof (gpg_do_table) / sizeof (struct do_table_entry))
extern const uint8_t const do_5e[];
extern const uint8_t const do_5b[];
extern const uint8_t const do_5f2d[];
extern const uint8_t const do_5f35[];
extern const uint8_t const do_5f50[];
/*
* Initialize GPG_DO_TABLE reading from Flash ROM
*/
int
gpg_do_table_init (void)
{
do_ptr[NR_DO_LOGIN_DATA] = do_5e;
do_ptr[NR_DO_PW_STATUS] = do_pw_status_bytes_template;
do_ptr[NR_DO_NAME] = do_5b;
do_ptr[NR_DO_LANGUAGE] = do_5f2d;
do_ptr[NR_DO_SEX] = do_5f35;
do_ptr[NR_DO_URL] = do_5f50;
return 0;
}

View File

@ -42,8 +42,28 @@
#define INS_PUT_DATA 0xda
#define INS_PUT_DATA_ODD 0xdb /* For key import */
extern const char const select_file_TOP_result[20];
extern const char const get_data_rb_result[6];
static const uint8_t const
select_file_TOP_result[] __attribute__ ((aligned (1))) = {
0x00, 0x00, /* unused */
0x0b, 0x10, /* number of bytes in this directory */
0x3f, 0x00, /* field of selected file: MF, 3f00 */
0x38, /* it's DF */
0xff, /* unused */
0xff, 0x44, 0x44, /* access conditions */
0x01, /* status of the selected file (OK, unblocked) */
0x05, /* number of bytes of data follow */
0x03, /* Features: unused */
0x01, /* number of subdirectories (OpenPGP) */
0x01, /* number of elementary files (SerialNo) */
0x00, /* number of secret codes */
0x00, /* Unused */
0x00, 0x00 /* PIN status: OK, PIN blocked?: No */
};
static const uint8_t const
get_data_rb_result[] __attribute__ ((aligned (1))) = {
0x5a, 0x4, 0x01, 0x02, 0x03, 0x04
};
void
write_res_apdu (const uint8_t *p, int len, uint8_t sw1, uint8_t sw2)
@ -394,7 +414,7 @@ cmd_select_file (void)
}
else
{
write_res_apdu ((const uint8_t *)select_file_TOP_result,
write_res_apdu (select_file_TOP_result,
sizeof (select_file_TOP_result), 0x90, 0x00);
}