diff options
author | NIIBE Yutaka <[email protected]> | 2015-07-25 03:09:23 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2015-07-25 03:09:23 +0000 |
commit | ef080d5c7fb7f3b75c3c57c011f78a312b8e13a9 (patch) | |
tree | 8700bb903f43af4979141d1ddbdd947ad890dfd8 /g10/call-agent.c | |
parent | doc: Document scissor line for commit logs (diff) | |
download | gnupg-ef080d5c7fb7f3b75c3c57c011f78a312b8e13a9.tar.gz gnupg-ef080d5c7fb7f3b75c3c57c011f78a312b8e13a9.zip |
scd: support any curves defined by libgcrypt.
* g10/call-agent.h (struct agent_card_info_s): Add curve field.
* g10/call-agent.c (learn_status_cb): Use curve name.
* g10/card-util.c (card_status): Show pubkey name.
* scd/app-openpgp.c (struct app_local_s): Record OID and flags.
(store_fpr): Use ALGO instead of key type.
(send_key_attr): Use curve name instead of OID.
(get_public_key): Clean up by OID to curve name.
(ecc_writekey): Support any curves in libgcrypt.
(do_genkey, do_auth, ): Follow the change.
(ecc_oid): New.
(parse_algorithm_attribute): Show OID here.
Diffstat (limited to '')
-rw-r--r-- | g10/call-agent.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c index edee66ed4..0df572a62 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -645,14 +645,32 @@ learn_status_cb (void *opaque, const char *line) } else if (keywordlen == 8 && !memcmp (keyword, "KEY-ATTR", keywordlen)) { - int keyno, algo, nbits; + int keyno = 0; + int algo = PUBKEY_ALGO_RSA; + int n = 0; - sscanf (line, "%d %d %d", &keyno, &algo, &nbits); + sscanf (line, "%d %d %n", &keyno, &algo, &n); keyno--; - if (keyno >= 0 && keyno < DIM (parm->key_attr)) + if (keyno < 0 || keyno >= DIM (parm->key_attr)) + return 0; + + parm->key_attr[keyno].algo = algo; + if (algo == PUBKEY_ALGO_RSA) + parm->key_attr[keyno].nbits = strtoul (line+n+3, NULL, 10); + else if (algo == PUBKEY_ALGO_ECDH || algo == PUBKEY_ALGO_ECDSA + || algo == PUBKEY_ALGO_EDDSA) { - parm->key_attr[keyno].algo = algo; - parm->key_attr[keyno].nbits = nbits; + const char *curve; + + i = 0; + do + { + curve = openpgp_enum_curves (&i); + if (!strcmp (curve, line+n)) + break; + } + while (curve != NULL); + parm->key_attr[keyno].curve = curve; } } else if (keywordlen == 12 && !memcmp (keyword, "PRIVATE-DO-", 11) |