From 29410c170eaea11686dc21ac94b1f250e5fcf66b Mon Sep 17 00:00:00 2001 From: Yaroslav Isakov Date: Tue, 6 Apr 2021 17:58:23 +0200 Subject: [PATCH] Make OpenPGP curves to be a pointer to OpenPGP 3.4 curves list --- src/libopensc/card-openpgp.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c index c2bb4d7d..f54bf517 100644 --- a/src/libopensc/card-openpgp.c +++ b/src/libopensc/card-openpgp.c @@ -87,8 +87,11 @@ static struct sc_card_driver pgp_drv = { }; -/* v3.0+ supports: [RFC 4880 & 6637] 0x12 = ECDH, 0x13 = ECDSA */ -static pgp_ec_curves_t ec_curves_openpgp[] = { +static pgp_ec_curves_t ec_curves_openpgp34[] = { + /* OpenPGP 3.4+ Ed25519 and Curve25519 */ + {{{1, 3, 6, 1, 4, 1, 3029, 1, 5, 1, -1}}, 256}, /* curve25519 for encryption => CKK_EC_MONTGOMERY */ + {{{1, 3, 6, 1, 4, 1, 11591, 15, 1, -1}}, 256}, /* ed25519 for signatures => CKK_EC_EDWARDS */ + /* v3.0+ supports: [RFC 4880 & 6637] 0x12 = ECDH, 0x13 = ECDSA */ {{{1, 2, 840, 10045, 3, 1, 7, -1}}, 256}, /* ansiX9p256r1 */ {{{1, 3, 132, 0, 34, -1}}, 384}, /* ansiX9p384r1 */ {{{1, 3, 132, 0, 35, -1}}, 521}, /* ansiX9p521r1 */ @@ -98,18 +101,7 @@ static pgp_ec_curves_t ec_curves_openpgp[] = { {{{-1}}, 0} /* This entry must not be touched. */ }; -/* v3.0+ supports: [RFC 4880 & 6637] 0x12 = ECDH, 0x13 = ECDSA */ -static pgp_ec_curves_t ec_curves_openpgp34[] = { - {{{1, 2, 840, 10045, 3, 1, 7, -1}}, 256}, /* ansiX9p256r1 */ - {{{1, 3, 132, 0, 34, -1}}, 384}, /* ansiX9p384r1 */ - {{{1, 3, 132, 0, 35, -1}}, 521}, /* ansiX9p521r1 */ - {{{1, 3, 36, 3, 3, 2, 8, 1, 1, 7, -1}}, 256}, /* brainpoolP256r1 */ - {{{1, 3, 36, 3, 3, 2, 8, 1, 1, 11, -1}}, 384}, /* brainpoolP384r1 */ - {{{1, 3, 36, 3, 3, 2, 8, 1, 1, 13, -1}}, 512}, /* brainpoolP512r1 */ - {{{1, 3, 6, 1, 4, 1, 3029, 1, 5, 1, -1}}, 256}, /* curve25519 for encryption => CKK_EC_MONTGOMERY */ - {{{1, 3, 6, 1, 4, 1, 11591, 15, 1, -1}}, 256}, /* ed25519 for signatures => CKK_EC_EDWARDS */ - {{{-1}}, 0} /* This entry must not be touched. */ -}; +static pgp_ec_curves_t *ec_curves_openpgp = ec_curves_openpgp34 + 2; struct sc_object_id curve25519_oid = {{1, 3, 6, 1, 4, 1, 3029, 1, 5, 1, -1}};