On 07/03/2013 03:00 PM, Daniel Vassdal wrote:
> Is it reliable to cast from gnutls_mac_algorithm_t to 
> gnutls_digest_algorithm_t?
> I want to let the user dynamically select hashing algorithm from what their 
> gnutls installation supports, so what I'm doing is:
> gnutls_digest_algorithm_t selected_hash = 
> (gnutls_digest_algorithm_t)gnutls_mac_get_id(hash_name);
> Is this prone to failure? I see the enums have a comment in them telling to 
> align them. Could this change?
> Is there a better way to do what I want to do?

In general yes, but note that gnutls_mac_algorithm_t is a superset of
gnutls_digest_algorithm_t, i.e., a MAC algorithm may not always be a
digest algorithm (e.g. UMAC).

I'll try to add similar functions for the digest algorithms to avoid
such issues.

regards,
Nikos


_______________________________________________
Gnutls-help mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-help

Reply via email to