diff options
author | Adam Langley <agl@imperialviolet.org> | 2024-06-19 21:09:51 +0000 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-06-20 18:14:39 +0000 |
commit | d1e6d3b4af50c9490cc6210e2763b3c45ba14b07 (patch) | |
tree | baa43382cd6baa2511ab122f052e78dcdf1c749c /util | |
parent | 84dc9bb624b47bda0bf802ae9e04a6eecb40865c (diff) | |
download | boringssl-d1e6d3b4af50c9490cc6210e2763b3c45ba14b07.zip boringssl-d1e6d3b4af50c9490cc6210e2763b3c45ba14b07.tar.gz boringssl-d1e6d3b4af50c9490cc6210e2763b3c45ba14b07.tar.bz2 |
test_fips: two tweaks
1. Ensure that the output is line buffered so that nothing is lost
when tests fail.
2. Check that FIPS_mode returns the expected mode so that we have
evidence for this during testing.
Change-Id: Ib294e890a21e8002d5e2a646f08b49a03e645cb2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69487
Auto-Submit: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/fipstools/test_fips.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/util/fipstools/test_fips.c b/util/fipstools/test_fips.c index a628213..c779180 100644 --- a/util/fipstools/test_fips.c +++ b/util/fipstools/test_fips.c @@ -50,6 +50,17 @@ static void hexdump(const void *a, size_t len) { int main(int argc, char **argv) { CRYPTO_library_init(); + // Ensure that the output is line-buffered rather than fully buffered. When + // some of the tests fail, some of the output can otherwise be lost. + setvbuf(stdout, NULL, _IOLBF, 0); + setvbuf(stderr, NULL, _IOLBF, 0); + + if (!FIPS_mode()) { + printf("Module not in FIPS mode\n"); + goto err; + } + printf("Module is in FIPS mode\n"); + const uint32_t module_version = FIPS_version(); if (module_version == 0) { printf("No module version set\n"); |