From b1325f0077b76d76be5b0a3ac7ee531be594ce6f Mon Sep 17 00:00:00 2001 From: Jonas Allmann Date: Tue, 11 Dec 2018 11:45:58 +0100 Subject: Bug 1508666 - AES-GCM Wycheproof testcases, r=franziskus This patch also introduces the ./mach wycheproof command to update wycheproof test cases. Differential Revision: https://phabricator.services.mozilla.com/D12559 --- mach | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'mach') diff --git a/mach b/mach index 178cfeb74..46b3ad7b1 100755 --- a/mach +++ b/mach @@ -17,6 +17,7 @@ import platform import tempfile from hashlib import sha256 +from gtests.common.wycheproof.genaesgcm import generate_aes_gcm DEVNULL = open(os.devnull, 'wb') cwd = os.path.dirname(os.path.abspath(__file__)) @@ -212,6 +213,22 @@ class commandsAction(argparse.Action): for c in commandsAction.commands: print(c) +class wycheproofAction(argparse.Action): + tests = ['aes_gcm_test.json'] + + def __call__(self, parser, args, values, option_string=None): + self.update_tests() + generate_aes_gcm() + clangFormat = cfAction(None, None, None) + clangFormat(None, args, None) + + def update_tests(self): + remote = "https://raw.githubusercontent.com/google/wycheproof/master/testvectors/" + for test in self.tests: + subprocess.check_call(['wget', remote+test, '-O', + 'gtests/common/wycheproof/testvectors/'+test, + '--no-check-certificate']) + def parse_arguments(): parser = argparse.ArgumentParser( @@ -270,6 +287,18 @@ def parse_arguments(): nargs='*', action=commandsAction) + parser_wycheproof = subparsers.add_parser( + 'wycheproof', + help="generate wycheproof test headers") + parser_wycheproof.add_argument( + '--noroot', + help='On linux, suppress the use of \'sudo\' for running docker.', + action='store_true') + parser_wycheproof.add_argument( + 'wycheproof', + nargs='*', + action=wycheproofAction) + commandsAction.commands = [c for c in subparsers.choices] return parser.parse_args() -- cgit v1.2.1