OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::MbedTLSCrypto::CipherContextAEAD Class Reference

#include <cipheraead.hpp>

Inheritance diagram for openvpn::MbedTLSCrypto::CipherContextAEAD:
[legend]
Collaboration diagram for openvpn::MbedTLSCrypto::CipherContextAEAD:
[legend]

Public Types

enum  { IV_LEN = 12 , AUTH_TAG_LEN = 16 }
 
- Public Types inherited from openvpn::MbedTLSCrypto::CipherContextCommon
enum  { MODE_UNDEF = MBEDTLS_OPERATION_NONE , ENCRYPT = MBEDTLS_ENCRYPT , DECRYPT = MBEDTLS_DECRYPT }
 

Public Member Functions

 OPENVPN_EXCEPTION (mbedtls_aead_error)
 
 CipherContextAEAD ()=default
 
 ~CipherContextAEAD ()
 
 CipherContextAEAD (CipherContextAEAD &&other) noexcept
 
CipherContextAEADoperator= (CipherContextAEAD &&other)
 
void init (SSLLib::Ctx libctx, const CryptoAlgs::Type alg, const unsigned char *key, const unsigned int keysize, const int mode)
 
void encrypt (const unsigned char *input, unsigned char *output, size_t length, const unsigned char *iv, unsigned char *tag, const unsigned char *ad, size_t ad_len)
 
const Crypto::AEADUsageLimitget_usage_limit ()
 
bool decrypt (const unsigned char *input, unsigned char *output, size_t length, const unsigned char *iv, const unsigned char *tag, const unsigned char *ad, size_t ad_len)
 
bool is_initialized () const
 
- Public Member Functions inherited from openvpn::MbedTLSCrypto::CipherContextCommon
 OPENVPN_SIMPLE_EXCEPTION (mbedtls_cipher_mode_error)
 
 OPENVPN_SIMPLE_EXCEPTION (mbedtls_cipher_uninitialized)
 
bool constexpr requires_authtag_at_end ()
 

Static Public Member Functions

static bool is_supported (void *libctx, const CryptoAlgs::Type alg)
 

Static Private Member Functions

static mbedtls_cipher_type_t cipher_type (const CryptoAlgs::Type alg, unsigned int &keysize)
 

Private Attributes

Crypto::AEADUsageLimit aead_usage_limit_ = {}
 

Additional Inherited Members

- Protected Member Functions inherited from openvpn::MbedTLSCrypto::CipherContextCommon
 CipherContextCommon ()=default
 
virtual ~CipherContextCommon ()
 
 CipherContextCommon (const CipherContextCommon &other)=delete
 
CipherContextCommonoperator= (const CipherContextCommon &other)=delete
 
 CipherContextCommon (CipherContextCommon &&other) noexcept
 
CipherContextCommonoperator= (CipherContextCommon &&other)
 
void erase ()
 
void check_initialized () const
 
- Static Protected Member Functions inherited from openvpn::MbedTLSCrypto::CipherContextCommon
static void check_mode (int mode)
 
- Protected Attributes inherited from openvpn::MbedTLSCrypto::CipherContextCommon
bool initialized = false
 
mbedtls_cipher_context_t ctx
 

Detailed Description

Definition at line 29 of file cipheraead.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
IV_LEN 
AUTH_TAG_LEN 

Definition at line 36 of file cipheraead.hpp.

Constructor & Destructor Documentation

◆ CipherContextAEAD() [1/2]

openvpn::MbedTLSCrypto::CipherContextAEAD::CipherContextAEAD ( )
default

◆ ~CipherContextAEAD()

openvpn::MbedTLSCrypto::CipherContextAEAD::~CipherContextAEAD ( )
inline

Definition at line 52 of file cipheraead.hpp.

◆ CipherContextAEAD() [2/2]

openvpn::MbedTLSCrypto::CipherContextAEAD::CipherContextAEAD ( CipherContextAEAD &&  other)
inlinenoexcept

Definition at line 57 of file cipheraead.hpp.

Member Function Documentation

◆ cipher_type()

static mbedtls_cipher_type_t openvpn::MbedTLSCrypto::CipherContextAEAD::cipher_type ( const CryptoAlgs::Type  alg,
unsigned int &  keysize 
)
inlinestaticprivate

Definition at line 198 of file cipheraead.hpp.

Here is the caller graph for this function:

◆ decrypt()

bool openvpn::MbedTLSCrypto::CipherContextAEAD::decrypt ( const unsigned char *  input,
unsigned char *  output,
size_t  length,
const unsigned char *  iv,
const unsigned char *  tag,
const unsigned char *  ad,
size_t  ad_len 
)
inline

Decrypts AEAD encrypted data. Note that this method ignores the tag parameter and the tag is assumed to be part of input and at the end of the input.

Parameters
inputInput data to decrypt
outputWhere decrypted data will be written to
ivIV of the encrypted data.
lengthlength the of the data, this includes the tag at the end.
adstart of the additional data
ad_lenlength of the additional data
tagignored by the mbed TLS variant of the method. (see OpenSSL variant of the method for more details).

input and output may NOT be equal

Definition at line 153 of file cipheraead.hpp.

◆ encrypt()

void openvpn::MbedTLSCrypto::CipherContextAEAD::encrypt ( const unsigned char *  input,
unsigned char *  output,
size_t  length,
const unsigned char *  iv,
unsigned char *  tag,
const unsigned char *  ad,
size_t  ad_len 
)
inline

Definition at line 108 of file cipheraead.hpp.

◆ get_usage_limit()

const Crypto::AEADUsageLimit & openvpn::MbedTLSCrypto::CipherContextAEAD::get_usage_limit ( )
inline

Returns the AEAD usage limit associated with this AEAD cipher instance to check the limits

Definition at line 134 of file cipheraead.hpp.

◆ init()

void openvpn::MbedTLSCrypto::CipherContextAEAD::init ( SSLLib::Ctx  libctx,
const CryptoAlgs::Type  alg,
const unsigned char *  key,
const unsigned int  keysize,
const int  mode 
)
inline

Definition at line 74 of file cipheraead.hpp.

◆ is_initialized()

bool openvpn::MbedTLSCrypto::CipherContextAEAD::is_initialized ( ) const
inline

Definition at line 185 of file cipheraead.hpp.

◆ is_supported()

static bool openvpn::MbedTLSCrypto::CipherContextAEAD::is_supported ( void *  libctx,
const CryptoAlgs::Type  alg 
)
inlinestatic

Definition at line 190 of file cipheraead.hpp.

◆ OPENVPN_EXCEPTION()

openvpn::MbedTLSCrypto::CipherContextAEAD::OPENVPN_EXCEPTION ( mbedtls_aead_error  )

◆ operator=()

CipherContextAEAD & openvpn::MbedTLSCrypto::CipherContextAEAD::operator= ( CipherContextAEAD &&  other)
inline

Definition at line 62 of file cipheraead.hpp.

Member Data Documentation

◆ aead_usage_limit_

Crypto::AEADUsageLimit openvpn::MbedTLSCrypto::CipherContextAEAD::aead_usage_limit_ = {}
private

Definition at line 197 of file cipheraead.hpp.


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