aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuraj Somorovsky <[email protected]>2016-11-19 21:58:18 +0100
committerJuraj Somorovsky <[email protected]>2016-11-19 21:58:18 +0100
commitacf1999cb85fc6bca83ac828b66593a6767174f7 (patch)
treefa41669cd94ffde178c3dbd0b838c377ea8ec2a4 /src
parent1e21b64bb96815ebadfab892a73094c758db142d (diff)
TLS CBC functionality now exposed to the library developer. Useful for direct TLS CBC testing.
CLI TLS server now catches an exception if an invalid connection is received (Otherwise, the server always stopped working)
Diffstat (limited to 'src')
-rw-r--r--src/cli/tls_server.cpp51
-rw-r--r--src/lib/tls/tls_cbc/tls_cbc.h2
2 files changed, 32 insertions, 21 deletions
diff --git a/src/cli/tls_server.cpp b/src/cli/tls_server.cpp
index dd1c7f450..b1a5b0ec6 100644
--- a/src/cli/tls_server.cpp
+++ b/src/cli/tls_server.cpp
@@ -138,31 +138,42 @@ class TLS_Server final : public Command
{
while(!server.is_closed())
{
- uint8_t buf[4*1024] = { 0 };
- ssize_t got = ::read(fd, buf, sizeof(buf));
-
- if(got == -1)
+ try
{
- std::cout << "Error in socket read - " << strerror(errno) << std::endl;
- break;
- }
+ uint8_t buf[4*1024] = { 0 };
+ ssize_t got = ::read(fd, buf, sizeof(buf));
- if(got == 0)
- {
- std::cout << "EOF on socket" << std::endl;
- break;
- }
+ if(got == -1)
+ {
+ std::cout << "Error in socket read - " << strerror(errno) << std::endl;
+ break;
+ }
+
+ if(got == 0)
+ {
+ std::cout << "EOF on socket" << std::endl;
+ break;
+ }
- server.received_data(buf, got);
+ server.received_data(buf, got);
- while(server.is_active() && !pending_output.empty())
- {
- std::string output = pending_output.front();
- pending_output.pop_front();
- server.send(output);
+ while(server.is_active() && !pending_output.empty())
+ {
+ std::string output = pending_output.front();
+ pending_output.pop_front();
+ server.send(output);
- if(output == "quit\n")
- server.close();
+ if(output == "quit\n")
+ server.close();
+ }
+ }
+ catch(std::exception& e)
+ {
+ std::cout << "Connection1 problem: " << e.what() << std::endl;
+ if(is_tcp)
+ {
+ ::close(fd);
+ }
}
}
}
diff --git a/src/lib/tls/tls_cbc/tls_cbc.h b/src/lib/tls/tls_cbc/tls_cbc.h
index c448879fb..97c3387e8 100644
--- a/src/lib/tls/tls_cbc/tls_cbc.h
+++ b/src/lib/tls/tls_cbc/tls_cbc.h
@@ -21,7 +21,7 @@ namespace TLS {
* TLS CBC+HMAC AEAD base class (GenericBlockCipher in TLS spec)
* This is the weird TLS-specific mode, not for general consumption.
*/
-class TLS_CBC_HMAC_AEAD_Mode : public AEAD_Mode
+class BOTAN_DLL TLS_CBC_HMAC_AEAD_Mode : public AEAD_Mode
{
public:
size_t process(uint8_t buf[], size_t sz) override final;