diff options
author | Daiki Ueno <ueno@gnu.org> | 2022-01-12 08:15:24 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2022-01-12 08:16:03 +0100 |
commit | 93085b76bd3fa43cb596b6d894510c49405213ec (patch) | |
tree | 55eff5a5ba0af736d857b8cb7095332a0d119598 /tests | |
parent | a06be080ca4894ebb22071911bda777b45d993d9 (diff) | |
download | gnutls-93085b76bd3fa43cb596b6d894510c49405213ec.tar.gz |
tests: simple: check if the digest algorithm is compiled in
When the library is built with --disable-gost, gnutls_digest_get_id
returns GNUTLS_DIG_UNKNOWN for GOST algorithms.
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/simple.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/simple.c b/tests/simple.c index 5e20c61182..b2d53d8032 100644 --- a/tests/simple.c +++ b/tests/simple.c @@ -128,7 +128,12 @@ void doit(void) hash = gnutls_sign_get_hash_algorithm(algs[i]); if (hash != GNUTLS_DIG_UNKNOWN) { const char *name = gnutls_digest_get_name(hash); - if (gnutls_digest_get_id(name) != hash) + gnutls_digest_algorithm_t hash2 = gnutls_digest_get_id(name); + /* gnutls_digest_get_id returns + * GNUTLS_DIG_UNKNOWN if the algorithm is not + * compiled in. + */ + if (hash2 != GNUTLS_DIG_UNKNOWN && hash2 != hash) fail("gnutls_digest id for %s doesn't match %s\n", gnutls_sign_algorithm_get_name(algs[i]), name); |