32 #ifndef MBEDTLS_CHACHA20_H
33 #define MBEDTLS_CHACHA20_H
42 #define MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA -0x0051
48 #if !defined(MBEDTLS_CHACHA20_ALT)
50 typedef struct mbedtls_chacha20_context
56 mbedtls_chacha20_context;
59 #include "chacha20_alt.h"
107 const unsigned char key[32] );
129 const unsigned char nonce[12],
163 const unsigned char *input,
164 unsigned char *output );
195 const unsigned char nonce[12],
198 const unsigned char* input,
199 unsigned char* output );
201 #if defined(MBEDTLS_SELF_TEST)
#define MBEDTLS_PRIVATE(member)
int mbedtls_chacha20_crypt(const unsigned char key[32], const unsigned char nonce[12], uint32_t counter, size_t size, const unsigned char *input, unsigned char *output)
This function encrypts or decrypts data with ChaCha20 and the given key and nonce.
int mbedtls_chacha20_self_test(int verbose)
The ChaCha20 checkup routine.
Macro wrapper for struct's memebrs.
int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx, const unsigned char key[32])
This function sets the encryption/decryption key.
Build-time configuration info.
int mbedtls_chacha20_starts(mbedtls_chacha20_context *ctx, const unsigned char nonce[12], uint32_t counter)
This function sets the nonce and initial counter value.
void mbedtls_chacha20_free(mbedtls_chacha20_context *ctx)
This function releases and clears the specified ChaCha20 context.
int mbedtls_chacha20_update(mbedtls_chacha20_context *ctx, size_t size, const unsigned char *input, unsigned char *output)
This function encrypts or decrypts data.
void mbedtls_chacha20_init(mbedtls_chacha20_context *ctx)
This function initializes the specified ChaCha20 context.