diff options
author | Daiki Ueno <ueno@gnu.org> | 2020-06-12 11:32:58 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2020-06-15 09:44:13 +0200 |
commit | adf825e2b84cc40721692fa23f7e5a85a03441a7 (patch) | |
tree | 2a2ddee4e2a4f087371d584806fc9f71ff7bbabd /lib/algorithms.h | |
parent | 1270e81b944e1672f89d8a8b1db986535cf5b072 (diff) | |
download | gnutls-adf825e2b84cc40721692fa23f7e5a85a03441a7.tar.gz |
build: avoid -Wenum-conversion warnings with GCC 10
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/algorithms.h')
-rw-r--r-- | lib/algorithms.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/algorithms.h b/lib/algorithms.h index 9cdb3abf7a..7a051b6365 100644 --- a/lib/algorithms.h +++ b/lib/algorithms.h @@ -174,11 +174,24 @@ inline static int _gnutls_mac_get_key_size(const mac_entry_st * e) return e->key_size; } +inline static gnutls_digest_algorithm_t +_gnutls_mac_to_dig(gnutls_mac_algorithm_t mac) +{ + if (unlikely(mac >= GNUTLS_MAC_AEAD)) + return GNUTLS_DIG_UNKNOWN; + + return (gnutls_digest_algorithm_t)mac; +} + +#define MAC_TO_DIG(mac) _gnutls_mac_to_dig(mac) + /* Functions for digests. */ #define _gnutls_x509_digest_to_oid _gnutls_x509_mac_to_oid #define _gnutls_digest_get_name _gnutls_mac_get_name #define _gnutls_hash_get_algo_len _gnutls_mac_get_algo_len +#define DIG_TO_MAC(dig) (gnutls_mac_algorithm_t)(dig) + /* Security against pre-image attacks */ inline static int _gnutls_digest_is_secure(const mac_entry_st * e) { |