iked: replace a conditional EVP_CIPHER_CTX_cleanup() + free() stanza
authortb <tb@openbsd.org>
Thu, 18 Nov 2021 22:59:03 +0000 (22:59 +0000)
committertb <tb@openbsd.org>
Thu, 18 Nov 2021 22:59:03 +0000 (22:59 +0000)
with an unconditional EVP_CIPHER_CTX_free().

ok tobhe

sbin/iked/crypto.c

index 9b5f38b..4ecda33 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: crypto.c,v 1.35 2021/11/18 22:42:02 tobhe Exp $       */
+/*     $OpenBSD: crypto.c,v 1.36 2021/11/18 22:59:03 tb Exp $  */
 
 /*
  * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -551,10 +551,7 @@ cipher_free(struct iked_cipher *encr)
 {
        if (encr == NULL)
                return;
-       if (encr->encr_ctx != NULL) {
-               EVP_CIPHER_CTX_cleanup(encr->encr_ctx);
-               free(encr->encr_ctx);
-       }
+       EVP_CIPHER_CTX_free(encr->encr_ctx);
        ibuf_release(encr->encr_iv);
        ibuf_release(encr->encr_key);
        free(encr);