35 #if defined(MBEDTLS_MD_LIGHT)
52 #if defined(MBEDTLS_PSA_CRYPTO_C)
53 #if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
54 #define MBEDTLS_MD_CAN_MD5
55 #define MBEDTLS_MD_MD5_VIA_PSA
56 #define MBEDTLS_MD_SOME_PSA
58 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
59 #define MBEDTLS_MD_CAN_SHA1
60 #define MBEDTLS_MD_SHA1_VIA_PSA
61 #define MBEDTLS_MD_SOME_PSA
63 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
64 #define MBEDTLS_MD_CAN_SHA224
65 #define MBEDTLS_MD_SHA224_VIA_PSA
66 #define MBEDTLS_MD_SOME_PSA
68 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
69 #define MBEDTLS_MD_CAN_SHA256
70 #define MBEDTLS_MD_SHA256_VIA_PSA
71 #define MBEDTLS_MD_SOME_PSA
73 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
74 #define MBEDTLS_MD_CAN_SHA384
75 #define MBEDTLS_MD_SHA384_VIA_PSA
76 #define MBEDTLS_MD_SOME_PSA
78 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
79 #define MBEDTLS_MD_CAN_SHA512
80 #define MBEDTLS_MD_SHA512_VIA_PSA
81 #define MBEDTLS_MD_SOME_PSA
83 #if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
84 #define MBEDTLS_MD_CAN_RIPEMD160
85 #define MBEDTLS_MD_RIPEMD160_VIA_PSA
86 #define MBEDTLS_MD_SOME_PSA
91 #if defined(MBEDTLS_MD5_C)
92 #define MBEDTLS_MD_CAN_MD5
93 #define MBEDTLS_MD_SOME_LEGACY
95 #if defined(MBEDTLS_SHA1_C)
96 #define MBEDTLS_MD_CAN_SHA1
97 #define MBEDTLS_MD_SOME_LEGACY
99 #if defined(MBEDTLS_SHA224_C)
100 #define MBEDTLS_MD_CAN_SHA224
101 #define MBEDTLS_MD_SOME_LEGACY
103 #if defined(MBEDTLS_SHA256_C)
104 #define MBEDTLS_MD_CAN_SHA256
105 #define MBEDTLS_MD_SOME_LEGACY
107 #if defined(MBEDTLS_SHA384_C)
108 #define MBEDTLS_MD_CAN_SHA384
109 #define MBEDTLS_MD_SOME_LEGACY
111 #if defined(MBEDTLS_SHA512_C)
112 #define MBEDTLS_MD_CAN_SHA512
113 #define MBEDTLS_MD_SOME_LEGACY
115 #if defined(MBEDTLS_RIPEMD160_C)
116 #define MBEDTLS_MD_CAN_RIPEMD160
117 #define MBEDTLS_MD_SOME_LEGACY
123 #define MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE -0x5080
125 #define MBEDTLS_ERR_MD_BAD_INPUT_DATA -0x5100
127 #define MBEDTLS_ERR_MD_ALLOC_FAILED -0x5180
129 #define MBEDTLS_ERR_MD_FILE_IO_ERROR -0x5200
154 #if defined(MBEDTLS_MD_CAN_SHA512)
155 #define MBEDTLS_MD_MAX_SIZE 64
156 #elif defined(MBEDTLS_MD_CAN_SHA384)
157 #define MBEDTLS_MD_MAX_SIZE 48
158 #elif defined(MBEDTLS_MD_CAN_SHA256)
159 #define MBEDTLS_MD_MAX_SIZE 32
160 #elif defined(MBEDTLS_MD_CAN_SHA224)
161 #define MBEDTLS_MD_MAX_SIZE 28
163 #define MBEDTLS_MD_MAX_SIZE 20
167 #if defined(MBEDTLS_MD_CAN_SHA512)
168 #define MBEDTLS_MD_MAX_BLOCK_SIZE 128
170 #define MBEDTLS_MD_MAX_BLOCK_SIZE 64
202 #if defined(MBEDTLS_MD_SOME_PSA)
210 #if defined(MBEDTLS_MD_C)
400 unsigned char *output);
450 #if defined(MBEDTLS_FS_IO)
470 unsigned char *output);
581 const unsigned char *input,
size_t ilen,
582 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...
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_starts(mbedtls_md_context_t *ctx)
This function starts a message-digest computation.
const mbedtls_md_info_t * mbedtls_md_info_from_ctx(const mbedtls_md_context_t *ctx)
This function returns the message-digest information from the given context.
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_hmac_update(mbedtls_md_context_t *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing HMAC 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 ...
#define MBEDTLS_PRIVATE(member)
MBEDTLS_CHECK_RETURN_TYPICAL 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.
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_hmac(const mbedtls_md_info_t *md_info, const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char *output)
This function calculates the full generic HMAC on the input buffer with the provided key...
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...
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_file(const mbedtls_md_info_t *md_info, const char *path, unsigned char *output)
This function calculates the message-digest checksum result of the contents of the provided file...
MBEDTLS_CHECK_RETURN_TYPICAL 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.
MBEDTLS_CHECK_RETURN_TYPICAL 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...
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_hmac_finish(mbedtls_md_context_t *ctx, unsigned char *output)
This function finishes the HMAC operation, and writes the result to the output buffer.
Macro wrapper for struct's members.
const char * mbedtls_md_get_name(const mbedtls_md_info_t *md_info)
This function extracts the message-digest name from the message-digest information structure...
struct mbedtls_md_context_t mbedtls_md_context_t
Build-time configuration info.
const int * mbedtls_md_list(void)
This function returns the list of digests supported by the generic digest module. ...
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...
MBEDTLS_CHECK_RETURN_TYPICAL 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.
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_hmac_reset(mbedtls_md_context_t *ctx)
This function prepares to authenticate a new message with the same key as the previous HMAC operation...
MBEDTLS_CHECK_RETURN_TYPICAL int mbedtls_md_hmac_starts(mbedtls_md_context_t *ctx, const unsigned char *key, size_t keylen)
This function sets the HMAC key and prepares to authenticate a new message.
struct mbedtls_md_info_t mbedtls_md_info_t
mbedtls_md_type_t
Supported message digests.
const mbedtls_md_info_t * mbedtls_md_info_from_string(const char *md_name)
This function returns the message-digest information associated with the given digest name...
MBEDTLS_CHECK_RETURN_TYPICAL 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...