Lines Matching +full:for +full:- +full:context

4  * \brief   This file contains the generic functions for message-digest
7 * \author Adriaan de Jong <dejong@fox-it.com>
11 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
24 #define MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE -0x5080
26 #define MBEDTLS_ERR_MD_BAD_INPUT_DATA -0x5100
28 #define MBEDTLS_ERR_MD_ALLOC_FAILED -0x5180
30 #define MBEDTLS_ERR_MD_FILE_IO_ERROR -0x5200
39 * \warning MD5 and SHA-1 are considered weak message digests and
44 /* Note: these are aligned with the definitions of PSA_ALG_ macros for hashes,
50 MBEDTLS_MD_RIPEMD160=0x04, /**< The RIPEMD-160 message digest. */
51 MBEDTLS_MD_SHA1=0x05, /**< The SHA-1 message digest. */
52 MBEDTLS_MD_SHA224=0x08, /**< The SHA-224 message digest. */
53 MBEDTLS_MD_SHA256=0x09, /**< The SHA-256 message digest. */
54 MBEDTLS_MD_SHA384=0x0a, /**< The SHA-384 message digest. */
55 MBEDTLS_MD_SHA512=0x0b, /**< The SHA-512 message digest. */
56 MBEDTLS_MD_SHA3_224=0x10, /**< The SHA3-224 message digest. */
57 MBEDTLS_MD_SHA3_256=0x11, /**< The SHA3-256 message digest. */
58 MBEDTLS_MD_SHA3_384=0x12, /**< The SHA3-384 message digest. */
59 MBEDTLS_MD_SHA3_512=0x13, /**< The SHA3-512 message digest. */
65 * This is to make things easier for modules such as TLS that may define a
79 #define MBEDTLS_MD_MAX_SIZE 20 /* longest known is SHA1 or RIPE MD-160
84 #define MBEDTLS_MD_MAX_BLOCK_SIZE 144 /* the longest known is SHA3-224 */
110 * Used internally to indicate whether a context uses legacy or PSA.
120 * The generic message-digest context.
131 /** The digest-specific context (legacy) or the PSA operation. */
135 /** The HMAC part of the context. */
141 * \brief This function returns the message-digest information
144 * \param md_type The type of digest to search for.
146 * \return The message-digest information associated with \p md_type.
147 * \return NULL if the associated message-digest information is not found.
152 * \brief This function initializes a message-digest context without
153 * binding it to a particular message-digest algorithm.
156 * context for mbedtls_md_setup() for binding it to a
157 * message-digest algorithm.
168 * context.
185 * \param ctx The context to set up.
186 * \param md_info The information structure of the message-digest algorithm
189 * or non-zero: HMAC is used with this context.
192 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
194 * \return #MBEDTLS_ERR_MD_ALLOC_FAILED on memory-allocation failure.
200 * \brief This function clones the state of a message-digest
201 * context.
207 * for example, both are SHA-256.
209 * \warning This function clones the message-digest state, not the
212 * \param dst The destination context.
213 * \param src The context to be cloned.
216 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification failure.
227 * \brief This function extracts the message-digest size from the
228 * message-digest information structure.
230 * \param md_info The information structure of the message-digest algorithm
233 * \return The size of the message-digest output in Bytes.
238 * \brief This function gives the message-digest size associated to
239 * message-digest type.
241 * \param md_type The message-digest type.
243 * \return The size of the message-digest output in Bytes,
244 * or 0 if the message-digest type is not known.
252 * \brief This function extracts the message-digest type from the
253 * message-digest information structure.
255 * \param md_info The information structure of the message-digest algorithm
263 * \brief This function starts a message-digest computation.
265 * You must call this function after setting up the context
269 * \param ctx The generic message-digest context.
272 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
280 * message-digest computation.
286 * \param ctx The generic message-digest context.
291 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
303 * Afterwards, you may either clear the context with
305 * the context for another digest operation with the same
308 * \param ctx The generic message-digest context.
309 * \param output The buffer for the generic message-digest checksum result.
312 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
319 * \brief This function calculates the message-digest of a buffer,
320 * with respect to a configurable message-digest algorithm
326 * \param md_info The information structure of the message-digest algorithm
330 * \param output The generic message-digest checksum result.
333 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
348 * message-digest enumeration #mbedtls_md_type_t.
354 * \brief This function returns the message-digest information
357 * \param md_name The name of the digest to search for.
359 * \return The message-digest information associated with \p md_name.
360 * \return NULL if the associated message-digest information is not found.
365 * \brief This function returns the name of the message digest for
366 * the message-digest information structure given.
368 * \param md_info The information structure of the message-digest algorithm
376 * \brief This function returns the message-digest information
377 * from the given context.
379 * \param ctx The context from which to extract the information.
382 * \return The message-digest information associated with \p ctx.
390 * \brief This function calculates the message-digest checksum
396 * \param md_info The information structure of the message-digest algorithm
399 * \param output The generic message-digest checksum result.
416 * the MD context for an HMAC calculation, then call
420 * \param ctx The message digest context containing an embedded HMAC
421 * context.
426 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
443 * \param ctx The message digest context containing an embedded HMAC
444 * context.
449 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
462 * you may either call mbedtls_md_free() to clear the context,
463 * or call mbedtls_md_hmac_reset() to reuse the context with
466 * \param ctx The message digest context containing an embedded HMAC
467 * context.
471 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
485 * \param ctx The message digest context containing an embedded HMAC
486 * context.
489 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
499 * The function allocates the context, performs the
500 * calculation, and frees the context.
505 * \param md_info The information structure of the message-digest algorithm
514 * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification