summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/evp_enc.c')
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index 556908fd10..f8d2cb78d4 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.30 2016/05/04 15:05:13 tedu Exp $ */ 1/* $OpenBSD: evp_enc.c,v 1.31 2016/05/30 13:42:54 beck 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 *
@@ -264,9 +264,9 @@ int
264EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 264EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
265{ 265{
266 if (ctx->encrypt) 266 if (ctx->encrypt)
267 return EVP_EncryptFinal(ctx, out, outl); 267 return EVP_EncryptFinal_ex(ctx, out, outl);
268 else 268 else
269 return EVP_DecryptFinal(ctx, out, outl); 269 return EVP_DecryptFinal_ex(ctx, out, outl);
270} 270}
271 271
272int 272int
@@ -371,6 +371,7 @@ EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
371 int ret; 371 int ret;
372 372
373 ret = EVP_EncryptFinal_ex(ctx, out, outl); 373 ret = EVP_EncryptFinal_ex(ctx, out, outl);
374 (void) EVP_CIPHER_CTX_cleanup(ctx);
374 return ret; 375 return ret;
375} 376}
376 377
@@ -484,6 +485,7 @@ EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
484 int ret; 485 int ret;
485 486
486 ret = EVP_DecryptFinal_ex(ctx, out, outl); 487 ret = EVP_DecryptFinal_ex(ctx, out, outl);
488 (void) EVP_CIPHER_CTX_cleanup(ctx);
487 return ret; 489 return ret;
488} 490}
489 491
@@ -571,7 +573,7 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
571 * functional reference we held for this reason. */ 573 * functional reference we held for this reason. */
572 ENGINE_finish(c->engine); 574 ENGINE_finish(c->engine);
573#endif 575#endif
574 memset(c, 0, sizeof(EVP_CIPHER_CTX)); 576 explicit_bzero(c, sizeof(EVP_CIPHER_CTX));
575 return 1; 577 return 1;
576} 578}
577 579