Skip to content
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b37e882
x509storeissuer: factor out usage printing
esyr Oct 20, 2025
c201051
s/err/error where apropriate easiest way to fix liner issues on windows
Sashan Sep 29, 2025
948ffbd
Use perflib/err.h unconditionally
esyr Sep 25, 2025
2b3b804
perflib: add vwarn/err/warn
esyr Sep 25, 2025
ec81797
x509storeissuer: use errx/warnx for error message output
esyr Oct 20, 2025
7bbc211
x509storeissuer: factor out integer parameter parsing into a separate…
esyr Oct 20, 2025
a76d93b
x509storeissuer: provide the initial infrastructure for nonce configu…
esyr Oct 20, 2025
7e32341
x509storeissuer: add ability to configure verbosity level
esyr Oct 20, 2025
6b9361a
x509storeissuer: unify funtion definition formatting
esyr Oct 20, 2025
3924835
x509storeissuer: add -T option to specify the run time
esyr Oct 20, 2025
0b3b091
x509storeissuer: support providing multiple certificate directories
esyr Oct 20, 2025
c7f19dc
x509storeissuer: reduce the rate ossl_time_now() queries
esyr Oct 21, 2025
effd1b7
x509storeissuer: count the iterations in a local variable to avoid ha…
esyr Oct 21, 2025
a4c199d
x509storeissuer: tolerate X509_STORE_CTX_get1_issuer() successes, cou…
esyr Oct 21, 2025
4f491bf
x509storeissuer: add certificates from the provided directories to th…
esyr Oct 21, 2025
fc6682d
x509storeissuer: add and option to configure X509_STORE_CTX sharing
esyr Oct 21, 2025
5724e00
x509storeissuer: report the store size before the test run if the ver…
esyr Oct 22, 2025
a5d0c9e
x509storeissuer: make the verbose reporting more elaborate
esyr Oct 22, 2025
2282242
x509storeissuer: generate some certificates and add them to the store
esyr Oct 22, 2025
c3c4152
x509storeissuer: add support for gernerated nonces
esyr Oct 22, 2025
806e3ee
x509storeissuer: add ability to add certificates to the store during …
esyr Oct 22, 2025
9147f7f
x509storeissuer: make thread_data cache-line-aligned
esyr Oct 23, 2025
4b335f7
.github/workflows/test.yml: do not build OpenSSL apps and tests
esyr Oct 23, 2025
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
69 changes: 27 additions & 42 deletions source/x509storeissuer.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void do_x509storeissuer(size_t num)
OSSL_TIME time;

if (ctx == NULL || !X509_STORE_CTX_init(ctx, store, x509, NULL)) {
printf("Failed to initialise X509_STORE_CTX\n");
warnx("Failed to initialise X509_STORE_CTX");
error = 1;
goto err;
}
Expand All @@ -55,7 +55,7 @@ static void do_x509storeissuer(size_t num)
* against an empty store.
*/
if (X509_STORE_CTX_get1_issuer(&issuer, ctx, x509) != 0) {
printf("Unexpected result from X509_STORE_CTX_get1_issuer\n");
warnx("Unexpected result from X509_STORE_CTX_get1_issuer");
error = 1;
X509_free(issuer);
goto err;
Expand Down Expand Up @@ -101,63 +101,48 @@ int main(int argc, char *argv[])
}
}

if (argv[optind] == NULL) {
printf("certsdir is missing\n");
goto err;
}
if (argv[optind] == NULL)
errx(EXIT_FAILURE, "certsdir is missing");

cert = perflib_mk_file_path(argv[optind], "servercert.pem");
if (cert == NULL) {
printf("Failed to allocate cert\n");
goto err;
}
if (cert == NULL)
errx(EXIT_FAILURE, "Failed to allocate cert path");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing goto err on every errx.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errx() does exit() so goto won't be executed.


optind++;

if (argv[optind] == NULL) {
printf("threadcount is missing\n");
goto err;
}
if (argv[optind] == NULL)
errx(EXIT_FAILURE, "threadcount is missing");

threadcount = atoi(argv[optind]);
if (threadcount < 1) {
printf("threadcount must be > 0\n");
goto err;
}
if (threadcount < 1)
errx(EXIT_FAILURE, "threadcount must be > 0");

store = X509_STORE_new();
if (store == NULL || !X509_STORE_set_default_paths(store)) {
printf("Failed to create X509_STORE\n");
goto err;
}
if (store == NULL || !X509_STORE_set_default_paths(store))
errx(EXIT_FAILURE, "Failed to create X509_STORE");

bio = BIO_new_file(cert, "rb");
if (bio == NULL) {
printf("Unable to load certificate\n");
goto err;
}
if (bio == NULL)
errx(EXIT_FAILURE, "Unable to load certificate\n");

x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL);
if (x509 == NULL) {
printf("Failed to read certificate\n");
goto err;
}
if (x509 == NULL)
errx(EXIT_FAILURE, "Failed to read certificate");

BIO_free(bio);
bio = NULL;

counts = OPENSSL_malloc(sizeof(size_t) * threadcount);
if (counts == NULL) {
printf("Failed to create counts array\n");
goto err;
}
if (counts == NULL)
errx(EXIT_FAILURE, "Failed to create counts array");

max_time = ossl_time_add(ossl_time_now(), ossl_seconds2time(RUN_TIME));

if (!perflib_run_multi_thread_test(do_x509storeissuer, threadcount, &duration)) {
printf("Failed to run the test\n");
goto err;
}
if (!perflib_run_multi_thread_test(do_x509storeissuer, threadcount, &duration))
errx(EXIT_FAILURE, "Failed to run the test");

if (error) {
printf("Error during test\n");
goto err;
}
if (error)
errx(EXIT_FAILURE, "Error during test");

for (i = 0; i < threadcount; i++)
total_count += counts[i];
Expand Down