Skip to content

Commit 53fb420

Browse files
authored
harness/openssl: add some flags (#29)
Signed-off-by: William Woodruff <william@trailofbits.com>
1 parent 513f7e9 commit 53fb420

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

harness/openssl/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ json evaluate_testcase(const json &testcase)
112112

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

145156
if (testcase["expected_peer_name"].is_object())
146157
{

0 commit comments

Comments
 (0)