Loading .vscode/tasks.json +11 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,17 @@ "command": "test", "problemMatcher": [], "detail": "CMake template test task" }, { "type": "cmake", "label": "CMake: clean rebuild", "command": "cleanRebuild", "targets": [ "all" ], "group": "build", "problemMatcher": [], "detail": "CMake template clean rebuild task" } ], "version": "2.0.0" Loading CMakeLists.txt +3 −8 Original line number Diff line number Diff line project(libnetplus C CXX ASM ) project(libnetplus CXX C ASM ) cmake_minimum_required(VERSION 3.26) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH} ) Loading @@ -6,8 +6,6 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_CXX_STANDARD 17) #find_package(MbedTLS REQUIRED) if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") set (VISIBILTY_HIDDEN "__attribute__ ((visibility (\"hidden\")))") Loading @@ -16,9 +14,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") -fPIC \ -Wall \ -O1 \ -g \ -fsanitize=undefined,address \ " -g " ) set(CMAKE_C_FLAGS Loading @@ -26,8 +22,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") -fPIC \ -Wall \ -O1 \ -g \ -fsanitize=undefined,address " -g " ) endif() Loading src/crypto/curve25519.cpp +339 −1369 File changed.Preview size limit exceeded, changes collapsed. Show changes src/crypto/curve25519.h +33 −7 Original line number Diff line number Diff line #include <vector> #include <cstdint> #include <algorithm> #pragma once #include <stdint.h> namespace netplus { bool scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t point_u[32]); class FieldElement { public: std::vector<int32_t> limbs; FieldElement(); FieldElement(int v); FieldElement(const std::vector<int32_t>& v); FieldElement& operator=(const std::vector<int32_t>& v); FieldElement operator+(const FieldElement& other) const; FieldElement operator-(const FieldElement& other) const; FieldElement operator*(const FieldElement& other) const; FieldElement operator*(int32_t scalar) const; bool operator==(const FieldElement& other) const; void zero(); void one(); void to_bytes(std::vector<uint8_t>& out) const; FieldElement invert() const; private: friend FieldElement operator*(int32_t scalar, const FieldElement& fe); }; bool scalarmult_curve25519(std::vector<uint8_t> &out, const std::vector<uint8_t> &scalar, const std::vector<uint8_t> &point_u); bool scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32]); bool scalarmult_curve25519_base(std::vector<uint8_t> &out, const std::vector<uint8_t> &scalar); } // namespace netplus }; // namespace netplus src/socket.h +2 −2 Original line number Diff line number Diff line Loading @@ -606,8 +606,8 @@ namespace netplus { std::vector<uint8_t> _client_keyshare_x25519; // 32 bytes std::vector<uint8_t> _server_keyshare_x25519; uint8_t _server_priv_x25519[32]; uint8_t _server_pub_x25519[32]; std::vector<uint8_t> _server_priv_x25519; std::vector<uint8_t> _server_pub_x25519; std::vector<uint8_t> _client_keyshare_ecdhe; std::vector<uint8_t> _server_keyshare_ecdhe; Loading Loading
.vscode/tasks.json +11 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,17 @@ "command": "test", "problemMatcher": [], "detail": "CMake template test task" }, { "type": "cmake", "label": "CMake: clean rebuild", "command": "cleanRebuild", "targets": [ "all" ], "group": "build", "problemMatcher": [], "detail": "CMake template clean rebuild task" } ], "version": "2.0.0" Loading
CMakeLists.txt +3 −8 Original line number Diff line number Diff line project(libnetplus C CXX ASM ) project(libnetplus CXX C ASM ) cmake_minimum_required(VERSION 3.26) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH} ) Loading @@ -6,8 +6,6 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_CXX_STANDARD 17) #find_package(MbedTLS REQUIRED) if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") set (VISIBILTY_HIDDEN "__attribute__ ((visibility (\"hidden\")))") Loading @@ -16,9 +14,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") -fPIC \ -Wall \ -O1 \ -g \ -fsanitize=undefined,address \ " -g " ) set(CMAKE_C_FLAGS Loading @@ -26,8 +22,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") -fPIC \ -Wall \ -O1 \ -g \ -fsanitize=undefined,address " -g " ) endif() Loading
src/crypto/curve25519.cpp +339 −1369 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/crypto/curve25519.h +33 −7 Original line number Diff line number Diff line #include <vector> #include <cstdint> #include <algorithm> #pragma once #include <stdint.h> namespace netplus { bool scalarmult_curve25519(uint8_t out[32], const uint8_t scalar[32], const uint8_t point_u[32]); class FieldElement { public: std::vector<int32_t> limbs; FieldElement(); FieldElement(int v); FieldElement(const std::vector<int32_t>& v); FieldElement& operator=(const std::vector<int32_t>& v); FieldElement operator+(const FieldElement& other) const; FieldElement operator-(const FieldElement& other) const; FieldElement operator*(const FieldElement& other) const; FieldElement operator*(int32_t scalar) const; bool operator==(const FieldElement& other) const; void zero(); void one(); void to_bytes(std::vector<uint8_t>& out) const; FieldElement invert() const; private: friend FieldElement operator*(int32_t scalar, const FieldElement& fe); }; bool scalarmult_curve25519(std::vector<uint8_t> &out, const std::vector<uint8_t> &scalar, const std::vector<uint8_t> &point_u); bool scalarmult_curve25519_base(uint8_t out[32], const uint8_t scalar[32]); bool scalarmult_curve25519_base(std::vector<uint8_t> &out, const std::vector<uint8_t> &scalar); } // namespace netplus }; // namespace netplus
src/socket.h +2 −2 Original line number Diff line number Diff line Loading @@ -606,8 +606,8 @@ namespace netplus { std::vector<uint8_t> _client_keyshare_x25519; // 32 bytes std::vector<uint8_t> _server_keyshare_x25519; uint8_t _server_priv_x25519[32]; uint8_t _server_pub_x25519[32]; std::vector<uint8_t> _server_priv_x25519; std::vector<uint8_t> _server_pub_x25519; std::vector<uint8_t> _client_keyshare_ecdhe; std::vector<uint8_t> _server_keyshare_ecdhe; Loading