32#ifndef WOLF_CRYPT_CHACHA20_POLY1305_H
33#define WOLF_CRYPT_CHACHA20_POLY1305_H
39#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
45#define CHACHA20_POLY1305_AEAD_KEYSIZE 32
46#define CHACHA20_POLY1305_AEAD_IV_SIZE 12
47#define CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE 16
50 CHACHA20_POLY_1305_ENC_TYPE = 8,
53 CHACHA20_POLY1305_AEAD_DECRYPT = 0,
54 CHACHA20_POLY1305_AEAD_ENCRYPT = 1,
57 CHACHA20_POLY1305_STATE_INIT = 0,
58 CHACHA20_POLY1305_STATE_READY = 1,
59 CHACHA20_POLY1305_STATE_AAD = 2,
60 CHACHA20_POLY1305_STATE_DATA = 3,
87 const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
88 const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
89 const byte* inAAD,
const word32 inAADLen,
90 const byte* inPlaintext,
const word32 inPlaintextLen,
92 byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]);
96 const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
97 const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
98 const byte* inAAD,
const word32 inAADLen,
99 const byte* inCiphertext,
const word32 inCiphertextLen,
100 const byte inAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE],
104int wc_ChaCha20Poly1305_CheckTag(
105 const byte authTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE],
106 const byte authTagChk[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]);
113 const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
114 const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
117 const byte* inAAD, word32 inAADLen);
119 const byte* inData,
byte* outData, word32 dataLen);
121 byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]);
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,...
Definition chacha20_poly1305.c:44
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,...
Definition chacha20_poly1305.c:76
Definition chacha20_poly1305.h:63