16 #include "mbedtls/private_access.h"
24 #define MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE -0x5080
26 #define MBEDTLS_ERR_MD_BAD_INPUT_DATA PSA_ERROR_INVALID_ARGUMENT
28 #define MBEDTLS_ERR_MD_ALLOC_FAILED PSA_ERROR_INSUFFICIENT_MEMORY
30 #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
32 #define MBEDTLS_ERR_MD_FILE_IO_ERROR -0x5200
73 #if defined(PSA_WANT_ALG_SHA_512) || defined(PSA_WANT_ALG_SHA3_512)
74 #define MBEDTLS_MD_MAX_SIZE 64
75 #elif defined(PSA_WANT_ALG_SHA_384) || defined(PSA_WANT_ALG_SHA3_384)
76 #define MBEDTLS_MD_MAX_SIZE 48
77 #elif defined(PSA_WANT_ALG_SHA_256) || defined(PSA_WANT_ALG_SHA3_256)
78 #define MBEDTLS_MD_MAX_SIZE 32
79 #elif defined(PSA_WANT_ALG_SHA_224) || defined(PSA_WANT_ALG_SHA3_224)
80 #define MBEDTLS_MD_MAX_SIZE 28
82 #define MBEDTLS_MD_MAX_SIZE 20
114 #if defined(MBEDTLS_MD_SOME_PSA)
120 void *MBEDTLS_PRIVATE(md_ctx);
122 #if defined(MBEDTLS_MD_C)
124 void *MBEDTLS_PRIVATE(hmac_ctx);
329 unsigned char *output);
331 #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
361 const int *mbedtls_md_list(
void);
398 #if defined(MBEDTLS_FS_IO)
418 unsigned char *output);
528 int mbedtls_md_hmac(
const mbedtls_md_info_t *md_info,
const unsigned char *key,
size_t keylen,
529 const unsigned char *input,
size_t ilen,
530 unsigned char *output);
mbedtls_md_type_t mbedtls_md_get_type(const mbedtls_md_info_t *md_info)
This function extracts the message-digest type from the message-digest information structure...
int mbedtls_md_starts(mbedtls_md_context_t *ctx)
This function starts a message-digest computation.
void mbedtls_md_free(mbedtls_md_context_t *ctx)
This function clears the internal structure of ctx and frees any embedded internal structure...
void mbedtls_md_init(mbedtls_md_context_t *ctx)
This function initializes a message-digest context without binding it to a particular message-digest ...
int mbedtls_md_clone(mbedtls_md_context_t *dst, const mbedtls_md_context_t *src)
This function clones the state of a message-digest context.
unsigned char mbedtls_md_get_size(const mbedtls_md_info_t *md_info)
This function extracts the message-digest size from the message-digest information structure...
int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac)
This function selects the message digest algorithm to use, and allocates internal structures...
int mbedtls_md(const mbedtls_md_info_t *md_info, const unsigned char *input, size_t ilen, unsigned char *output)
This function calculates the message-digest of a buffer, with respect to a configurable message-diges...
int mbedtls_md_finish(mbedtls_md_context_t *ctx, unsigned char *output)
This function finishes the digest operation, and writes the result to the output buffer.
static unsigned char mbedtls_md_get_size_from_type(mbedtls_md_type_t md_type)
This function gives the message-digest size associated to message-digest type.
struct mbedtls_md_context_t mbedtls_md_context_t
const mbedtls_md_info_t * mbedtls_md_info_from_type(mbedtls_md_type_t md_type)
This function returns the message-digest information associated with the given digest type...
struct mbedtls_md_info_t mbedtls_md_info_t
Build-time configuration info.
mbedtls_md_type_t
Supported message digests.
int mbedtls_md_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing message-digest computation.