/src/botan/src/lib/tls/tls_client.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * TLS Client |
3 | | * (C) 2004-2011,2012,2015,2016 Jack Lloyd |
4 | | * 2016 Matthias Gierlings |
5 | | * 2017 Harry Reimann, Rohde & Schwarz Cybersecurity |
6 | | * 2021 Elektrobit Automotive GmbH |
7 | | * |
8 | | * Botan is released under the Simplified BSD License (see license.txt) |
9 | | */ |
10 | | |
11 | | #include <botan/tls_client.h> |
12 | | #include <botan/tls_messages.h> |
13 | | #include <botan/internal/tls_handshake_state.h> |
14 | | #include <botan/internal/stl_util.h> |
15 | | |
16 | | #include <botan/internal/tls_client_impl_12.h> |
17 | | |
18 | | #include <iterator> |
19 | | #include <sstream> |
20 | | |
21 | | namespace Botan::TLS { |
22 | | |
23 | | /* |
24 | | * TLS Client Constructor |
25 | | */ |
26 | | Client::Client(Callbacks& callbacks, |
27 | | Session_Manager& session_manager, |
28 | | Credentials_Manager& creds, |
29 | | const Policy& policy, |
30 | | RandomNumberGenerator& rng, |
31 | | const Server_Information& info, |
32 | | const Protocol_Version& offer_version, |
33 | | const std::vector<std::string>& next_protocols, |
34 | | size_t io_buf_sz) |
35 | 1.42k | { |
36 | 1.42k | Protocol_Version effective_version = offer_version; |
37 | 1.42k | m_impl = std::make_unique<Client_Impl_12>( |
38 | 1.42k | callbacks, session_manager, creds, policy, |
39 | 1.42k | rng, info, effective_version.is_datagram_protocol(), |
40 | 1.42k | next_protocols, io_buf_sz); |
41 | 1.42k | } |
42 | | |
43 | 1.42k | Client::~Client() = default; |
44 | | |
45 | | size_t Client::received_data(const uint8_t buf[], size_t buf_size) |
46 | 1.42k | { |
47 | 1.42k | return m_impl->received_data(buf, buf_size); |
48 | 1.42k | } |
49 | | |
50 | | bool Client::is_active() const |
51 | 0 | { |
52 | 0 | return m_impl->is_active(); |
53 | 0 | } |
54 | | |
55 | | bool Client::is_closed() const |
56 | 0 | { |
57 | 0 | return m_impl->is_closed(); |
58 | 0 | } |
59 | | |
60 | | std::vector<X509_Certificate> Client::peer_cert_chain() const |
61 | 0 | { |
62 | 0 | return m_impl->peer_cert_chain(); |
63 | 0 | } |
64 | | |
65 | | SymmetricKey Client::key_material_export(const std::string& label, |
66 | | const std::string& context, |
67 | | size_t length) const |
68 | 0 | { |
69 | 0 | return m_impl->key_material_export(label, context, length); |
70 | 0 | } |
71 | | |
72 | | void Client::renegotiate(bool force_full_renegotiation) |
73 | 0 | { |
74 | 0 | m_impl->renegotiate(force_full_renegotiation); |
75 | 0 | } |
76 | | |
77 | | bool Client::secure_renegotiation_supported() const |
78 | 0 | { |
79 | 0 | return m_impl->secure_renegotiation_supported(); |
80 | 0 | } |
81 | | |
82 | | void Client::send(const uint8_t buf[], size_t buf_size) |
83 | 0 | { |
84 | 0 | m_impl->send(buf, buf_size); |
85 | 0 | } |
86 | | |
87 | | void Client::send_alert(const Alert& alert) |
88 | 0 | { |
89 | 0 | m_impl->send_alert(alert); |
90 | 0 | } |
91 | | |
92 | | void Client::send_warning_alert(Alert::Type type) |
93 | 0 | { |
94 | 0 | m_impl->send_warning_alert(type); |
95 | 0 | } |
96 | | |
97 | | void Client::send_fatal_alert(Alert::Type type) |
98 | 0 | { |
99 | 0 | m_impl->send_fatal_alert(type); |
100 | 0 | } |
101 | | |
102 | | void Client::close() |
103 | 0 | { |
104 | 0 | m_impl->close(); |
105 | 0 | } |
106 | | |
107 | | bool Client::timeout_check() |
108 | 0 | { |
109 | 0 | return m_impl->timeout_check(); |
110 | 0 | } |
111 | | |
112 | | std::string Client::application_protocol() const |
113 | 0 | { |
114 | 0 | return m_impl->application_protocol(); |
115 | 0 | } |
116 | | |
117 | | } |