summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/cipher.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-02-07 02:06:50 +0000
committerjsing <jsing@openbsd.org>2018-02-07 02:06:50 +0000
commite7fab504cc56b1bcad841564992d71bf5f905dce (patch)
treeb0d1b6c09c41af3c4dab09021a9275e15dc4a65f /usr.bin/ssh/cipher.c
parentremove mobileip(4) tendrils (diff)
downloadwireguard-openbsd-e7fab504cc56b1bcad841564992d71bf5f905dce.tar.xz
wireguard-openbsd-e7fab504cc56b1bcad841564992d71bf5f905dce.zip
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@
Diffstat (limited to 'usr.bin/ssh/cipher.c')
-rw-r--r--usr.bin/ssh/cipher.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/ssh/cipher.c b/usr.bin/ssh/cipher.c
index ec6c138c4d6..cded43b2bb3 100644
--- a/usr.bin/ssh/cipher.c
+++ b/usr.bin/ssh/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
@@ -304,8 +304,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);
@@ -410,10 +409,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);