summaryrefslogtreecommitdiff
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 aa8cfcf67..f3d4f69a5 100644
--- a/cipher.c
+++ b/cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.c,v 1.108 2017/11/03 02:22:41 djm Exp $ */ 1/* $OpenBSD: cipher.c,v 1.109 2018/02/07 02:06:50 jsing Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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,
310 } else { 310 } else {
311 if (cc != NULL) { 311 if (cc != NULL) {
312#ifdef WITH_OPENSSL 312#ifdef WITH_OPENSSL
313 if (cc->evp != NULL) 313 EVP_CIPHER_CTX_free(cc->evp);
314 EVP_CIPHER_CTX_free(cc->evp);
315#endif /* WITH_OPENSSL */ 314#endif /* WITH_OPENSSL */
316 explicit_bzero(cc, sizeof(*cc)); 315 explicit_bzero(cc, sizeof(*cc));
317 free(cc); 316 free(cc);
@@ -416,10 +415,8 @@ cipher_free(struct sshcipher_ctx *cc)
416 else if ((cc->cipher->flags & CFLAG_AESCTR) != 0) 415 else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)
417 explicit_bzero(&cc->ac_ctx, sizeof(cc->ac_ctx)); 416 explicit_bzero(&cc->ac_ctx, sizeof(cc->ac_ctx));
418#ifdef WITH_OPENSSL 417#ifdef WITH_OPENSSL
419 if (cc->evp != NULL) { 418 EVP_CIPHER_CTX_free(cc->evp);
420 EVP_CIPHER_CTX_free(cc->evp); 419 cc->evp = NULL;
421 cc->evp = NULL;
422 }
423#endif 420#endif
424 explicit_bzero(cc, sizeof(*cc)); 421 explicit_bzero(cc, sizeof(*cc));
425 free(cc); 422 free(cc);