Mbed TLS v3.5.0
sha3.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright The Mbed TLS Contributors
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License"); you may
15  * not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  */
26 
27 #ifndef MBEDTLS_SHA3_H
28 #define MBEDTLS_SHA3_H
29 #include "mbedtls/private_access.h"
30 
31 #include "mbedtls/build_info.h"
32 
33 #include <stddef.h>
34 #include <stdint.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
41 #define MBEDTLS_ERR_SHA3_BAD_INPUT_DATA -0x0076
42 
49 typedef enum {
56 
62 typedef struct {
63  uint64_t MBEDTLS_PRIVATE(state[25]);
64  uint32_t MBEDTLS_PRIVATE(index);
65  uint16_t MBEDTLS_PRIVATE(olen);
66  uint16_t MBEDTLS_PRIVATE(max_block_size);
67 }
69 
76 
85 
93  const mbedtls_sha3_context *src);
94 
106 
121  const uint8_t *input,
122  size_t ilen);
123 
140  uint8_t *output, size_t olen);
141 
165 int mbedtls_sha3(mbedtls_sha3_id id, const uint8_t *input,
166  size_t ilen,
167  uint8_t *output,
168  size_t olen);
169 
170 #if defined(MBEDTLS_SELF_TEST)
177 int mbedtls_sha3_self_test(int verbose);
178 #endif /* MBEDTLS_SELF_TEST */
179 
180 #ifdef __cplusplus
181 }
182 #endif
183 
184 #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:49
@ MBEDTLS_SHA3_512
Definition: sha3.h:54
@ MBEDTLS_SHA3_NONE
Definition: sha3.h:50
@ MBEDTLS_SHA3_224
Definition: sha3.h:51
@ MBEDTLS_SHA3_256
Definition: sha3.h:52
@ MBEDTLS_SHA3_384
Definition: sha3.h:53
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:62