Skip to content

Commit

Permalink
Removed strict cert verification, added error string print
Browse files Browse the repository at this point in the history
Signed-off-by: AssemblyJohn <[email protected]>
  • Loading branch information
AssemblyJohn committed Feb 28, 2024
1 parent 703018b commit 7193907
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/evse_security/crypto/openssl/openssl_supplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,21 @@ bool OpenSSLSupplier::x509_is_child(X509Handle* child, X509Handle* parent) {

// If the parent is not a self-signed certificate, assume we have a partial chain
if (x509_is_selfsigned(parent) == false) {
// TODO(ioan): see if this strict flag is required
X509_STORE_CTX_set_flags(ctx.get(), X509_V_FLAG_X509_STRICT);
// TODO(ioan): see if this strict flag is required, caused many problems
// X509_STORE_CTX_set_flags(ctx.get(), X509_V_FLAG_X509_STRICT);

X509_STORE_CTX_set_flags(ctx.get(), X509_V_FLAG_PARTIAL_CHAIN);
}

return (X509_verify_cert(ctx.get()) == 1);
if (X509_verify_cert(ctx.get()) != 1) {
int ec = X509_STORE_CTX_get_error(ctx.get());
const char* error = X509_verify_cert_error_string(ec);

EVLOG_debug << "Certificate issued by error: " << (error != nullptr) ? error : "UNKNOWN";

Check notice on line 530 in lib/evse_security/crypto/openssl/openssl_supplier.cpp

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lib/evse_security/crypto/openssl/openssl_supplier.cpp#L530

Clarify calculation precedence for '<<' and '?'.
return false;
}

return true;
}

bool OpenSSLSupplier::x509_is_selfsigned(X509Handle* handle) {
Expand Down

0 comments on commit 7193907

Please sign in to comment.