Skip to content

Commit

Permalink
minor beautifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Rantzsch authored and reneme committed Jan 14, 2022
1 parent a4ce076 commit 8b3c7bf
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
5 changes: 1 addition & 4 deletions src/lib/tls/tls12/tls_channel_impl_12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,8 @@ size_t Channel_Impl_12::received_data(const uint8_t input[], size_t input_size)
{
if(pending->server_hello() != nullptr && record.version() != pending->version())
{
if(record.version() != pending->version())
{
throw TLS_Exception(Alert::PROTOCOL_VERSION,
throw TLS_Exception(Alert::PROTOCOL_VERSION,
"Received unexpected record version");
}
}
}
else if(auto active = active_state())
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tls/tls12/tls_server_impl_12.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Server_Impl_12 : public Channel_Impl_12, public Server_Impl
* Server initialization
*
* @param callbacks contains a set of callback function references
* required by the TLS client.
* required by the TLS server.
*
* @param session_manager manages session state
*
Expand Down
10 changes: 3 additions & 7 deletions src/lib/tls/tls13/tls_channel_impl_13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,10 @@ size_t Channel_Impl_13::received_data(const uint8_t input[], size_t input_size)
}
else if(auto state = handshake_state())
{
if(state->server_hello() != nullptr &&
record.version() != state->version())
if(state->server_hello() != nullptr && record.version() != state->version())
{
if(record.version() != state->version())
{
throw TLS_Exception(Alert::PROTOCOL_VERSION,
"Received unexpected record version");
}
throw TLS_Exception(Alert::PROTOCOL_VERSION,
"Received unexpected record version");
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/lib/tls/tls13/tls_client_impl_13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#include <botan/tls_client.h>
#include <botan/tls_messages.h>
#include <botan/internal/tls_client_impl_13.h>
Expand Down
14 changes: 14 additions & 0 deletions src/lib/tls/tls_endpoint_factory.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* TLS Endpoint Factory
* (C) 2021 Elektrobit Automotive GmbH
* 2021 Rene Meusel, Hannes Rantzsch
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
Expand Down Expand Up @@ -45,12 +46,25 @@ struct TLS_Endpoint_Factory::Impl_Version_Trait<Client_Impl, Protocol_Version::T
using Ver_Impl = Client_Impl_12;
};

template<>
struct TLS_Endpoint_Factory::Impl_Version_Trait<Server_Impl, Protocol_Version::TLS_V12>
{
using Ver_Impl = Server_Impl_12;
};


#if defined(BOTAN_HAS_TLS_13)
template<>
struct TLS_Endpoint_Factory::Impl_Version_Trait<Client_Impl, Protocol_Version::TLS_V13>
{
using Ver_Impl = Client_Impl_13;
};

template<>
struct TLS_Endpoint_Factory::Impl_Version_Trait<Server_Impl, Protocol_Version::TLS_V13>
{
using Ver_Impl = Server_Impl_13;
};
#endif

}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tls/tls_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BOTAN_PUBLIC_API(2,0) Server final : public Channel
* Server initialization
*
* @param callbacks contains a set of callback function references
* required by the TLS client.
* required by the TLS server.
*
* @param session_manager manages session state
*
Expand Down

0 comments on commit 8b3c7bf

Please sign in to comment.