|
Mbed TLS v3.6.5
|
This file contains SHA-3 definitions and functions. More...
#include "mbedtls/private_access.h"#include "mbedtls/build_info.h"#include <stddef.h>#include <stdint.h>

Go to the source code of this file.
Data Structures | |
| struct | mbedtls_sha3_context |
| The SHA-3 context structure. More... | |
Macros | |
| #define | MBEDTLS_ERR_SHA3_BAD_INPUT_DATA -0x0076 |
Enumerations | |
| enum | mbedtls_sha3_id { MBEDTLS_SHA3_NONE = 0 , MBEDTLS_SHA3_224 , MBEDTLS_SHA3_256 , MBEDTLS_SHA3_384 , MBEDTLS_SHA3_512 } |
Functions | |
| void | mbedtls_sha3_init (mbedtls_sha3_context *ctx) |
| This function initializes a SHA-3 context. | |
| void | mbedtls_sha3_free (mbedtls_sha3_context *ctx) |
| This function clears a SHA-3 context. | |
| void | mbedtls_sha3_clone (mbedtls_sha3_context *dst, const mbedtls_sha3_context *src) |
| This function clones the state of a SHA-3 context. | |
| int | mbedtls_sha3_starts (mbedtls_sha3_context *ctx, mbedtls_sha3_id id) |
| This function starts a SHA-3 checksum calculation. | |
| int | mbedtls_sha3_update (mbedtls_sha3_context *ctx, const uint8_t *input, size_t ilen) |
| This function feeds an input buffer into an ongoing SHA-3 checksum calculation. | |
| int | mbedtls_sha3_finish (mbedtls_sha3_context *ctx, uint8_t *output, size_t olen) |
| This function finishes the SHA-3 operation, and writes the result to the output buffer. | |
| int | mbedtls_sha3 (mbedtls_sha3_id id, const uint8_t *input, size_t ilen, uint8_t *output, size_t olen) |
| This function calculates the SHA-3 checksum of a buffer. | |
| int | mbedtls_sha3_self_test (int verbose) |
| Checkup routine for the algorithms implemented by this module: SHA3-224, SHA3-256, SHA3-384, SHA3-512. | |
This file contains SHA-3 definitions and functions.
The Secure Hash Algorithms cryptographic hash functions are defined in FIPS 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions .
Definition in file sha3.h.
| #define MBEDTLS_ERR_SHA3_BAD_INPUT_DATA -0x0076 |
| enum mbedtls_sha3_id |
| int mbedtls_sha3 | ( | mbedtls_sha3_id | id, |
| const uint8_t * | input, | ||
| size_t | ilen, | ||
| uint8_t * | output, | ||
| size_t | olen ) |
This function calculates the SHA-3 checksum of a buffer.
The function allocates the context, performs the calculation, and frees the context.
The SHA-3 result is calculated as output = SHA-3(id, input buffer, d).
| id | The id of the SHA-3 family. |
| input | The buffer holding the data. This must be a readable buffer of length ilen Bytes. |
| ilen | The length of the input data in Bytes. |
| output | The SHA-3 checksum result. This must be a writable buffer of length olen bytes. |
| olen | Defines the length of output buffer (in bytes). For SHA-3 224, SHA-3 256, SHA-3 384 and SHA-3 512 olen must equal to 28, 32, 48 and 64, respectively. |
0 on success. | void mbedtls_sha3_clone | ( | mbedtls_sha3_context * | dst, |
| const mbedtls_sha3_context * | src ) |
This function clones the state of a SHA-3 context.
| dst | The destination context. This must be initialized. |
| src | The context to clone. This must be initialized. |
| int mbedtls_sha3_finish | ( | mbedtls_sha3_context * | ctx, |
| uint8_t * | output, | ||
| size_t | olen ) |
This function finishes the SHA-3 operation, and writes the result to the output buffer.
| ctx | The SHA-3 context. This must be initialized and have a hash operation started. |
| output | The SHA-3 checksum result. This must be a writable buffer of length olen bytes. |
| olen | Defines the length of output buffer (in bytes). For SHA-3 224, SHA-3 256, SHA-3 384 and SHA-3 512 olen must equal to 28, 32, 48 and 64, respectively. |
0 on success. | void mbedtls_sha3_free | ( | mbedtls_sha3_context * | ctx | ) |
This function clears a SHA-3 context.
| ctx | The SHA-3 context to clear. This may be NULL, in which case this function returns immediately. If it is not NULL, it must point to an initialized SHA-3 context. |
| void mbedtls_sha3_init | ( | mbedtls_sha3_context * | ctx | ) |
This function initializes a SHA-3 context.
| ctx | The SHA-3 context to initialize. This must not be NULL. |
| int mbedtls_sha3_self_test | ( | int | verbose | ) |
Checkup routine for the algorithms implemented by this module: SHA3-224, SHA3-256, SHA3-384, SHA3-512.
| int mbedtls_sha3_starts | ( | mbedtls_sha3_context * | ctx, |
| mbedtls_sha3_id | id ) |
This function starts a SHA-3 checksum calculation.
| ctx | The context to use. This must be initialized. |
| id | The id of the SHA-3 family. |
0 on success. | int mbedtls_sha3_update | ( | mbedtls_sha3_context * | ctx, |
| const uint8_t * | input, | ||
| size_t | ilen ) |
This function feeds an input buffer into an ongoing SHA-3 checksum calculation.
| ctx | The SHA-3 context. This must be initialized and have a hash operation started. |
| input | The buffer holding the data. This must be a readable buffer of length ilen Bytes. |
| ilen | The length of the input data in Bytes. |
0 on success.