summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/err/openssl.txt1
-rw-r--r--crypto/evp/digest.c5
-rw-r--r--crypto/evp/evp_err.c1
-rw-r--r--crypto/evp/evp_lib.c8
-rw-r--r--crypto/include/internal/evp_int.h1
5 files changed, 16 insertions, 0 deletions
diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt
index fbf35d14bf..f15fc9c1bd 100644
--- a/crypto/err/openssl.txt
+++ b/crypto/err/openssl.txt
@@ -800,6 +800,7 @@ EVP_F_EVP_MAC_CTRL_STR:210:EVP_MAC_ctrl_str
EVP_F_EVP_MAC_CTX_COPY:211:EVP_MAC_CTX_copy
EVP_F_EVP_MAC_CTX_NEW:213:EVP_MAC_CTX_new
EVP_F_EVP_MAC_INIT:212:EVP_MAC_init
+EVP_F_EVP_MD_BLOCK_SIZE:229:EVP_MD_block_size
EVP_F_EVP_MD_CTX_COPY_EX:110:EVP_MD_CTX_copy_ex
EVP_F_EVP_MD_SIZE:162:EVP_MD_size
EVP_F_EVP_OPENINIT:102:EVP_OpenInit
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 89f8e54a91..b93a014564 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -549,6 +549,11 @@ static void *evp_md_from_dispatch(int mdtype, const OSSL_DISPATCH *fns,
break;
md->size = OSSL_get_OP_digest_size(fns);
break;
+ case OSSL_FUNC_DIGEST_BLOCK_SIZE:
+ if (md->dblock_size != NULL)
+ break;
+ md->dblock_size = OSSL_get_OP_digest_block_size(fns);
+ break;
}
}
if ((fncnt != 0 && fncnt != 5)
diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c
index 6e72b6b427..a3e01fdd5d 100644
--- a/crypto/evp/evp_err.c
+++ b/crypto/evp/evp_err.c
@@ -71,6 +71,7 @@ static const ERR_STRING_DATA EVP_str_functs[] = {
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MAC_CTX_COPY, 0), "EVP_MAC_CTX_copy"},
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MAC_CTX_NEW, 0), "EVP_MAC_CTX_new"},
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MAC_INIT, 0), "EVP_MAC_init"},
+ {ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MD_BLOCK_SIZE, 0), "EVP_MD_block_size"},
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MD_CTX_COPY_EX, 0), "EVP_MD_CTX_copy_ex"},
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MD_SIZE, 0), "EVP_MD_size"},
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_OPENINIT, 0), "EVP_OpenInit"},
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index f99e905e42..914a19cc5e 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -298,6 +298,14 @@ int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
int EVP_MD_block_size(const EVP_MD *md)
{
+ if (md == NULL) {
+ EVPerr(EVP_F_EVP_MD_BLOCK_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
+ return -1;
+ }
+
+ if (md->prov != NULL && md->dblock_size != NULL)
+ return (int)md->dblock_size();
+
return md->block_size;
}
diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h
index ab8ce00e47..c932898139 100644
--- a/crypto/include/internal/evp_int.h
+++ b/crypto/include/internal/evp_int.h
@@ -204,6 +204,7 @@ struct evp_md_st {
OSSL_OP_digest_freectx_fn *freectx;
OSSL_OP_digest_dupctx_fn *dupctx;
OSSL_OP_digest_size_fn *size;
+ OSSL_OP_digest_block_size_fn *dblock_size;
} /* EVP_MD */ ;