FD.io VPP  v21.01
Vector Packet Processing
quic_crypto.c File Reference
+ Include dependency graph for quic_crypto.c:

Go to the source code of this file.

Data Structures

struct  cipher_context_t
 
struct  aead_crypto_context_t
 

Macros

#define QUICLY_EPOCH_1RTT   3
 

Typedefs

typedef void(* quicly_do_transform_fn) (ptls_cipher_context_t *, void *, const void *, size_t)
 

Functions

quic_ctx_tquic_get_conn_ctx (quicly_conn_t *conn)
 
static size_t quic_crypto_offload_aead_decrypt (quic_ctx_t *qctx, ptls_aead_context_t *_ctx, void *_output, const void *input, size_t inlen, uint64_t decrypted_pn, const void *aad, size_t aadlen)
 
void quic_crypto_batch_tx_packets (quic_crypto_batch_ctx_t *batch_ctx)
 
void quic_crypto_batch_rx_packets (quic_crypto_batch_ctx_t *batch_ctx)
 
void build_iv (ptls_aead_context_t *ctx, uint8_t *iv, uint64_t seq)
 
static void do_finalize_send_packet (ptls_cipher_context_t *hp, quicly_datagram_t *packet, size_t first_byte_at, size_t payload_from)
 
void quic_crypto_finalize_send_packet (quicly_datagram_t *packet)
 
static int quic_crypto_setup_cipher (quicly_crypto_engine_t *engine, quicly_conn_t *conn, size_t epoch, int is_enc, ptls_cipher_context_t **hp_ctx, ptls_aead_context_t **aead_ctx, ptls_aead_algorithm_t *aead, ptls_hash_algorithm_t *hash, const void *secret)
 
void quic_crypto_finalize_send_packet_cb (struct st_quicly_crypto_engine_t *engine, quicly_conn_t *conn, ptls_cipher_context_t *hp, ptls_aead_context_t *aead, quicly_datagram_t *packet, size_t first_byte_at, size_t payload_from, int coalesced)
 
void quic_crypto_decrypt_packet (quic_ctx_t *qctx, quic_rx_packet_ctx_t *pctx)
 
void quic_crypto_aead_encrypt_init (ptls_aead_context_t *_ctx, const void *iv, const void *aad, size_t aadlen)
 
size_t quic_crypto_aead_encrypt_update (ptls_aead_context_t *_ctx, void *output, const void *input, size_t inlen)
 
size_t quic_crypto_aead_encrypt_final (ptls_aead_context_t *_ctx, void *output)
 
size_t quic_crypto_aead_decrypt (ptls_aead_context_t *_ctx, void *_output, const void *input, size_t inlen, const void *iv, const void *aad, size_t aadlen)
 
static void quic_crypto_aead_dispose_crypto (ptls_aead_context_t *_ctx)
 
static int quic_crypto_aead_setup_crypto (ptls_aead_context_t *_ctx, int is_enc, const void *key, const EVP_CIPHER *cipher)
 
static int quic_crypto_aead_aes128gcm_setup_crypto (ptls_aead_context_t *ctx, int is_enc, const void *key)
 
static int quic_crypto_aead_aes256gcm_setup_crypto (ptls_aead_context_t *ctx, int is_enc, const void *key)
 
int quic_encrypt_ticket_cb (ptls_encrypt_ticket_t *_self, ptls_t *tls, int is_encrypt, ptls_buffer_t *dst, ptls_iovec_t src)
 

Variables

quic_main_t quic_main
 
vnet_crypto_main_tcm = &crypto_main
 
ptls_aead_algorithm_t quic_crypto_aes128gcm
 
ptls_aead_algorithm_t quic_crypto_aes256gcm
 
ptls_cipher_suite_t quic_crypto_aes128gcmsha256
 
ptls_cipher_suite_t quic_crypto_aes256gcmsha384
 
ptls_cipher_suite_t * quic_crypto_cipher_suites []
 
quicly_crypto_engine_t quic_crypto_engine
 

Macro Definition Documentation

◆ QUICLY_EPOCH_1RTT

#define QUICLY_EPOCH_1RTT   3

Definition at line 24 of file quic_crypto.c.

Typedef Documentation

◆ quicly_do_transform_fn

typedef void(* quicly_do_transform_fn) (ptls_cipher_context_t *, void *, const void *, size_t)

Definition at line 29 of file quic_crypto.c.

Function Documentation

◆ build_iv()

void build_iv ( ptls_aead_context_t *  ctx,
uint8_t *  iv,
uint64_t  seq 
)

Definition at line 94 of file quic_crypto.c.

+ Here is the caller graph for this function:

◆ do_finalize_send_packet()

static void do_finalize_send_packet ( ptls_cipher_context_t *  hp,
quicly_datagram_t *  packet,
size_t  first_byte_at,
size_t  payload_from 
)
static

Definition at line 112 of file quic_crypto.c.

+ Here is the caller graph for this function:

◆ quic_crypto_aead_aes128gcm_setup_crypto()

static int quic_crypto_aead_aes128gcm_setup_crypto ( ptls_aead_context_t *  ctx,
int  is_enc,
const void *  key 
)
static

Definition at line 649 of file quic_crypto.c.

+ Here is the call graph for this function:

◆ quic_crypto_aead_aes256gcm_setup_crypto()

static int quic_crypto_aead_aes256gcm_setup_crypto ( ptls_aead_context_t *  ctx,
int  is_enc,
const void *  key 
)
static

Definition at line 656 of file quic_crypto.c.

+ Here is the call graph for this function:

◆ quic_crypto_aead_decrypt()

size_t quic_crypto_aead_decrypt ( ptls_aead_context_t *  _ctx,
void *  _output,
const void *  input,
size_t  inlen,
const void *  iv,
const void *  aad,
size_t  aadlen 
)

Definition at line 507 of file quic_crypto.c.

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

◆ quic_crypto_aead_dispose_crypto()

static void quic_crypto_aead_dispose_crypto ( ptls_aead_context_t *  _ctx)
static

Definition at line 595 of file quic_crypto.c.

+ Here is the caller graph for this function:

◆ quic_crypto_aead_encrypt_final()

size_t quic_crypto_aead_encrypt_final ( ptls_aead_context_t *  _ctx,
void *  output 
)

Definition at line 492 of file quic_crypto.c.

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

◆ quic_crypto_aead_encrypt_init()

void quic_crypto_aead_encrypt_init ( ptls_aead_context_t *  _ctx,
const void *  iv,
const void *  aad,
size_t  aadlen 
)

Definition at line 431 of file quic_crypto.c.

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

◆ quic_crypto_aead_encrypt_update()

size_t quic_crypto_aead_encrypt_update ( ptls_aead_context_t *  _ctx,
void *  output,
const void *  input,
size_t  inlen 
)

Definition at line 468 of file quic_crypto.c.

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

◆ quic_crypto_aead_setup_crypto()

static int quic_crypto_aead_setup_crypto ( ptls_aead_context_t *  _ctx,
int  is_enc,
const void *  key,
const EVP_CIPHER *  cipher 
)
static

Definition at line 601 of file quic_crypto.c.

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

◆ quic_crypto_batch_rx_packets()

void quic_crypto_batch_rx_packets ( quic_crypto_batch_ctx_t batch_ctx)

Definition at line 75 of file quic_crypto.c.

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

◆ quic_crypto_batch_tx_packets()

void quic_crypto_batch_tx_packets ( quic_crypto_batch_ctx_t batch_ctx)

Definition at line 56 of file quic_crypto.c.

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

◆ quic_crypto_decrypt_packet()

void quic_crypto_decrypt_packet ( quic_ctx_t qctx,
quic_rx_packet_ctx_t pctx 
)

Definition at line 244 of file quic_crypto.c.

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

◆ quic_crypto_finalize_send_packet()

void quic_crypto_finalize_send_packet ( quicly_datagram_t *  packet)

Definition at line 137 of file quic_crypto.c.

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

◆ quic_crypto_finalize_send_packet_cb()

void quic_crypto_finalize_send_packet_cb ( struct st_quicly_crypto_engine_t *  engine,
quicly_conn_t *  conn,
ptls_cipher_context_t *  hp,
ptls_aead_context_t *  aead,
quicly_datagram_t *  packet,
size_t  first_byte_at,
size_t  payload_from,
int  coalesced 
)

Definition at line 224 of file quic_crypto.c.

◆ quic_crypto_offload_aead_decrypt()

static size_t quic_crypto_offload_aead_decrypt ( quic_ctx_t qctx,
ptls_aead_context_t *  _ctx,
void *  _output,
const void *  input,
size_t  inlen,
uint64_t  decrypted_pn,
const void *  aad,
size_t  aadlen 
)
static

Definition at line 550 of file quic_crypto.c.

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

◆ quic_crypto_setup_cipher()

static int quic_crypto_setup_cipher ( quicly_crypto_engine_t *  engine,
quicly_conn_t *  conn,
size_t  epoch,
int  is_enc,
ptls_cipher_context_t **  hp_ctx,
ptls_aead_context_t **  aead_ctx,
ptls_aead_algorithm_t *  aead,
ptls_hash_algorithm_t *  hash,
const void *  secret 
)
static

Definition at line 153 of file quic_crypto.c.

+ Here is the call graph for this function:

◆ quic_encrypt_ticket_cb()

int quic_encrypt_ticket_cb ( ptls_encrypt_ticket_t *  _self,
ptls_t *  tls,
int  is_encrypt,
ptls_buffer_t *  dst,
ptls_iovec_t  src 
)

Definition at line 725 of file quic_crypto.c.

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

◆ quic_get_conn_ctx()

quic_ctx_t* quic_get_conn_ctx ( quicly_conn_t *  conn)

Definition at line 416 of file quic.c.

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

Variable Documentation

◆ cm

Definition at line 53 of file quic_crypto.c.

◆ quic_crypto_aes128gcm

ptls_aead_algorithm_t quic_crypto_aes128gcm
Initial value:
= {
"AES128-GCM",
&ptls_openssl_aes128ctr,
&ptls_openssl_aes128ecb,
PTLS_AES128_KEY_SIZE,
PTLS_AESGCM_IV_SIZE,
PTLS_AESGCM_TAG_SIZE,
sizeof (struct aead_crypto_context_t),
}
static int quic_crypto_aead_aes128gcm_setup_crypto(ptls_aead_context_t *ctx, int is_enc, const void *key)
Definition: quic_crypto.c:649

Definition at line 676 of file quic_crypto.c.

◆ quic_crypto_aes128gcmsha256

ptls_cipher_suite_t quic_crypto_aes128gcmsha256
Initial value:
= {
PTLS_CIPHER_SUITE_AES_128_GCM_SHA256,
&quic_crypto_aes128gcm, &ptls_openssl_sha256
}
ptls_aead_algorithm_t quic_crypto_aes128gcm
Definition: quic_crypto.c:676

Definition at line 706 of file quic_crypto.c.

◆ quic_crypto_aes256gcm

ptls_aead_algorithm_t quic_crypto_aes256gcm
Initial value:
= {
"AES256-GCM",
&ptls_openssl_aes256ctr,
&ptls_openssl_aes256ecb,
PTLS_AES256_KEY_SIZE,
PTLS_AESGCM_IV_SIZE,
PTLS_AESGCM_TAG_SIZE,
sizeof (struct aead_crypto_context_t),
}
static int quic_crypto_aead_aes256gcm_setup_crypto(ptls_aead_context_t *ctx, int is_enc, const void *key)
Definition: quic_crypto.c:656

Definition at line 691 of file quic_crypto.c.

◆ quic_crypto_aes256gcmsha384

ptls_cipher_suite_t quic_crypto_aes256gcmsha384
Initial value:
= {
PTLS_CIPHER_SUITE_AES_256_GCM_SHA384,
&quic_crypto_aes256gcm, &ptls_openssl_sha384
}
ptls_aead_algorithm_t quic_crypto_aes256gcm
Definition: quic_crypto.c:691

Definition at line 711 of file quic_crypto.c.

◆ quic_crypto_cipher_suites

ptls_cipher_suite_t* quic_crypto_cipher_suites[]
Initial value:
= {
}
ptls_cipher_suite_t quic_crypto_aes256gcmsha384
Definition: quic_crypto.c:711
ptls_cipher_suite_t quic_crypto_aes128gcmsha256
Definition: quic_crypto.c:706

Definition at line 716 of file quic_crypto.c.

◆ quic_crypto_engine

quicly_crypto_engine_t quic_crypto_engine
Initial value:
= {
}
void quic_crypto_finalize_send_packet_cb(struct st_quicly_crypto_engine_t *engine, quicly_conn_t *conn, ptls_cipher_context_t *hp, ptls_aead_context_t *aead, quicly_datagram_t *packet, size_t first_byte_at, size_t payload_from, int coalesced)
Definition: quic_crypto.c:224
static int quic_crypto_setup_cipher(quicly_crypto_engine_t *engine, quicly_conn_t *conn, size_t epoch, int is_enc, ptls_cipher_context_t **hp_ctx, ptls_aead_context_t **aead_ctx, ptls_aead_algorithm_t *aead, ptls_hash_algorithm_t *hash, const void *secret)
Definition: quic_crypto.c:153

Definition at line 720 of file quic_crypto.c.

◆ quic_main

quic_main_t quic_main

Definition at line 46 of file quic.c.