1 /* Automatically generated by generate_ssl_debug_helpers.py. DO NOT EDIT. */
2
3 /**
4 * \file ssl_debug_helpers_generated.c
5 *
6 * \brief Automatically generated helper functions for debugging
7 */
8 /*
9 * Copyright The Mbed TLS Contributors
10 * SPDX-License-Identifier: Apache-2.0
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License"); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 */
24
25 #include "common.h"
26
27 #if defined(MBEDTLS_DEBUG_C)
28
29 #include "ssl_debug_helpers.h"
30
31
mbedtls_ssl_named_group_to_str(uint16_t in)32 const char *mbedtls_ssl_named_group_to_str( uint16_t in )
33 {
34 switch( in )
35 {
36 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP192K1:
37 return "secp192k1";
38 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP192R1:
39 return "secp192r1";
40 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP224K1:
41 return "secp224k1";
42 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP224R1:
43 return "secp224r1";
44 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP256K1:
45 return "secp256k1";
46 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1:
47 return "secp256r1";
48 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP384R1:
49 return "secp384r1";
50 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP521R1:
51 return "secp521r1";
52 case MBEDTLS_SSL_IANA_TLS_GROUP_BP256R1:
53 return "bp256r1";
54 case MBEDTLS_SSL_IANA_TLS_GROUP_BP384R1:
55 return "bp384r1";
56 case MBEDTLS_SSL_IANA_TLS_GROUP_BP512R1:
57 return "bp512r1";
58 case MBEDTLS_SSL_IANA_TLS_GROUP_X25519:
59 return "x25519";
60 case MBEDTLS_SSL_IANA_TLS_GROUP_X448:
61 return "x448";
62 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE2048:
63 return "ffdhe2048";
64 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE3072:
65 return "ffdhe3072";
66 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE4096:
67 return "ffdhe4096";
68 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE6144:
69 return "ffdhe6144";
70 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE8192:
71 return "ffdhe8192";
72 };
73
74 return "UNKOWN";
75 }
mbedtls_ssl_sig_alg_to_str(uint16_t in)76 const char *mbedtls_ssl_sig_alg_to_str( uint16_t in )
77 {
78 switch( in )
79 {
80 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA256:
81 return "rsa_pkcs1_sha256";
82 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA384:
83 return "rsa_pkcs1_sha384";
84 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA512:
85 return "rsa_pkcs1_sha512";
86 case MBEDTLS_TLS1_3_SIG_ECDSA_SECP256R1_SHA256:
87 return "ecdsa_secp256r1_sha256";
88 case MBEDTLS_TLS1_3_SIG_ECDSA_SECP384R1_SHA384:
89 return "ecdsa_secp384r1_sha384";
90 case MBEDTLS_TLS1_3_SIG_ECDSA_SECP521R1_SHA512:
91 return "ecdsa_secp521r1_sha512";
92 case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA256:
93 return "rsa_pss_rsae_sha256";
94 case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA384:
95 return "rsa_pss_rsae_sha384";
96 case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA512:
97 return "rsa_pss_rsae_sha512";
98 case MBEDTLS_TLS1_3_SIG_ED25519:
99 return "ed25519";
100 case MBEDTLS_TLS1_3_SIG_ED448:
101 return "ed448";
102 case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA256:
103 return "rsa_pss_pss_sha256";
104 case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA384:
105 return "rsa_pss_pss_sha384";
106 case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA512:
107 return "rsa_pss_pss_sha512";
108 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA1:
109 return "rsa_pkcs1_sha1";
110 case MBEDTLS_TLS1_3_SIG_ECDSA_SHA1:
111 return "ecdsa_sha1";
112 case MBEDTLS_TLS1_3_SIG_NONE:
113 return "none";
114 };
115
116 return "UNKNOWN";
117 }
mbedtls_ssl_states_str(mbedtls_ssl_states in)118 const char *mbedtls_ssl_states_str( mbedtls_ssl_states in )
119 {
120 const char * in_to_str[]=
121 {
122 [MBEDTLS_SSL_HELLO_REQUEST] = "MBEDTLS_SSL_HELLO_REQUEST",
123 [MBEDTLS_SSL_CLIENT_HELLO] = "MBEDTLS_SSL_CLIENT_HELLO",
124 [MBEDTLS_SSL_SERVER_HELLO] = "MBEDTLS_SSL_SERVER_HELLO",
125 [MBEDTLS_SSL_SERVER_CERTIFICATE] = "MBEDTLS_SSL_SERVER_CERTIFICATE",
126 [MBEDTLS_SSL_SERVER_KEY_EXCHANGE] = "MBEDTLS_SSL_SERVER_KEY_EXCHANGE",
127 [MBEDTLS_SSL_CERTIFICATE_REQUEST] = "MBEDTLS_SSL_CERTIFICATE_REQUEST",
128 [MBEDTLS_SSL_SERVER_HELLO_DONE] = "MBEDTLS_SSL_SERVER_HELLO_DONE",
129 [MBEDTLS_SSL_CLIENT_CERTIFICATE] = "MBEDTLS_SSL_CLIENT_CERTIFICATE",
130 [MBEDTLS_SSL_CLIENT_KEY_EXCHANGE] = "MBEDTLS_SSL_CLIENT_KEY_EXCHANGE",
131 [MBEDTLS_SSL_CERTIFICATE_VERIFY] = "MBEDTLS_SSL_CERTIFICATE_VERIFY",
132 [MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC] = "MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC",
133 [MBEDTLS_SSL_CLIENT_FINISHED] = "MBEDTLS_SSL_CLIENT_FINISHED",
134 [MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC] = "MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC",
135 [MBEDTLS_SSL_SERVER_FINISHED] = "MBEDTLS_SSL_SERVER_FINISHED",
136 [MBEDTLS_SSL_FLUSH_BUFFERS] = "MBEDTLS_SSL_FLUSH_BUFFERS",
137 [MBEDTLS_SSL_HANDSHAKE_WRAPUP] = "MBEDTLS_SSL_HANDSHAKE_WRAPUP",
138 [MBEDTLS_SSL_NEW_SESSION_TICKET] = "MBEDTLS_SSL_NEW_SESSION_TICKET",
139 [MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT] = "MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT",
140 [MBEDTLS_SSL_HELLO_RETRY_REQUEST] = "MBEDTLS_SSL_HELLO_RETRY_REQUEST",
141 [MBEDTLS_SSL_ENCRYPTED_EXTENSIONS] = "MBEDTLS_SSL_ENCRYPTED_EXTENSIONS",
142 [MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY] = "MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY",
143 [MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED] = "MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED",
144 [MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO] = "MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO",
145 [MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO] = "MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO",
146 [MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST] = "MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST",
147 [MBEDTLS_SSL_HANDSHAKE_OVER] = "MBEDTLS_SSL_HANDSHAKE_OVER",
148 [MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET] = "MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET",
149 [MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH] = "MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH",
150 };
151
152 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
153 in_to_str[ in ] == NULL )
154 {
155 return "UNKNOWN_VALUE";
156 }
157 return in_to_str[ in ];
158 }
159
mbedtls_ssl_protocol_version_str(mbedtls_ssl_protocol_version in)160 const char *mbedtls_ssl_protocol_version_str( mbedtls_ssl_protocol_version in )
161 {
162 const char * in_to_str[]=
163 {
164 [MBEDTLS_SSL_VERSION_UNKNOWN] = "MBEDTLS_SSL_VERSION_UNKNOWN",
165 [MBEDTLS_SSL_VERSION_TLS1_2] = "MBEDTLS_SSL_VERSION_TLS1_2",
166 [MBEDTLS_SSL_VERSION_TLS1_3] = "MBEDTLS_SSL_VERSION_TLS1_3",
167 };
168
169 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
170 in_to_str[ in ] == NULL )
171 {
172 return "UNKNOWN_VALUE";
173 }
174 return in_to_str[ in ];
175 }
176
mbedtls_tls_prf_types_str(mbedtls_tls_prf_types in)177 const char *mbedtls_tls_prf_types_str( mbedtls_tls_prf_types in )
178 {
179 const char * in_to_str[]=
180 {
181 [MBEDTLS_SSL_TLS_PRF_NONE] = "MBEDTLS_SSL_TLS_PRF_NONE",
182 [MBEDTLS_SSL_TLS_PRF_SHA384] = "MBEDTLS_SSL_TLS_PRF_SHA384",
183 [MBEDTLS_SSL_TLS_PRF_SHA256] = "MBEDTLS_SSL_TLS_PRF_SHA256",
184 [MBEDTLS_SSL_HKDF_EXPAND_SHA384] = "MBEDTLS_SSL_HKDF_EXPAND_SHA384",
185 [MBEDTLS_SSL_HKDF_EXPAND_SHA256] = "MBEDTLS_SSL_HKDF_EXPAND_SHA256",
186 };
187
188 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
189 in_to_str[ in ] == NULL )
190 {
191 return "UNKNOWN_VALUE";
192 }
193 return in_to_str[ in ];
194 }
195
mbedtls_ssl_key_export_type_str(mbedtls_ssl_key_export_type in)196 const char *mbedtls_ssl_key_export_type_str( mbedtls_ssl_key_export_type in )
197 {
198 const char * in_to_str[]=
199 {
200 [MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET",
201 #if defined(MBEDTLS_SSL_PROTO_TLS1_3)
202 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET",
203 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET",
204 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET",
205 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET",
206 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET",
207 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET",
208 #endif
209 };
210
211 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
212 in_to_str[ in ] == NULL )
213 {
214 return "UNKNOWN_VALUE";
215 }
216 return in_to_str[ in ];
217 }
218
219
220
221 #endif /* MBEDTLS_DEBUG_C */
222 /* End of automatically generated file. */
223
224