mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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.
This commit is contained in:
parent
4ee4b99837
commit
ef080d5c7f
4 changed files with 180 additions and 232 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue