]> git.ipfire.org Git - thirdparty/openssl.git/blob - include/internal/quic_record_util.h
cc103505c4147ca5a90b0d397d96ca66d3639841
[thirdparty/openssl.git] / include / internal / quic_record_util.h
1 /*
2 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10 #ifndef OSSL_QUIC_RECORD_UTIL_H
11 # define OSSL_QUIC_RECORD_UTIL_H
12
13 # include <openssl/ssl.h>
14
15 /*
16 * QUIC Key Derivation Utilities
17 * =============================
18 */
19
20 /* HKDF-Extract(salt, IKM) (RFC 5869) */
21 int ossl_quic_hkdf_extract(OSSL_LIB_CTX *libctx,
22 const char *propq,
23 const EVP_MD *md,
24 const unsigned char *salt, size_t salt_len,
25 const unsigned char *ikm, size_t ikm_len,
26 unsigned char *out, size_t out_len);
27
28 /*
29 * QUIC Record Layer Ciphersuite Info
30 * ==================================
31 */
32
33 /* Available QUIC Record Layer (QRL) ciphersuites. */
34 # define QRL_SUITE_AES128GCM 1 /* SHA256 */
35 # define QRL_SUITE_AES256GCM 2 /* SHA384 */
36 # define QRL_SUITE_CHACHA20POLY1305 3 /* SHA256 */
37
38 /* Returns cipher name in bytes or NULL if suite ID is invalid. */
39 const char *ossl_qrl_get_suite_cipher_name(uint32_t suite_id);
40
41 /* Returns hash function name in bytes or NULL if suite ID is invalid. */
42 const char *ossl_qrl_get_suite_md_name(uint32_t suite_id);
43
44 /* Returns secret length in bytes or 0 if suite ID is invalid. */
45 uint32_t ossl_qrl_get_suite_secret_len(uint32_t suite_id);
46
47 /* Returns key length in bytes or 0 if suite ID is invalid. */
48 uint32_t ossl_qrl_get_suite_cipher_key_len(uint32_t suite_id);
49
50 /* Returns IV length in bytes or 0 if suite ID is invalid. */
51 uint32_t ossl_qrl_get_suite_cipher_iv_len(uint32_t suite_id);
52
53 /* Returns AEAD auth tag length in bytes or 0 if suite ID is invalid. */
54 uint32_t ossl_qrl_get_suite_cipher_tag_len(uint32_t suite_id);
55
56 /* Returns a QUIC_HDR_PROT_CIPHER_* value or 0 if suite ID is invalid. */
57 uint32_t ossl_qrl_get_suite_hdr_prot_cipher_id(uint32_t suite_id);
58
59 /* Returns header protection key length in bytes or 0 if suite ID is invalid. */
60 uint32_t ossl_qrl_get_suite_hdr_prot_key_len(uint32_t suite_id);
61
62 #endif