OpenVPN
|
Container for one set of cipher and/or HMAC contexts. More...
#include <crypto.h>
Data Fields | |
cipher_ctx_t * | cipher |
Generic cipher context. | |
hmac_ctx_t * | hmac |
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. | |
cipher_ctx_t* key_ctx::cipher |
Generic cipher context.
Definition at line 202 of file crypto.h.
Referenced by free_key_ctx(), init_key_ctx(), key_ctx_update_implicit_iv(), openvpn_decrypt(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), read_control_auth(), test_crypto(), tls_crypt_unwrap(), tls_crypt_v2_extract_client_key(), tls_crypt_v2_wrap_client_key(), and tls_crypt_wrap().
uint16_t key_ctx::epoch |
OpenVPN data channel epoch, this variable holds the epoch number this key belongs to.
Note that epoch 0 is not used and epoch is always non-zero for epoch key contexts
Definition at line 227 of file crypto.h.
Referenced by check_aead_limits(), crypto_check_replay(), crypto_test_epoch_key_generation(), crypto_test_epoch_key_overflow(), crypto_test_epoch_key_receive_lookup(), crypto_test_epoch_key_rotation(), epoch_check_send_iterate(), epoch_generate_future_receive_keys(), epoch_init_send_key_ctx(), epoch_lookup_decrypt_key(), epoch_replace_update_recv_key(), free_key_ctx(), init_key_bi_ctx_recv(), init_key_bi_ctx_send(), init_key_ctx(), openvpn_decrypt_aead(), and openvpn_encrypt_aead().
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_ctx_t* key_ctx::hmac |
Generic HMAC context.
Definition at line 203 of file crypto.h.
Referenced by free_key_ctx(), generate_auth_token(), init_key_ctx(), openvpn_decrypt_v1(), openvpn_encrypt_v1(), swap_hmac(), tls_crypt_unwrap(), tls_crypt_wrap(), and verify_auth_token().
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().
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().