diff options
Diffstat (limited to 'src/lib/libcrypto/evp/evp_enc.c')
-rw-r--r-- | src/lib/libcrypto/evp/evp_enc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index c46989b068..49e0ffa144 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_enc.c,v 1.46 2022/09/04 13:34:13 jsing Exp $ */ | 1 | /* $OpenBSD: evp_enc.c,v 1.47 2022/09/13 04:59:18 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -601,18 +601,21 @@ int | |||
601 | EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | 601 | EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) |
602 | { | 602 | { |
603 | if (c->cipher != NULL) { | 603 | if (c->cipher != NULL) { |
604 | if (c->cipher->cleanup && !c->cipher->cleanup(c)) | 604 | if (c->cipher->cleanup != NULL) |
605 | return 0; | 605 | c->cipher->cleanup(c); |
606 | /* Cleanse cipher context data */ | 606 | if (c->cipher_data != NULL) |
607 | if (c->cipher_data) | ||
608 | explicit_bzero(c->cipher_data, c->cipher->ctx_size); | 607 | explicit_bzero(c->cipher_data, c->cipher->ctx_size); |
609 | } | 608 | } |
609 | |||
610 | /* XXX - store size of cipher_data so we can always freezero(). */ | 610 | /* XXX - store size of cipher_data so we can always freezero(). */ |
611 | free(c->cipher_data); | 611 | free(c->cipher_data); |
612 | |||
612 | #ifndef OPENSSL_NO_ENGINE | 613 | #ifndef OPENSSL_NO_ENGINE |
613 | ENGINE_finish(c->engine); | 614 | ENGINE_finish(c->engine); |
614 | #endif | 615 | #endif |
616 | |||
615 | explicit_bzero(c, sizeof(EVP_CIPHER_CTX)); | 617 | explicit_bzero(c, sizeof(EVP_CIPHER_CTX)); |
618 | |||
616 | return 1; | 619 | return 1; |
617 | } | 620 | } |
618 | 621 | ||