blob: 51c8fe3bd547dbb0628b4bb036b299984b4777d9 [file] [log] [blame]
Jerry Yu65dd2cc2021-08-18 16:38:40 +08001/*
2 * TLS 1.3 functionality shared between client and server
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
20#include "common.h"
21
22#if defined(MBEDTLS_SSL_TLS_C)
23
24#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
25
26#include "ssl_misc.h"
27
28int mbedtls_ssl_start_handshake_msg( mbedtls_ssl_context *ssl,
29 unsigned hs_type,
30 unsigned char **buf,
31 size_t *buflen )
32{
33 ((void) ssl);
34 ((void) hs_type);
35 ((void) buf);
36 ((void) buflen);
37 return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
38}
39
40int mbedtls_ssl_finish_handshake_msg( mbedtls_ssl_context *ssl,
41 size_t buf_len,
42 size_t msg_len )
43{
44 ((void) ssl);
45 ((void) buf_len);
46 ((void) msg_len);
47 return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
48}
49
50void mbedtls_ssl_add_hs_hdr_to_checksum( mbedtls_ssl_context *ssl,
51 unsigned hs_type,
52 size_t total_hs_len )
53{
54 unsigned char hs_hdr[4];
55
56 /* Build HS header for checksum update. */
57 hs_hdr[0] = hs_type;
58 hs_hdr[1] = (unsigned char)( total_hs_len >> 16 );
59 hs_hdr[2] = (unsigned char)( total_hs_len >> 8 );
60 hs_hdr[3] = (unsigned char)( total_hs_len >> 0 );
61
62 ssl->handshake->update_checksum( ssl, hs_hdr, sizeof( hs_hdr ) );
63}
64
65#endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
66
67#endif /* MBEDTLS_SSL_TLS_C */