Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::EncryptionNonce Struct Reference
Collaboration diagram for duckdb::EncryptionNonce:

Public Member Functions

 EncryptionNonce (EncryptionTypes::CipherType cipher=EncryptionTypes::GCM, EncryptionTypes::EncryptionVersion version=EncryptionTypes::EncryptionVersion::V0_1)
 
data_ptr_t data ()
 
idx_t size () const
 
idx_t total_size () const
 
idx_t size_deprecated () const
 
void SetSize (idx_t length)
 

Private Attributes

unique_ptr< data_t[]> nonce
 
idx_t nonce_len
 
EncryptionTypes::EncryptionVersion version
 
EncryptionTypes::CipherType cipher
 

Constructor & Destructor Documentation

◆ EncryptionNonce()

duckdb::EncryptionNonce::EncryptionNonce ( EncryptionTypes::CipherType  cipher = EncryptionTypes::GCM,
EncryptionTypes::EncryptionVersion  version = EncryptionTypes::EncryptionVersion::V0_1 
)
explicit
52410 : version(version_p), cipher(cipher_p) {
52411 switch (version) {
52412 case Version::V0_0:
52413 // for prior versions
52414 // nonce len is 16 for both GCM and CTR
52415 nonce_len = MainHeader::AES_NONCE_LEN_DEPRECATED;
52416 nonce = unique_ptr<data_t[]>(new data_t[nonce_len]());
52417 break;
52418 case Version::V0_1:
52419 if (cipher == CipherType::CTR) {
52420 // for CTR we need a 16-byte nonce / iv
52421 // the last 4 bytes (counter) are zeroed-out
52422 nonce_len = MainHeader::AES_IV_LEN;
52423 nonce = unique_ptr<data_t[]>(new data_t[nonce_len]());
52424 break;
52425 }
52426 // we fall through to NONE (often Parquet) with a 12-byte nonce
52427 DUCKDB_EXPLICIT_FALLTHROUGH;
52428 case Version::NONE:
52429 nonce_len = MainHeader::AES_NONCE_LEN;
52430 nonce = unique_ptr<data_t[]>(new data_t[nonce_len]());
52431 break;
52432 default:
52433 throw InvalidConfigurationException("Encryption version not recognized!");
52434 }
52435
52436#ifdef DEBUG
52437 // Check whether the nonce is zero-initialized
52438 for (idx_t i = 0; i < nonce_len; i++) {
52439 if (nonce[i] != 0) {
52440 throw InvalidInputException("Nonce is not correctly zero-initialized!");
52441 }
52442 }
52443#endif
52444}
static constexpr uint64_t AES_NONCE_LEN
Nonce, IV (nonce + counter) and tag length.
Definition duckdb.hpp:9769
uint8_t data_t
data pointers
Definition duckdb.hpp:246

Member Function Documentation

◆ data()

data_ptr_t duckdb::EncryptionNonce::data ( )
52446 {
52447 return nonce.get();
52448}

◆ size()

idx_t duckdb::EncryptionNonce::size ( ) const
52450 {
52451 // always return 12 bytes
52452 if (version == Version::V0_0) {
52453 // in the first version, nonce was always 16
52454 return MainHeader::AES_NONCE_LEN_DEPRECATED;
52455 }
52456 // in v1, nonce is always 12
52458}

◆ total_size()

idx_t duckdb::EncryptionNonce::total_size ( ) const
52460 {
52461 return nonce_len;
52462}

◆ size_deprecated()

idx_t duckdb::EncryptionNonce::size_deprecated ( ) const
52464 {
52465 return MainHeader::AES_NONCE_LEN_DEPRECATED;
52466}

◆ SetSize()

void duckdb::EncryptionNonce::SetSize ( idx_t  length)
52468 {
52469 nonce_len = length;
52470}

The documentation for this struct was generated from the following file: