From 57086e28d8b563a68ad73af43efb8270ba7f8e28 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Thu, 12 Sep 2019 11:43:52 -0700 Subject: [PATCH] fix unittest warnings + remove trailing spaces --- README.md | 2 +- docs/CHANGELOG.md | 4 +-- docs/build.md | 5 +-- docs/usage.md | 2 +- ixwebsocket/IXDNSLookup.cpp | 2 +- ixwebsocket/IXNetSystem.cpp | 2 +- ixwebsocket/IXSocket.cpp | 2 +- makefile | 4 +-- test/IXCobraChatTest.cpp | 14 ++++---- test/IXCobraMetricsPublisherTest.cpp | 4 +-- test/IXGetFreePort.cpp | 3 -- test/IXWebSocketCloseTest.cpp | 6 ---- test/IXWebSocketServerTest.cpp | 6 ++++ third_party/jsoncpp/json/json-forwards.h | 14 ++++---- third_party/jsoncpp/json/json.h | 22 ++++++------- third_party/jsoncpp/jsoncpp.cpp | 27 +++++++--------- third_party/mbedtls/.github/issue_template.md | 32 +++++++++---------- .../mbedtls/.github/pull_request_template.md | 4 +-- .../mbedtls/crypto/.github/issue_template.md | 9 +++--- third_party/mbedtls/crypto/programs/README.md | 4 +-- .../crypto/tests/git-scripts/README.md | 2 +- third_party/mbedtls/programs/README.md | 5 ++- .../mbedtls/tests/git-scripts/README.md | 2 +- ws/ws_autobahn.cpp | 14 +++----- ws/ws_cobra_subscribe.cpp | 2 +- 25 files changed, 87 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index dcc4080a..6b4873f0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Hello world -![Alt text](https://travis-ci.org/machinezone/IXWebSocket.svg?branch=master) +![Alt text](https://travis-ci.org/machinezone/IXWebSocket.svg?branch=master) IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use and support everything you'll likely need for websocket dev (SSL, deflate compression, compiles on most platforms, etc...). HTTP client and server code is also available, but it hasn't received as much testing. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 23ee017a..3bf2d151 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -75,7 +75,7 @@ Close connections when reserved bits are used (fix autobahn test: 3.X Reserved B - add utf-8 validation code, not hooked up properly yet - Ping received with a payload too large (> 125 bytes) trigger a connection closure - cobra / add tracking about published messages -- cobra / publish returns a message id, that can be used when +- cobra / publish returns a message id, that can be used when - cobra / new message type in the message received handler when publish/ok is received (can be used to implement an ack system). ## [5.0.9] - 2019-08-30 @@ -89,7 +89,7 @@ ws connect --max_wait 5000 ws://example.com # will only wait 5 seconds max betwe ## [5.0.7] - 2019-08-23 - WebSocket: add new option to pass in extra HTTP headers when connecting. -- `ws connect` add new option (-H, works like [curl](https://stackoverflow.com/questions/356705/how-to-send-a-header-using-a-http-request-through-a-curl-call)) to pass in extra HTTP headers when connecting +- `ws connect` add new option (-H, works like [curl](https://stackoverflow.com/questions/356705/how-to-send-a-header-using-a-http-request-through-a-curl-call)) to pass in extra HTTP headers when connecting If you run against `ws echo_server` you will see the headers being received printed in the terminal. ``` diff --git a/docs/build.md b/docs/build.md index 7d44f577..3f63d70e 100644 --- a/docs/build.md +++ b/docs/build.md @@ -33,7 +33,7 @@ vcpkg install ixwebsocket ### Conan -Support for building with conan was contributed by Olivia Zoe (thanks !). The package name to reference is `IXWebSocket/5.0.0@LunarWatcher/stable`. The package is in the process to be published to the official conan package repo, but in the meantime, it can be accessed by adding a new remote +Support for building with conan was contributed by Olivia Zoe (thanks !). The package name to reference is `IXWebSocket/5.0.0@LunarWatcher/stable`. The package is in the process to be published to the official conan package repo, but in the meantime, it can be accessed by adding a new remote ``` conan remote add remote_name_here https://api.bintray.com/conan/oliviazoe0/conan-packages @@ -59,6 +59,3 @@ app@ca2340eb9106:~$ ws --help ws is a websocket tool ... ``` - - - diff --git a/docs/usage.md b/docs/usage.md index c648f585..faa2f907 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -225,7 +225,7 @@ Wait time(ms): 10000 The waiting time is capped by default at 10s between 2 attempts, but that value can be changed and queried. ``` -webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s +webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries(); ``` diff --git a/ixwebsocket/IXDNSLookup.cpp b/ixwebsocket/IXDNSLookup.cpp index 1d71993f..d776f6d1 100644 --- a/ixwebsocket/IXDNSLookup.cpp +++ b/ixwebsocket/IXDNSLookup.cpp @@ -94,7 +94,7 @@ namespace ix int port = _port; std::string hostname(_hostname); - // We make the background thread doing the work a shared pointer + // We make the background thread doing the work a shared pointer // instead of a member variable, because it can keep running when // this object goes out of scope, in case of cancellation auto t = std::make_shared(&DNSLookup::run, this, self, hostname, port); diff --git a/ixwebsocket/IXNetSystem.cpp b/ixwebsocket/IXNetSystem.cpp index 0c9ada18..78de0669 100644 --- a/ixwebsocket/IXNetSystem.cpp +++ b/ixwebsocket/IXNetSystem.cpp @@ -80,7 +80,7 @@ namespace ix int ret = select(maxfd + 1, &readfds, &writefds, &errorfds, timeout != -1 ? &tv : NULL); - if (ret < 0) + if (ret < 0) { return ret; } diff --git a/ixwebsocket/IXSocket.cpp b/ixwebsocket/IXSocket.cpp index 62a01d52..f9e68351 100644 --- a/ixwebsocket/IXSocket.cpp +++ b/ixwebsocket/IXSocket.cpp @@ -54,7 +54,7 @@ namespace ix // which crash in FD_SET as they are larger than FD_SETSIZE. // Switching to ::poll does fix that. // - // However poll isn't as portable as select and has bugs on Windows, so we should write a + // However poll isn't as portable as select and has bugs on Windows, so we should write a // shim to fallback to select on those platforms. // See https://github.com/mpv-player/mpv/pull/5203/files for such a select wrapper. // diff --git a/makefile b/makefile index 547c742f..90134094 100644 --- a/makefile +++ b/makefile @@ -47,9 +47,9 @@ trail: sh third_party/remote_trailing_whitespaces.sh format: - find test ixwebsocket ws -name '*.cpp' -o -name '*.h' -exec clang-format -i {} \; + clang-format -i `find test ixwebsocket ws -name '*.cpp' -o -name '*.h'` -# That target is used to start a node server, but isn't required as we have +# That target is used to start a node server, but isn't required as we have # a builtin C++ server started in the unittest now test_server: (cd test && npm i ws && node broadcast-server.js) diff --git a/test/IXCobraChatTest.cpp b/test/IXCobraChatTest.cpp index 8f43e206..5189940e 100644 --- a/test/IXCobraChatTest.cpp +++ b/test/IXCobraChatTest.cpp @@ -135,12 +135,12 @@ namespace if (!msg.isMember("user")) return; if (!msg.isMember("text")) return; if (!msg.isMember("session")) return; - + std::string msg_user = msg["user"].asString(); std::string msg_text = msg["text"].asString(); std::string msg_session = msg["session"].asString(); - // We are not interested in messages + // We are not interested in messages // from a different session. if (msg_session != _session) return; @@ -150,7 +150,7 @@ namespace _receivedQueue.push(msg); std::stringstream ss; - ss << std::endl + ss << std::endl << msg_user << " > " << msg_text << std::endl << _user << " > "; @@ -246,7 +246,7 @@ namespace std::stringstream ss; ss << "Sending msg [" << text << "]"; log(ss.str()); - + Json::Value channels; channels.append(channel); _conn.publish(channels, msg); @@ -260,7 +260,7 @@ namespace ix::msleep(50); _conn.disconnect(); - + _conn.setEventCallback([] (ix::CobraConnectionEventType eventType, const std::string& errMsg, @@ -305,7 +305,7 @@ TEST_CASE("Cobra_chat", "[cobra_chat]") { if (chatA.isReady() && chatB.isReady()) break; ix::msleep(10); - + timeout -= 10; if (timeout <= 0) { @@ -329,7 +329,7 @@ TEST_CASE("Cobra_chat", "[cobra_chat]") while (chatA.hasPendingMessages() || chatB.hasPendingMessages()) { ix::msleep(10); - + timeout -= 10; if (timeout <= 0) { diff --git a/test/IXCobraMetricsPublisherTest.cpp b/test/IXCobraMetricsPublisherTest.cpp index e33ba2f9..e58337db 100644 --- a/test/IXCobraMetricsPublisherTest.cpp +++ b/test/IXCobraMetricsPublisherTest.cpp @@ -137,13 +137,13 @@ TEST_CASE("Cobra_Metrics_Publisher", "[cobra]") std::thread bgThread(&startSubscriber, endpoint); int timeout = 10 * 1000; // 10s - + // Wait until the subscriber is ready (authenticated + subscription successful) while (!gSubscriberConnectedAndSubscribed) { std::chrono::duration duration(10); std::this_thread::sleep_for(duration); - + timeout -= 10; if (timeout <= 0) { diff --git a/test/IXGetFreePort.cpp b/test/IXGetFreePort.cpp index 134e029f..dd08bb01 100644 --- a/test/IXGetFreePort.cpp +++ b/test/IXGetFreePort.cpp @@ -23,7 +23,6 @@ namespace ix int getAnyFreePort() { - int defaultPort = 8090; int sockfd; if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { @@ -89,5 +88,3 @@ namespace ix return -1; } } // namespace ix - - diff --git a/test/IXWebSocketCloseTest.cpp b/test/IXWebSocketCloseTest.cpp index 02a5e239..22a37a73 100644 --- a/test/IXWebSocketCloseTest.cpp +++ b/test/IXWebSocketCloseTest.cpp @@ -28,7 +28,6 @@ namespace void stop(); void stop(uint16_t code, const std::string& reason); bool isReady() const; - void sendMessage(const std::string& text); uint16_t getCloseCode(); const std::string& getCloseReason(); @@ -171,11 +170,6 @@ namespace _webSocket.start(); } - void WebSocketClient::sendMessage(const std::string& text) - { - _webSocket.send(text); - } - bool startServer(ix::WebSocketServer& server, uint16_t& receivedCloseCode, std::string& receivedCloseReason, diff --git a/test/IXWebSocketServerTest.cpp b/test/IXWebSocketServerTest.cpp index 429194c2..c9d7dffe 100644 --- a/test/IXWebSocketServerTest.cpp +++ b/test/IXWebSocketServerTest.cpp @@ -112,6 +112,8 @@ TEST_CASE("Websocket_server", "[websocket_server]") auto lineResult = socket->readLine(isCancellationRequested); auto lineValid = lineResult.first; + REQUIRE(lineValid); + auto line = lineResult.second; int status = -1; @@ -149,6 +151,8 @@ TEST_CASE("Websocket_server", "[websocket_server]") auto lineResult = socket->readLine(isCancellationRequested); auto lineValid = lineResult.first; + REQUIRE(lineValid); + auto line = lineResult.second; int status = -1; @@ -190,6 +194,8 @@ TEST_CASE("Websocket_server", "[websocket_server]") auto lineResult = socket->readLine(isCancellationRequested); auto lineValid = lineResult.first; + REQUIRE(lineValid); + auto line = lineResult.second; int status = -1; diff --git a/third_party/jsoncpp/json/json-forwards.h b/third_party/jsoncpp/json/json-forwards.h index 61d08880..6c2b5eb3 100644 --- a/third_party/jsoncpp/json/json-forwards.h +++ b/third_party/jsoncpp/json/json-forwards.h @@ -7,28 +7,28 @@ // ////////////////////////////////////////////////////////////////////// /* -The JsonCpp library's source code, including accompanying documentation, +The JsonCpp library's source code, including accompanying documentation, tests and demonstration applications, are licensed under the following conditions... -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, this software is released into the Public Domain. In jurisdictions which do not recognize Public Domain property (e.g. Germany as of 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is released under the terms of the MIT License (see below). -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual Public Domain/MIT License conditions described here, as they choose. The MIT License is about as close to Public Domain as a license can get, and is described in clear, concise terms at: http://en.wikipedia.org/wiki/MIT_License - + The full text of the MIT License follows: ======================================================================== diff --git a/third_party/jsoncpp/json/json.h b/third_party/jsoncpp/json/json.h index 347b5731..293228db 100644 --- a/third_party/jsoncpp/json/json.h +++ b/third_party/jsoncpp/json/json.h @@ -6,28 +6,28 @@ // ////////////////////////////////////////////////////////////////////// /* -The JsonCpp library's source code, including accompanying documentation, +The JsonCpp library's source code, including accompanying documentation, tests and demonstration applications, are licensed under the following conditions... -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, this software is released into the Public Domain. In jurisdictions which do not recognize Public Domain property (e.g. Germany as of 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is released under the terms of the MIT License (see below). -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual Public Domain/MIT License conditions described here, as they choose. The MIT License is about as close to Public Domain as a license can get, and is described in clear, concise terms at: http://en.wikipedia.org/wiki/MIT_License - + The full text of the MIT License follows: ======================================================================== @@ -390,7 +390,7 @@ public: #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) //Conditional NORETURN attribute on the throw functions would: -// a) suppress false positives from static code analysis +// a) suppress false positives from static code analysis // b) possibly improve optimization opportunities. #if !defined(JSONCPP_NORETURN) # if defined(_MSC_VER) @@ -422,7 +422,7 @@ protected: /** Exceptions which the user cannot easily avoid. * * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input - * + * * \remark derived from Json::Exception */ class JSON_API RuntimeError : public Exception { @@ -433,7 +433,7 @@ public: /** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. * * These are precondition-violations (user bugs) and internal errors (our bugs). - * + * * \remark derived from Json::Exception */ class JSON_API LogicError : public Exception { @@ -1502,7 +1502,7 @@ public: - `"rejectDupKeys": false or true` - If true, `parse()` returns false when a key is duplicated within an object. - `"allowSpecialFloats": false or true` - - If true, special float values (NaNs and infinities) are allowed + - If true, special float values (NaNs and infinities) are allowed and their values are lossfree restorable. You can examine 'settings_` yourself diff --git a/third_party/jsoncpp/jsoncpp.cpp b/third_party/jsoncpp/jsoncpp.cpp index bf5b8c7e..297d13c1 100644 --- a/third_party/jsoncpp/jsoncpp.cpp +++ b/third_party/jsoncpp/jsoncpp.cpp @@ -6,28 +6,28 @@ // ////////////////////////////////////////////////////////////////////// /* -The JsonCpp library's source code, including accompanying documentation, +The JsonCpp library's source code, including accompanying documentation, tests and demonstration applications, are licensed under the following conditions... -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, this software is released into the Public Domain. In jurisdictions which do not recognize Public Domain property (e.g. Germany as of 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is released under the terms of the MIT License (see below). -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual Public Domain/MIT License conditions described here, as they choose. The MIT License is about as close to Public Domain as a license can get, and is described in clear, concise terms at: http://en.wikipedia.org/wiki/MIT_License - + The full text of the MIT License follows: ======================================================================== @@ -209,7 +209,7 @@ static inline void fixNumericLocale(char* begin, char* end) { #include #endif #if defined(_MSC_VER) -#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above #define snprintf sprintf_s #elif _MSC_VER >= 1900 // VC++ 14.0 and above #define snprintf std::snprintf @@ -3780,7 +3780,7 @@ Value& Path::make(Value& root) const { #endif #if defined(_MSC_VER) -#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above #define snprintf sprintf_s #elif _MSC_VER >= 1900 // VC++ 14.0 and above #define snprintf std::snprintf @@ -3793,7 +3793,7 @@ Value& Path::make(Value& root) const { #define snprintf std::snprintf #endif -#if defined(__BORLANDC__) +#if defined(__BORLANDC__) #include #define isfinite _finite #define snprintf _snprintf @@ -4856,7 +4856,7 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const std::string cs_str = settings_["commentStyle"].asString(); bool eyc = settings_["enableYAMLCompatibility"].asBool(); bool dnp = settings_["dropNullPlaceholders"].asBool(); - bool usf = settings_["useSpecialFloats"].asBool(); + bool usf = settings_["useSpecialFloats"].asBool(); unsigned int pre = settings_["precision"].asUInt(); CommentStyle::Enum cs = CommentStyle::All; if (cs_str == "All") { @@ -4945,8 +4945,3 @@ std::ostream& operator<<(std::ostream& sout, Value const& root) { // ////////////////////////////////////////////////////////////////////// // End of content of file: src/lib_json/json_writer.cpp // ////////////////////////////////////////////////////////////////////// - - - - - diff --git a/third_party/mbedtls/.github/issue_template.md b/third_party/mbedtls/.github/issue_template.md index 7c313535..746f2617 100644 --- a/third_party/mbedtls/.github/issue_template.md +++ b/third_party/mbedtls/.github/issue_template.md @@ -7,35 +7,35 @@ Note: This is just a template, so feel free to use/remove the unnecessary things --------------------------------------------------------------- ## Bug -**OS** +**OS** Mbed OS|linux|windows| -**mbed TLS build:** -Version: x.x.x or git commit id -OS version: x.x.x -Configuration: please attach config.h file where possible -Compiler and options (if you used a pre-built binary, please indicate how you obtained it): -Additional environment information: +**mbed TLS build:** +Version: x.x.x or git commit id +OS version: x.x.x +Configuration: please attach config.h file where possible +Compiler and options (if you used a pre-built binary, please indicate how you obtained it): +Additional environment information: -**Peer device TLS stack and version** -OpenSSL|GnuTls|Chrome|NSS(Firefox)|SecureChannel (IIS/Internet Explorer/Edge)|Other -Version: +**Peer device TLS stack and version** +OpenSSL|GnuTls|Chrome|NSS(Firefox)|SecureChannel (IIS/Internet Explorer/Edge)|Other +Version: -**Expected behavior** +**Expected behavior** -**Actual behavior** +**Actual behavior** -**Steps to reproduce** +**Steps to reproduce** ---------------------------------------------------------------- ## Enhancement\Feature Request -**Justification - why does the library need this feature?** +**Justification - why does the library need this feature?** -**Suggested enhancement** +**Suggested enhancement** ----------------------------------------------------------------- ## Question -**Please first check for answers in the [Mbed TLS knowledge Base](https://tls.mbed.org/kb), and preferably file an issue in the [Mbed TLS support forum](https://forums.mbed.com/c/mbed-tls)** +**Please first check for answers in the [Mbed TLS knowledge Base](https://tls.mbed.org/kb), and preferably file an issue in the [Mbed TLS support forum](https://forums.mbed.com/c/mbed-tls)** diff --git a/third_party/mbedtls/.github/pull_request_template.md b/third_party/mbedtls/.github/pull_request_template.md index 485b5419..139aa3c2 100644 --- a/third_party/mbedtls/.github/pull_request_template.md +++ b/third_party/mbedtls/.github/pull_request_template.md @@ -1,6 +1,6 @@ Notes: * Pull requests cannot be accepted until: -- The submitter has [accepted the online agreement here with a click through](https://developer.mbed.org/contributor_agreement/) +- The submitter has [accepted the online agreement here with a click through](https://developer.mbed.org/contributor_agreement/) or for companies or those that do not wish to create an mbed account, a slightly different agreement can be found [here](https://www.mbed.com/en/about-mbed/contributor-license-agreements/) - The PR follows the [mbed TLS coding standards](https://tls.mbed.org/kb/development/mbedtls-coding-standards) * This is just a template, so feel free to use/remove the unnecessary things @@ -17,7 +17,7 @@ Changes do not have to be backported if: - This PR is a new feature\enhancement - This PR contains changes in the API. If this is true, and there is a need for the fix to be backported, the fix should be handled differently in the legacy branch -Yes | NO +Yes | NO Which branch? ## Migrations diff --git a/third_party/mbedtls/crypto/.github/issue_template.md b/third_party/mbedtls/crypto/.github/issue_template.md index 7d4f1e84..108d296f 100644 --- a/third_party/mbedtls/crypto/.github/issue_template.md +++ b/third_party/mbedtls/crypto/.github/issue_template.md @@ -2,12 +2,12 @@ ************************************** WARNING ************************************** - The ciarcom bot parses this header automatically. Any deviation from the - template may cause the bot to automatically correct this header or may result in a + The ciarcom bot parses this header automatically. Any deviation from the + template may cause the bot to automatically correct this header or may result in a warning message, requesting updates. - Please ensure that nothing follows the Issue request type section, all - issue details are within the Description section and no changes are made to the + Please ensure that nothing follows the Issue request type section, all + issue details are within the Description section and no changes are made to the template format (as detailed below). ************************************************************************************* @@ -41,4 +41,3 @@ [ ] Question [ ] Enhancement [ ] Bug - diff --git a/third_party/mbedtls/crypto/programs/README.md b/third_party/mbedtls/crypto/programs/README.md index 977e26c4..b0e717d2 100644 --- a/third_party/mbedtls/crypto/programs/README.md +++ b/third_party/mbedtls/crypto/programs/README.md @@ -5,7 +5,7 @@ This subdirectory mostly contains sample programs that illustrate specific featu ## Symmetric cryptography (AES) examples -* [`aes/aescrypt2.c`](aes/aescrypt2.c): file encryption and authentication with a key derived from a low-entropy secret, demonstrating the low-level AES interface, the digest interface and HMAC. +* [`aes/aescrypt2.c`](aes/aescrypt2.c): file encryption and authentication with a key derived from a low-entropy secret, demonstrating the low-level AES interface, the digest interface and HMAC. Warning: this program illustrates how to use low-level functions in the library. It should not be taken as an example of how to build a secure encryption mechanism. To derive a key from a low-entropy secret such as a password, use a standard key stretching mechanism such as PBKDF2 (provided by the `pkcs5` module). To encrypt and authenticate data, use a standard mode such as GCM or CCM (both available as library module). * [`aes/crypt_and_hash.c`](aes/crypt_and_hash.c): file encryption and authentication, demonstrating the generic cipher interface and the generic hash interface. @@ -54,7 +54,7 @@ This subdirectory mostly contains sample programs that illustrate specific featu ## Random number generator (RNG) examples -* [`random/gen_entropy.c`](random/gen_entropy.c): shows how to use the default entropy sources to generate random data. +* [`random/gen_entropy.c`](random/gen_entropy.c): shows how to use the default entropy sources to generate random data. Note: most applications should only use the entropy generator to seed a cryptographic pseudorandom generator, as illustrated by `random/gen_random_ctr_drbg.c`. * [`random/gen_random_ctr_drbg.c`](random/gen_random_ctr_drbg.c): shows how to use the default entropy sources to seed a pseudorandom generator, and how to use the resulting random generator to generate random data. diff --git a/third_party/mbedtls/crypto/tests/git-scripts/README.md b/third_party/mbedtls/crypto/tests/git-scripts/README.md index 29d7501b..c3b154cd 100644 --- a/third_party/mbedtls/crypto/tests/git-scripts/README.md +++ b/third_party/mbedtls/crypto/tests/git-scripts/README.md @@ -8,7 +8,7 @@ The mbed TLS git hooks are located in `/tests/git-scripts` direct Example: -Execute the following command to create a link on linux from the mbed TLS `.git/hooks` directory: +Execute the following command to create a link on linux from the mbed TLS `.git/hooks` directory: `ln -s ../../tests/git-scripts/pre-push.sh pre-push` **Note: Currently the mbed TLS git hooks work only on a GNU platform. If using a non-GNU platform, don't enable these hooks!** diff --git a/third_party/mbedtls/programs/README.md b/third_party/mbedtls/programs/README.md index d26349d0..8b8c7dc0 100644 --- a/third_party/mbedtls/programs/README.md +++ b/third_party/mbedtls/programs/README.md @@ -5,7 +5,7 @@ This subdirectory mostly contains sample programs that illustrate specific featu ## Symmetric cryptography (AES) examples -* [`aes/aescrypt2.c`](aes/aescrypt2.c): file encryption and authentication with a key derived from a low-entropy secret, demonstrating the low-level AES interface, the digest interface and HMAC. +* [`aes/aescrypt2.c`](aes/aescrypt2.c): file encryption and authentication with a key derived from a low-entropy secret, demonstrating the low-level AES interface, the digest interface and HMAC. Warning: this program illustrates how to use low-level functions in the library. It should not be taken as an example of how to build a secure encryption mechanism. To derive a key from a low-entropy secret such as a password, use a standard key stretching mechanism such as PBKDF2 (provided by the `pkcs5` module). To encrypt and authenticate data, use a standard mode such as GCM or CCM (both available as library module). * [`aes/crypt_and_hash.c`](aes/crypt_and_hash.c): file encryption and authentication, demonstrating the generic cipher interface and the generic hash interface. @@ -56,7 +56,7 @@ This subdirectory mostly contains sample programs that illustrate specific featu ## Random number generator (RNG) examples -* [`random/gen_entropy.c`](random/gen_entropy.c): shows how to use the default entropy sources to generate random data. +* [`random/gen_entropy.c`](random/gen_entropy.c): shows how to use the default entropy sources to generate random data. Note: most applications should only use the entropy generator to seed a cryptographic pseudorandom generator, as illustrated by `random/gen_random_ctr_drbg.c`. * [`random/gen_random_ctr_drbg.c`](random/gen_random_ctr_drbg.c): shows how to use the default entropy sources to seed a pseudorandom generator, and how to use the resulting random generator to generate random data. @@ -120,4 +120,3 @@ In addition to providing options for testing client-side features, the `ssl_clie * [`x509/crl_app.c`](x509/crl_app.c): loads and dumps a certificate revocation list (CRL). * [`x509/req_app.c`](x509/req_app.c): loads and dumps a certificate signing request (CSR). - diff --git a/third_party/mbedtls/tests/git-scripts/README.md b/third_party/mbedtls/tests/git-scripts/README.md index 29d7501b..c3b154cd 100644 --- a/third_party/mbedtls/tests/git-scripts/README.md +++ b/third_party/mbedtls/tests/git-scripts/README.md @@ -8,7 +8,7 @@ The mbed TLS git hooks are located in `/tests/git-scripts` direct Example: -Execute the following command to create a link on linux from the mbed TLS `.git/hooks` directory: +Execute the following command to create a link on linux from the mbed TLS `.git/hooks` directory: `ln -s ../../tests/git-scripts/pre-push.sh pre-push` **Note: Currently the mbed TLS git hooks work only on a GNU platform. If using a non-GNU platform, don't enable these hooks!** diff --git a/ws/ws_autobahn.cpp b/ws/ws_autobahn.cpp index 4b68f72a..637ef399 100644 --- a/ws/ws_autobahn.cpp +++ b/ws/ws_autobahn.cpp @@ -5,11 +5,11 @@ */ // -// 1. First you need to generate a config file in a config folder, +// 1. First you need to generate a config file in a config folder, // which can use a white list of test to execute (with globbing), // or a black list of tests to ignore // -// config/fuzzingserver.json +// config/fuzzingserver.json // { // "url": "ws://127.0.0.1:9001", // "outdir": "./reports/clients", @@ -18,15 +18,10 @@ // ], // "exclude-agent-cases": {} // } -// +// // // 2 Run the test server (using docker) -// docker run -it --rm \ -// -v "${PWD}/config:/config" \ -// -v "${PWD}/reports:/reports" \ -// -p 9001:9001 \ -// --name fuzzingserver \ -// crossbario/autobahn-testsuite +// docker run -it --rm -v "${PWD}/config:/config" -v "${PWD}/reports:/reports" -p 9001:9001 --name fuzzingserver crossbario/autobahn-testsuite // // 3. Run this command // ws autobahn -q --url ws://localhost:9001 @@ -315,4 +310,3 @@ namespace ix return generateReport(url) ? 0 : 1; } } - diff --git a/ws/ws_cobra_subscribe.cpp b/ws/ws_cobra_subscribe.cpp index 278a84c1..d4e595fa 100644 --- a/ws/ws_cobra_subscribe.cpp +++ b/ws/ws_cobra_subscribe.cpp @@ -35,7 +35,7 @@ namespace ix // Display incoming messages std::atomic msgPerSeconds(0); std::atomic msgCount(0); - + auto timer = [&msgPerSeconds, &msgCount] { while (true)