Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/75 deprecate openssl 1 #76

Merged
merged 5 commits into from
May 27, 2024
Merged
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ 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 REQUIRED)
find_package(OpenSSL 3 REQUIRED)

add_subdirectory(lib)

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All documentation and the issue tracking can be found in our main repository her

## Prerequisites

The library requires OpenSSL 1.1.1.
The library requires OpenSSL 3.

## Build Instructions

Expand Down Expand Up @@ -61,7 +61,6 @@ When receiving back a signed CSR, the library will take care to create two files
## TPM
There is a configuration option to configure OpenSSL for use with a TPM.<br>
`cmake` ... `-DUSING_TPM2=ON`<br>
Note OpenSSL providers are not available for OpenSSL v1, OpenSSL v3 is required.

The library will use the `UseTPM` flag and the PEM private key file to
configure whether to use the `default` provider or the `tpm2` provider.
Expand Down
7 changes: 4 additions & 3 deletions include/evse_security/crypto/interface/crypto_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ namespace evse_security {
enum class CryptoKeyType {
EC_prime256v1, // Default EC. P-256, ~equiv to rsa 3072
EC_secp384r1, // P-384, ~equiv to rsa 7680
RSA_TPM20, // Default TPM RSA, only option allowed for TPM (universal support), 2048 bits
RSA_3072, // Default RSA. Protection lifetime: ~2030
RSA_7680, // Protection lifetime: >2031. Very long generation time 8-40s on 16 core PC
RSA_2048,
RSA_TPM20 = RSA_2048, // Default TPM RSA, only option allowed for TPM (universal support), 2048 bits
RSA_3072, // Default RSA. Protection lifetime: ~2030
RSA_7680, // Protection lifetime: >2031. Very long generation time 8-40s on 16 core PC
};

enum class KeyValidationResult {
Expand Down
205 changes: 0 additions & 205 deletions include/evse_security/detail/openssl/openssl_providers.hpp

This file was deleted.

23 changes: 0 additions & 23 deletions include/evse_security/detail/openssl/openssl_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <memory>
#include <openssl/x509v3.h>

#define EVSE_OPENSSL_VER_3 (OPENSSL_VERSION_NUMBER >= 0x30000000L)

template <> class std::default_delete<X509> {
public:
void operator()(X509* ptr) const {
Expand Down Expand Up @@ -77,22 +75,6 @@ template <> class std::default_delete<EVP_ENCODE_CTX> {
}
};

#if !EVSE_OPENSSL_VER_3
template <> class std::default_delete<EC_KEY> {
public:
void operator()(EC_KEY* ptr) const {
::EC_KEY_free(ptr);
}
};

template <> class std::default_delete<RSA> {
public:
void operator()(RSA* ptr) const {
::RSA_free(ptr);
}
};
#endif

namespace evse_security {

using X509_ptr = std::unique_ptr<X509>;
Expand All @@ -108,9 +90,4 @@ using BIO_ptr = std::unique_ptr<BIO>;
using EVP_MD_CTX_ptr = std::unique_ptr<EVP_MD_CTX>;
using EVP_ENCODE_CTX_ptr = std::unique_ptr<EVP_ENCODE_CTX>;

#if !EVSE_OPENSSL_VER_3
using EC_KEY_ptr = std::unique_ptr<EC_KEY>;
using RSA_ptr = std::unique_ptr<RSA>;
#endif

} // namespace evse_security
Loading
Loading