X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fevp%2Fbio_enc.c;h=2e6ce33e4e5a4c25ed960968a2d78936c7c80f75;hb=936166aff21dafed33aeb92bad0a5b46d730221d;hp=4409a91242b473eefd8b27e49d18c06d79cb7049;hpb=b196e7d936fb377d9c5b305748ac25ff0e53ef6d;p=oweals%2Fopenssl.git diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c index 4409a91242..2e6ce33e4e 100644 --- a/crypto/evp/bio_enc.c +++ b/crypto/evp/bio_enc.c @@ -58,7 +58,7 @@ #include #include -#include "cryptlib.h" +#include "internal/cryptlib.h" #include #include @@ -112,17 +112,13 @@ static int enc_new(BIO *bi) { BIO_ENC_CTX *ctx; - ctx = OPENSSL_malloc(sizeof(BIO_ENC_CTX)); + ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx == NULL) return (0); - EVP_CIPHER_CTX_init(&ctx->cipher); - ctx->buf_len = 0; - ctx->buf_off = 0; + EVP_CIPHER_CTX_init(&ctx->cipher); ctx->cont = 1; - ctx->finished = 0; ctx->ok = 1; - bi->init = 0; bi->ptr = (char *)ctx; bi->flags = 0; @@ -137,8 +133,7 @@ static int enc_free(BIO *a) return (0); b = (BIO_ENC_CTX *)a->ptr; EVP_CIPHER_CTX_cleanup(&(b->cipher)); - OPENSSL_cleanse(a->ptr, sizeof(BIO_ENC_CTX)); - OPENSSL_free(a->ptr); + OPENSSL_clear_free(a->ptr, sizeof(BIO_ENC_CTX)); a->ptr = NULL; a->init = 0; a->flags = 0;