#include "common.h"
#if defined(MBEDTLS_CHACHA20_C)
#include "mbedtls/chacha20.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include <stddef.h>
#include <string.h>
#include "mbedtls/platform.h"
#if !defined(MBEDTLS_CHACHA20_ALT)
#define ROTL32(value, amount) …
#define CHACHA20_CTR_INDEX …
#define CHACHA20_BLOCK_SIZE_BYTES …
static inline void chacha20_quarter_round(uint32_t state[16],
size_t a,
size_t b,
size_t c,
size_t d)
{ … }
static void chacha20_inner_block(uint32_t state[16])
{ … }
static void chacha20_block(const uint32_t initial_state[16],
unsigned char keystream[64])
{ … }
void mbedtls_chacha20_init(mbedtls_chacha20_context *ctx)
{ … }
void mbedtls_chacha20_free(mbedtls_chacha20_context *ctx)
{ … }
int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx,
const unsigned char key[32])
{ … }
int mbedtls_chacha20_starts(mbedtls_chacha20_context *ctx,
const unsigned char nonce[12],
uint32_t counter)
{ … }
int mbedtls_chacha20_update(mbedtls_chacha20_context *ctx,
size_t size,
const unsigned char *input,
unsigned char *output)
{ … }
int mbedtls_chacha20_crypt(const unsigned char key[32],
const unsigned char nonce[12],
uint32_t counter,
size_t data_len,
const unsigned char *input,
unsigned char *output)
{ … }
#endif
#if defined(MBEDTLS_SELF_TEST)
static const unsigned char test_keys[2][32] = …;
static const unsigned char test_nonces[2][12] = …;
static const uint32_t test_counters[2] = …;
static const unsigned char test_input[2][375] = …;
static const unsigned char test_output[2][375] = …;
static const size_t test_lengths[2] = …;
#undef ASSERT
#define ASSERT(cond, args) …
int mbedtls_chacha20_self_test(int verbose)
{ … }
#endif
#endif