blob: 880ff696718b1bfa44d519b1c4aacb0b18cc03c8 [file] [log] [blame]
Gilles Peskine863b96a2021-12-16 10:04:58 +01001/**
2 * \file ssl_debug_helpers.h
3 *
4 * \brief Automatically generated helper functions for debugging
5 */
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22
Gilles Peskine09f1ee62021-12-15 12:53:34 +010023#ifndef MBEDTLS_SSL_DEBUG_HELPERS_H
24#define MBEDTLS_SSL_DEBUG_HELPERS_H
25
26#include "common.h"
27
28#if defined(MBEDTLS_DEBUG_C)
29
30#include "mbedtls/ssl.h"
31#include "ssl_misc.h"
32
33
Gilles Peskine449bd832023-01-11 14:50:10 +010034const char *mbedtls_ssl_states_str(mbedtls_ssl_states in);
Gilles Peskine09f1ee62021-12-15 12:53:34 +010035
Gilles Peskine449bd832023-01-11 14:50:10 +010036const char *mbedtls_ssl_protocol_version_str(mbedtls_ssl_protocol_version in);
Gilles Peskine66971f82022-01-13 13:46:05 +010037
Gilles Peskine449bd832023-01-11 14:50:10 +010038const char *mbedtls_tls_prf_types_str(mbedtls_tls_prf_types in);
Gilles Peskine09f1ee62021-12-15 12:53:34 +010039
Gilles Peskine449bd832023-01-11 14:50:10 +010040const char *mbedtls_ssl_key_export_type_str(mbedtls_ssl_key_export_type in);
Gilles Peskine09f1ee62021-12-15 12:53:34 +010041
Gilles Peskine449bd832023-01-11 14:50:10 +010042const char *mbedtls_ssl_sig_alg_to_str(uint16_t in);
Gilles Peskine09f1ee62021-12-15 12:53:34 +010043
Gilles Peskine449bd832023-01-11 14:50:10 +010044const char *mbedtls_ssl_named_group_to_str(uint16_t in);
Jerry Yufe24d1c2022-04-11 21:04:47 +080045
Gilles Peskine449bd832023-01-11 14:50:10 +010046const char *mbedtls_ssl_get_extension_name(unsigned int extension_type);
Gilles Peskine09f1ee62021-12-15 12:53:34 +010047
Gilles Peskine449bd832023-01-11 14:50:10 +010048void mbedtls_ssl_print_extensions(const mbedtls_ssl_context *ssl,
Jerry Yu79aa7212022-11-08 21:30:21 +080049 int level, const char *file, int line,
Gilles Peskine449bd832023-01-11 14:50:10 +010050 int hs_msg_type, uint32_t extensions_mask,
51 const char *extra);
Jerry Yu471dee52022-08-04 16:33:14 +080052
Gilles Peskine449bd832023-01-11 14:50:10 +010053void mbedtls_ssl_print_extension(const mbedtls_ssl_context *ssl,
54 int level, const char *file, int line,
55 int hs_msg_type, unsigned int extension_type,
56 const char *extra_msg0, const char *extra_msg1);
Jerry Yud25cab02022-10-31 12:48:30 +080057
Pengyu Lvee455c02023-01-12 14:37:24 +080058#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
59void mbedtls_debug_print_ticket_flags(const mbedtls_ssl_context *ssl,
60 int level, const char *file, int line,
61 mbedtls_ssl_tls13_ticket_flags flag);
62#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
63
Gilles Peskine449bd832023-01-11 14:50:10 +010064#define MBEDTLS_SSL_PRINT_EXTS(level, hs_msg_type, extensions_mask) \
65 mbedtls_ssl_print_extensions(ssl, level, __FILE__, __LINE__, \
66 hs_msg_type, extensions_mask, NULL)
67
68#define MBEDTLS_SSL_PRINT_EXT(level, hs_msg_type, extension_type, extra) \
69 mbedtls_ssl_print_extension(ssl, level, __FILE__, __LINE__, \
70 hs_msg_type, extension_type, \
71 extra, NULL)
Pengyu Lvee455c02023-01-12 14:37:24 +080072
73#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
74#define MBEDTLS_SSL_DEBUG_TICKET_FLAGS(level, flag) \
75 mbedtls_debug_print_ticket_flags(ssl, level, __FILE__, __LINE__, flag)
76#endif
77
Jerry Yu471dee52022-08-04 16:33:14 +080078#else
79
Gilles Peskine449bd832023-01-11 14:50:10 +010080#define MBEDTLS_SSL_PRINT_EXTS(level, hs_msg_type, extension_mask)
Jerry Yu471dee52022-08-04 16:33:14 +080081
Gilles Peskine449bd832023-01-11 14:50:10 +010082#define MBEDTLS_SSL_PRINT_EXT(level, hs_msg_type, extension_type, extra)
Jerry Yu471dee52022-08-04 16:33:14 +080083
Pengyu Lvee455c02023-01-12 14:37:24 +080084#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
85#define MBEDTLS_SSL_DEBUG_TICKET_FLAGS(level, flag)
86#endif
87
Jerry Yud25cab02022-10-31 12:48:30 +080088#endif /* MBEDTLS_DEBUG_C */
89
90#endif /* MBEDTLS_SSL_DEBUG_HELPERS_H */