Skip to content

Commit

Permalink
- Update Readme
Browse files Browse the repository at this point in the history
- Fix in benchmark code
  • Loading branch information
bhess committed Jan 26, 2024
1 parent 8db36f4 commit 0e3fafb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The default build type uses `-O3 -Wstrict-prototypes -Wno-error=strict-prototype

## Build artifacts

The following artefacts are built:
The following artifacts are built:

- `libmayo_common_sys.a`: library with common crypto - AES, Keccak and system random number generator.
- `libmary_common_test.a`: library with common crypto for deterministic tests - AES, Keccak and CTR-DRBG PRNG.
Expand All @@ -91,10 +91,10 @@ The following artefacts are built:
- `libmayo_<level>_nistapi.a`: library for `MAYO_<level>` against the NIST API.
- `libmayo_<level>_nistapi_test.a`: library for `MAYO_<level>` against the NIST API. Only for test, using the deterministic CTR-DRBG as backend.
- `mayo_bench_<param>`: Benchmarking suites.
- `mayo_test_kat_<param>`: KAT test suites.
- `mayo_test_scheme_<param>`: Self-test suites.
- `mayo_test_kat_<param>` (`opt` and `avx2`), `mayo_test_kat` (`ref`): KAT test suites.
- `mayo_test_scheme_<param>` (`opt` and `avx2`), `mayo_test_scheme` (`ref`): Self-test suites.
- `PQCgenKAT_sign_<param>`: App for generating NIST KAT.
- `example_<param>`: Example app using the MAYO API.
- `example_<param>` (`opt` and `avx2`), `example_mayo` (`ref`): Example app using the MAYO API.
- `example_nistapi_<param>`: Example app using the NIST API.

## Test
Expand All @@ -121,9 +121,13 @@ KAT verification is done as part of the test harness (see previous section).

## Benchmarks

A benchmarking suite is built and runs with the following command:
A benchmarking suite is built and runs with the following command, where `params` specifies the MAYO parameter set and `runs` the number of benchmark runs:

- `test/mayo_bench_<param> <runs>`, where params specifies the MAYO parameter set and runs the number of benchmark runs.
If `MAYO_BUILD_TYPE` is `opt` or `avx2`:
- `test/mayo_bench_<param> <runs>`,

If `MAYO_BUILD_TYPE` is `ref`:
- `test/mayo_bench <param> <runs>`,

The benchmarks profile the `MAYO.CompactKeyGen`, `MAYO.expandSK`, `MAYO.expandSK`, `MAYO.sign` and `MAYO.verify` functions. The results are reported in CPU cycles if available on the host platform, and timing in nanoseconds otherwise.

Expand Down
3 changes: 2 additions & 1 deletion test/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int bench_sig(const mayo_params_t *p, int runs, int csv) {
unsigned char *pk = calloc(p->cpk_bytes, 1);
unsigned char *epk = calloc(p->epk_bytes, 1);
unsigned char *sk = calloc(p->csk_bytes, 1);
sk_t *esk = (sk_t *)calloc(p->esk_bytes, 1);
sk_t *esk = (sk_t *)calloc(sizeof(sk_t), 1);
unsigned char *sig = calloc(p->sig_bytes + m_len, 1);
unsigned char *m = calloc(m_len, 1);
unsigned long long len = p->sig_bytes;
Expand Down Expand Up @@ -137,6 +137,7 @@ static int bench_sig(const mayo_params_t *p, int runs, int csv) {

free(pk);
free(sk);
free(epk);
free(esk);
free(sig);
free(m);
Expand Down

0 comments on commit 0e3fafb

Please sign in to comment.