From: Daiki Ueno Date: Wed, 12 Jan 2022 07:15:24 +0000 (+0100) Subject: tests: simple: check if the digest algorithm is compiled in X-Git-Tag: 3.7.3~5^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93085b76bd3fa43cb596b6d894510c49405213ec;p=thirdparty%2Fgnutls.git 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 --- 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);