Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ cc_library(
name = "ncrypto",
srcs = glob(["src/*.cpp"]),
hdrs = glob(["include/*.h", "include/ncrypto/*.h"]),
copts = [
"-Werror",
"-Wextra",
"-Wno-unused-parameter",
"-Wimplicit-fallthrough",
"-Wno-deprecated-declarations", # OpenSSL 3.0 deprecates many APIs we intentionally use
],
includes = ["include"],
local_defines = {
"NCRYPTO_BSSL_LIBDECREPIT_MISSING": select(
Expand Down
2 changes: 1 addition & 1 deletion include/ncrypto/aead.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Aead final {

public:
Aead() = default;
Aead(const AeadInfo* info, const EVP_AEAD* aead) : info_(info), aead_(aead) {}
Aead(const AeadInfo* info, const EVP_AEAD* aead) : aead_(aead), info_(info) {}
Aead(const Aead&) = default;
Aead& operator=(const Aead&) = default;
NCRYPTO_DISALLOW_MOVE(Aead)
Expand Down
22 changes: 22 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
add_library(ncrypto ncrypto.cpp engine.cpp aead.cpp)

# Enable strict warning flags for ncrypto sources only
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
target_compile_options(ncrypto PRIVATE
-Werror
-Wextra
-Wno-unused-parameter
-Wimplicit-fallthrough
-Wno-deprecated-declarations # OpenSSL 3.0 deprecates many APIs we intentionally use
)
elseif(MSVC)
target_compile_options(ncrypto PRIVATE
/WX # Treat warnings as errors
/W3 # Warning level 3 (production quality)
/wd4100 # Unreferenced formal parameter (like -Wno-unused-parameter)
/wd4267 # Conversion from 'size_t' to smaller type
/wd4244 # Conversion, possible loss of data
/wd4305 # Truncation from 'int' to 'bool'
/wd4127 # Conditional expression is constant
)
endif()

if (NCRYPTO_SHARED_LIBS)
target_link_libraries(ncrypto PUBLIC OpenSSL::SSL OpenSSL::Crypto)
else()
Expand Down