Mbed TLS v3.6.3
sha3.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright The Mbed TLS Contributors
12  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
13  */
14 
15 #ifndef MBEDTLS_SHA3_H
16 #define MBEDTLS_SHA3_H
17 #include "mbedtls/private_access.h"
18 
19 #include "mbedtls/build_info.h"
20 
21 #include <stddef.h>
22 #include <stdint.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
29 #define MBEDTLS_ERR_SHA3_BAD_INPUT_DATA -0x0076
30 
37 typedef enum {
44 
50 typedef struct {
51  uint64_t MBEDTLS_PRIVATE(state[25]);
52  uint32_t MBEDTLS_PRIVATE(index);
53  uint16_t MBEDTLS_PRIVATE(olen);
54  uint16_t MBEDTLS_PRIVATE(max_block_size);
55 }
57 
64 
73 
81  const mbedtls_sha3_context *src);
82 
94 
109  const uint8_t *input,
110  size_t ilen);
111 
128  uint8_t *output, size_t olen);
129 
153 int mbedtls_sha3(mbedtls_sha3_id id, const uint8_t *input,
154  size_t ilen,
155  uint8_t *output,
156  size_t olen);
157 
158 #if defined(MBEDTLS_SELF_TEST)
165 int mbedtls_sha3_self_test(int verbose);
166 #endif /* MBEDTLS_SELF_TEST */
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* mbedtls_sha3.h */
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
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.
mbedtls_sha3_id
Definition: sha3.h:37
@ MBEDTLS_SHA3_512
Definition: sha3.h:42
@ MBEDTLS_SHA3_NONE
Definition: sha3.h:38
@ MBEDTLS_SHA3_224
Definition: sha3.h:39
@ MBEDTLS_SHA3_256
Definition: sha3.h:40
@ MBEDTLS_SHA3_384
Definition: sha3.h:41
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.
void mbedtls_sha3_init(mbedtls_sha3_context *ctx)
This function initializes a SHA-3 context.
int mbedtls_sha3_self_test(int verbose)
Checkup routine for the algorithms implemented by this module: SHA3-224, SHA3-256,...
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.
The SHA-3 context structure.
Definition: sha3.h:50