/src/gnutls/lib/hello_ext.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2000-2012 Free Software Foundation, Inc. |
3 | | * Copyright (C) 2015-2018 Red Hat, Inc. |
4 | | * |
5 | | * Author: Nikos Mavrogiannopoulos |
6 | | * |
7 | | * This file is part of GnuTLS. |
8 | | * |
9 | | * The GnuTLS is free software; you can redistribute it and/or |
10 | | * modify it under the terms of the GNU Lesser General Public License |
11 | | * as published by the Free Software Foundation; either version 2.1 of |
12 | | * the License, or (at your option) any later version. |
13 | | * |
14 | | * This library is distributed in the hope that it will be useful, but |
15 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | | * Lesser General Public License for more details. |
18 | | * |
19 | | * You should have received a copy of the GNU Lesser General Public License |
20 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
21 | | * |
22 | | */ |
23 | | |
24 | | #ifndef GNUTLS_LIB_HELLO_EXT_H |
25 | | #define GNUTLS_LIB_HELLO_EXT_H |
26 | | |
27 | | #include "gnutls_int.h" |
28 | | #include <gnutls/gnutls.h> |
29 | | #include "str.h" |
30 | | |
31 | | /* Functions for hello extension parsing. |
32 | | */ |
33 | | int _gnutls_parse_hello_extensions(gnutls_session_t session, |
34 | | gnutls_ext_flags_t msg, |
35 | | gnutls_ext_parse_type_t parse_type, |
36 | | const uint8_t *data, int data_size); |
37 | | int _gnutls_gen_hello_extensions(gnutls_session_t session, |
38 | | gnutls_buffer_st *extdata, |
39 | | gnutls_ext_flags_t msg, |
40 | | gnutls_ext_parse_type_t); |
41 | | int _gnutls_hello_ext_init(void); |
42 | | void _gnutls_hello_ext_deinit(void); |
43 | | |
44 | | void _gnutls_hello_ext_priv_deinit(gnutls_session_t session); |
45 | | |
46 | | /* functions to be used by extensions internally |
47 | | */ |
48 | | void _gnutls_hello_ext_unset_priv(gnutls_session_t session, extensions_t ext); |
49 | | void _gnutls_hello_ext_set_priv(gnutls_session_t session, extensions_t ext, |
50 | | gnutls_ext_priv_data_t); |
51 | | int _gnutls_hello_ext_get_priv(gnutls_session_t session, extensions_t ext, |
52 | | gnutls_ext_priv_data_t *); |
53 | | int _gnutls_hello_ext_get_resumed_priv(gnutls_session_t session, |
54 | | extensions_t ext, |
55 | | gnutls_ext_priv_data_t *data); |
56 | | |
57 | | #define GNUTLS_EXT_FLAG_MSG_MASK \ |
58 | 0 | (GNUTLS_EXT_FLAG_CLIENT_HELLO | GNUTLS_EXT_FLAG_TLS12_SERVER_HELLO | \ |
59 | 0 | GNUTLS_EXT_FLAG_TLS13_SERVER_HELLO | GNUTLS_EXT_FLAG_EE | \ |
60 | 0 | GNUTLS_EXT_FLAG_HRR) |
61 | | |
62 | | /* these flags can only be set in the extensions, but cannot be requested; |
63 | | * they are handled internally by the hello parsing/generating functions. */ |
64 | | #define GNUTLS_EXT_FLAG_SET_ONLY_FLAGS_MASK \ |
65 | 0 | ~(GNUTLS_EXT_FLAG_DTLS | GNUTLS_EXT_FLAG_TLS) |
66 | | |
67 | | /* obtain the message this extension was received at */ |
68 | | inline static gnutls_ext_flags_t _gnutls_ext_get_msg(gnutls_session_t session) |
69 | 0 | { |
70 | 0 | return session->internals.ext_msg & GNUTLS_EXT_FLAG_MSG_MASK; |
71 | 0 | } Unexecuted instantiation: global.c:_gnutls_ext_get_msg Unexecuted instantiation: priority.c:_gnutls_ext_get_msg Unexecuted instantiation: hello_ext.c:_gnutls_ext_get_msg Unexecuted instantiation: state.c:_gnutls_ext_get_msg Unexecuted instantiation: cert-session.c:_gnutls_ext_get_msg Unexecuted instantiation: extv.c:_gnutls_ext_get_msg Unexecuted instantiation: output.c:_gnutls_ext_get_msg Unexecuted instantiation: alpn.c:_gnutls_ext_get_msg Unexecuted instantiation: client_cert_type.c:_gnutls_ext_get_msg Unexecuted instantiation: compress_certificate.c:_gnutls_ext_get_msg Unexecuted instantiation: cookie.c:_gnutls_ext_get_msg Unexecuted instantiation: dumbfw.c:_gnutls_ext_get_msg Unexecuted instantiation: early_data.c:_gnutls_ext_get_msg Unexecuted instantiation: ec_point_formats.c:_gnutls_ext_get_msg Unexecuted instantiation: etm.c:_gnutls_ext_get_msg Unexecuted instantiation: ext_master_secret.c:_gnutls_ext_get_msg Unexecuted instantiation: heartbeat.c:_gnutls_ext_get_msg Unexecuted instantiation: key_share.c:_gnutls_ext_get_msg Unexecuted instantiation: max_record.c:_gnutls_ext_get_msg Unexecuted instantiation: post_handshake.c:_gnutls_ext_get_msg Unexecuted instantiation: pre_shared_key.c:_gnutls_ext_get_msg Unexecuted instantiation: psk_ke_modes.c:_gnutls_ext_get_msg Unexecuted instantiation: record_size_limit.c:_gnutls_ext_get_msg Unexecuted instantiation: safe_renegotiation.c:_gnutls_ext_get_msg Unexecuted instantiation: server_cert_type.c:_gnutls_ext_get_msg Unexecuted instantiation: server_name.c:_gnutls_ext_get_msg Unexecuted instantiation: session_ticket.c:_gnutls_ext_get_msg Unexecuted instantiation: signature.c:_gnutls_ext_get_msg Unexecuted instantiation: srtp.c:_gnutls_ext_get_msg Unexecuted instantiation: status_request.c:_gnutls_ext_get_msg Unexecuted instantiation: supported_groups.c:_gnutls_ext_get_msg Unexecuted instantiation: supported_versions.c:_gnutls_ext_get_msg Unexecuted instantiation: cert.c:_gnutls_ext_get_msg Unexecuted instantiation: ciphersuites.c:_gnutls_ext_get_msg Unexecuted instantiation: record.c:_gnutls_ext_get_msg Unexecuted instantiation: handshake-tls13.c:_gnutls_ext_get_msg Unexecuted instantiation: handshake.c:_gnutls_ext_get_msg Unexecuted instantiation: db.c:_gnutls_ext_get_msg Unexecuted instantiation: sslv2_compat.c:_gnutls_ext_get_msg Unexecuted instantiation: session_pack.c:_gnutls_ext_get_msg Unexecuted instantiation: constate.c:_gnutls_ext_get_msg Unexecuted instantiation: tls-sig.c:_gnutls_ext_get_msg Unexecuted instantiation: handshake-checks.c:_gnutls_ext_get_msg Unexecuted instantiation: hello_ext_lib.c:_gnutls_ext_get_msg Unexecuted instantiation: encrypted_extensions.c:_gnutls_ext_get_msg Unexecuted instantiation: certificate_request.c:_gnutls_ext_get_msg Unexecuted instantiation: certificate_verify.c:_gnutls_ext_get_msg Unexecuted instantiation: tls13-sig.c:_gnutls_ext_get_msg Unexecuted instantiation: hello_retry.c:_gnutls_ext_get_msg Unexecuted instantiation: certificate.c:_gnutls_ext_get_msg Unexecuted instantiation: anon_ecdh.c:_gnutls_ext_get_msg Unexecuted instantiation: ecdhe.c:_gnutls_ext_get_msg Unexecuted instantiation: vko_gost.c:_gnutls_ext_get_msg |
72 | | |
73 | | inline static void _gnutls_ext_set_msg(gnutls_session_t session, |
74 | | gnutls_ext_flags_t msg) |
75 | 0 | { |
76 | 0 | session->internals.ext_msg = msg; |
77 | 0 | } Unexecuted instantiation: global.c:_gnutls_ext_set_msg Unexecuted instantiation: priority.c:_gnutls_ext_set_msg Unexecuted instantiation: hello_ext.c:_gnutls_ext_set_msg Unexecuted instantiation: state.c:_gnutls_ext_set_msg Unexecuted instantiation: cert-session.c:_gnutls_ext_set_msg Unexecuted instantiation: extv.c:_gnutls_ext_set_msg Unexecuted instantiation: output.c:_gnutls_ext_set_msg Unexecuted instantiation: alpn.c:_gnutls_ext_set_msg Unexecuted instantiation: client_cert_type.c:_gnutls_ext_set_msg Unexecuted instantiation: compress_certificate.c:_gnutls_ext_set_msg Unexecuted instantiation: cookie.c:_gnutls_ext_set_msg Unexecuted instantiation: dumbfw.c:_gnutls_ext_set_msg Unexecuted instantiation: early_data.c:_gnutls_ext_set_msg Unexecuted instantiation: ec_point_formats.c:_gnutls_ext_set_msg Unexecuted instantiation: etm.c:_gnutls_ext_set_msg Unexecuted instantiation: ext_master_secret.c:_gnutls_ext_set_msg Unexecuted instantiation: heartbeat.c:_gnutls_ext_set_msg Unexecuted instantiation: key_share.c:_gnutls_ext_set_msg Unexecuted instantiation: max_record.c:_gnutls_ext_set_msg Unexecuted instantiation: post_handshake.c:_gnutls_ext_set_msg Unexecuted instantiation: pre_shared_key.c:_gnutls_ext_set_msg Unexecuted instantiation: psk_ke_modes.c:_gnutls_ext_set_msg Unexecuted instantiation: record_size_limit.c:_gnutls_ext_set_msg Unexecuted instantiation: safe_renegotiation.c:_gnutls_ext_set_msg Unexecuted instantiation: server_cert_type.c:_gnutls_ext_set_msg Unexecuted instantiation: server_name.c:_gnutls_ext_set_msg Unexecuted instantiation: session_ticket.c:_gnutls_ext_set_msg Unexecuted instantiation: signature.c:_gnutls_ext_set_msg Unexecuted instantiation: srtp.c:_gnutls_ext_set_msg Unexecuted instantiation: status_request.c:_gnutls_ext_set_msg Unexecuted instantiation: supported_groups.c:_gnutls_ext_set_msg Unexecuted instantiation: supported_versions.c:_gnutls_ext_set_msg Unexecuted instantiation: cert.c:_gnutls_ext_set_msg Unexecuted instantiation: ciphersuites.c:_gnutls_ext_set_msg Unexecuted instantiation: record.c:_gnutls_ext_set_msg Unexecuted instantiation: handshake-tls13.c:_gnutls_ext_set_msg Unexecuted instantiation: handshake.c:_gnutls_ext_set_msg Unexecuted instantiation: db.c:_gnutls_ext_set_msg Unexecuted instantiation: sslv2_compat.c:_gnutls_ext_set_msg Unexecuted instantiation: session_pack.c:_gnutls_ext_set_msg Unexecuted instantiation: constate.c:_gnutls_ext_set_msg Unexecuted instantiation: tls-sig.c:_gnutls_ext_set_msg Unexecuted instantiation: handshake-checks.c:_gnutls_ext_set_msg Unexecuted instantiation: hello_ext_lib.c:_gnutls_ext_set_msg Unexecuted instantiation: encrypted_extensions.c:_gnutls_ext_set_msg Unexecuted instantiation: certificate_request.c:_gnutls_ext_set_msg Unexecuted instantiation: certificate_verify.c:_gnutls_ext_set_msg Unexecuted instantiation: tls13-sig.c:_gnutls_ext_set_msg Unexecuted instantiation: hello_retry.c:_gnutls_ext_set_msg Unexecuted instantiation: certificate.c:_gnutls_ext_set_msg Unexecuted instantiation: anon_ecdh.c:_gnutls_ext_set_msg Unexecuted instantiation: ecdhe.c:_gnutls_ext_set_msg Unexecuted instantiation: vko_gost.c:_gnutls_ext_set_msg |
78 | | |
79 | | inline static void _gnutls_ext_set_extensions_offset(gnutls_session_t session, |
80 | | int offset) |
81 | 0 | { |
82 | 0 | session->internals.extensions_offset = offset; |
83 | 0 | } Unexecuted instantiation: global.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: priority.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: hello_ext.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: state.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: cert-session.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: extv.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: output.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: alpn.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: client_cert_type.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: compress_certificate.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: cookie.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: dumbfw.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: early_data.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: ec_point_formats.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: etm.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: ext_master_secret.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: heartbeat.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: key_share.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: max_record.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: post_handshake.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: pre_shared_key.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: psk_ke_modes.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: record_size_limit.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: safe_renegotiation.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: server_cert_type.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: server_name.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: session_ticket.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: signature.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: srtp.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: status_request.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: supported_groups.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: supported_versions.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: cert.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: ciphersuites.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: record.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: handshake-tls13.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: handshake.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: db.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: sslv2_compat.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: session_pack.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: constate.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: tls-sig.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: handshake-checks.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: hello_ext_lib.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: encrypted_extensions.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: certificate_request.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: certificate_verify.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: tls13-sig.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: hello_retry.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: certificate.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: anon_ecdh.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: ecdhe.c:_gnutls_ext_set_extensions_offset Unexecuted instantiation: vko_gost.c:_gnutls_ext_set_extensions_offset |
84 | | |
85 | | inline static int _gnutls_ext_get_extensions_offset(gnutls_session_t session) |
86 | 0 | { |
87 | 0 | return session->internals.extensions_offset; |
88 | 0 | } Unexecuted instantiation: global.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: priority.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: hello_ext.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: state.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: cert-session.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: extv.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: output.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: alpn.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: client_cert_type.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: compress_certificate.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: cookie.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: dumbfw.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: early_data.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: ec_point_formats.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: etm.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: ext_master_secret.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: heartbeat.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: key_share.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: max_record.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: post_handshake.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: pre_shared_key.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: psk_ke_modes.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: record_size_limit.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: safe_renegotiation.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: server_cert_type.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: server_name.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: session_ticket.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: signature.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: srtp.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: status_request.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: supported_groups.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: supported_versions.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: cert.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: ciphersuites.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: record.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: handshake-tls13.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: handshake.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: db.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: sslv2_compat.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: session_pack.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: constate.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: tls-sig.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: handshake-checks.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: hello_ext_lib.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: encrypted_extensions.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: certificate_request.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: certificate_verify.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: tls13-sig.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: hello_retry.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: certificate.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: anon_ecdh.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: ecdhe.c:_gnutls_ext_get_extensions_offset Unexecuted instantiation: vko_gost.c:_gnutls_ext_get_extensions_offset |
89 | | |
90 | | int _gnutls_ext_set_full_client_hello(gnutls_session_t session, |
91 | | handshake_buffer_st *recv_buf); |
92 | | unsigned _gnutls_ext_get_full_client_hello(gnutls_session_t session, |
93 | | gnutls_datum_t *datum); |
94 | | |
95 | | /* for session packing */ |
96 | | int _gnutls_hello_ext_pack(gnutls_session_t session, gnutls_buffer_st *packed); |
97 | | int _gnutls_hello_ext_unpack(gnutls_session_t session, |
98 | | gnutls_buffer_st *packed); |
99 | | |
100 | | inline static const char *ext_msg_validity_to_str(gnutls_ext_flags_t msg) |
101 | 0 | { |
102 | 0 | msg &= GNUTLS_EXT_FLAG_MSG_MASK; |
103 | |
|
104 | 0 | switch (msg) { |
105 | 0 | case GNUTLS_EXT_FLAG_CLIENT_HELLO: |
106 | 0 | return "client hello"; |
107 | 0 | case GNUTLS_EXT_FLAG_TLS12_SERVER_HELLO: |
108 | 0 | return "TLS 1.2 server hello"; |
109 | 0 | case GNUTLS_EXT_FLAG_TLS13_SERVER_HELLO: |
110 | 0 | return "TLS 1.3 server hello"; |
111 | 0 | case GNUTLS_EXT_FLAG_EE: |
112 | 0 | return "encrypted extensions"; |
113 | 0 | case GNUTLS_EXT_FLAG_HRR: |
114 | 0 | return "hello retry request"; |
115 | 0 | default: |
116 | 0 | return "(unknown)"; |
117 | 0 | } |
118 | 0 | } Unexecuted instantiation: global.c:ext_msg_validity_to_str Unexecuted instantiation: priority.c:ext_msg_validity_to_str Unexecuted instantiation: hello_ext.c:ext_msg_validity_to_str Unexecuted instantiation: state.c:ext_msg_validity_to_str Unexecuted instantiation: cert-session.c:ext_msg_validity_to_str Unexecuted instantiation: extv.c:ext_msg_validity_to_str Unexecuted instantiation: output.c:ext_msg_validity_to_str Unexecuted instantiation: alpn.c:ext_msg_validity_to_str Unexecuted instantiation: client_cert_type.c:ext_msg_validity_to_str Unexecuted instantiation: compress_certificate.c:ext_msg_validity_to_str Unexecuted instantiation: cookie.c:ext_msg_validity_to_str Unexecuted instantiation: dumbfw.c:ext_msg_validity_to_str Unexecuted instantiation: early_data.c:ext_msg_validity_to_str Unexecuted instantiation: ec_point_formats.c:ext_msg_validity_to_str Unexecuted instantiation: etm.c:ext_msg_validity_to_str Unexecuted instantiation: ext_master_secret.c:ext_msg_validity_to_str Unexecuted instantiation: heartbeat.c:ext_msg_validity_to_str Unexecuted instantiation: key_share.c:ext_msg_validity_to_str Unexecuted instantiation: max_record.c:ext_msg_validity_to_str Unexecuted instantiation: post_handshake.c:ext_msg_validity_to_str Unexecuted instantiation: pre_shared_key.c:ext_msg_validity_to_str Unexecuted instantiation: psk_ke_modes.c:ext_msg_validity_to_str Unexecuted instantiation: record_size_limit.c:ext_msg_validity_to_str Unexecuted instantiation: safe_renegotiation.c:ext_msg_validity_to_str Unexecuted instantiation: server_cert_type.c:ext_msg_validity_to_str Unexecuted instantiation: server_name.c:ext_msg_validity_to_str Unexecuted instantiation: session_ticket.c:ext_msg_validity_to_str Unexecuted instantiation: signature.c:ext_msg_validity_to_str Unexecuted instantiation: srtp.c:ext_msg_validity_to_str Unexecuted instantiation: status_request.c:ext_msg_validity_to_str Unexecuted instantiation: supported_groups.c:ext_msg_validity_to_str Unexecuted instantiation: supported_versions.c:ext_msg_validity_to_str Unexecuted instantiation: cert.c:ext_msg_validity_to_str Unexecuted instantiation: ciphersuites.c:ext_msg_validity_to_str Unexecuted instantiation: record.c:ext_msg_validity_to_str Unexecuted instantiation: handshake-tls13.c:ext_msg_validity_to_str Unexecuted instantiation: handshake.c:ext_msg_validity_to_str Unexecuted instantiation: db.c:ext_msg_validity_to_str Unexecuted instantiation: sslv2_compat.c:ext_msg_validity_to_str Unexecuted instantiation: session_pack.c:ext_msg_validity_to_str Unexecuted instantiation: constate.c:ext_msg_validity_to_str Unexecuted instantiation: tls-sig.c:ext_msg_validity_to_str Unexecuted instantiation: handshake-checks.c:ext_msg_validity_to_str Unexecuted instantiation: hello_ext_lib.c:ext_msg_validity_to_str Unexecuted instantiation: encrypted_extensions.c:ext_msg_validity_to_str Unexecuted instantiation: certificate_request.c:ext_msg_validity_to_str Unexecuted instantiation: certificate_verify.c:ext_msg_validity_to_str Unexecuted instantiation: tls13-sig.c:ext_msg_validity_to_str Unexecuted instantiation: hello_retry.c:ext_msg_validity_to_str Unexecuted instantiation: certificate.c:ext_msg_validity_to_str Unexecuted instantiation: anon_ecdh.c:ext_msg_validity_to_str Unexecuted instantiation: ecdhe.c:ext_msg_validity_to_str Unexecuted instantiation: vko_gost.c:ext_msg_validity_to_str |
119 | | |
120 | | typedef struct hello_ext_entry_st { |
121 | | const char *name; /* const overridden when free_struct is set */ |
122 | | unsigned free_struct; |
123 | | |
124 | | uint16_t tls_id; |
125 | | unsigned gid; /* gnutls internal ID */ |
126 | | |
127 | | gnutls_ext_parse_type_t client_parse_point; |
128 | | gnutls_ext_parse_type_t server_parse_point; |
129 | | unsigned validity; /* multiple items of gnutls_ext_flags_t */ |
130 | | |
131 | | /* this function must return 0 when Not Applicable |
132 | | * size of extension data if ok |
133 | | * < 0 on other error. |
134 | | */ |
135 | | gnutls_ext_recv_func recv_func; |
136 | | |
137 | | /* this function must return 0 when Not Applicable |
138 | | * size of extension data if ok |
139 | | * GNUTLS_E_INT_RET_0 if extension data size is zero |
140 | | * < 0 on other error. |
141 | | */ |
142 | | gnutls_ext_send_func send_func; |
143 | | |
144 | | gnutls_ext_deinit_data_func |
145 | | deinit_func; /* this will be called to deinitialize |
146 | | * internal data |
147 | | */ |
148 | | gnutls_ext_pack_func |
149 | | pack_func; /* packs internal data to machine independent format */ |
150 | | gnutls_ext_unpack_func unpack_func; /* unpacks internal data */ |
151 | | |
152 | | /* non-zero if that extension cannot be overridden by the applications. |
153 | | * That should be set to extensions which allocate data early, e.g., on |
154 | | * gnutls_init(), or modify the TLS protocol in a way that the application |
155 | | * cannot control. */ |
156 | | unsigned cannot_be_overriden; |
157 | | } hello_ext_entry_st; |
158 | | |
159 | | /* Checks if the extension @id provided has been requested |
160 | | * by us (in client side).In server side it checks whether this |
161 | | * extension was advertised by the client. |
162 | | * |
163 | | * It returns non-zero for true, otherwise zero. |
164 | | */ |
165 | | inline static unsigned _gnutls_hello_ext_is_present(gnutls_session_t session, |
166 | | extensions_t id) |
167 | 0 | { |
168 | 0 | if (session->internals.used_exts & ((ext_track_t)1 << id)) |
169 | 0 | return 1; |
170 | | |
171 | 0 | return 0; |
172 | 0 | } Unexecuted instantiation: global.c:_gnutls_hello_ext_is_present Unexecuted instantiation: priority.c:_gnutls_hello_ext_is_present Unexecuted instantiation: hello_ext.c:_gnutls_hello_ext_is_present Unexecuted instantiation: state.c:_gnutls_hello_ext_is_present Unexecuted instantiation: cert-session.c:_gnutls_hello_ext_is_present Unexecuted instantiation: extv.c:_gnutls_hello_ext_is_present Unexecuted instantiation: output.c:_gnutls_hello_ext_is_present Unexecuted instantiation: alpn.c:_gnutls_hello_ext_is_present Unexecuted instantiation: client_cert_type.c:_gnutls_hello_ext_is_present Unexecuted instantiation: compress_certificate.c:_gnutls_hello_ext_is_present Unexecuted instantiation: cookie.c:_gnutls_hello_ext_is_present Unexecuted instantiation: dumbfw.c:_gnutls_hello_ext_is_present Unexecuted instantiation: early_data.c:_gnutls_hello_ext_is_present Unexecuted instantiation: ec_point_formats.c:_gnutls_hello_ext_is_present Unexecuted instantiation: etm.c:_gnutls_hello_ext_is_present Unexecuted instantiation: ext_master_secret.c:_gnutls_hello_ext_is_present Unexecuted instantiation: heartbeat.c:_gnutls_hello_ext_is_present Unexecuted instantiation: key_share.c:_gnutls_hello_ext_is_present Unexecuted instantiation: max_record.c:_gnutls_hello_ext_is_present Unexecuted instantiation: post_handshake.c:_gnutls_hello_ext_is_present Unexecuted instantiation: pre_shared_key.c:_gnutls_hello_ext_is_present Unexecuted instantiation: psk_ke_modes.c:_gnutls_hello_ext_is_present Unexecuted instantiation: record_size_limit.c:_gnutls_hello_ext_is_present Unexecuted instantiation: safe_renegotiation.c:_gnutls_hello_ext_is_present Unexecuted instantiation: server_cert_type.c:_gnutls_hello_ext_is_present Unexecuted instantiation: server_name.c:_gnutls_hello_ext_is_present Unexecuted instantiation: session_ticket.c:_gnutls_hello_ext_is_present Unexecuted instantiation: signature.c:_gnutls_hello_ext_is_present Unexecuted instantiation: srtp.c:_gnutls_hello_ext_is_present Unexecuted instantiation: status_request.c:_gnutls_hello_ext_is_present Unexecuted instantiation: supported_groups.c:_gnutls_hello_ext_is_present Unexecuted instantiation: supported_versions.c:_gnutls_hello_ext_is_present Unexecuted instantiation: cert.c:_gnutls_hello_ext_is_present Unexecuted instantiation: ciphersuites.c:_gnutls_hello_ext_is_present Unexecuted instantiation: record.c:_gnutls_hello_ext_is_present Unexecuted instantiation: handshake-tls13.c:_gnutls_hello_ext_is_present Unexecuted instantiation: handshake.c:_gnutls_hello_ext_is_present Unexecuted instantiation: db.c:_gnutls_hello_ext_is_present Unexecuted instantiation: sslv2_compat.c:_gnutls_hello_ext_is_present Unexecuted instantiation: session_pack.c:_gnutls_hello_ext_is_present Unexecuted instantiation: constate.c:_gnutls_hello_ext_is_present Unexecuted instantiation: tls-sig.c:_gnutls_hello_ext_is_present Unexecuted instantiation: handshake-checks.c:_gnutls_hello_ext_is_present Unexecuted instantiation: hello_ext_lib.c:_gnutls_hello_ext_is_present Unexecuted instantiation: encrypted_extensions.c:_gnutls_hello_ext_is_present Unexecuted instantiation: certificate_request.c:_gnutls_hello_ext_is_present Unexecuted instantiation: certificate_verify.c:_gnutls_hello_ext_is_present Unexecuted instantiation: tls13-sig.c:_gnutls_hello_ext_is_present Unexecuted instantiation: hello_retry.c:_gnutls_hello_ext_is_present Unexecuted instantiation: certificate.c:_gnutls_hello_ext_is_present Unexecuted instantiation: anon_ecdh.c:_gnutls_hello_ext_is_present Unexecuted instantiation: ecdhe.c:_gnutls_hello_ext_is_present Unexecuted instantiation: vko_gost.c:_gnutls_hello_ext_is_present |
173 | | |
174 | | /* Adds the extension we want to send in the extensions list. |
175 | | * This list is used in client side to check whether the (later) received |
176 | | * extensions are the ones we requested. |
177 | | * |
178 | | * In server side, this list is used to ensure we don't send |
179 | | * extensions that we didn't receive a corresponding value. |
180 | | * |
181 | | * Returns zero if failed, non-zero on success. |
182 | | */ |
183 | | inline static unsigned _gnutls_hello_ext_save(gnutls_session_t session, |
184 | | extensions_t id, |
185 | | unsigned check_dup) |
186 | 0 | { |
187 | 0 | if (check_dup && _gnutls_hello_ext_is_present(session, id)) { |
188 | 0 | return 0; |
189 | 0 | } |
190 | | |
191 | 0 | session->internals.used_exts |= ((ext_track_t)1 << id); |
192 | |
|
193 | 0 | return 1; |
194 | 0 | } Unexecuted instantiation: global.c:_gnutls_hello_ext_save Unexecuted instantiation: priority.c:_gnutls_hello_ext_save Unexecuted instantiation: hello_ext.c:_gnutls_hello_ext_save Unexecuted instantiation: state.c:_gnutls_hello_ext_save Unexecuted instantiation: cert-session.c:_gnutls_hello_ext_save Unexecuted instantiation: extv.c:_gnutls_hello_ext_save Unexecuted instantiation: output.c:_gnutls_hello_ext_save Unexecuted instantiation: alpn.c:_gnutls_hello_ext_save Unexecuted instantiation: client_cert_type.c:_gnutls_hello_ext_save Unexecuted instantiation: compress_certificate.c:_gnutls_hello_ext_save Unexecuted instantiation: cookie.c:_gnutls_hello_ext_save Unexecuted instantiation: dumbfw.c:_gnutls_hello_ext_save Unexecuted instantiation: early_data.c:_gnutls_hello_ext_save Unexecuted instantiation: ec_point_formats.c:_gnutls_hello_ext_save Unexecuted instantiation: etm.c:_gnutls_hello_ext_save Unexecuted instantiation: ext_master_secret.c:_gnutls_hello_ext_save Unexecuted instantiation: heartbeat.c:_gnutls_hello_ext_save Unexecuted instantiation: key_share.c:_gnutls_hello_ext_save Unexecuted instantiation: max_record.c:_gnutls_hello_ext_save Unexecuted instantiation: post_handshake.c:_gnutls_hello_ext_save Unexecuted instantiation: pre_shared_key.c:_gnutls_hello_ext_save Unexecuted instantiation: psk_ke_modes.c:_gnutls_hello_ext_save Unexecuted instantiation: record_size_limit.c:_gnutls_hello_ext_save Unexecuted instantiation: safe_renegotiation.c:_gnutls_hello_ext_save Unexecuted instantiation: server_cert_type.c:_gnutls_hello_ext_save Unexecuted instantiation: server_name.c:_gnutls_hello_ext_save Unexecuted instantiation: session_ticket.c:_gnutls_hello_ext_save Unexecuted instantiation: signature.c:_gnutls_hello_ext_save Unexecuted instantiation: srtp.c:_gnutls_hello_ext_save Unexecuted instantiation: status_request.c:_gnutls_hello_ext_save Unexecuted instantiation: supported_groups.c:_gnutls_hello_ext_save Unexecuted instantiation: supported_versions.c:_gnutls_hello_ext_save Unexecuted instantiation: cert.c:_gnutls_hello_ext_save Unexecuted instantiation: ciphersuites.c:_gnutls_hello_ext_save Unexecuted instantiation: record.c:_gnutls_hello_ext_save Unexecuted instantiation: handshake-tls13.c:_gnutls_hello_ext_save Unexecuted instantiation: handshake.c:_gnutls_hello_ext_save Unexecuted instantiation: db.c:_gnutls_hello_ext_save Unexecuted instantiation: sslv2_compat.c:_gnutls_hello_ext_save Unexecuted instantiation: session_pack.c:_gnutls_hello_ext_save Unexecuted instantiation: constate.c:_gnutls_hello_ext_save Unexecuted instantiation: tls-sig.c:_gnutls_hello_ext_save Unexecuted instantiation: handshake-checks.c:_gnutls_hello_ext_save Unexecuted instantiation: hello_ext_lib.c:_gnutls_hello_ext_save Unexecuted instantiation: encrypted_extensions.c:_gnutls_hello_ext_save Unexecuted instantiation: certificate_request.c:_gnutls_hello_ext_save Unexecuted instantiation: certificate_verify.c:_gnutls_hello_ext_save Unexecuted instantiation: tls13-sig.c:_gnutls_hello_ext_save Unexecuted instantiation: hello_retry.c:_gnutls_hello_ext_save Unexecuted instantiation: certificate.c:_gnutls_hello_ext_save Unexecuted instantiation: anon_ecdh.c:_gnutls_hello_ext_save Unexecuted instantiation: ecdhe.c:_gnutls_hello_ext_save Unexecuted instantiation: vko_gost.c:_gnutls_hello_ext_save |
195 | | |
196 | | inline static void _gnutls_hello_ext_save_sr(gnutls_session_t session) |
197 | 0 | { |
198 | 0 | _gnutls_hello_ext_save(session, GNUTLS_EXTENSION_SAFE_RENEGOTIATION, 1); |
199 | 0 | } Unexecuted instantiation: global.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: priority.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: hello_ext.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: state.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: cert-session.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: extv.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: output.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: alpn.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: client_cert_type.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: compress_certificate.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: cookie.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: dumbfw.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: early_data.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: ec_point_formats.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: etm.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: ext_master_secret.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: heartbeat.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: key_share.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: max_record.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: post_handshake.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: pre_shared_key.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: psk_ke_modes.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: record_size_limit.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: safe_renegotiation.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: server_cert_type.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: server_name.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: session_ticket.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: signature.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: srtp.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: status_request.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: supported_groups.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: supported_versions.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: cert.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: ciphersuites.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: record.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: handshake-tls13.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: handshake.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: db.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: sslv2_compat.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: session_pack.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: constate.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: tls-sig.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: handshake-checks.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: hello_ext_lib.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: encrypted_extensions.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: certificate_request.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: certificate_verify.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: tls13-sig.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: hello_retry.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: certificate.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: anon_ecdh.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: ecdhe.c:_gnutls_hello_ext_save_sr Unexecuted instantiation: vko_gost.c:_gnutls_hello_ext_save_sr |
200 | | |
201 | | #endif /* GNUTLS_LIB_HELLO_EXT_H */ |