Mbed OS Reference
Loading...
Searching...
No Matches
chachapoly.h File Reference

This file contains the AEAD-ChaCha20-Poly1305 definitions and functions. More...

#include "mbedtls/config.h"
#include "mbedtls/poly1305.h"
#include "mbedtls/chacha20.h"

Go to the source code of this file.

Data Structures

struct  mbedtls_chachapoly_context
 

Macros

#define MBEDTLS_ERR_CHACHAPOLY_BAD_STATE   -0x0054
 The requested operation is not permitted in the current state. More...
 
#define MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED   -0x0056
 Authenticated decryption failed: data was not authentic. More...
 

Enumerations

enum  mbedtls_chachapoly_mode_t { MBEDTLS_CHACHAPOLY_ENCRYPT , MBEDTLS_CHACHAPOLY_DECRYPT }
 

Functions

void mbedtls_chachapoly_init (mbedtls_chachapoly_context *ctx)
 This function initializes the specified ChaCha20-Poly1305 context. More...
 
void mbedtls_chachapoly_free (mbedtls_chachapoly_context *ctx)
 This function releases and clears the specified ChaCha20-Poly1305 context. More...
 
int mbedtls_chachapoly_setkey (mbedtls_chachapoly_context *ctx, const unsigned char key[32])
 This function sets the ChaCha20-Poly1305 symmetric encryption key. More...
 
int mbedtls_chachapoly_starts (mbedtls_chachapoly_context *ctx, const unsigned char nonce[12], mbedtls_chachapoly_mode_t mode)
 This function starts a ChaCha20-Poly1305 encryption or decryption operation. More...
 
int mbedtls_chachapoly_update_aad (mbedtls_chachapoly_context *ctx, const unsigned char *aad, size_t aad_len)
 This function feeds additional data to be authenticated into an ongoing ChaCha20-Poly1305 operation. More...
 
int mbedtls_chachapoly_update (mbedtls_chachapoly_context *ctx, size_t len, const unsigned char *input, unsigned char *output)
 Thus function feeds data to be encrypted or decrypted into an on-going ChaCha20-Poly1305 operation. More...
 
int mbedtls_chachapoly_finish (mbedtls_chachapoly_context *ctx, unsigned char mac[16])
 This function finished the ChaCha20-Poly1305 operation and generates the MAC (authentication tag). More...
 
int mbedtls_chachapoly_encrypt_and_tag (mbedtls_chachapoly_context *ctx, size_t length, const unsigned char nonce[12], const unsigned char *aad, size_t aad_len, const unsigned char *input, unsigned char *output, unsigned char tag[16])
 This function performs a complete ChaCha20-Poly1305 authenticated encryption with the previously-set key. More...
 
int mbedtls_chachapoly_auth_decrypt (mbedtls_chachapoly_context *ctx, size_t length, const unsigned char nonce[12], const unsigned char *aad, size_t aad_len, const unsigned char tag[16], const unsigned char *input, unsigned char *output)
 This function performs a complete ChaCha20-Poly1305 authenticated decryption with the previously-set key. More...
 

Detailed Description

This file contains the AEAD-ChaCha20-Poly1305 definitions and functions.

ChaCha20-Poly1305 is an algorithm for Authenticated Encryption with Associated Data (AEAD) that can be used to encrypt and authenticate data. It is based on ChaCha20 and Poly1305 by Daniel Bernstein and was standardized in RFC 7539.

Author
Daniel King damak.nosp@m.i.gh.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Definition in file chachapoly.h.

Macro Definition Documentation

◆ MBEDTLS_ERR_CHACHAPOLY_BAD_STATE

#define MBEDTLS_ERR_CHACHAPOLY_BAD_STATE   -0x0054

The requested operation is not permitted in the current state.

Definition at line 44 of file chachapoly.h.

◆ MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED

#define MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED   -0x0056

Authenticated decryption failed: data was not authentic.

Definition at line 45 of file chachapoly.h.