OpenVPN
Data Fields
key_ctx Struct Reference

Container for one set of cipher and/or HMAC contexts. More...

#include <crypto.h>

Data Fields

cipher_ctx_tcipher
 Generic cipher context.
 
hmac_ctx_thmac
 Generic HMAC context.
 
uint8_t implicit_iv [OPENVPN_MAX_IV_LENGTH]
 This implicit IV will be always XORed with the packet id that is sent on the wire to get the IV.
 
size_t implicit_iv_len
 The length of implicit_iv.
 
uint64_t plaintext_blocks
 Counter for the number of plaintext block encrypted using this cipher with the current key in number of 128 bit blocks (only used for AEAD ciphers)
 
uint64_t failed_verifications
 number of failed verification using this cipher
 
uint16_t epoch
 OpenVPN data channel epoch, this variable holds the epoch number this key belongs to.
 

Detailed Description

Container for one set of cipher and/or HMAC contexts.

Definition at line 200 of file crypto.h.

Field Documentation

◆ cipher

cipher_ctx_t* key_ctx::cipher

◆ epoch

uint16_t key_ctx::epoch

◆ failed_verifications

uint64_t key_ctx::failed_verifications

number of failed verification using this cipher

Definition at line 223 of file crypto.h.

Referenced by cipher_decrypt_verify_fail_exceeded(), cipher_decrypt_verify_fail_warn(), and openvpn_decrypt_aead().

◆ hmac

hmac_ctx_t* key_ctx::hmac

◆ implicit_iv

uint8_t key_ctx::implicit_iv[OPENVPN_MAX_IV_LENGTH]

This implicit IV will be always XORed with the packet id that is sent on the wire to get the IV.

For the common AEAD ciphers of AES-GCM and Chacha20-Poly1305, the length of the IV is 12 bytes (96 bits).

For non-epoch 32bit packet id AEAD format we set the first 32 bits of implicit_iv to 0. Xor with the packet id in this case works as concatenation: after xor the lower 32 bit of the IV are the packet id and the rest of the IV is from the implicit IV. The implicit part of the IV

Definition at line 215 of file crypto.h.

Referenced by free_key_ctx(), key_ctx_update_implicit_iv(), openvpn_decrypt_aead(), openvpn_encrypt_aead(), and test_crypto().

◆ implicit_iv_len

size_t key_ctx::implicit_iv_len

The length of implicit_iv.

Definition at line 217 of file crypto.h.

◆ plaintext_blocks

uint64_t key_ctx::plaintext_blocks

Counter for the number of plaintext block encrypted using this cipher with the current key in number of 128 bit blocks (only used for AEAD ciphers)

Definition at line 221 of file crypto.h.

Referenced by aead_usage_limit_reached(), check_aead_limits(), free_key_ctx(), openvpn_decrypt_aead(), openvpn_encrypt_aead(), and tls_process().


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