siv: deinit gnutls on unsupported SIV

This commit is contained in:
Miroslav Lichvar 2021-09-02 09:56:58 +02:00
parent 0ad5f5ea89
commit 70a0f18d52

View file

@ -102,8 +102,11 @@ SIV_CreateInstance(SIV_Algorithm algorithm)
init_gnutls();
/* Check if the cipher is actually supported */
if (gnutls_cipher_get_tag_size(calgo) == 0)
if (gnutls_cipher_get_tag_size(calgo) == 0) {
if (instance_counter == 0)
deinit_gnutls();
return NULL;
}
instance = MallocNew(struct SIV_Instance_Record);
instance->algorithm = calgo;