From db2187835c19e5ddc5ba92b8d3b35e0dcaf9844c Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 25 Feb 2014 11:06:11 +0900 Subject: [PATCH] don't put OID for public key info. --- ChangeLog | 2 ++ src/openpgp-do.c | 28 +++++++--------------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f7ffd5..b87a3d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 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. diff --git a/src/openpgp-do.c b/src/openpgp-do.c index 5b5a010..66aac38 100644 --- a/src/openpgp-do.c +++ b/src/openpgp-do.c @@ -1061,9 +1061,9 @@ gpg_do_chks_prvkey (enum kind_of_key kk, * 4d, xx, xx, xx: Extended Header List * b6 00 (SIG) / b8 00 (DEC) / a4 00 (AUT) * 7f48, xx: cardholder private key template - * 91 xx: length of E - * 92 xx xx: length of P - * 93 xx xx: length of Q + * 91 L: L: 91=tag of E, L: length of E + * 92 Lh

Ll

: 92=tag of P, L

: length of P + * 93 Lh Ll: 93=tag of Q, L: length of Q * 5f48, xx xx xx: cardholder private key * , , * @@ -1071,9 +1071,9 @@ gpg_do_chks_prvkey (enum kind_of_key kk, * 4d, xx: Extended Header List * a4 00 (AUT) * 7f48, xx: cardholder private key template - * 91 xx: length of d + * 9x LEN: 9x=tag of private key d, LEN=length of d * 5f48, xx : cardholder private key - * + * (in the format of: 04 || X || Y ) */ static int proc_key_import (const uint8_t *data, int len) @@ -1686,27 +1686,13 @@ gpg_do_public_key (uint8_t kk_byte) #error "not supported." #endif { /* ECDSA */ - const uint8_t *algorithm_attr; - int aa_len; - - if (kk_byte == 0xb6) - algorithm_attr = algorithm_attr_p256k1; - else - algorithm_attr = algorithm_attr_p256r1; - aa_len = algorithm_attr[0] - 1; - /* LEN */ - *res_p++ = 2 + aa_len + 2 + 1 + 64; + *res_p++ = 2 + 1 + 64; { - /*TAG*/ /* LEN = AA_LEN */ - *res_p++ = 0x06; *res_p++ = aa_len; - memcpy (res_p, algorithm_attr+2, aa_len); - res_p += aa_len; - /*TAG*/ /* LEN = 1+64 */ *res_p++ = 0x86; *res_p++ = 0x41; *res_p++ = 0x04; /* No compression of EC point. */ - /* 64-byte binary (big endian) */ + /* 64-byte binary (big endian): X || Y */ memcpy (res_p, key_addr + KEY_CONTENT_LEN, 64); res_p += 64; }