func TestMain(m *testing.M) { … } func wrapperMain() { … } type request … type commandHandler … type command … var capabilitiesJson … var commands … func processingLoop(reader io.Reader, writer io.Writer) error { … } func readRequest(reader io.Reader) (*request, error) { … } func readArgs(reader io.Reader, requiredArgs uint32) ([][]byte, error) { … } func writeResponse(writer io.Writer, args [][]byte) error { … } // "All implementations must support the getConfig command // which takes no arguments and returns a single byte string // which is a JSON blob of ACVP algorithm configuration." func cmdGetConfig() command { … } // cmdHashAft returns a command handler for the specified hash // algorithm for algorithm functional test (AFT) test cases. // // This shape of command expects a message as the sole argument, // and writes the resulting digest as a response. // // See https://pages.nist.gov/ACVP/draft-celi-acvp-sha.html func cmdHashAft(h fips.Hash) command { … } // cmdHashMct returns a command handler for the specified hash // algorithm for monte carlo test (MCT) test cases. // // This shape of command expects a seed as the sole argument, // and writes the resulting digest as a response. It implements // the "standard" flavour of the MCT, not the "alternative". // // This algorithm was ported from `HashMCT` in BSSL's `modulewrapper.cc` // Note that it differs slightly from the upstream NIST MCT[0] algorithm // in that it does not perform the outer 100 iterations itself. See // footnote #1 in the ACVP.md docs[1], the acvptool handles this. // // [0]: https://pages.nist.gov/ACVP/draft-celi-acvp-sha.html#section-6.2 // [1]: https://boringssl.googlesource.com/boringssl/+/refs/heads/master/util/fipstools/acvp/ACVP.md#testing-other-fips-modules func cmdHashMct(h fips.Hash) command { … } // cmdSha3Mct returns a command handler for the specified hash // algorithm for SHA-3 monte carlo test (MCT) test cases. // // This shape of command expects a seed as the sole argument, // and writes the resulting digest as a response. It implements // the "standard" flavour of the MCT, not the "alternative". // // This algorithm was ported from the "standard" MCT algorithm // specified in draft-celi-acvp-sha3[0]. Note this differs from // the SHA2-* family of MCT tests handled by cmdHashMct. However, // like that handler it does not perform the outer 100 iterations. // // [0]: https://pages.nist.gov/ACVP/draft-celi-acvp-sha3.html#section-6.2.1 func cmdSha3Mct(h fips.Hash) command { … } func cmdHmacAft(h func() fips.Hash) command { … } func TestACVP(t *testing.T) { … } func fetchModule(t *testing.T, module, version string) string { … } func TestTooFewArgs(t *testing.T) { … } func TestTooManyArgs(t *testing.T) { … } func TestGetConfig(t *testing.T) { … } func TestSha2256(t *testing.T) { … } func mockRequest(t *testing.T, cmd string, args [][]byte) io.Reader { … } func readResponse(t *testing.T, reader io.Reader) [][]byte { … }