Skip to content

Commit

Permalink
Removed openssl code from 'detail' header, added it to public usage b…
Browse files Browse the repository at this point in the history
…ased on used crypto provider (#90)

Signed-off-by: AssemblyJohn <[email protected]>
  • Loading branch information
AssemblyJohn authored Aug 5, 2024
1 parent d1f9a77 commit aec3836
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ option(LIBEVSE_SECURITY_USE_BOOST_FILESYSTEM "Usage of boost/filesystem.hpp inst
option(LIBEVSE_CRYPTO_SUPPLIER_OPENSSL "Default OpenSSL cryptography supplier" ON)

# dependencies
find_package(OpenSSL 3 REQUIRED)
if (LIBEVSE_CRYPTO_SUPPLIER_OPENSSL)
find_package(OpenSSL 3 REQUIRED)
endif()

add_subdirectory(lib)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Copyright Pionix GmbH and Contributors to EVerest
#pragma once

#ifdef LIBEVSE_CRYPTO_SUPPLIER_OPENSSL

#include <evse_security/crypto/interface/crypto_supplier.hpp>

namespace evse_security {
Expand Down Expand Up @@ -54,4 +56,6 @@ class OpenSSLSupplier : public AbstractCryptoSupplier {
static bool base64_encode_from_string(const std::string& string, std::string& out_encoded);
};

} // namespace evse_security
} // namespace evse_security

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Copyright Pionix GmbH and Contributors to EVerest
#pragma once

#ifdef LIBEVSE_CRYPTO_SUPPLIER_OPENSSL

#include <memory>
#include <openssl/x509v3.h>

Expand Down Expand Up @@ -118,3 +120,5 @@ struct KeyHandleOpenSSL : public KeyHandle {
};

} // namespace evse_security

#endif
10 changes: 8 additions & 2 deletions lib/evse_security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ target_sources(evse_security

crypto/interface/crypto_supplier.cpp
crypto/interface/crypto_types.cpp
crypto/openssl/openssl_crypto_supplier.cpp
crypto/openssl/openssl_provider.cpp
)

if (LIBEVSE_CRYPTO_SUPPLIER_OPENSSL)
target_sources(evse_security
PRIVATE
crypto/openssl/openssl_crypto_supplier.cpp
crypto/openssl/openssl_provider.cpp
)
endif()

target_include_directories(evse_security
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
Expand Down
5 changes: 2 additions & 3 deletions lib/evse_security/crypto/openssl/openssl_crypto_supplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Copyright Pionix GmbH and Contributors to EVerest
#include <evse_security/crypto/openssl/openssl_crypto_supplier.hpp>

#include <evse_security/detail/openssl/openssl_types.hpp>
#include <evse_security/utils/evse_filesystem.hpp>

#include <everest/logging.hpp>

#include <algorithm>
Expand All @@ -23,6 +20,8 @@
#include <openssl/x509v3.h>

#include <evse_security/crypto/openssl/openssl_provider.hpp>
#include <evse_security/crypto/openssl/openssl_types.hpp>
#include <evse_security/utils/evse_filesystem.hpp>

namespace evse_security {

Expand Down

0 comments on commit aec3836

Please sign in to comment.