33 #ifndef MBEDTLS_CHACHA20_H 34 #define MBEDTLS_CHACHA20_H 36 #if !defined(MBEDTLS_CONFIG_FILE) 39 #include MBEDTLS_CONFIG_FILE 45 #define MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA -0x0051 49 #define MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE -0x0053 53 #define MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED -0x0055 59 #if !defined(MBEDTLS_CHACHA20_ALT) 70 #include "chacha20_alt.h" 118 const unsigned char key[32] );
140 const unsigned char nonce[12],
174 const unsigned char *input,
175 unsigned char *output );
206 const unsigned char nonce[12],
209 const unsigned char* input,
210 unsigned char* output );
212 #if defined(MBEDTLS_SELF_TEST) 219 int mbedtls_chacha20_self_test(
int verbose );
struct mbedtls_chacha20_context mbedtls_chacha20_context
Configuration options (set of defines)
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.
uint8_t keystream8[64]
Definition: chacha20.h:64
int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx, const unsigned char key[32])
This function sets the encryption/decryption key.
Definition: chacha20.h:61
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.
uint32_t state[16]
Definition: chacha20.h:63
size_t keystream_bytes_used
Definition: chacha20.h:65