diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/asn1.cpp | 8 | ||||
-rw-r--r-- | src/cmd/base64.cpp | 4 | ||||
-rw-r--r-- | src/cmd/bcrypt.cpp | 8 | ||||
-rw-r--r-- | src/cmd/cert_verify.cpp | 6 | ||||
-rw-r--r-- | src/cmd/compress.cpp | 10 | ||||
-rw-r--r-- | src/cmd/dsa_sign.cpp | 4 | ||||
-rw-r--r-- | src/cmd/dsa_ver.cpp | 6 | ||||
-rw-r--r-- | src/cmd/factor.cpp | 4 | ||||
-rw-r--r-- | src/cmd/fpe.cpp | 10 | ||||
-rw-r--r-- | src/cmd/is_prime.cpp | 6 | ||||
-rw-r--r-- | src/cmd/keygen.cpp | 2 | ||||
-rw-r--r-- | src/cmd/main.cpp | 32 | ||||
-rw-r--r-- | src/cmd/ocsp.cpp | 4 | ||||
-rw-r--r-- | src/cmd/rng.cpp | 10 | ||||
-rw-r--r-- | src/cmd/speed.cpp | 8 | ||||
-rw-r--r-- | src/cmd/speed_pk.cpp | 14 | ||||
-rw-r--r-- | src/cmd/tls_client.cpp | 28 | ||||
-rw-r--r-- | src/cmd/tls_proxy.cpp | 8 | ||||
-rw-r--r-- | src/cmd/tls_server.cpp | 28 | ||||
-rw-r--r-- | src/cmd/x509print.cpp | 4 |
20 files changed, 102 insertions, 102 deletions
diff --git a/src/cmd/asn1.cpp b/src/cmd/asn1.cpp index d02a4cced..f5b6b6b4e 100644 --- a/src/cmd/asn1.cpp +++ b/src/cmd/asn1.cpp @@ -90,7 +90,7 @@ void emit(const std::string& type, size_t level, size_t length, const std::strin out << value; } - std::cout << out.str() << "\n"; + std::cout << out.str() << std::endl; } std::string type_name(ASN1_Tag type) @@ -308,7 +308,7 @@ void decode(BER_Decoder& decoder, size_t level) std::cout << "Unknown ASN.1 tag class=" << static_cast<int>(class_tag) << " type=" - << static_cast<int>(type_tag) << "\n"; + << static_cast<int>(type_tag) << std::endl; } obj = decoder.get_next_object(); @@ -319,7 +319,7 @@ int asn1(int argc, char* argv[]) { if(argc != 2) { - std::cout << "Usage: " << argv[0] << " <file>\n"; + std::cout << "Usage: " << argv[0] << " <file>" << std::endl; return 1; } @@ -340,7 +340,7 @@ int asn1(int argc, char* argv[]) } catch(std::exception& e) { - std::cout << "Error: " << e.what() << "\n"; + std::cout << "Error: " << e.what() << std::endl; return 2; } diff --git a/src/cmd/base64.cpp b/src/cmd/base64.cpp index b0e39132f..e0798dcee 100644 --- a/src/cmd/base64.cpp +++ b/src/cmd/base64.cpp @@ -21,10 +21,10 @@ int base64(int argc, char* argv[]) if(argc < 2) { std::cout << "Usage: " << argv[0] << " [-w] [-c n] [-e|-d] files...\n" - " -e : Encode input to base64 strings (default) \n" + " -e : Encode input to base64 strings (default)\n" " -d : Decode base64 input\n" " -w : Wrap lines\n" - " -c n: Wrap lines at column n, default 78\n"; + " -c n: Wrap lines at column n, default 78" << std::endl; return 1; } diff --git a/src/cmd/bcrypt.cpp b/src/cmd/bcrypt.cpp index 4d3926b83..498e8f8fd 100644 --- a/src/cmd/bcrypt.cpp +++ b/src/cmd/bcrypt.cpp @@ -19,7 +19,7 @@ int bcrypt(int argc, char* argv[]) const std::string password = argv[1]; - std::cout << generate_bcrypt(password, rng, 12) << "\n"; + std::cout << generate_bcrypt(password, rng, 12) << std::endl; return 0; } else if(argc == 3) @@ -28,16 +28,16 @@ int bcrypt(int argc, char* argv[]) const std::string hash = argv[2]; if(hash.length() != 60) - std::cout << "Note: bcrypt '" << hash << "' has wrong length and cannot be valid\n"; + std::cout << "Note: bcrypt '" << hash << "' has wrong length and cannot be valid" << std::endl; const bool ok = check_bcrypt(password, hash); - std::cout << "Password is " << (ok ? "valid" : "NOT valid") << "\n"; + std::cout << "Password is " << (ok ? "valid" : "NOT valid") << std::endl; return (ok ? 0 : 1); } std::cout << "Usage: " << argv[0] << " password\n" - << " " << argv[0] << " password passhash\n"; + << " " << argv[0] << " password passhash" << std::endl; return 1; } diff --git a/src/cmd/cert_verify.cpp b/src/cmd/cert_verify.cpp index b486f8880..feff40141 100644 --- a/src/cmd/cert_verify.cpp +++ b/src/cmd/cert_verify.cpp @@ -19,7 +19,7 @@ int cert_verify(int argc, char* argv[]) if(argc <= 2) { - std::cout << "Usage: " << argv[0] << " subject.pem [CA certificates...]\n"; + std::cout << "Usage: " << argv[0] << " subject.pem [CA certificates...]" << std::endl; return 1; } @@ -38,9 +38,9 @@ int cert_verify(int argc, char* argv[]) certs); if(result.successful_validation()) - std::cout << "Certificate validated\n"; + std::cout << "Certificate validated" << std::endl; else - std::cout << "Certificate did not validate - " << result.result_string() << "\n"; + std::cout << "Certificate did not validate - " << result.result_string() << std::endl; return 0; } diff --git a/src/cmd/compress.cpp b/src/cmd/compress.cpp index d7456fc31..62f9eb7dc 100644 --- a/src/cmd/compress.cpp +++ b/src/cmd/compress.cpp @@ -37,7 +37,7 @@ int compress(int argc, char* argv[]) { if(argc != 2 && argc != 3 && argc != 4) { - std::cout << "Usage: " << argv[0] << " input [type] [level]\n"; + std::cout << "Usage: " << argv[0] << " input [type] [level]" << std::endl; return 1; } @@ -46,7 +46,7 @@ int compress(int argc, char* argv[]) if(!in.good()) { - std::cout << "Couldn't read " << in_file << "\n"; + std::cout << "Couldn't read " << in_file << std::endl; return 1; } @@ -57,7 +57,7 @@ int compress(int argc, char* argv[]) if(!compress) { - std::cout << suffix << " compression not supported\n"; + std::cout << suffix << " compression not supported" << std::endl; return 1; } @@ -88,7 +88,7 @@ int uncompress(int argc, char* argv[]) if(!in.good()) { - std::cout << "Couldn't read " << argv[1] << "\n"; + std::cout << "Couldn't read '" << argv[1] << "'" << std::endl; return 1; } @@ -101,7 +101,7 @@ int uncompress(int argc, char* argv[]) if(!decompress) { - std::cout << suffix << " decompression not supported\n"; + std::cout << suffix << " decompression not supported" << std::endl; return 1; } diff --git a/src/cmd/dsa_sign.cpp b/src/cmd/dsa_sign.cpp index baf884301..3941f6b71 100644 --- a/src/cmd/dsa_sign.cpp +++ b/src/cmd/dsa_sign.cpp @@ -57,7 +57,7 @@ int dsa_sign(int argc, char* argv[]) if(!dsakey) { - std::cout << "The loaded key is not a DSA key!\n"; + std::cout << "The loaded key is not a DSA key!" << std::endl; return 1; } @@ -68,7 +68,7 @@ int dsa_sign(int argc, char* argv[]) while(size_t got = in.read(buf, sizeof(buf))) signer.update(buf, got); - sigfile << base64_encode(signer.signature(rng)) << "\n"; + sigfile << base64_encode(signer.signature(rng)) << std::endl; } catch(std::exception& e) { diff --git a/src/cmd/dsa_ver.cpp b/src/cmd/dsa_ver.cpp index 0490bb065..35841b6cf 100644 --- a/src/cmd/dsa_ver.cpp +++ b/src/cmd/dsa_ver.cpp @@ -50,7 +50,7 @@ int dsa_verify(int argc, char* argv[]) if(!dsakey) { - std::cout << "The loaded key is not a DSA key!\n"; + std::cout << "The loaded key is not a DSA key!" << std::endl; return 1; } @@ -67,12 +67,12 @@ int dsa_verify(int argc, char* argv[]) if(ok) { - std::cout << "Signature verified\n"; + std::cout << "Signature verified" << std::endl; return 0; } else { - std::cout << "Signature did NOT verify\n"; + std::cout << "Signature did NOT verify" << std::endl; return 1; } } diff --git a/src/cmd/factor.cpp b/src/cmd/factor.cpp index 4cba01d95..e4e20f5b7 100644 --- a/src/cmd/factor.cpp +++ b/src/cmd/factor.cpp @@ -124,7 +124,7 @@ int factor(int argc, char* argv[]) { if(argc != 2) { - std::cout << "Usage: " << argv[0] << " <integer>\n"; + std::cout << "Usage: " << argv[0] << " <integer>" << std::endl; return 1; } @@ -141,7 +141,7 @@ int factor(int argc, char* argv[]) std::copy(factors.begin(), factors.end(), std::ostream_iterator<BigInt>(std::cout, " ")); - std::cout << "\n"; + std::cout << std::endl; } catch(std::exception& e) { diff --git a/src/cmd/fpe.cpp b/src/cmd/fpe.cpp index fc60fe099..579586eaf 100644 --- a/src/cmd/fpe.cpp +++ b/src/cmd/fpe.cpp @@ -111,7 +111,7 @@ int fpe(int argc, char* argv[]) { if(argc != 4) { - std::cout << "Usage: " << argv[0] << " cc-number acct-name passwd\n"; + std::cout << "Usage: " << argv[0] << " cc-number acct-name passwd" << std::endl; return 1; } @@ -120,7 +120,7 @@ int fpe(int argc, char* argv[]) std::string passwd = argv[3]; std::cout << "Input was: " << cc_number << ' ' - << luhn_check(cc_number) << '\n'; + << luhn_check(cc_number) << std::endl; /* * In practice something like PBKDF2 with a salt and high iteration @@ -131,16 +131,16 @@ int fpe(int argc, char* argv[]) u64bit enc_cc = encrypt_cc_number(cc_number, key, acct_name); std::cout << "Encrypted: " << enc_cc - << ' ' << luhn_check(enc_cc) << '\n'; + << ' ' << luhn_check(enc_cc) << std::endl; u64bit dec_cc = decrypt_cc_number(enc_cc, key, acct_name); std::cout << "Decrypted: " << dec_cc - << ' ' << luhn_check(dec_cc) << '\n'; + << ' ' << luhn_check(dec_cc) << std::endl; if(dec_cc != cc_number) { - std::cout << "Something went wrong :( Bad CC checksum?\n"; + std::cout << "Something went wrong :( Bad CC checksum?" << std::endl; return 2; } diff --git a/src/cmd/is_prime.cpp b/src/cmd/is_prime.cpp index 5a95f0a12..c3bf8970e 100644 --- a/src/cmd/is_prime.cpp +++ b/src/cmd/is_prime.cpp @@ -13,7 +13,7 @@ int is_prime(int argc, char* argv[]) { if(argc != 2 && argc != 3) { - std::cerr << "Usage: " << argv[0] << " n <prob>\n"; + std::cerr << "Usage: " << argv[0] << " n <prob>" << std::endl; return 2; } @@ -30,12 +30,12 @@ int is_prime(int argc, char* argv[]) if(prime) { - std::cout << n << " is prime\n"; + std::cout << n << " is prime" << std::endl; return 0; } else { - std::cout << n << " is not prime\n"; + std::cout << n << " is not prime" << std::endl; return 1; } } diff --git a/src/cmd/keygen.cpp b/src/cmd/keygen.cpp index 99769a62f..f5dfd425e 100644 --- a/src/cmd/keygen.cpp +++ b/src/cmd/keygen.cpp @@ -106,7 +106,7 @@ int keygen(int argc, char* argv[]) else priv << PKCS8::PEM_encode(*key, rng, pass, std::chrono::milliseconds(300), pbe); - std::cout << "Wrote " << bits << " bit " << algo << " key to public.pem / private.pem\n"; + std::cout << "Wrote " << bits << " bit " << algo << " key to public.pem / private.pem" << std::endl; } catch(std::exception& e) { diff --git a/src/cmd/main.cpp b/src/cmd/main.cpp index 3a6bd4e36..95b232849 100644 --- a/src/cmd/main.cpp +++ b/src/cmd/main.cpp @@ -29,11 +29,11 @@ namespace { int help(int , char* argv[]) { - std::cout << "Usage: " << argv[0] << " [subcommand] [subcommand-options]\n"; + std::cout << "Usage: " << argv[0] << " [subcommand] [subcommand-options]" << std::endl; std::set<std::string> apps = AppRegistrations::instance().all_apps(); - std::cout << "Available commands:\n"; + std::cout << "Available commands:" << std::endl; size_t idx = 1; for(auto&& app: apps) @@ -41,13 +41,13 @@ int help(int , char* argv[]) std::cout << app; if(idx % 3 == 0) - std::cout << "\n"; + std::cout << std::endl; else std::cout << std::string(18-app.size(), ' '); ++idx; } - std::cout << "\n"; + std::cout << std::endl; return 1; } @@ -60,28 +60,28 @@ int config(int argc, char* argv[]) << " prefix: Print install prefix\n" << " cflags: Print include params\n" << " ldflags: Print linker params\n" - << " libs: Print libraries\n"; + << " libs: Print libraries" << std::endl; return 1; } const std::string arg = argv[1]; if(arg == "prefix") - std::cout << BOTAN_INSTALL_PREFIX << "\n"; + std::cout << BOTAN_INSTALL_PREFIX << std::endl; else if(arg == "cflags") - std::cout << "-I" << BOTAN_INSTALL_PREFIX << "/" << BOTAN_INSTALL_HEADER_DIR << "\n"; + std::cout << "-I" << BOTAN_INSTALL_PREFIX << "/" << BOTAN_INSTALL_HEADER_DIR << std::endl; else if(arg == "ldflags") - std::cout << "-L" << BOTAN_INSTALL_PREFIX << "/" << BOTAN_INSTALL_LIB_DIR << "\n"; + std::cout << "-L" << BOTAN_INSTALL_PREFIX << "/" << BOTAN_INSTALL_LIB_DIR << std::endl; else if(arg == "libs") std::cout << "-lbotan-" << version_major() << "." << version_minor() - << " " << BOTAN_LIB_LINK << "\n"; + << " " << BOTAN_LIB_LINK << std::endl; else { - std::cerr << "Unknown option " << arg << " to botan config\n"; + std::cerr << "Unknown option " << arg << " to botan config" << std::endl; return 1; } @@ -102,22 +102,22 @@ int version(int argc, char* argv[]) << ") does not match version built against (" << BOTAN_VERSION_MAJOR << '.' << BOTAN_VERSION_MINOR << '.' - << BOTAN_VERSION_PATCH << ")\n"; + << BOTAN_VERSION_PATCH << ")" << std::endl; } if(argc == 1) { std::cout << Botan::version_major() << "." << Botan::version_minor() << "." - << Botan::version_patch() << "\n"; + << Botan::version_patch() << std::endl; } else if(argc == 2 && std::string(argv[1]) == "--full") { - std::cout << Botan::version_string() << "\n"; + std::cout << Botan::version_string() << std::endl; } else { - std::cout << "Usage: " << argv[0] << " version [--full]\n"; + std::cout << "Usage: " << argv[0] << " version [--full]" << std::endl; return 1; } @@ -137,12 +137,12 @@ int http_get(int argc, char* argv[]) { if(argc != 2) { - std::cout << "Usage " << argv[0] << " <url>\n"; + std::cout << "Usage " << argv[0] << " <url>" << std::endl; return 1; } auto resp = HTTP::GET_sync(argv[2]); - std::cout << resp << "\n"; + std::cout << resp << std::endl; return 0; } REGISTER_APP(http_get); diff --git a/src/cmd/ocsp.cpp b/src/cmd/ocsp.cpp index 1106d3fe4..a939b4680 100644 --- a/src/cmd/ocsp.cpp +++ b/src/cmd/ocsp.cpp @@ -36,12 +36,12 @@ int ocsp_check(int argc, char* argv[]) if(status == Certificate_Status_Code::VERIFIED) { - std::cout << "OCSP check OK\n"; + std::cout << "OCSP check OK" << std::endl; return 0; } else { - std::cout << "OCSP check failed " << Path_Validation_Result::status_string(status) << "\n"; + std::cout << "OCSP check failed " << Path_Validation_Result::status_string(status) << std::endl; return 1; } } diff --git a/src/cmd/rng.cpp b/src/cmd/rng.cpp index 0c0a5a77e..901607bea 100644 --- a/src/cmd/rng.cpp +++ b/src/cmd/rng.cpp @@ -18,7 +18,7 @@ int rng(int argc, char* argv[]) { if(argc == 1) { - std::cout << "Usage: " << argv[0] << " [--raw-entropy] [n]\n"; + std::cout << "Usage: " << argv[0] << " [--raw-entropy] [n]" << std::endl; return 1; } @@ -28,13 +28,13 @@ int rng(int argc, char* argv[]) const bool raw = (argc == 3 && std::string(argv[1]) == "--raw-entropy"); #if defined(BOTAN_HAS_SYSTEM_RNG) - std::cout << "System " << hex_encode(system_rng().random_vec(amt)) << "\n"; + std::cout << "System " << hex_encode(system_rng().random_vec(amt)) << std::endl; #endif if(!raw) { AutoSeeded_RNG rng; - std::cout << hex_encode(rng.random_vec(amt)) << "\n"; + std::cout << hex_encode(rng.random_vec(amt)) << std::endl; } else { @@ -44,7 +44,7 @@ int rng(int argc, char* argv[]) [amt,&total_collected](const byte in[], size_t in_len, double entropy_estimate) { std::cout << "Collected estimated "<< entropy_estimate << " bits in " - << hex_encode(in, in_len) << "\n"; + << hex_encode(in, in_len) << std::endl; total_collected += entropy_estimate; return total_collected >= amt; }); @@ -54,7 +54,7 @@ int rng(int argc, char* argv[]) } catch(std::exception& e) { - std::cout << "Error: " << e.what() << "\n"; + std::cout << "Error: " << e.what() << std::endl; return 1; } diff --git a/src/cmd/speed.cpp b/src/cmd/speed.cpp index 516d89d77..63100d1d9 100644 --- a/src/cmd/speed.cpp +++ b/src/cmd/speed.cpp @@ -151,7 +151,7 @@ void time_transform(std::unique_ptr<Transform> tf, const double Mbps = ((reps / seconds_used) * buf_size) / 1024 / 1024; std::cout << tf->name() << " " << std::setprecision(4) << Mbps - << " MiB / sec with " << buf_size << " byte blocks\n"; + << " MiB / sec with " << buf_size << " byte blocks" << std::endl; } } @@ -204,7 +204,7 @@ int speed(int argc, char* argv[]) seconds = std::atof(opts.value("seconds").c_str()); if(seconds < 0.1 || seconds > (5 * 60)) { - std::cout << "Invalid argument to --seconds\n"; + std::cout << "Invalid argument to --seconds" << std::endl; return 2; } } @@ -214,7 +214,7 @@ int speed(int argc, char* argv[]) buf_size = std::atoi(opts.value("buf-size").c_str()); if(buf_size == 0 || buf_size > 1024) { - std::cout << "Invalid argument to --buf-size\n"; + std::cout << "Invalid argument to --buf-size" << std::endl; return 2; } } @@ -226,7 +226,7 @@ int speed(int argc, char* argv[]) if(args[0] == "help" || args[0] == "-h") { - std::cout << "Usage: " << argv[0] << " [algo name...]\n"; + std::cout << "Usage: " << argv[0] << " [algo name...]" << std::endl; return 1; } diff --git a/src/cmd/speed_pk.cpp b/src/cmd/speed_pk.cpp index ed3349cd5..63395e624 100644 --- a/src/cmd/speed_pk.cpp +++ b/src/cmd/speed_pk.cpp @@ -138,7 +138,7 @@ void benchmark_enc_dec(PK_Encryptor& enc, PK_Decryptor& dec, if(plaintext_out != plaintext) { // has never happened... - std::cerr << "Contents mismatched on decryption during benchmark!\n"; + std::cerr << "Contents mismatched on decryption during benchmark!" << std::endl; } } } @@ -173,7 +173,7 @@ void benchmark_sig_ver(PK_Verifier& ver, PK_Signer& sig, verify_timer.stop(); if(!verified) - std::cerr << "Signature verification failure\n"; + std::cerr << "Signature verification failure" << std::endl; if((i % 100) == 0) { @@ -184,7 +184,7 @@ void benchmark_sig_ver(PK_Verifier& ver, PK_Signer& sig, verify_timer.stop(); if(verified_bad) - std::cerr << "Signature verification failure (bad sig OK)\n"; + std::cerr << "Signature verification failure (bad sig OK)" << std::endl; } } } @@ -265,7 +265,7 @@ void benchmark_rsa(RandomNumberGenerator& rng, } catch(Exception& e) { - std::cout << e.what() << "\n"; + std::cout << e.what() << std::endl; } } @@ -447,7 +447,7 @@ void benchmark_ecdh(RandomNumberGenerator& rng, kex_timer.stop(); if(secret1 != secret2) - std::cerr << "ECDH secrets did not match\n"; + std::cerr << "ECDH secrets did not match" << std::endl; } } @@ -545,7 +545,7 @@ void benchmark_curve25519(RandomNumberGenerator& rng, kex_timer.stop(); if(secret1 != secret2) - std::cerr << "Curve25519 secrets did not match\n"; + std::cerr << "Curve25519 secrets did not match" << std::endl; } } @@ -604,7 +604,7 @@ void benchmark_dh(RandomNumberGenerator& rng, kex_timer.stop(); if(secret1 != secret2) - std::cerr << "DH secrets did not match\n"; + std::cerr << "DH secrets did not match" << std::endl; } } diff --git a/src/cmd/tls_client.cpp b/src/cmd/tls_client.cpp index d96cc47a9..e052c6842 100644 --- a/src/cmd/tls_client.cpp +++ b/src/cmd/tls_client.cpp @@ -78,13 +78,13 @@ int connect_to_host(const std::string& host, u16bit port, bool tcp) bool handshake_complete(const TLS::Session& session) { std::cout << "Handshake complete, " << session.version().to_string() - << " using " << session.ciphersuite().to_string() << "\n"; + << " using " << session.ciphersuite().to_string() << std::endl; if(!session.session_id().empty()) - std::cout << "Session ID " << hex_encode(session.session_id()) << "\n"; + std::cout << "Session ID " << hex_encode(session.session_id()) << std::endl; if(!session.session_ticket().empty()) - std::cout << "Session ticket " << hex_encode(session.session_ticket()) << "\n"; + std::cout << "Session ticket " << hex_encode(session.session_ticket()) << std::endl; return true; } @@ -123,7 +123,7 @@ bool got_alert = false; void alert_received(TLS::Alert alert, const byte [], size_t ) { - std::cout << "Alert: " << alert.type_string() << "\n"; + std::cout << "Alert: " << alert.type_string() << std::endl; got_alert = true; } @@ -137,7 +137,7 @@ int tls_client(int argc, char* argv[]) { if(argc != 2 && argc != 3 && argc != 4) { - std::cout << "Usage " << argv[0] << " host [port] [udp|tcp]\n"; + std::cout << "Usage " << argv[0] << " host [port] [udp|tcp]" << std::endl; return 1; } @@ -203,7 +203,7 @@ int tls_client(int argc, char* argv[]) { std::string app = client.application_protocol(); if(app != "") - std::cout << "Server choose protocol: " << client.application_protocol() << "\n"; + std::cout << "Server choose protocol: " << client.application_protocol() << std::endl; first_active = false; } } @@ -220,12 +220,12 @@ int tls_client(int argc, char* argv[]) if(got == 0) { - std::cout << "EOF on socket\n"; + std::cout << "EOF on socket" << std::endl; break; } else if(got == -1) { - std::cout << "Socket error: " << errno << " " << strerror(errno) << "\n"; + std::cout << "Socket error: " << errno << " " << strerror(errno) << std::endl; continue; } @@ -239,13 +239,13 @@ int tls_client(int argc, char* argv[]) if(got == 0) { - std::cout << "EOF on stdin\n"; + std::cout << "EOF on stdin" << std::endl; client.close(); break; } else if(got == -1) { - std::cout << "Stdin error: " << errno << " " << strerror(errno) << "\n"; + std::cout << "Stdin error: " << errno << " " << strerror(errno) << std::endl; continue; } @@ -255,12 +255,12 @@ int tls_client(int argc, char* argv[]) if(cmd == 'R' || cmd == 'r') { - std::cout << "Client initiated renegotiation\n"; + std::cout << "Client initiated renegotiation" << std::endl; client.renegotiate(cmd == 'R'); } else if(cmd == 'Q') { - std::cout << "Client initiated close\n"; + std::cout << "Client initiated close" << std::endl; client.close(); } } @@ -272,7 +272,7 @@ int tls_client(int argc, char* argv[]) if(client.timeout_check()) { - std::cout << "Timeout detected\n"; + std::cout << "Timeout detected" << std::endl; } } @@ -280,7 +280,7 @@ int tls_client(int argc, char* argv[]) } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << "\n"; + std::cout << "Exception: " << e.what() << std::endl; return 1; } return 0; diff --git a/src/cmd/tls_proxy.cpp b/src/cmd/tls_proxy.cpp index 7afe27a3c..724a1e00c 100644 --- a/src/cmd/tls_proxy.cpp +++ b/src/cmd/tls_proxy.cpp @@ -261,12 +261,12 @@ class tls_proxy_session : public boost::enable_shared_from_this<tls_proxy_sessio bool tls_handshake_complete(const TLS::Session& session) { - //std::cout << "Handshake from client complete\n"; + //std::cout << "Handshake from client complete" << std::endl; m_hostname = session.server_info().hostname(); if(m_hostname != "") - std::cout << "Client requested hostname '" << m_hostname << "'\n"; + std::cout << "Client requested hostname '" << m_hostname << "'" << std::endl; async_connect(m_server_socket, m_server_endpoints, [this](boost::system::error_code ec, tcp::resolver::iterator endpoint) @@ -291,7 +291,7 @@ class tls_proxy_session : public boost::enable_shared_from_this<tls_proxy_sessio return; } else - std::cout << "Alert " << alert.type_string() << "\n"; + std::cout << "Alert " << alert.type_string() << std::endl; } boost::asio::io_service::strand m_strand; @@ -396,7 +396,7 @@ int tls_proxy(int argc, char* argv[]) { if(argc != 6) { - std::cout << "Usage: " << argv[0] << " listen_port target_host target_port server_cert server_key\n"; + std::cout << "Usage: " << argv[0] << " listen_port target_host target_port server_cert server_key" << std::endl; return 1; } diff --git a/src/cmd/tls_server.cpp b/src/cmd/tls_server.cpp index ee72ba5ac..b7fbfa2c8 100644 --- a/src/cmd/tls_server.cpp +++ b/src/cmd/tls_server.cpp @@ -76,13 +76,13 @@ int make_server_socket(bool is_tcp, u16bit port) bool handshake_complete(const TLS::Session& session) { std::cout << "Handshake complete, " << session.version().to_string() - << " using " << session.ciphersuite().to_string() << "\n"; + << " using " << session.ciphersuite().to_string() << std::endl; if(!session.session_id().empty()) - std::cout << "Session ID " << hex_encode(session.session_id()) << "\n"; + std::cout << "Session ID " << hex_encode(session.session_id()) << std::endl; if(!session.session_ticket().empty()) - std::cout << "Session ticket " << hex_encode(session.session_ticket()) << "\n"; + std::cout << "Session ticket " << hex_encode(session.session_ticket()) << std::endl; return true; } @@ -92,9 +92,9 @@ void dgram_socket_write(int sockfd, const byte buf[], size_t length) ssize_t sent = ::send(sockfd, buf, length, MSG_NOSIGNAL); if(sent == -1) - std::cout << "Error writing to socket - " << strerror(errno) << "\n"; + std::cout << "Error writing to socket - " << strerror(errno) << std::endl; else if(sent != static_cast<ssize_t>(length)) - std::cout << "Packet of length " << length << " truncated to " << sent << "\n"; + std::cout << "Packet of length " << length << " truncated to " << sent << std::endl; } void stream_socket_write(int sockfd, const byte buf[], size_t length) @@ -118,14 +118,14 @@ void stream_socket_write(int sockfd, const byte buf[], size_t length) void alert_received(TLS::Alert alert, const byte[], size_t) { - std::cout << "Alert: " << alert.type_string() << "\n"; + std::cout << "Alert: " << alert.type_string() << std::endl; } int tls_server(int argc, char* argv[]) { if(argc != 4 && argc != 5) { - std::cout << "Usage: " << argv[0] << " server.crt server.key port [tcp|udp]\n"; + std::cout << "Usage: " << argv[0] << " server.crt server.key port [tcp|udp]" << std::endl; return 1; } @@ -148,11 +148,11 @@ int tls_server(int argc, char* argv[]) auto protocol_chooser = [](const std::vector<std::string>& protocols) -> std::string { for(size_t i = 0; i != protocols.size(); ++i) - std::cout << "Client offered protocol " << i << " = " << protocols[i] << "\n"; + std::cout << "Client offered protocol " << i << " = " << protocols[i] << std::endl; return "echo/1.0"; // too bad }; - std::cout << "Listening for new connections on " << transport << " port " << port << "\n"; + std::cout << "Listening for new connections on " << transport << " port " << port << std::endl; int server_fd = make_server_socket(is_tcp, port); @@ -179,7 +179,7 @@ int tls_server(int argc, char* argv[]) fd = server_fd; } - std::cout << "New connection received\n"; + std::cout << "New connection received" << std::endl; auto socket_write = is_tcp ? std::bind(stream_socket_write, fd, _1, _2) : std::bind(dgram_socket_write, fd, _1, _2); @@ -219,13 +219,13 @@ int tls_server(int argc, char* argv[]) if(got == -1) { - std::cout << "Error in socket read - " << strerror(errno) << "\n"; + std::cout << "Error in socket read - " << strerror(errno) << std::endl; break; } if(got == 0) { - std::cout << "EOF on socket\n"; + std::cout << "EOF on socket" << std::endl; break; } @@ -248,14 +248,14 @@ int tls_server(int argc, char* argv[]) } catch(std::exception& e) { - std::cout << "Connection problem: " << e.what() << "\n"; + std::cout << "Connection problem: " << e.what() << std::endl; return 1; } } } catch(std::exception& e) { - std::cout << e.what() << "\n"; + std::cout << e.what() << std::endl; return 1; } diff --git a/src/cmd/x509print.cpp b/src/cmd/x509print.cpp index 4bc46d5b9..c95ab6cdb 100644 --- a/src/cmd/x509print.cpp +++ b/src/cmd/x509print.cpp @@ -14,13 +14,13 @@ int x509print(int argc, char* argv[]) { if(argc < 1) { - std::cout << "Usage: " << argv[0] << " cert.pem\n"; + std::cout << "Usage: " << argv[0] << " cert.pem" << std::endl; return 1; } X509_Certificate cert(argv[1]); - std::cout << cert.to_string() << "\n"; + std::cout << cert.to_string() << std::endl; return 0; } |