Data Structures | Typedefs | Functions | Variables
chacha20_poly1305.h File Reference

Go to the source code of this file.

Data Structures

struct  ChaChaPoly_Aead
 

Typedefs

typedef struct ChaChaPoly_Aead ChaChaPoly_Aead
 

Functions

WOLFSSL_API int wc_ChaCha20Poly1305_Encrypt (const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE], const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE], const byte *inAAD, const word32 inAADLen, const byte *inPlaintext, const word32 inPlaintextLen, byte *outCiphertext, byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE])
 This function encrypts an input message, inPlaintext, using the ChaCha20 stream cipher, into the output buffer, outCiphertext. It also performs Poly-1305 authentication (on the cipher text), and stores the generated authentication tag in the output buffer, outAuthTag. More...
 
WOLFSSL_API int wc_ChaCha20Poly1305_Decrypt (const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE], const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE], const byte *inAAD, const word32 inAADLen, const byte *inCiphertext, const word32 inCiphertextLen, const byte inAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE], byte *outPlaintext)
 This function decrypts input ciphertext, inCiphertext, using the ChaCha20 stream cipher, into the output buffer, outPlaintext. It also performs Poly-1305 authentication, comparing the given inAuthTag to an authentication generated with the inAAD (arbitrary length additional authentication data). Note: If the generated authentication tag does not match the supplied authentication tag, the text is not decrypted. More...
 
WOLFSSL_API int wc_ChaCha20Poly1305_CheckTag (const byte authTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE], const byte authTagChk[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE])
 
WOLFSSL_API int wc_ChaCha20Poly1305_Init (ChaChaPoly_Aead *aead, const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE], const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE], int isEncrypt)
 
WOLFSSL_API int wc_ChaCha20Poly1305_UpdateAad (ChaChaPoly_Aead *aead, const byte *inAAD, word32 inAADLen)
 
WOLFSSL_API int wc_ChaCha20Poly1305_UpdateData (ChaChaPoly_Aead *aead, const byte *inData, byte *outData, word32 dataLen)
 
WOLFSSL_API int wc_ChaCha20Poly1305_Final (ChaChaPoly_Aead *aead, byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE])
 

Variables

 C
 

Variable Documentation

◆ C

C
Initial value:
{
#endif
#define CHACHA20_POLY1305_AEAD_KEYSIZE 32
#define CHACHA20_POLY1305_AEAD_IV_SIZE 12
#define CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE 16
enum {
CHACHA20_POLY_1305_ENC_TYPE = 8,
CHACHA20_POLY1305_AEAD_DECRYPT = 0,
CHACHA20_POLY1305_AEAD_ENCRYPT = 1,
CHACHA20_POLY1305_STATE_INIT = 0,
CHACHA20_POLY1305_STATE_READY = 1,
CHACHA20_POLY1305_STATE_AAD = 2,
CHACHA20_POLY1305_STATE_DATA = 3,
}