Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

ChaCha20Poly1305AEAD Class Reference

#include <chacha_poly_aead.h>

+ Collaboration diagram for ChaCha20Poly1305AEAD:

Public Member Functions

 ChaCha20Poly1305AEAD (const unsigned char *K_1, size_t K_1_len, const unsigned char *K_2, size_t K_2_len)
 
 ChaCha20Poly1305AEAD (const ChaCha20Poly1305AEAD &)=delete
 
bool Crypt (uint64_t seqnr_payload, uint64_t seqnr_aad, int aad_pos, unsigned char *dest, size_t dest_len, const unsigned char *src, size_t src_len, bool is_encrypt)
 Encrypts/decrypts a packet seqnr_payload, the message sequence number seqnr_aad, the messages AAD sequence number which allows reuse of the AAD keystream aad_pos, position to use in the AAD keystream to encrypt the AAD dest, output buffer, must be of a size equal or larger then CHACHA20_POLY1305_AEAD_AAD_LEN + payload (+ POLY1305_TAG_LEN in encryption) bytes destlen, length of the destination buffer src, the AAD+payload to encrypt or the AAD+payload+MAC to decrypt src_len, the length of the source buffer is_encrypt, set to true if we encrypt (creates and appends the MAC instead of verifying it) More...
 
bool GetLength (uint32_t *len24_out, uint64_t seqnr_aad, int aad_pos, const uint8_t *ciphertext)
 decrypts the 3 bytes AAD data and decodes it into a uint32_t field More...
 

Private Attributes

ChaCha20 m_chacha_main
 
ChaCha20 m_chacha_header
 
unsigned char m_aad_keystream_buffer [CHACHA20_ROUND_OUTPUT]
 
uint64_t m_cached_aad_seqnr
 

Detailed Description

Definition at line 117 of file chacha_poly_aead.h.

Constructor & Destructor Documentation

◆ ChaCha20Poly1305AEAD() [1/2]

ChaCha20Poly1305AEAD::ChaCha20Poly1305AEAD ( const unsigned char *  K_1,
size_t  K_1_len,
const unsigned char *  K_2,
size_t  K_2_len 
)

◆ ChaCha20Poly1305AEAD() [2/2]

ChaCha20Poly1305AEAD::ChaCha20Poly1305AEAD ( const ChaCha20Poly1305AEAD )
explicitdelete

Member Function Documentation

◆ Crypt()

bool ChaCha20Poly1305AEAD::Crypt ( uint64_t  seqnr_payload,
uint64_t  seqnr_aad,
int  aad_pos,
unsigned char *  dest,
size_t  dest_len,
const unsigned char *  src,
size_t  src_len,
bool  is_encrypt 
)

Encrypts/decrypts a packet seqnr_payload, the message sequence number seqnr_aad, the messages AAD sequence number which allows reuse of the AAD keystream aad_pos, position to use in the AAD keystream to encrypt the AAD dest, output buffer, must be of a size equal or larger then CHACHA20_POLY1305_AEAD_AAD_LEN + payload (+ POLY1305_TAG_LEN in encryption) bytes destlen, length of the destination buffer src, the AAD+payload to encrypt or the AAD+payload+MAC to decrypt src_len, the length of the source buffer is_encrypt, set to true if we encrypt (creates and appends the MAC instead of verifying it)

Definition at line 43 of file chacha_poly_aead.cpp.

References CHACHA20_POLY1305_AEAD_AAD_LEN, CHACHA20_ROUND_OUTPUT, ChaCha20::Crypt(), ChaCha20::Keystream(), m_aad_keystream_buffer, m_cached_aad_seqnr, m_chacha_header, m_chacha_main, memory_cleanse(), poly1305_auth(), POLY1305_KEYLEN, POLY1305_TAGLEN, ChaCha20::Seek(), ChaCha20::SetIV(), and timingsafe_bcmp().

Referenced by CHACHA20_POLY1305_AEAD().

◆ GetLength()

bool ChaCha20Poly1305AEAD::GetLength ( uint32_t *  len24_out,
uint64_t  seqnr_aad,
int  aad_pos,
const uint8_t *  ciphertext 
)

decrypts the 3 bytes AAD data and decodes it into a uint32_t field

Definition at line 107 of file chacha_poly_aead.cpp.

References CHACHA20_POLY1305_AEAD_AAD_LEN, CHACHA20_ROUND_OUTPUT, ChaCha20::Keystream(), m_aad_keystream_buffer, m_cached_aad_seqnr, m_chacha_header, ChaCha20::Seek(), and ChaCha20::SetIV().

Referenced by CHACHA20_POLY1305_AEAD().

Member Data Documentation

◆ m_aad_keystream_buffer

unsigned char ChaCha20Poly1305AEAD::m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT]
private

Definition at line 122 of file chacha_poly_aead.h.

Referenced by Crypt(), and GetLength().

◆ m_cached_aad_seqnr

uint64_t ChaCha20Poly1305AEAD::m_cached_aad_seqnr
private

Definition at line 123 of file chacha_poly_aead.h.

Referenced by ChaCha20Poly1305AEAD(), Crypt(), and GetLength().

◆ m_chacha_header

ChaCha20 ChaCha20Poly1305AEAD::m_chacha_header
private

Definition at line 121 of file chacha_poly_aead.h.

Referenced by ChaCha20Poly1305AEAD(), Crypt(), and GetLength().

◆ m_chacha_main

ChaCha20 ChaCha20Poly1305AEAD::m_chacha_main
private

Definition at line 120 of file chacha_poly_aead.h.

Referenced by ChaCha20Poly1305AEAD(), and Crypt().


The documentation for this class was generated from the following files:
Released under the MIT license