#include "common.h"
#if defined(MBEDTLS_SHA3_C)
#if !defined(MBEDTLS_SHA3_THETA_UNROLL)
#define MBEDTLS_SHA3_THETA_UNROLL …
#endif
#if !defined(MBEDTLS_SHA3_CHI_UNROLL)
#if defined(__OPTIMIZE_SIZE__)
#define MBEDTLS_SHA3_CHI_UNROLL …
#else
#define MBEDTLS_SHA3_CHI_UNROLL …
#endif
#endif
#if !defined(MBEDTLS_SHA3_PI_UNROLL)
#define MBEDTLS_SHA3_PI_UNROLL …
#endif
#if !defined(MBEDTLS_SHA3_RHO_UNROLL)
#define MBEDTLS_SHA3_RHO_UNROLL …
#endif
#include "mbedtls/sha3.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include <string.h>
#if defined(MBEDTLS_SELF_TEST)
#include "mbedtls/platform.h"
#endif
#define XOR_BYTE …
#define H …
static const uint8_t iota_r_packed[24] = …;
#undef H
static const uint32_t rho[6] = …;
static const uint32_t pi[6] = …;
#define ROTR64(x, y) …
#define ABSORB(ctx, idx, v) …
#define SQUEEZE(ctx, idx) …
#define SWAP(x, y) …
static void keccak_f1600(mbedtls_sha3_context *ctx)
{ … }
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)
static const unsigned char test_data[2][4] = …;
static const size_t test_data_len[2] = …;
static const unsigned char test_hash_sha3_224[2][28] = …;
static const unsigned char test_hash_sha3_256[2][32] = …;
static const unsigned char test_hash_sha3_384[2][48] = …;
static const unsigned char test_hash_sha3_512[2][64] = …;
static const unsigned char long_kat_hash_sha3_224[28] = …;
static const unsigned char long_kat_hash_sha3_256[32] = …;
static const unsigned char long_kat_hash_sha3_384[48] = …;
static const unsigned char long_kat_hash_sha3_512[64] = …;
static int mbedtls_sha3_kat_test(int verbose,
const char *type_name,
mbedtls_sha3_id id,
int test_num)
{ … }
static int mbedtls_sha3_long_kat_test(int verbose,
const char *type_name,
mbedtls_sha3_id id)
{ … }
int mbedtls_sha3_self_test(int verbose)
{ … }
#endif
#endif