Lines Matching refs:hpr

14 int ossl_quic_hdr_protector_init(QUIC_HDR_PROTECTOR *hpr,  in ossl_quic_hdr_protector_init()  argument
38 hpr->cipher_ctx = EVP_CIPHER_CTX_new(); in ossl_quic_hdr_protector_init()
39 if (hpr->cipher_ctx == NULL) { in ossl_quic_hdr_protector_init()
44 hpr->cipher = EVP_CIPHER_fetch(libctx, cipher_name, propq); in ossl_quic_hdr_protector_init()
45 if (hpr->cipher == NULL in ossl_quic_hdr_protector_init()
46 || quic_hp_key_len != (size_t)EVP_CIPHER_get_key_length(hpr->cipher)) { in ossl_quic_hdr_protector_init()
51 if (!EVP_CipherInit_ex(hpr->cipher_ctx, hpr->cipher, NULL, in ossl_quic_hdr_protector_init()
57 hpr->libctx = libctx; in ossl_quic_hdr_protector_init()
58 hpr->propq = propq; in ossl_quic_hdr_protector_init()
59 hpr->cipher_id = cipher_id; in ossl_quic_hdr_protector_init()
63 ossl_quic_hdr_protector_cleanup(hpr); in ossl_quic_hdr_protector_init()
67 void ossl_quic_hdr_protector_cleanup(QUIC_HDR_PROTECTOR *hpr) in ossl_quic_hdr_protector_cleanup() argument
69 EVP_CIPHER_CTX_free(hpr->cipher_ctx); in ossl_quic_hdr_protector_cleanup()
70 hpr->cipher_ctx = NULL; in ossl_quic_hdr_protector_cleanup()
72 EVP_CIPHER_free(hpr->cipher); in ossl_quic_hdr_protector_cleanup()
73 hpr->cipher = NULL; in ossl_quic_hdr_protector_cleanup()
76 static int hdr_generate_mask(QUIC_HDR_PROTECTOR *hpr, in hdr_generate_mask() argument
85 if (hpr->cipher_id == QUIC_HDR_PROT_CIPHER_AES_128 in hdr_generate_mask()
86 || hpr->cipher_id == QUIC_HDR_PROT_CIPHER_AES_256) { in hdr_generate_mask()
92 if (!EVP_CipherInit_ex(hpr->cipher_ctx, NULL, NULL, NULL, NULL, 1) in hdr_generate_mask()
93 || !EVP_CipherUpdate(hpr->cipher_ctx, dst, &l, sample, 16)) { in hdr_generate_mask()
100 } else if (hpr->cipher_id == QUIC_HDR_PROT_CIPHER_CHACHA) { in hdr_generate_mask()
106 if (!EVP_CipherInit_ex(hpr->cipher_ctx, NULL, NULL, NULL, sample, 1) in hdr_generate_mask()
107 || !EVP_CipherUpdate(hpr->cipher_ctx, mask, &l, in hdr_generate_mask()
126 int ossl_quic_hdr_protector_decrypt(QUIC_HDR_PROTECTOR *hpr, in ossl_quic_hdr_protector_decrypt() argument
129 return ossl_quic_hdr_protector_decrypt_fields(hpr, in ossl_quic_hdr_protector_decrypt()
136 int ossl_quic_hdr_protector_decrypt_fields(QUIC_HDR_PROTECTOR *hpr, in ossl_quic_hdr_protector_decrypt_fields() argument
144 if (!hdr_generate_mask(hpr, sample, sample_len, mask)) in ossl_quic_hdr_protector_decrypt_fields()
156 int ossl_quic_hdr_protector_encrypt(QUIC_HDR_PROTECTOR *hpr, in ossl_quic_hdr_protector_encrypt() argument
159 return ossl_quic_hdr_protector_encrypt_fields(hpr, in ossl_quic_hdr_protector_encrypt()
166 int ossl_quic_hdr_protector_encrypt_fields(QUIC_HDR_PROTECTOR *hpr, in ossl_quic_hdr_protector_encrypt_fields() argument
174 if (!hdr_generate_mask(hpr, sample, sample_len, mask)) in ossl_quic_hdr_protector_encrypt_fields()