mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Omit block_size when MD_C is not enabled
It's only used by our HMAC implementation Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
50
library/md.c
50
library/md.c
@ -76,91 +76,75 @@
|
|||||||
#error "Internal error: MBEDTLS_MD_MAX_SIZE < PSA_HASH_MAX_SIZE"
|
#error "Internal error: MBEDTLS_MD_MAX_SIZE < PSA_HASH_MAX_SIZE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_MD_C)
|
||||||
|
#define MD_INFO(type, out_size, block_size) type, out_size, block_size,
|
||||||
|
#else
|
||||||
|
#define MD_INFO(type, out_size, block_size) type, out_size,
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_MD5)
|
#if defined(MBEDTLS_MD_CAN_MD5)
|
||||||
static const mbedtls_md_info_t mbedtls_md5_info = {
|
static const mbedtls_md_info_t mbedtls_md5_info = {
|
||||||
MBEDTLS_MD_MD5,
|
MD_INFO(MBEDTLS_MD_MD5, 16, 64)
|
||||||
16,
|
|
||||||
64,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_RIPEMD160)
|
#if defined(MBEDTLS_MD_CAN_RIPEMD160)
|
||||||
static const mbedtls_md_info_t mbedtls_ripemd160_info = {
|
static const mbedtls_md_info_t mbedtls_ripemd160_info = {
|
||||||
MBEDTLS_MD_RIPEMD160,
|
MD_INFO(MBEDTLS_MD_RIPEMD160, 20, 64)
|
||||||
20,
|
|
||||||
64,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA1)
|
#if defined(MBEDTLS_MD_CAN_SHA1)
|
||||||
static const mbedtls_md_info_t mbedtls_sha1_info = {
|
static const mbedtls_md_info_t mbedtls_sha1_info = {
|
||||||
MBEDTLS_MD_SHA1,
|
MD_INFO(MBEDTLS_MD_SHA1, 20, 64)
|
||||||
20,
|
|
||||||
64,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA224)
|
#if defined(MBEDTLS_MD_CAN_SHA224)
|
||||||
static const mbedtls_md_info_t mbedtls_sha224_info = {
|
static const mbedtls_md_info_t mbedtls_sha224_info = {
|
||||||
MBEDTLS_MD_SHA224,
|
MD_INFO(MBEDTLS_MD_SHA224, 28, 64)
|
||||||
28,
|
|
||||||
64,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA256)
|
#if defined(MBEDTLS_MD_CAN_SHA256)
|
||||||
static const mbedtls_md_info_t mbedtls_sha256_info = {
|
static const mbedtls_md_info_t mbedtls_sha256_info = {
|
||||||
MBEDTLS_MD_SHA256,
|
MD_INFO(MBEDTLS_MD_SHA256, 32, 64)
|
||||||
32,
|
|
||||||
64,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA384)
|
#if defined(MBEDTLS_MD_CAN_SHA384)
|
||||||
static const mbedtls_md_info_t mbedtls_sha384_info = {
|
static const mbedtls_md_info_t mbedtls_sha384_info = {
|
||||||
MBEDTLS_MD_SHA384,
|
MD_INFO(MBEDTLS_MD_SHA384, 48, 128)
|
||||||
48,
|
|
||||||
128,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA512)
|
#if defined(MBEDTLS_MD_CAN_SHA512)
|
||||||
static const mbedtls_md_info_t mbedtls_sha512_info = {
|
static const mbedtls_md_info_t mbedtls_sha512_info = {
|
||||||
MBEDTLS_MD_SHA512,
|
MD_INFO(MBEDTLS_MD_SHA512, 64, 128)
|
||||||
64,
|
|
||||||
128,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA3_224)
|
#if defined(MBEDTLS_MD_CAN_SHA3_224)
|
||||||
static const mbedtls_md_info_t mbedtls_sha3_224_info = {
|
static const mbedtls_md_info_t mbedtls_sha3_224_info = {
|
||||||
MBEDTLS_MD_SHA3_224,
|
MD_INFO(MBEDTLS_MD_SHA3_224, 28, 144)
|
||||||
28,
|
|
||||||
144,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA3_256)
|
#if defined(MBEDTLS_MD_CAN_SHA3_256)
|
||||||
static const mbedtls_md_info_t mbedtls_sha3_256_info = {
|
static const mbedtls_md_info_t mbedtls_sha3_256_info = {
|
||||||
MBEDTLS_MD_SHA3_256,
|
MD_INFO(MBEDTLS_MD_SHA3_256, 32, 136)
|
||||||
32,
|
|
||||||
136,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA3_384)
|
#if defined(MBEDTLS_MD_CAN_SHA3_384)
|
||||||
static const mbedtls_md_info_t mbedtls_sha3_384_info = {
|
static const mbedtls_md_info_t mbedtls_sha3_384_info = {
|
||||||
MBEDTLS_MD_SHA3_384,
|
MD_INFO(MBEDTLS_MD_SHA3_384, 48, 104)
|
||||||
48,
|
|
||||||
104,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_CAN_SHA3_512)
|
#if defined(MBEDTLS_MD_CAN_SHA3_512)
|
||||||
static const mbedtls_md_info_t mbedtls_sha3_512_info = {
|
static const mbedtls_md_info_t mbedtls_sha3_512_info = {
|
||||||
MBEDTLS_MD_SHA3_512,
|
MD_INFO(MBEDTLS_MD_SHA3_512, 64, 72)
|
||||||
64,
|
|
||||||
72,
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ struct mbedtls_md_info_t {
|
|||||||
/** Output length of the digest function in bytes */
|
/** Output length of the digest function in bytes */
|
||||||
unsigned char size;
|
unsigned char size;
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_MD_C)
|
||||||
/** Block length of the digest function in bytes */
|
/** Block length of the digest function in bytes */
|
||||||
unsigned char block_size;
|
unsigned char block_size;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Reference in New Issue
Block a user