aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-24 16:26:46 +0000
committerlloyd <[email protected]>2014-01-24 16:26:46 +0000
commita8b93af1b0cad5cea5495aad1301f567b4345589 (patch)
tree579d011dbc75d0afea158f43c068aa9cb7efec9e
parentf5bd8adc44701a37204a6748089c2ee11a5a781d (diff)
Warning fixes, and hook default algo list into speed command
-rw-r--r--src/cmd/read_ssh.cpp2
-rw-r--r--src/cmd/speed/speed.cpp20
-rw-r--r--src/cmd/tls_client.cpp2
-rw-r--r--src/cmd/tls_server.cpp4
4 files changed, 12 insertions, 16 deletions
diff --git a/src/cmd/read_ssh.cpp b/src/cmd/read_ssh.cpp
index 2745f3209..bca4a2a0a 100644
--- a/src/cmd/read_ssh.cpp
+++ b/src/cmd/read_ssh.cpp
@@ -122,7 +122,7 @@ int read_ssh_main(int argc, char* argv[])
const std::string filename = argv[1];
std::unique_ptr<Public_Key> key(read_ssh_pubkey(filename));
- if(key == 0)
+ if(!key)
{
std::cout << "Failed to read" << filename << "\n";
return 1;
diff --git a/src/cmd/speed/speed.cpp b/src/cmd/speed/speed.cpp
index 9deb9cc63..f265045fb 100644
--- a/src/cmd/speed/speed.cpp
+++ b/src/cmd/speed/speed.cpp
@@ -28,8 +28,7 @@ using namespace Botan;
namespace {
-const std::string default_benchmark_list[] = {
-
+const std::vector<std::string> default_benchmark_list = {
/* Block ciphers */
"AES-128",
"AES-192",
@@ -38,8 +37,6 @@ const std::string default_benchmark_list[] = {
"CAST-128",
"CAST-256",
"DES",
- "DESX",
- "GOST",
"IDEA",
"KASUMI",
"MARS",
@@ -79,11 +76,8 @@ const std::string default_benchmark_list[] = {
"Salsa20",
/* Hashes */
- "HAS-160",
"Keccak-1600(512)",
- "MD4",
"MD5",
- "RIPEMD-128",
"RIPEMD-160",
"SHA-160",
"SHA-256",
@@ -95,8 +89,7 @@ const std::string default_benchmark_list[] = {
/* MACs */
"CMAC(AES-128)",
- "HMAC(SHA-1)",
- "",
+ "HMAC(SHA-1)"
};
void report_results(const std::string& algo,
@@ -213,11 +206,14 @@ int speed_main(int argc, char* argv[])
}
}
- const auto args = opts.arguments();
+ auto args = opts.arguments();
+
+ if(args.empty())
+ args = default_benchmark_list;
- if(args.empty() || args[0] == "help" || args[0] == "-h")
+ if(args[0] == "help" || args[0] == "-h")
{
- std::cout << "Help!\n";
+ std::cout << "Usage: " << argv[0] << " [algo name...]\n";
return 1;
}
diff --git a/src/cmd/tls_client.cpp b/src/cmd/tls_client.cpp
index b7c4f619f..933d859eb 100644
--- a/src/cmd/tls_client.cpp
+++ b/src/cmd/tls_client.cpp
@@ -190,7 +190,7 @@ int tls_client_main(int argc, char* argv[])
FD_SET(sockfd, &readfds);
FD_SET(STDIN_FILENO, &readfds);
- ::select(sockfd + 1, &readfds, NULL, NULL, NULL);
+ ::select(sockfd + 1, &readfds, nullptr, nullptr, nullptr);
if(FD_ISSET(sockfd, &readfds))
{
diff --git a/src/cmd/tls_server.cpp b/src/cmd/tls_server.cpp
index 819b9f380..dac69e2c1 100644
--- a/src/cmd/tls_server.cpp
+++ b/src/cmd/tls_server.cpp
@@ -159,13 +159,13 @@ int tls_server_main(int argc, char* argv[])
int fd;
if(transport == "tcp")
- fd = ::accept(server_fd, NULL, NULL);
+ fd = ::accept(server_fd, nullptr, nullptr);
else
{
struct sockaddr_in from;
socklen_t from_len = sizeof(sockaddr_in);
- if(::recvfrom(server_fd, NULL, 0, MSG_PEEK,
+ if(::recvfrom(server_fd, nullptr, 0, MSG_PEEK,
(struct sockaddr*)&from, &from_len) != 0)
throw std::runtime_error("Could not peek next packet");