There is no need for us to be diving inside the EVP_MD_CTX in the
implementation of an MD BIO. We can just use public APIs. By doing this
certain calls (such as getting the MD out of the BIO were not working
correctly) where providers are in use.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10116)
#include <stdio.h>
#include <errno.h>
-#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/evp.h>
-#include "crypto/evp.h"
-#include "evp_local.h"
#include "internal/bio.h"
/*
switch (cmd) {
case BIO_CTRL_RESET:
if (BIO_get_init(b))
- ret = EVP_DigestInit_ex(ctx, ctx->digest, NULL);
+ ret = EVP_DigestInit_ex(ctx, EVP_MD_CTX_md(ctx), NULL);
else
ret = 0;
if (ret > 0)
case BIO_C_GET_MD:
if (BIO_get_init(b)) {
ppmd = ptr;
- *ppmd = ctx->digest;
+ *ppmd = EVP_MD_CTX_md(ctx);
} else
ret = 0;
break;
ctx = BIO_get_data(bp);
- if (size < ctx->digest->md_size)
+ if (size < EVP_MD_CTX_size(ctx))
return 0;
if (EVP_DigestFinal_ex(ctx, (unsigned char *)buf, &ret) <= 0)