Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 1 | /* |
| 2 | * TLS 1.3 key schedule |
| 3 | * |
| 4 | * Copyright The Mbed TLS Contributors |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 ( the "License" ); you may |
| 8 | * not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | #if !defined(MBEDTLS_SSL_TLS1_3_KEYS_H) |
| 20 | #define MBEDTLS_SSL_TLS1_3_KEYS_H |
| 21 | |
Hanno Becker | 70d7fb0 | 2020-09-09 10:11:21 +0100 | [diff] [blame] | 22 | /* This requires MBEDTLS_SSL_TLS1_3_LABEL( idx, name, string ) to be defined at |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 23 | * the point of use. See e.g. the definition of mbedtls_ssl_tls13_labels_union |
Hanno Becker | a3a5a4e | 2020-09-08 11:33:48 +0100 | [diff] [blame] | 24 | * below. */ |
Jerry Yu | 0bbb397 | 2021-09-19 20:27:17 +0800 | [diff] [blame] | 25 | #define MBEDTLS_SSL_TLS1_3_LABEL_LIST \ |
| 26 | MBEDTLS_SSL_TLS1_3_LABEL( finished , "finished" ) \ |
| 27 | MBEDTLS_SSL_TLS1_3_LABEL( resumption , "resumption" ) \ |
| 28 | MBEDTLS_SSL_TLS1_3_LABEL( traffic_upd , "traffic upd" ) \ |
| 29 | MBEDTLS_SSL_TLS1_3_LABEL( exporter , "exporter" ) \ |
| 30 | MBEDTLS_SSL_TLS1_3_LABEL( key , "key" ) \ |
| 31 | MBEDTLS_SSL_TLS1_3_LABEL( iv , "iv" ) \ |
| 32 | MBEDTLS_SSL_TLS1_3_LABEL( c_hs_traffic, "c hs traffic" ) \ |
| 33 | MBEDTLS_SSL_TLS1_3_LABEL( c_ap_traffic, "c ap traffic" ) \ |
| 34 | MBEDTLS_SSL_TLS1_3_LABEL( c_e_traffic , "c e traffic" ) \ |
| 35 | MBEDTLS_SSL_TLS1_3_LABEL( s_hs_traffic, "s hs traffic" ) \ |
| 36 | MBEDTLS_SSL_TLS1_3_LABEL( s_ap_traffic, "s ap traffic" ) \ |
| 37 | MBEDTLS_SSL_TLS1_3_LABEL( s_e_traffic , "s e traffic" ) \ |
| 38 | MBEDTLS_SSL_TLS1_3_LABEL( e_exp_master, "e exp master" ) \ |
| 39 | MBEDTLS_SSL_TLS1_3_LABEL( res_master , "res master" ) \ |
| 40 | MBEDTLS_SSL_TLS1_3_LABEL( exp_master , "exp master" ) \ |
| 41 | MBEDTLS_SSL_TLS1_3_LABEL( ext_binder , "ext binder" ) \ |
| 42 | MBEDTLS_SSL_TLS1_3_LABEL( res_binder , "res binder" ) \ |
| 43 | MBEDTLS_SSL_TLS1_3_LABEL( derived , "derived" ) \ |
| 44 | MBEDTLS_SSL_TLS1_3_LABEL( client_cv , "TLS 1.3, client CertificateVerify" ) \ |
| 45 | MBEDTLS_SSL_TLS1_3_LABEL( server_cv , "TLS 1.3, server CertificateVerify" ) |
Hanno Becker | e4435ea | 2020-09-08 10:43:52 +0100 | [diff] [blame] | 46 | |
Hanno Becker | 1413bd8 | 2020-09-09 12:46:09 +0100 | [diff] [blame] | 47 | #define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \ |
Hanno Becker | e4435ea | 2020-09-08 10:43:52 +0100 | [diff] [blame] | 48 | const unsigned char name [ sizeof(string) - 1 ]; |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 49 | |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 50 | union mbedtls_ssl_tls13_labels_union |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 51 | { |
| 52 | MBEDTLS_SSL_TLS1_3_LABEL_LIST |
| 53 | }; |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 54 | struct mbedtls_ssl_tls13_labels_struct |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 55 | { |
| 56 | MBEDTLS_SSL_TLS1_3_LABEL_LIST |
| 57 | }; |
Hanno Becker | a3a5a4e | 2020-09-08 11:33:48 +0100 | [diff] [blame] | 58 | #undef MBEDTLS_SSL_TLS1_3_LABEL |
Hanno Becker | e4435ea | 2020-09-08 10:43:52 +0100 | [diff] [blame] | 59 | |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 60 | extern const struct mbedtls_ssl_tls13_labels_struct mbedtls_ssl_tls13_labels; |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 61 | |
Jerry Yu | 0bbb397 | 2021-09-19 20:27:17 +0800 | [diff] [blame] | 62 | #define MBEDTLS_SSL_TLS1_3_LBL_LEN( LABEL ) \ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 63 | sizeof(mbedtls_ssl_tls13_labels.LABEL) |
Jerry Yu | 0bbb397 | 2021-09-19 20:27:17 +0800 | [diff] [blame] | 64 | |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 65 | #define MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN( LABEL ) \ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 66 | mbedtls_ssl_tls13_labels.LABEL, \ |
Jerry Yu | 0bbb397 | 2021-09-19 20:27:17 +0800 | [diff] [blame] | 67 | MBEDTLS_SSL_TLS1_3_LBL_LEN( LABEL ) |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 68 | |
| 69 | #define MBEDTLS_SSL_TLS1_3_KEY_SCHEDULE_MAX_LABEL_LEN \ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 70 | sizeof( union mbedtls_ssl_tls13_labels_union ) |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 71 | |
Hanno Becker | 61baae7 | 2020-09-16 09:24:14 +0100 | [diff] [blame] | 72 | /* The maximum length of HKDF contexts used in the TLS 1.3 standard. |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 73 | * Since contexts are always hashes of message transcripts, this can |
| 74 | * be approximated from above by the maximum hash size. */ |
| 75 | #define MBEDTLS_SSL_TLS1_3_KEY_SCHEDULE_MAX_CONTEXT_LEN \ |
| 76 | MBEDTLS_MD_MAX_SIZE |
| 77 | |
| 78 | /* Maximum desired length for expanded key material generated |
Hanno Becker | 531fe30 | 2020-09-16 09:45:27 +0100 | [diff] [blame] | 79 | * by HKDF-Expand-Label. |
| 80 | * |
| 81 | * Warning: If this ever needs to be increased, the implementation |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 82 | * ssl_tls13_hkdf_encode_label() in ssl_tls13_keys.c needs to be |
Hanno Becker | 531fe30 | 2020-09-16 09:45:27 +0100 | [diff] [blame] | 83 | * adjusted since it currently assumes that HKDF key expansion |
| 84 | * is never used with more than 255 Bytes of output. */ |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 85 | #define MBEDTLS_SSL_TLS1_3_KEY_SCHEDULE_MAX_EXPANSION_LEN 255 |
| 86 | |
| 87 | /** |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 88 | * \brief The \c HKDF-Expand-Label function from |
| 89 | * the TLS 1.3 standard RFC 8446. |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 90 | * |
| 91 | * <tt> |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 92 | * HKDF-Expand-Label( Secret, Label, Context, Length ) = |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 93 | * HKDF-Expand( Secret, HkdfLabel, Length ) |
| 94 | * </tt> |
| 95 | * |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 96 | * \param hash_alg The identifier for the hash algorithm to use. |
| 97 | * \param secret The \c Secret argument to \c HKDF-Expand-Label. |
| 98 | * This must be a readable buffer of length \p slen Bytes. |
| 99 | * \param secret_len The length of \p secret in Bytes. |
| 100 | * \param label The \c Label argument to \c HKDF-Expand-Label. |
| 101 | * This must be a readable buffer of length \p llen Bytes. |
| 102 | * \param label_len The length of \p label in Bytes. |
| 103 | * \param ctx The \c Context argument to \c HKDF-Expand-Label. |
| 104 | * This must be a readable buffer of length \p clen Bytes. |
| 105 | * \param ctx_len The length of \p context in Bytes. |
| 106 | * \param buf The destination buffer to hold the expanded secret. |
| 107 | * This must be a writable buffer of length \p blen Bytes. |
| 108 | * \param buf_len The desired size of the expanded secret in Bytes. |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 109 | * |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 110 | * \returns \c 0 on success. |
| 111 | * \return A negative error code on failure. |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 112 | */ |
| 113 | |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 114 | int mbedtls_ssl_tls13_hkdf_expand_label( |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 115 | mbedtls_md_type_t hash_alg, |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 116 | const unsigned char *secret, size_t secret_len, |
| 117 | const unsigned char *label, size_t label_len, |
| 118 | const unsigned char *ctx, size_t ctx_len, |
| 119 | unsigned char *buf, size_t buf_len ); |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 120 | |
Hanno Becker | 3385a4d | 2020-08-21 13:03:34 +0100 | [diff] [blame] | 121 | /** |
| 122 | * \brief This function is part of the TLS 1.3 key schedule. |
| 123 | * It extracts key and IV for the actual client/server traffic |
| 124 | * from the client/server traffic secrets. |
| 125 | * |
| 126 | * From RFC 8446: |
| 127 | * |
| 128 | * <tt> |
| 129 | * [sender]_write_key = HKDF-Expand-Label(Secret, "key", "", key_length) |
| 130 | * [sender]_write_iv = HKDF-Expand-Label(Secret, "iv", "", iv_length)* |
| 131 | * </tt> |
| 132 | * |
| 133 | * \param hash_alg The identifier for the hash algorithm to be used |
| 134 | * for the HKDF-based expansion of the secret. |
| 135 | * \param client_secret The client traffic secret. |
| 136 | * This must be a readable buffer of size \p slen Bytes |
| 137 | * \param server_secret The server traffic secret. |
| 138 | * This must be a readable buffer of size \p slen Bytes |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 139 | * \param secret_len Length of the secrets \p client_secret and |
Hanno Becker | 3385a4d | 2020-08-21 13:03:34 +0100 | [diff] [blame] | 140 | * \p server_secret in Bytes. |
Hanno Becker | 493ea7f | 2020-09-08 11:01:00 +0100 | [diff] [blame] | 141 | * \param key_len The desired length of the key to be extracted in Bytes. |
| 142 | * \param iv_len The desired length of the IV to be extracted in Bytes. |
Hanno Becker | 3385a4d | 2020-08-21 13:03:34 +0100 | [diff] [blame] | 143 | * \param keys The address of the structure holding the generated |
| 144 | * keys and IVs. |
| 145 | * |
| 146 | * \returns \c 0 on success. |
| 147 | * \returns A negative error code on failure. |
| 148 | */ |
| 149 | |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 150 | int mbedtls_ssl_tls13_make_traffic_keys( |
Hanno Becker | 3385a4d | 2020-08-21 13:03:34 +0100 | [diff] [blame] | 151 | mbedtls_md_type_t hash_alg, |
| 152 | const unsigned char *client_secret, |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 153 | const unsigned char *server_secret, size_t secret_len, |
| 154 | size_t key_len, size_t iv_len, |
Hanno Becker | 3385a4d | 2020-08-21 13:03:34 +0100 | [diff] [blame] | 155 | mbedtls_ssl_key_set *keys ); |
| 156 | |
Hanno Becker | 0973ff9 | 2020-09-09 12:56:28 +0100 | [diff] [blame] | 157 | |
| 158 | #define MBEDTLS_SSL_TLS1_3_CONTEXT_UNHASHED 0 |
| 159 | #define MBEDTLS_SSL_TLS1_3_CONTEXT_HASHED 1 |
| 160 | |
Hanno Becker | b35d522 | 2020-08-21 13:27:44 +0100 | [diff] [blame] | 161 | /** |
| 162 | * \brief The \c Derive-Secret function from the TLS 1.3 standard RFC 8446. |
| 163 | * |
| 164 | * <tt> |
| 165 | * Derive-Secret( Secret, Label, Messages ) = |
| 166 | * HKDF-Expand-Label( Secret, Label, |
| 167 | * Hash( Messages ), |
| 168 | * Hash.Length ) ) |
| 169 | * </tt> |
| 170 | * |
Hanno Becker | 0c42fd9 | 2020-09-09 12:58:29 +0100 | [diff] [blame] | 171 | * \param hash_alg The identifier for the hash function used for the |
| 172 | * applications of HKDF. |
| 173 | * \param secret The \c Secret argument to the \c Derive-Secret function. |
| 174 | * This must be a readable buffer of length \p slen Bytes. |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 175 | * \param secret_len The length of \p secret in Bytes. |
Hanno Becker | 0c42fd9 | 2020-09-09 12:58:29 +0100 | [diff] [blame] | 176 | * \param label The \c Label argument to the \c Derive-Secret function. |
| 177 | * This must be a readable buffer of length \p llen Bytes. |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 178 | * \param label_len The length of \p label in Bytes. |
Hanno Becker | 0c42fd9 | 2020-09-09 12:58:29 +0100 | [diff] [blame] | 179 | * \param ctx The hash of the \c Messages argument to the |
| 180 | * \c Derive-Secret function, or the \c Messages argument |
| 181 | * itself, depending on \p context_already_hashed. |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 182 | * \param ctx_len The length of \p hash. |
Hanno Becker | 0c42fd9 | 2020-09-09 12:58:29 +0100 | [diff] [blame] | 183 | * \param ctx_hashed This indicates whether the \p ctx contains the hash of |
| 184 | * the \c Messages argument in the application of the |
| 185 | * \c Derive-Secret function |
| 186 | * (value MBEDTLS_SSL_TLS1_3_CONTEXT_HASHED), or whether |
| 187 | * it is the content of \c Messages itself, in which case |
| 188 | * the function takes care of the hashing |
| 189 | * (value MBEDTLS_SSL_TLS1_3_CONTEXT_UNHASHED). |
| 190 | * \param dstbuf The target buffer to write the output of |
| 191 | * \c Derive-Secret to. This must be a writable buffer of |
| 192 | * size \p buflen Bytes. |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 193 | * \param dstbuf_len The length of \p dstbuf in Bytes. |
Hanno Becker | b35d522 | 2020-08-21 13:27:44 +0100 | [diff] [blame] | 194 | * |
| 195 | * \returns \c 0 on success. |
| 196 | * \returns A negative error code on failure. |
| 197 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 198 | int mbedtls_ssl_tls13_derive_secret( |
Hanno Becker | b35d522 | 2020-08-21 13:27:44 +0100 | [diff] [blame] | 199 | mbedtls_md_type_t hash_alg, |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 200 | const unsigned char *secret, size_t secret_len, |
| 201 | const unsigned char *label, size_t label_len, |
| 202 | const unsigned char *ctx, size_t ctx_len, |
Hanno Becker | 0c42fd9 | 2020-09-09 12:58:29 +0100 | [diff] [blame] | 203 | int ctx_hashed, |
Xiaofei Bai | 89b526d | 2021-11-23 06:31:16 +0000 | [diff] [blame] | 204 | unsigned char *dstbuf, size_t dstbuf_len ); |
Hanno Becker | b35d522 | 2020-08-21 13:27:44 +0100 | [diff] [blame] | 205 | |
Hanno Becker | e9cccb4 | 2020-08-20 13:42:46 +0100 | [diff] [blame] | 206 | /** |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 207 | * \brief Derive TLS 1.3 early data key material from early secret. |
| 208 | * |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 209 | * This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret() |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 210 | * with the appropriate labels. |
| 211 | * |
| 212 | * <tt> |
| 213 | * Early Secret |
| 214 | * | |
| 215 | * +-----> Derive-Secret(., "c e traffic", ClientHello) |
| 216 | * | = client_early_traffic_secret |
| 217 | * | |
| 218 | * +-----> Derive-Secret(., "e exp master", ClientHello) |
| 219 | * . = early_exporter_master_secret |
| 220 | * . |
| 221 | * . |
| 222 | * </tt> |
| 223 | * |
| 224 | * \note To obtain the actual key and IV for the early data traffic, |
| 225 | * the client secret derived by this function need to be |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 226 | * further processed by mbedtls_ssl_tls13_make_traffic_keys(). |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 227 | * |
| 228 | * \note The binder key, which is also generated from the early secret, |
| 229 | * is omitted here. Its calculation is part of the separate routine |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 230 | * mbedtls_ssl_tls13_create_psk_binder(). |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 231 | * |
| 232 | * \param md_type The hash algorithm associated with the PSK for which |
| 233 | * early data key material is being derived. |
| 234 | * \param early_secret The early secret from which the early data key material |
| 235 | * should be derived. This must be a readable buffer whose |
| 236 | * length is the digest size of the hash algorithm |
| 237 | * represented by \p md_size. |
| 238 | * \param transcript The transcript of the handshake so far, calculated with |
| 239 | * respect to \p md_type. This must be a readable buffer |
| 240 | * whose length is the digest size of the hash algorithm |
| 241 | * represented by \p md_size. |
| 242 | * \param derived The address of the structure in which to store |
| 243 | * the early data key material. |
| 244 | * |
| 245 | * \returns \c 0 on success. |
| 246 | * \returns A negative error code on failure. |
| 247 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 248 | int mbedtls_ssl_tls13_derive_early_secrets( |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 249 | mbedtls_md_type_t md_type, |
| 250 | unsigned char const *early_secret, |
| 251 | unsigned char const *transcript, size_t transcript_len, |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 252 | mbedtls_ssl_tls13_early_secrets *derived ); |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 253 | |
| 254 | /** |
| 255 | * \brief Derive TLS 1.3 handshake key material from the handshake secret. |
| 256 | * |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 257 | * This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret() |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 258 | * with the appropriate labels from the standard. |
| 259 | * |
| 260 | * <tt> |
| 261 | * Handshake Secret |
| 262 | * | |
| 263 | * +-----> Derive-Secret( ., "c hs traffic", |
| 264 | * | ClientHello...ServerHello ) |
| 265 | * | = client_handshake_traffic_secret |
| 266 | * | |
| 267 | * +-----> Derive-Secret( ., "s hs traffic", |
| 268 | * . ClientHello...ServerHello ) |
| 269 | * . = server_handshake_traffic_secret |
| 270 | * . |
| 271 | * </tt> |
| 272 | * |
| 273 | * \note To obtain the actual key and IV for the encrypted handshake traffic, |
| 274 | * the client and server secret derived by this function need to be |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 275 | * further processed by mbedtls_ssl_tls13_make_traffic_keys(). |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 276 | * |
| 277 | * \param md_type The hash algorithm associated with the ciphersuite |
| 278 | * that's being used for the connection. |
| 279 | * \param handshake_secret The handshake secret from which the handshake key |
| 280 | * material should be derived. This must be a readable |
| 281 | * buffer whose length is the digest size of the hash |
| 282 | * algorithm represented by \p md_size. |
| 283 | * \param transcript The transcript of the handshake so far, calculated |
| 284 | * with respect to \p md_type. This must be a readable |
| 285 | * buffer whose length is the digest size of the hash |
| 286 | * algorithm represented by \p md_size. |
| 287 | * \param derived The address of the structure in which to |
| 288 | * store the handshake key material. |
| 289 | * |
| 290 | * \returns \c 0 on success. |
| 291 | * \returns A negative error code on failure. |
| 292 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 293 | int mbedtls_ssl_tls13_derive_handshake_secrets( |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 294 | mbedtls_md_type_t md_type, |
| 295 | unsigned char const *handshake_secret, |
| 296 | unsigned char const *transcript, size_t transcript_len, |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 297 | mbedtls_ssl_tls13_handshake_secrets *derived ); |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 298 | |
| 299 | /** |
| 300 | * \brief Derive TLS 1.3 application key material from the master secret. |
| 301 | * |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 302 | * This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret() |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 303 | * with the appropriate labels from the standard. |
| 304 | * |
| 305 | * <tt> |
| 306 | * Master Secret |
| 307 | * | |
| 308 | * +-----> Derive-Secret( ., "c ap traffic", |
| 309 | * | ClientHello...server Finished ) |
| 310 | * | = client_application_traffic_secret_0 |
| 311 | * | |
| 312 | * +-----> Derive-Secret( ., "s ap traffic", |
| 313 | * | ClientHello...Server Finished ) |
| 314 | * | = server_application_traffic_secret_0 |
| 315 | * | |
| 316 | * +-----> Derive-Secret( ., "exp master", |
| 317 | * . ClientHello...server Finished) |
| 318 | * . = exporter_master_secret |
| 319 | * . |
| 320 | * </tt> |
| 321 | * |
| 322 | * \note To obtain the actual key and IV for the (0-th) application traffic, |
| 323 | * the client and server secret derived by this function need to be |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 324 | * further processed by mbedtls_ssl_tls13_make_traffic_keys(). |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 325 | * |
| 326 | * \param md_type The hash algorithm associated with the ciphersuite |
| 327 | * that's being used for the connection. |
| 328 | * \param master_secret The master secret from which the application key |
| 329 | * material should be derived. This must be a readable |
| 330 | * buffer whose length is the digest size of the hash |
| 331 | * algorithm represented by \p md_size. |
| 332 | * \param transcript The transcript of the handshake up to and including |
| 333 | * the ServerFinished message, calculated with respect |
| 334 | * to \p md_type. This must be a readable buffer whose |
| 335 | * length is the digest size of the hash algorithm |
| 336 | * represented by \p md_type. |
| 337 | * \param derived The address of the structure in which to |
| 338 | * store the application key material. |
| 339 | * |
| 340 | * \returns \c 0 on success. |
| 341 | * \returns A negative error code on failure. |
| 342 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 343 | int mbedtls_ssl_tls13_derive_application_secrets( |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 344 | mbedtls_md_type_t md_type, |
| 345 | unsigned char const *master_secret, |
| 346 | unsigned char const *transcript, size_t transcript_len, |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 347 | mbedtls_ssl_tls13_application_secrets *derived ); |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 348 | |
| 349 | /** |
| 350 | * \brief Derive TLS 1.3 resumption master secret from the master secret. |
| 351 | * |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 352 | * This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret() |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 353 | * with the appropriate labels from the standard. |
| 354 | * |
| 355 | * \param md_type The hash algorithm used in the application for which |
| 356 | * key material is being derived. |
| 357 | * \param application_secret The application secret from which the resumption master |
| 358 | * secret should be derived. This must be a readable |
| 359 | * buffer whose length is the digest size of the hash |
| 360 | * algorithm represented by \p md_size. |
| 361 | * \param transcript The transcript of the handshake up to and including |
| 362 | * the ClientFinished message, calculated with respect |
| 363 | * to \p md_type. This must be a readable buffer whose |
| 364 | * length is the digest size of the hash algorithm |
| 365 | * represented by \p md_type. |
| 366 | * \param transcript_len The length of \p transcript in Bytes. |
| 367 | * \param derived The address of the structure in which to |
| 368 | * store the resumption master secret. |
| 369 | * |
| 370 | * \returns \c 0 on success. |
| 371 | * \returns A negative error code on failure. |
| 372 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 373 | int mbedtls_ssl_tls13_derive_resumption_master_secret( |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 374 | mbedtls_md_type_t md_type, |
| 375 | unsigned char const *application_secret, |
| 376 | unsigned char const *transcript, size_t transcript_len, |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 377 | mbedtls_ssl_tls13_application_secrets *derived ); |
Hanno Becker | ef5235b | 2021-05-24 06:39:41 +0100 | [diff] [blame] | 378 | |
| 379 | /** |
Hanno Becker | e9cccb4 | 2020-08-20 13:42:46 +0100 | [diff] [blame] | 380 | * \brief Compute the next secret in the TLS 1.3 key schedule |
| 381 | * |
| 382 | * The TLS 1.3 key schedule proceeds as follows to compute |
| 383 | * the three main secrets during the handshake: The early |
| 384 | * secret for early data, the handshake secret for all |
| 385 | * other encrypted handshake messages, and the master |
| 386 | * secret for all application traffic. |
| 387 | * |
| 388 | * <tt> |
| 389 | * 0 |
| 390 | * | |
| 391 | * v |
| 392 | * PSK -> HKDF-Extract = Early Secret |
| 393 | * | |
| 394 | * v |
| 395 | * Derive-Secret( ., "derived", "" ) |
| 396 | * | |
| 397 | * v |
| 398 | * (EC)DHE -> HKDF-Extract = Handshake Secret |
| 399 | * | |
| 400 | * v |
| 401 | * Derive-Secret( ., "derived", "" ) |
| 402 | * | |
| 403 | * v |
| 404 | * 0 -> HKDF-Extract = Master Secret |
| 405 | * </tt> |
| 406 | * |
| 407 | * Each of the three secrets in turn is the basis for further |
| 408 | * key derivations, such as the derivation of traffic keys and IVs; |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 409 | * see e.g. mbedtls_ssl_tls13_make_traffic_keys(). |
Hanno Becker | e9cccb4 | 2020-08-20 13:42:46 +0100 | [diff] [blame] | 410 | * |
| 411 | * This function implements one step in this evolution of secrets: |
| 412 | * |
| 413 | * <tt> |
| 414 | * old_secret |
| 415 | * | |
| 416 | * v |
| 417 | * Derive-Secret( ., "derived", "" ) |
| 418 | * | |
| 419 | * v |
| 420 | * input -> HKDF-Extract = new_secret |
| 421 | * </tt> |
| 422 | * |
| 423 | * \param hash_alg The identifier for the hash function used for the |
| 424 | * applications of HKDF. |
| 425 | * \param secret_old The address of the buffer holding the old secret |
| 426 | * on function entry. If not \c NULL, this must be a |
| 427 | * readable buffer whose size matches the output size |
| 428 | * of the hash function represented by \p hash_alg. |
| 429 | * If \c NULL, an all \c 0 array will be used instead. |
| 430 | * \param input The address of the buffer holding the additional |
| 431 | * input for the key derivation (e.g., the PSK or the |
| 432 | * ephemeral (EC)DH secret). If not \c NULL, this must be |
| 433 | * a readable buffer whose size \p input_len Bytes. |
| 434 | * If \c NULL, an all \c 0 array will be used instead. |
| 435 | * \param input_len The length of \p input in Bytes. |
| 436 | * \param secret_new The address of the buffer holding the new secret |
| 437 | * on function exit. This must be a writable buffer |
| 438 | * whose size matches the output size of the hash |
| 439 | * function represented by \p hash_alg. |
| 440 | * This may be the same as \p secret_old. |
| 441 | * |
| 442 | * \returns \c 0 on success. |
| 443 | * \returns A negative error code on failure. |
| 444 | */ |
| 445 | |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 446 | int mbedtls_ssl_tls13_evolve_secret( |
Hanno Becker | e9cccb4 | 2020-08-20 13:42:46 +0100 | [diff] [blame] | 447 | mbedtls_md_type_t hash_alg, |
| 448 | const unsigned char *secret_old, |
| 449 | const unsigned char *input, size_t input_len, |
| 450 | unsigned char *secret_new ); |
| 451 | |
Hanno Becker | b7d9bad | 2021-05-24 06:44:14 +0100 | [diff] [blame] | 452 | #define MBEDTLS_SSL_TLS1_3_PSK_EXTERNAL 0 |
| 453 | #define MBEDTLS_SSL_TLS1_3_PSK_RESUMPTION 1 |
| 454 | |
| 455 | /** |
| 456 | * \brief Calculate a TLS 1.3 PSK binder. |
| 457 | * |
| 458 | * \param ssl The SSL context. This is used for debugging only and may |
| 459 | * be \c NULL if MBEDTLS_DEBUG_C is disabled. |
| 460 | * \param md_type The hash algorithm associated to the PSK \p psk. |
| 461 | * \param psk The buffer holding the PSK for which to create a binder. |
| 462 | * \param psk_len The size of \p psk in bytes. |
Hanno Becker | c8d3ccd | 2021-05-26 04:47:29 +0100 | [diff] [blame] | 463 | * \param psk_type This indicates whether the PSK \p psk is externally |
Hanno Becker | b7d9bad | 2021-05-24 06:44:14 +0100 | [diff] [blame] | 464 | * provisioned (#MBEDTLS_SSL_TLS1_3_PSK_EXTERNAL) or a |
| 465 | * resumption PSK (#MBEDTLS_SSL_TLS1_3_PSK_RESUMPTION). |
| 466 | * \param transcript The handshake transcript up to the point where the |
| 467 | * PSK binder calculation happens. This must be readable, |
| 468 | * and its size must be equal to the digest size of |
| 469 | * the hash algorithm represented by \p md_type. |
| 470 | * \param result The address at which to store the PSK binder on success. |
| 471 | * This must be writable, and its size must be equal to the |
| 472 | * digest size of the hash algorithm represented by |
| 473 | * \p md_type. |
| 474 | * |
| 475 | * \returns \c 0 on success. |
| 476 | * \returns A negative error code on failure. |
| 477 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 478 | int mbedtls_ssl_tls13_create_psk_binder( mbedtls_ssl_context *ssl, |
Hanno Becker | b7d9bad | 2021-05-24 06:44:14 +0100 | [diff] [blame] | 479 | const mbedtls_md_type_t md_type, |
| 480 | unsigned char const *psk, size_t psk_len, |
| 481 | int psk_type, |
| 482 | unsigned char const *transcript, |
| 483 | unsigned char *result ); |
| 484 | |
Hanno Becker | c94060c | 2021-03-22 07:50:44 +0000 | [diff] [blame] | 485 | /** |
| 486 | * \bref Setup an SSL transform structure representing the |
| 487 | * record protection mechanism used by TLS 1.3 |
| 488 | * |
| 489 | * \param transform The SSL transform structure to be created. This must have |
| 490 | * been initialized through mbedtls_ssl_transform_init() and |
| 491 | * not used in any other way prior to calling this function. |
| 492 | * In particular, this function does not clean up the |
| 493 | * transform structure prior to installing the new keys. |
| 494 | * \param endpoint Indicates whether the transform is for the client |
| 495 | * (value #MBEDTLS_SSL_IS_CLIENT) or the server |
| 496 | * (value #MBEDTLS_SSL_IS_SERVER). |
| 497 | * \param ciphersuite The numerical identifier for the ciphersuite to use. |
| 498 | * This must be one of the identifiers listed in |
| 499 | * ssl_ciphersuites.h. |
| 500 | * \param traffic_keys The key material to use. No reference is stored in |
| 501 | * the SSL transform being generated, and the caller |
| 502 | * should destroy the key material afterwards. |
| 503 | * \param ssl (Debug-only) The SSL context to use for debug output |
| 504 | * in case of failure. This parameter is only needed if |
| 505 | * #MBEDTLS_DEBUG_C is set, and is ignored otherwise. |
| 506 | * |
| 507 | * \return \c 0 on success. In this case, \p transform is ready to |
| 508 | * be used with mbedtls_ssl_transform_decrypt() and |
| 509 | * mbedtls_ssl_transform_encrypt(). |
| 510 | * \return A negative error code on failure. |
| 511 | */ |
| 512 | int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform, |
| 513 | int endpoint, |
| 514 | int ciphersuite, |
| 515 | mbedtls_ssl_key_set const *traffic_keys, |
| 516 | mbedtls_ssl_context *ssl ); |
| 517 | |
Jerry Yu | 89ea321 | 2021-09-09 14:31:24 +0800 | [diff] [blame] | 518 | /* |
| 519 | * TLS 1.3 key schedule evolutions |
| 520 | * |
Jerry Yu | c1ddeef | 2021-10-08 15:14:45 +0800 | [diff] [blame] | 521 | * Early -> Handshake -> Application |
Jerry Yu | 89ea321 | 2021-09-09 14:31:24 +0800 | [diff] [blame] | 522 | * |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 523 | * Small wrappers around mbedtls_ssl_tls13_evolve_secret(). |
Jerry Yu | 89ea321 | 2021-09-09 14:31:24 +0800 | [diff] [blame] | 524 | */ |
| 525 | |
| 526 | /** |
Jerry Yu | c1ddeef | 2021-10-08 15:14:45 +0800 | [diff] [blame] | 527 | * \brief Begin TLS 1.3 key schedule by calculating early secret. |
Jerry Yu | 89ea321 | 2021-09-09 14:31:24 +0800 | [diff] [blame] | 528 | * |
| 529 | * The TLS 1.3 key schedule can be viewed as a simple state machine |
| 530 | * with states Initial -> Early -> Handshake -> Application, and |
| 531 | * this function represents the Initial -> Early transition. |
| 532 | * |
Jerry Yu | 89ea321 | 2021-09-09 14:31:24 +0800 | [diff] [blame] | 533 | * \param ssl The SSL context to operate on. |
| 534 | * |
| 535 | * \returns \c 0 on success. |
| 536 | * \returns A negative error code on failure. |
| 537 | */ |
Xiaofei Bai | 746f948 | 2021-11-12 08:53:56 +0000 | [diff] [blame] | 538 | int mbedtls_ssl_tls13_key_schedule_stage_early( mbedtls_ssl_context *ssl ); |
Jerry Yu | 4925ef5 | 2021-09-09 14:42:55 +0800 | [diff] [blame] | 539 | |
Jerry Yu | 61e35e0 | 2021-09-16 18:59:08 +0800 | [diff] [blame] | 540 | /** |
Jerry Yu | a0650eb | 2021-09-09 17:14:45 +0800 | [diff] [blame] | 541 | * \brief Transition into handshake stage of TLS 1.3 key schedule. |
| 542 | * |
| 543 | * The TLS 1.3 key schedule can be viewed as a simple state machine |
| 544 | * with states Initial -> Early -> Handshake -> Application, and |
| 545 | * this function represents the Early -> Handshake transition. |
| 546 | * |
Jerry Yu | c068b66 | 2021-10-11 22:30:19 +0800 | [diff] [blame] | 547 | * In the handshake stage, mbedtls_ssl_tls13_generate_handshake_keys() |
Jerry Yu | a0650eb | 2021-09-09 17:14:45 +0800 | [diff] [blame] | 548 | * can be used to derive the handshake traffic keys. |
| 549 | * |
| 550 | * \param ssl The SSL context to operate on. This must be in key schedule |
| 551 | * stage \c Early. |
| 552 | * |
| 553 | * \returns \c 0 on success. |
| 554 | * \returns A negative error code on failure. |
| 555 | */ |
Jerry Yu | f0ac235 | 2021-10-11 17:47:07 +0800 | [diff] [blame] | 556 | int mbedtls_ssl_tls13_key_schedule_stage_handshake( mbedtls_ssl_context *ssl ); |
Jerry Yu | a0650eb | 2021-09-09 17:14:45 +0800 | [diff] [blame] | 557 | |
| 558 | /** |
Jerry Yu | 61e35e0 | 2021-09-16 18:59:08 +0800 | [diff] [blame] | 559 | * \brief Compute TLS 1.3 handshake traffic keys. |
| 560 | * |
| 561 | * \param ssl The SSL context to operate on. This must be in |
| 562 | * key schedule stage \c Handshake, see |
Jerry Yu | f0ac235 | 2021-10-11 17:47:07 +0800 | [diff] [blame] | 563 | * mbedtls_ssl_tls13_key_schedule_stage_handshake(). |
Jerry Yu | 61e35e0 | 2021-09-16 18:59:08 +0800 | [diff] [blame] | 564 | * \param traffic_keys The address at which to store the handshake traffic key |
| 565 | * keys. This must be writable but may be uninitialized. |
| 566 | * |
| 567 | * \returns \c 0 on success. |
| 568 | * \returns A negative error code on failure. |
| 569 | */ |
Jerry Yu | c068b66 | 2021-10-11 22:30:19 +0800 | [diff] [blame] | 570 | int mbedtls_ssl_tls13_generate_handshake_keys( mbedtls_ssl_context *ssl, |
| 571 | mbedtls_ssl_key_set *traffic_keys ); |
Jerry Yu | 61e35e0 | 2021-09-16 18:59:08 +0800 | [diff] [blame] | 572 | |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 573 | /** |
| 574 | * \brief Transition into application stage of TLS 1.3 key schedule. |
| 575 | * |
| 576 | * The TLS 1.3 key schedule can be viewed as a simple state machine |
| 577 | * with states Initial -> Early -> Handshake -> Application, and |
| 578 | * this function represents the Handshake -> Application transition. |
| 579 | * |
XiaokangQian | d0aa3e9 | 2021-11-10 06:17:40 +0000 | [diff] [blame] | 580 | * In the handshake stage, mbedtls_ssl_tls13_generate_application_keys() |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 581 | * can be used to derive the handshake traffic keys. |
| 582 | * |
| 583 | * \param ssl The SSL context to operate on. This must be in key schedule |
| 584 | * stage \c Handshake. |
| 585 | * |
| 586 | * \returns \c 0 on success. |
| 587 | * \returns A negative error code on failure. |
| 588 | */ |
XiaokangQian | a4c99f2 | 2021-11-11 06:46:35 +0000 | [diff] [blame] | 589 | int mbedtls_ssl_tls13_key_schedule_stage_application( mbedtls_ssl_context *ssl ); |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 590 | |
| 591 | /** |
| 592 | * \brief Compute TLS 1.3 application traffic keys. |
| 593 | * |
| 594 | * \param ssl The SSL context to operate on. This must be in |
| 595 | * key schedule stage \c Application, see |
XiaokangQian | 4cab024 | 2021-10-12 08:43:37 +0000 | [diff] [blame] | 596 | * mbedtls_ssl_tls13_key_schedule_stage_application(). |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 597 | * \param traffic_keys The address at which to store the application traffic key |
| 598 | * keys. This must be writable but may be uninitialized. |
| 599 | * |
| 600 | * \returns \c 0 on success. |
| 601 | * \returns A negative error code on failure. |
| 602 | */ |
XiaokangQian | d0aa3e9 | 2021-11-10 06:17:40 +0000 | [diff] [blame] | 603 | int mbedtls_ssl_tls13_generate_application_keys( |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 604 | mbedtls_ssl_context* ssl, mbedtls_ssl_key_set *traffic_keys ); |
| 605 | |
| 606 | /** |
XiaokangQian | c5c39d5 | 2021-11-09 11:55:10 +0000 | [diff] [blame] | 607 | * \brief Calculate the verify_data value for the client or server TLS 1.3 |
| 608 | * Finished message. |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 609 | * |
| 610 | * \param ssl The SSL context to operate on. This must be in |
| 611 | * key schedule stage \c Handshake, see |
XiaokangQian | 4cab024 | 2021-10-12 08:43:37 +0000 | [diff] [blame] | 612 | * mbedtls_ssl_tls13_key_schedule_stage_application(). |
XiaokangQian | c5c39d5 | 2021-11-09 11:55:10 +0000 | [diff] [blame] | 613 | * \param dst The address at which to write the verify_data value. |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 614 | * \param dst_len The size of \p dst in bytes. |
| 615 | * \param actual_len The address at which to store the amount of data |
| 616 | * actually written to \p dst upon success. |
XiaokangQian | aaa0e19 | 2021-11-10 03:07:04 +0000 | [diff] [blame] | 617 | * \param which The message to calculate the `verify_data` for: |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 618 | * - #MBEDTLS_SSL_IS_CLIENT for the Client's Finished message |
| 619 | * - #MBEDTLS_SSL_IS_SERVER for the Server's Finished message |
| 620 | * |
| 621 | * \note Both client and server call this function twice, once to |
| 622 | * generate their own Finished message, and once to verify the |
| 623 | * peer's Finished message. |
| 624 | |
| 625 | * \returns \c 0 on success. |
| 626 | * \returns A negative error code on failure. |
| 627 | */ |
XiaokangQian | c5c39d5 | 2021-11-09 11:55:10 +0000 | [diff] [blame] | 628 | int mbedtls_ssl_tls13_calculate_verify_data( mbedtls_ssl_context *ssl, |
XiaokangQian | aaa0e19 | 2021-11-10 03:07:04 +0000 | [diff] [blame] | 629 | unsigned char *dst, |
| 630 | size_t dst_len, |
| 631 | size_t *actual_len, |
| 632 | int which ); |
XiaokangQian | aa5f5c1 | 2021-09-18 06:20:25 +0000 | [diff] [blame] | 633 | |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 634 | #endif /* MBEDTLS_SSL_TLS1_3_KEYS_H */ |