diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-01-01 13:05:15 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-01-01 13:05:15 -0800 |
| commit | 61d581e2343af9677815fa7dc13e8a36a6f5ec3e (patch) | |
| tree | 75d9b4d852333c834ee75783e7ba677a0b2ff774 /src/supplemental | |
| parent | 0d23af92531b7c0dd6d7b74c73c1a8c4811c7d13 (diff) | |
| download | nng-61d581e2343af9677815fa7dc13e8a36a6f5ec3e.tar.gz nng-61d581e2343af9677815fa7dc13e8a36a6f5ec3e.tar.bz2 nng-61d581e2343af9677815fa7dc13e8a36a6f5ec3e.zip | |
sha1: move this to private websocket API
Nothing else uses it, and nothing else *should* use it because SHA1 is insecure.
WebSockets have to use it by definition, unfortunately. The implementation is
not very fast, but doesn't have to be for the use case of websocket keying.
Diffstat (limited to 'src/supplemental')
| -rw-r--r-- | src/supplemental/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/supplemental/sha1/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/supplemental/websocket/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/supplemental/websocket/sha1.c (renamed from src/supplemental/sha1/sha1.c) | 0 | ||||
| -rw-r--r-- | src/supplemental/websocket/sha1.h (renamed from src/supplemental/sha1/sha1.h) | 8 | ||||
| -rw-r--r-- | src/supplemental/websocket/sha1_test.c (renamed from src/supplemental/sha1/sha1_test.c) | 0 | ||||
| -rw-r--r-- | src/supplemental/websocket/websocket.c | 5 | ||||
| -rw-r--r-- | src/supplemental/websocket/websocket_test.c | 2 |
8 files changed, 12 insertions, 23 deletions
diff --git a/src/supplemental/CMakeLists.txt b/src/supplemental/CMakeLists.txt index 2dcf228e..9bbddc44 100644 --- a/src/supplemental/CMakeLists.txt +++ b/src/supplemental/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2024 Staysail Systems, Inc. <info@staystail.tech> +# Copyright 2025 Staysail Systems, Inc. <info@staystail.tech> # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -11,7 +11,6 @@ nng_directory(supplemental) add_subdirectory(base64) add_subdirectory(http) -add_subdirectory(sha1) add_subdirectory(tls) add_subdirectory(util) add_subdirectory(websocket) diff --git a/src/supplemental/sha1/CMakeLists.txt b/src/supplemental/sha1/CMakeLists.txt deleted file mode 100644 index de301b08..00000000 --- a/src/supplemental/sha1/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# -# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> -# Copyright 2017 Capitar IT Group BV <info@capitar.com> -# -# This software is supplied under the terms of the MIT License, a -# copy of which should be located in the distribution where this -# file was obtained (LICENSE.txt). A copy of the license may also be -# found online at https://opensource.org/licenses/MIT. -# - -nng_sources_if(NNG_SUPP_SHA1 sha1.c sha1.h) -nng_test(sha1_test) diff --git a/src/supplemental/websocket/CMakeLists.txt b/src/supplemental/websocket/CMakeLists.txt index 200aeee4..5d2f4b0c 100644 --- a/src/supplemental/websocket/CMakeLists.txt +++ b/src/supplemental/websocket/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> # Copyright 2017 Capitar IT Group BV <info@capitar.com> # # This software is supplied under the terms of the MIT License, a @@ -9,7 +9,8 @@ # if (NNG_SUPP_WEBSOCKET) - nng_sources(websocket.c websocket.h) + nng_sources(sha1.c sha1.h websocket.c websocket.h) + nng_test(sha1_test) else () nng_sources(stub.c) endif () diff --git a/src/supplemental/sha1/sha1.c b/src/supplemental/websocket/sha1.c index 228b497d..228b497d 100644 --- a/src/supplemental/sha1/sha1.c +++ b/src/supplemental/websocket/sha1.c diff --git a/src/supplemental/sha1/sha1.h b/src/supplemental/websocket/sha1.h index adaa9a85..43b6f20d 100644 --- a/src/supplemental/sha1/sha1.h +++ b/src/supplemental/websocket/sha1.h @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -8,8 +8,8 @@ // found online at https://opensource.org/licenses/MIT. // -#ifndef NNG_SUPPLEMENTAL_SHA1_SHA1_H -#define NNG_SUPPLEMENTAL_SHA1_SHA1_H +#ifndef NNG_SUPPLEMENTAL_WEBSOCKET_SHA1_H +#define NNG_SUPPLEMENTAL_WEBSOCKET_SHA1_H typedef struct { uint32_t digest[5]; // resulting digest @@ -23,4 +23,4 @@ extern void nni_sha1_update(nni_sha1_ctx *, const void *, size_t); extern void nni_sha1_final(nni_sha1_ctx *, uint8_t[20]); extern void nni_sha1(const void *, size_t, uint8_t[20]); -#endif // NNG_SUPPLEMENTAL_SHA1_SHA1_H +#endif // NNG_SUPPLEMENTAL_WEBSOCKET_SHA1_H diff --git a/src/supplemental/sha1/sha1_test.c b/src/supplemental/websocket/sha1_test.c index 505175b0..505175b0 100644 --- a/src/supplemental/sha1/sha1_test.c +++ b/src/supplemental/websocket/sha1_test.c diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index 6053c5c2..9cb1a677 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -14,10 +14,11 @@ #include <string.h> #include "core/nng_impl.h" -#include "supplemental/base64/base64.h" #include "supplemental/http/http_api.h" -#include "supplemental/sha1/sha1.h" +#include "supplemental/base64/base64.h" + +#include "sha1.h" #include "websocket.h" // This should be removed or handled differently in the future. diff --git a/src/supplemental/websocket/websocket_test.c b/src/supplemental/websocket/websocket_test.c index 91e42601..30ebb3f5 100644 --- a/src/supplemental/websocket/websocket_test.c +++ b/src/supplemental/websocket/websocket_test.c @@ -11,7 +11,7 @@ #include <nng/nng.h> -#include "../sha1/sha1.h" +#include "sha1.h" #include <nuts.h> |
