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