Skip to content

Commit

Permalink
test_fips: two tweaks
Browse files Browse the repository at this point in the history
  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>
  • Loading branch information
agl authored and Boringssl LUCI CQ committed Jun 20, 2024
1 parent 84dc9bb commit d1e6d3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions util/fipstools/test_fips.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit d1e6d3b

Please sign in to comment.