Skip to content

Commit

Permalink
harness/openssl: add some flags (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw authored Jul 26, 2023
1 parent 513f7e9 commit 53fb420
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions harness/openssl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ json evaluate_testcase(const json &testcase)

X509_STORE_ptr store(X509_STORE_new(), X509_STORE_free);
X509_STORE_set_flags(store.get(), X509_V_FLAG_X509_STRICT);
// NOTE(ww): This flag is terribly named; it tells OpenSSL to
// treat intermediate certificates in the root store as trust anchors,
// which they already are (by virtue of being in the trust store).
// This isn't the default for backwards compatibility reasons,
// but it's consistent with how just about every other path building
// implementation works.
X509_STORE_set_flags(store.get(), X509_V_FLAG_PARTIAL_CHAIN);
for (auto &cert : testcase["trusted_certs"])
{
auto cert_pem = cert.template get<std::string>();
Expand Down Expand Up @@ -141,6 +148,10 @@ json evaluate_testcase(const json &testcase)
auto tm = std::chrono::system_clock::to_time_t(tp);
X509_STORE_CTX_set_time(ctx.get(), 0, tm);
}
else
{
X509_STORE_set_flags(store.get(), X509_V_FLAG_NO_CHECK_TIME);
}

if (testcase["expected_peer_name"].is_object())
{
Expand Down

0 comments on commit 53fb420

Please sign in to comment.