diff options
author | Werner Koch <[email protected]> | 2015-03-10 14:26:02 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-03-10 14:35:30 +0000 |
commit | 14af2be022ccaf826db048fc16959d0222ff1134 (patch) | |
tree | e2709ea773358d16deaeb238f55a087e12940929 /common/t-openpgp-oid.c | |
parent | scd: fix for 64-bit arch. (diff) | |
download | gnupg-14af2be022ccaf826db048fc16959d0222ff1134.tar.gz gnupg-14af2be022ccaf826db048fc16959d0222ff1134.zip |
gpg: Add --list-gcrypt-config and "curve" item for --list-config.
* common/openpgp-oid.c (curve_supported_p): New.
(openpgp_enum_curves): New.
* common/t-openpgp-oid.c (test_openpgp_enum_curves): New.
(main): Add option --verbose.
* g10/gpg.c (opts): Add --list-gcrypt-config.
(list_config): Add items "curve" and "curveoid". Remove unused code.
--
GnuPG-bug-id: 1917
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | common/t-openpgp-oid.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/common/t-openpgp-oid.c b/common/t-openpgp-oid.c index 5cd778d72..afb6ebe62 100644 --- a/common/t-openpgp-oid.c +++ b/common/t-openpgp-oid.c @@ -35,6 +35,10 @@ #define BADOID "1.3.6.1.4.1.11591.2.12242973" +static int verbose; + + + static void test_openpgp_oid_from_str (void) { @@ -184,15 +188,51 @@ test_openpgp_oid_is_ed25519 (void) } +static void +test_openpgp_enum_curves (void) +{ + int iter = 0; + const char *name; + int p256 = 0; + int p384 = 0; + int p521 = 0; + + while ((name = openpgp_enum_curves (&iter))) + { + if (verbose) + printf ("curve: %s\n", name); + if (!strcmp (name, "nistp256")) + p256++; + else if (!strcmp (name, "nistp384")) + p384++; + else if (!strcmp (name, "nistp521")) + p521++; + } + + if (p256 != 1 || p384 != 1 || p521 != 1) + { + /* We can only check the basic RFC-6637 requirements. */ + fputs ("standard ECC curve missing\n", stderr); + exit (1); + } +} + + int main (int argc, char **argv) { - (void)argc; - (void)argv; + if (argc) + { argc--; argv++; } + if (argc && !strcmp (argv[0], "--verbose")) + { + verbose = 1; + argc--; argv++; + } test_openpgp_oid_from_str (); test_openpgp_oid_to_str (); test_openpgp_oid_is_ed25519 (); + test_openpgp_enum_curves (); return 0; } |