Bitcoin ABC  0.24.7
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
ChaCha20Poly1305AEAD Class Reference

#include <chacha_poly_aead.h>

Collaboration diagram for ChaCha20Poly1305AEAD:
[legend]

Public Member Functions

 ChaCha20Poly1305AEAD (const uint8_t *K_1, size_t K_1_len, const uint8_t *K_2, size_t K_2_len)
 
 ChaCha20Poly1305AEAD (const ChaCha20Poly1305AEAD &)=delete
 
bool Crypt (uint64_t seqnr_payload, uint64_t seqnr_aad, int aad_pos, uint8_t *dest, size_t dest_len, const uint8_t *src, size_t src_len, bool is_encrypt)
 Encrypts/decrypts a packet. 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
 
uint8_t 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 uint8_t *  K_1,
size_t  K_1_len,
const uint8_t *  K_2,
size_t  K_2_len 
)

Definition at line 30 of file chacha_poly_aead.cpp.

Here is the call graph for this function:

◆ 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,
uint8_t *  dest,
size_t  dest_len,
const uint8_t *  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 than 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 121 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_aad_keystream_buffer

uint8_t ChaCha20Poly1305AEAD::m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT]
private

Definition at line 124 of file chacha_poly_aead.h.

◆ m_cached_aad_seqnr

uint64_t ChaCha20Poly1305AEAD::m_cached_aad_seqnr
private

Definition at line 126 of file chacha_poly_aead.h.

◆ m_chacha_header

ChaCha20 ChaCha20Poly1305AEAD::m_chacha_header
private

Definition at line 122 of file chacha_poly_aead.h.

◆ m_chacha_main

ChaCha20 ChaCha20Poly1305AEAD::m_chacha_main
private

Definition at line 120 of file chacha_poly_aead.h.


The documentation for this class was generated from the following files: