]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
siv: deinit gnutls on unsupported SIV
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 2 Sep 2021 07:56:58 +0000 (09:56 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 2 Sep 2021 11:35:35 +0000 (13:35 +0200)
siv_gnutls.c

index 77942ece60c5adb02a37beadcd1d9bbb681659d0..437f7151ebe77314bc5312ee835b8352921523f0 100644 (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;