diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-06-17 11:33:16 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-06-17 11:33:16 +1000 |
commit | 4f2271d58a36b2aee125062ffb9626c6208fa394 (patch) | |
tree | 122e6de930647c37a35b5f457448a031e51969b8 /test/recipes | |
parent | 5a147abd790075cdc97b36ff5084e2eb1d779b95 (diff) |
Add ACVP fips module tests
For FIPS validation purposes - Automated Cryptographic Validation Protocol (ACVP) tests need to be
performed. (See https://github.com/usnistgov/ACVP). These tests are very similiar to the old CAVS tests.
This PR uses a hardwired subset of these test vectors to perform similiar operations,
to show the usage and prove that the API's are able to perform the required operations.
It may also help with communication with the lab (i.e- The lab could add a test here to show
a unworking use case - which we can then address).
The EVP layer performs these tests instead of calling lower level API's
as was done in the old FOM.
Some of these tests require access to internals that are not normally allowed/required.
The config option 'acvp_tests' (enabled by default) has been added so that this
access may be removed.
The mechanism has been implemented as additional OSSL_PARAM values that can be set and get.
A callback mechanism did not seem to add any additional benefit.
These params will not be added to the gettables lists.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11572)
Diffstat (limited to 'test/recipes')
-rw-r--r-- | test/recipes/30-test_acvp.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/recipes/30-test_acvp.t b/test/recipes/30-test_acvp.t new file mode 100644 index 0000000000..e2e40aaa76 --- /dev/null +++ b/test/recipes/30-test_acvp.t @@ -0,0 +1,41 @@ +#! /usr/bin/env perl +# Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +use strict; +use warnings; + +use OpenSSL::Test qw(:DEFAULT bldtop_dir srctop_dir srctop_file bldtop_file); +use OpenSSL::Test::Utils; + +BEGIN { +setup("test_acvp"); +} + +my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0); + +plan skip_all => "ACVP is not supported by this test" + if $no_fips || disabled("acvp_tests"); + +use lib srctop_dir('Configurations'); +use lib bldtop_dir('.'); +use platform; + +my $infile = bldtop_file('providers', platform->dso('fips')); + +plan tests => 2; + +ok(run(app(['openssl', 'fipsinstall', + '-out', bldtop_file('providers', 'fipsmodule.cnf'), + '-module', $infile, + '-provider_name', 'fips', '-mac_name', 'HMAC', + '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00', + '-section_name', 'fips_sect'])), + "fipsinstall"); + +ok(run(test(["acvp_test", "-config", srctop_file("test","fips.cnf")])), + "running acvp_test"); |