Loading...
Searching...
No Matches
sha3.h
Go to the documentation of this file.
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SHA3_H
#define MBEDTLS_SHA3_H
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MBEDTLS_ERR_SHA3_BAD_INPUT_DATA -0x0076
typedef enum {
MBEDTLS_SHA3_NONE = 0,
MBEDTLS_SHA3_224,
MBEDTLS_SHA3_256,
MBEDTLS_SHA3_384,
MBEDTLS_SHA3_512,
} mbedtls_sha3_id;
typedef struct {
uint64_t MBEDTLS_PRIVATE(state[25]);
uint32_t MBEDTLS_PRIVATE(index);
uint16_t MBEDTLS_PRIVATE(olen);
uint16_t MBEDTLS_PRIVATE(max_block_size);
}
mbedtls_sha3_context;
void mbedtls_sha3_init(mbedtls_sha3_context *ctx);
void mbedtls_sha3_free(mbedtls_sha3_context *ctx);
void mbedtls_sha3_clone(mbedtls_sha3_context *dst,
const mbedtls_sha3_context *src);
int mbedtls_sha3_starts(mbedtls_sha3_context *ctx, mbedtls_sha3_id id);
int mbedtls_sha3_update(mbedtls_sha3_context *ctx,
const uint8_t *input,
size_t ilen);
int mbedtls_sha3_finish(mbedtls_sha3_context *ctx,
uint8_t *output, size_t olen);
int mbedtls_sha3(mbedtls_sha3_id id, const uint8_t *input,
size_t ilen,
uint8_t *output,
size_t olen);
#if defined(MBEDTLS_SELF_TEST)
int mbedtls_sha3_self_test(int verbose);
#endif /* MBEDTLS_SELF_TEST */
#ifdef __cplusplus
}
#endif
#endif /* mbedtls_sha3.h */
build_info.h
Build-time configuration info.
private_access.h
Macro wrapper for struct's members.
MBEDTLS_PRIVATE
#define MBEDTLS_PRIVATE(member)
Definition private_access.h:15
mbedtls_sha3_free
void mbedtls_sha3_free(mbedtls_sha3_context *ctx)
This function clears a SHA-3 context.
mbedtls_sha3_clone
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
mbedtls_sha3_id
Definition sha3.h:37
MBEDTLS_SHA3_512
@ MBEDTLS_SHA3_512
Definition sha3.h:42
MBEDTLS_SHA3_NONE
@ MBEDTLS_SHA3_NONE
Definition sha3.h:38
MBEDTLS_SHA3_224
@ MBEDTLS_SHA3_224
Definition sha3.h:39
MBEDTLS_SHA3_256
@ MBEDTLS_SHA3_256
Definition sha3.h:40
MBEDTLS_SHA3_384
@ MBEDTLS_SHA3_384
Definition sha3.h:41
mbedtls_sha3_finish
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.
mbedtls_sha3
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.
mbedtls_sha3_init
void mbedtls_sha3_init(mbedtls_sha3_context *ctx)
This function initializes a SHA-3 context.
mbedtls_sha3_self_test
int mbedtls_sha3_self_test(int verbose)
Checkup routine for the algorithms implemented by this module: SHA3-224, SHA3-256,...
mbedtls_sha3_starts
int mbedtls_sha3_starts(mbedtls_sha3_context *ctx, mbedtls_sha3_id id)
This function starts a SHA-3 checksum calculation.
mbedtls_sha3_update
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.
mbedtls_sha3_context
The SHA-3 context structure.
Definition sha3.h:50