summaryrefslogtreecommitdiffstats
path: root/cipher.c
diff options
context:
space:
mode:
authorjsing@openbsd.org <jsing@openbsd.org>2018-02-07 02:06:50 +0000
committerDarren Tucker <dtucker@dtucker.net>2018-02-08 09:26:27 +1100
commit7cd31632e3a6607170ed0c9ed413a7ded5b9b377 (patch)
tree2acf74a8e668468768bdf9fe1b48d2289b3299bb /cipher.c
parent3c000d57d46882eb736c6563edfc4995915c24a2 (diff)
upstream commit
Remove all guards for calls to OpenSSL free functions - all of these functions handle NULL, from at least OpenSSL 1.0.1g onwards. Prompted by dtucker@ asking about guards for RSA_free(), when looking at openssh-portable pr#84 on github. ok deraadt@ dtucker@ OpenBSD-Commit-ID: 954f1c51b94297d0ae1f749271e184141e0cadae
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/cipher.c b/cipher.c
index aa8cfcf6..f3d4f69a 100644
--- a/cipher.c
+++ b/cipher.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cipher.c,v 1.108 2017/11/03 02:22:41 djm Exp $ */
+/* $OpenBSD: cipher.c,v 1.109 2018/02/07 02:06:50 jsing Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -310,8 +310,7 @@ cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher,
} else {
if (cc != NULL) {
#ifdef WITH_OPENSSL
- if (cc->evp != NULL)
- EVP_CIPHER_CTX_free(cc->evp);
+ EVP_CIPHER_CTX_free(cc->evp);
#endif /* WITH_OPENSSL */
explicit_bzero(cc, sizeof(*cc));
free(cc);
@@ -416,10 +415,8 @@ cipher_free(struct sshcipher_ctx *cc)
else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)
explicit_bzero(&cc->ac_ctx, sizeof(cc->ac_ctx));
#ifdef WITH_OPENSSL
- if (cc->evp != NULL) {
- EVP_CIPHER_CTX_free(cc->evp);
- cc->evp = NULL;
- }
+ EVP_CIPHER_CTX_free(cc->evp);
+ cc->evp = NULL;
#endif
explicit_bzero(cc, sizeof(*cc));
free(cc);