diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2019-11-22 17:21:19 +0300 |
---|---|---|
committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2019-11-22 17:21:19 +0300 |
commit | c4b7b23e00cc4e5d92f38fda0cadee8ef349016f (patch) | |
tree | bcb6a0188707fa309c8730127b8782f8c4184d68 | |
parent | 82cb8c6381bfacd63e801525c713c6dca2c330d7 (diff) | |
download | gnutls-c4b7b23e00cc4e5d92f38fda0cadee8ef349016f.tar.gz |
tests: make tests pass with disabled GOST algorithms
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
-rw-r--r-- | tests/cert-tests/data/gost-cert-nogost.pem | 1 | ||||
-rw-r--r-- | tests/key-export-pkcs8.c | 2 | ||||
-rw-r--r-- | tests/key-import-export.c | 6 | ||||
-rw-r--r-- | tests/privkey-keygen.c | 18 |
4 files changed, 22 insertions, 5 deletions
diff --git a/tests/cert-tests/data/gost-cert-nogost.pem b/tests/cert-tests/data/gost-cert-nogost.pem index bf280349fd..76fcd3d8b9 100644 --- a/tests/cert-tests/data/gost-cert-nogost.pem +++ b/tests/cert-tests/data/gost-cert-nogost.pem @@ -6,6 +6,7 @@ X.509 Certificate Information: Not Before: Fri Aug 17 06:47:36 UTC 2012 Not After: Sat Aug 17 06:47:36 UTC 2013 Subject: CN=SuperTerm0000001,OU=SuperPlat Terminals,O=SuperPlat,L=Moscow,ST=Russia,C=RU +error importing public key: The curve is unsupported Subject Public Key Algorithm: GOST R 34.10-2001 Extensions: Basic Constraints (not critical): diff --git a/tests/key-export-pkcs8.c b/tests/key-export-pkcs8.c index aa11bd7405..9956e505ca 100644 --- a/tests/key-export-pkcs8.c +++ b/tests/key-export-pkcs8.c @@ -172,6 +172,7 @@ int check_ed25519(void) static int check_gost(void) { +#ifdef ENABLE_GOST gnutls_x509_privkey_t key; gnutls_datum_t out; int ret; @@ -193,6 +194,7 @@ int check_gost(void) gnutls_free(out.data); gnutls_x509_privkey_deinit(key); +#endif return 0; } diff --git a/tests/key-import-export.c b/tests/key-import-export.c index 47b8804c32..45434eeb2d 100644 --- a/tests/key-import-export.c +++ b/tests/key-import-export.c @@ -289,8 +289,10 @@ int check_privkey_import_export(void) gnutls_datum_t p, q, g, y, x; gnutls_datum_t m, e, u, e1, e2, d; gnutls_ecc_curve_t curve; +#ifdef ENABLE_GOST gnutls_digest_algorithm_t digest; gnutls_gost_paramset_t paramset; +#endif int ret; global_init(); @@ -473,6 +475,7 @@ int check_privkey_import_export(void) gnutls_privkey_deinit(key); /* GOST */ +#ifdef ENABLE_GOST ret = gnutls_privkey_init(&key); if (ret < 0) fail("error\n"); @@ -527,6 +530,7 @@ int check_privkey_import_export(void) gnutls_free(y.data); gnutls_free(p.data); gnutls_privkey_deinit(key); +#endif return 0; } @@ -891,6 +895,7 @@ int check_ed25519(void) static int check_gost(void) { +#ifdef ENABLE_GOST gnutls_privkey_t key; gnutls_pubkey_t pub; gnutls_datum_t y, x, k; @@ -993,6 +998,7 @@ int check_gost(void) gnutls_privkey_deinit(key); gnutls_pubkey_deinit(pub); +#endif return 0; } diff --git a/tests/privkey-keygen.c b/tests/privkey-keygen.c index ad0bad8675..7491e3cf33 100644 --- a/tests/privkey-keygen.c +++ b/tests/privkey-keygen.c @@ -125,12 +125,20 @@ void doit(void) algorithm == GNUTLS_PK_ECDH_X25519) continue; - if (gnutls_fips140_mode_enabled() && - (algorithm == GNUTLS_PK_GOST_01 || - algorithm == GNUTLS_PK_GOST_12_256 || - algorithm == GNUTLS_PK_GOST_12_512)) + if (algorithm == GNUTLS_PK_GOST_01 || + algorithm == GNUTLS_PK_GOST_12_256 || + algorithm == GNUTLS_PK_GOST_12_512) { + /* Skip GOST algorithms: + * - If they are disabled by ./configure option + * - Or in FIPS140 mode + */ +#ifdef ENABLE_GOST + if (gnutls_fips140_mode_enabled()) + continue; +#else continue; - +#endif + } ret = gnutls_x509_privkey_init(&pkey); if (ret < 0) { |