blob: a0127be863a2662e41480dba57e739c47f8f9849 [file] [log] [blame]
Valerio Setti8d178be2023-10-17 12:23:55 +02001#!/usr/bin/env python3
Gilles Peskine15c2cbf2020-06-25 18:36:28 +02002
3"""Analyze the test outcomes from a full CI run.
4
5This script can also run on outcomes from a partial run, but the results are
6less likely to be useful.
7"""
8
9import argparse
10import sys
11import traceback
Przemek Stekiel85c54ea2022-11-17 11:50:23 +010012import re
Valerio Settia2663322023-03-24 08:20:18 +010013import subprocess
14import os
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020015
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020016import check_test_cases
17
Valerio Settif075e472023-10-17 11:03:16 +020018class Results:
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020019 """Process analysis results."""
20
21 def __init__(self):
22 self.error_count = 0
23 self.warning_count = 0
Valerio Settiaaef0bc2023-10-10 09:42:13 +020024
Valerio Setti2cff8202023-10-18 14:36:47 +020025 def new_section(self, fmt, *args, **kwargs):
26 self._print_line('\n*** ' + fmt + ' ***\n', *args, **kwargs)
27
Valerio Settiaaef0bc2023-10-10 09:42:13 +020028 def info(self, fmt, *args, **kwargs):
Valerio Setti8070dbe2023-10-17 12:29:30 +020029 self._print_line('Info: ' + fmt, *args, **kwargs)
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020030
31 def error(self, fmt, *args, **kwargs):
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020032 self.error_count += 1
Valerio Setti8070dbe2023-10-17 12:29:30 +020033 self._print_line('Error: ' + fmt, *args, **kwargs)
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020034
35 def warning(self, fmt, *args, **kwargs):
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020036 self.warning_count += 1
Valerio Setti8070dbe2023-10-17 12:29:30 +020037 self._print_line('Warning: ' + fmt, *args, **kwargs)
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020038
Valerio Setti3f339892023-10-17 10:42:11 +020039 @staticmethod
Valerio Setti8070dbe2023-10-17 12:29:30 +020040 def _print_line(fmt, *args, **kwargs):
Valerio Setti735794c2023-10-18 08:05:15 +020041 sys.stderr.write((fmt + '\n').format(*args, **kwargs))
Valerio Settiaaef0bc2023-10-10 09:42:13 +020042
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020043class TestCaseOutcomes:
44 """The outcomes of one test case across many configurations."""
45 # pylint: disable=too-few-public-methods
46
47 def __init__(self):
Gilles Peskine3d863f22020-06-26 13:02:30 +020048 # Collect a list of witnesses of the test case succeeding or failing.
49 # Currently we don't do anything with witnesses except count them.
50 # The format of a witness is determined by the read_outcome_file
51 # function; it's the platform and configuration joined by ';'.
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020052 self.successes = []
53 self.failures = []
54
55 def hits(self):
56 """Return the number of times a test case has been run.
57
58 This includes passes and failures, but not skips.
59 """
60 return len(self.successes) + len(self.failures)
61
Valerio Settif075e472023-10-17 11:03:16 +020062def execute_reference_driver_tests(results: Results, ref_component, driver_component, \
Valerio Setti781c2342023-10-17 12:47:35 +020063 outcome_file):
Valerio Setti22992a02023-03-29 11:15:28 +020064 """Run the tests specified in ref_component and driver_component. Results
65 are stored in the output_file and they will be used for the following
Valerio Settia2663322023-03-24 08:20:18 +010066 coverage analysis"""
67 # If the outcome file already exists, we assume that the user wants to
68 # perform the comparison analysis again without repeating the tests.
69 if os.path.exists(outcome_file):
Valerio Setti39d4b9d2023-10-18 14:30:03 +020070 results.info("Outcome file ({}) already exists. Tests will be skipped.", outcome_file)
Valerio Setti781c2342023-10-17 12:47:35 +020071 return
Valerio Settia2663322023-03-24 08:20:18 +010072
73 shell_command = "tests/scripts/all.sh --outcome-file " + outcome_file + \
74 " " + ref_component + " " + driver_component
Valerio Setti39d4b9d2023-10-18 14:30:03 +020075 results.info("Running: {}", shell_command)
Valerio Settia2663322023-03-24 08:20:18 +010076 ret_val = subprocess.run(shell_command.split(), check=False).returncode
77
78 if ret_val != 0:
Valerio Settif075e472023-10-17 11:03:16 +020079 results.error("failed to run reference/driver components")
Valerio Settiaaef0bc2023-10-10 09:42:13 +020080
Tomás Gonzálezb401e112023-08-11 15:22:04 +010081def analyze_coverage(results, outcomes, allow_list, full_coverage):
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020082 """Check that all available test cases are executed at least once."""
Gilles Peskine686c2922022-01-07 15:58:38 +010083 available = check_test_cases.collect_available_test_cases()
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020084 for key in available:
85 hits = outcomes[key].hits() if key in outcomes else 0
Tomás González07bdcc22023-08-11 14:59:03 +010086 if hits == 0 and key not in allow_list:
Tomás Gonzálezb401e112023-08-11 15:22:04 +010087 if full_coverage:
88 results.error('Test case not executed: {}', key)
89 else:
90 results.warning('Test case not executed: {}', key)
Tomás González07bdcc22023-08-11 14:59:03 +010091 elif hits != 0 and key in allow_list:
92 # Test Case should be removed from the allow list.
Tomás González7ebb18f2023-08-22 09:40:23 +010093 if full_coverage:
Tomás Gonzáleza0631442023-08-22 12:17:57 +010094 results.error('Allow listed test case was executed: {}', key)
Tomás González7ebb18f2023-08-22 09:40:23 +010095 else:
96 results.warning('Allow listed test case was executed: {}', key)
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020097
Manuel Pégourié-Gonnard881ce012023-10-18 10:22:07 +020098def name_matches_pattern(name, str_or_re):
99 """Check if name matches a pattern, that may be a string or regex.
100 - If the pattern is a string, name must be equal to match.
101 - If the pattern is a regex, name must fully match.
102 """
Manuel Pégourié-Gonnardb2695432023-10-23 09:30:40 +0200103 # The CI's python is too old for re.Pattern
104 #if isinstance(str_or_re, re.Pattern):
105 if not isinstance(str_or_re, str):
Manuel Pégourié-Gonnard881ce012023-10-18 10:22:07 +0200106 if str_or_re.fullmatch(name):
107 return True
108 else:
109 if str_or_re == name:
110 return True
111 return False
112
Valerio Settif075e472023-10-17 11:03:16 +0200113def analyze_driver_vs_reference(results: Results, outcomes,
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200114 component_ref, component_driver,
Manuel Pégourié-Gonnard881ce012023-10-18 10:22:07 +0200115 ignored_suites, ignored_tests=None):
Przemek Stekiel4e955902022-10-21 13:42:08 +0200116 """Check that all tests executed in the reference component are also
117 executed in the corresponding driver component.
Valerio Setti3002c992023-01-18 17:28:36 +0100118 Skip:
119 - full test suites provided in ignored_suites list
120 - only some specific test inside a test suite, for which the corresponding
121 output string is provided
Przemek Stekiel4e955902022-10-21 13:42:08 +0200122 """
Manuel Pégourié-Gonnard371165a2023-10-18 12:44:54 +0200123 seen_reference_passing = False
124 for key in outcomes:
Manuel Pégourié-Gonnard4da369f2023-10-18 09:40:32 +0200125 # key is like "test_suite_foo.bar;Description of test case"
126 (full_test_suite, test_string) = key.split(';')
Valerio Setti00c1ccb2023-02-02 11:33:31 +0100127 test_suite = full_test_suite.split('.')[0] # retrieve main part of test suite name
Manuel Pégourié-Gonnard371165a2023-10-18 12:44:54 +0200128
129 # Immediately skip fully-ignored test suites
Manuel Pégourié-Gonnard7d381f52023-03-17 15:13:08 +0100130 if test_suite in ignored_suites or full_test_suite in ignored_suites:
Valerio Setti00c1ccb2023-02-02 11:33:31 +0100131 continue
Manuel Pégourié-Gonnard371165a2023-10-18 12:44:54 +0200132
133 # For ignored test cases inside test suites, just remember and:
134 # don't issue an error if they're skipped with drivers,
135 # but issue an error if they're not (means we have a bad entry).
136 ignored = False
Manuel Pégourié-Gonnard881ce012023-10-18 10:22:07 +0200137 if full_test_suite in ignored_tests:
138 for str_or_re in ignored_tests[full_test_suite]:
139 if name_matches_pattern(test_string, str_or_re):
Manuel Pégourié-Gonnard371165a2023-10-18 12:44:54 +0200140 ignored = True
Manuel Pégourié-Gonnard4da369f2023-10-18 09:40:32 +0200141
Przemek Stekiel4e955902022-10-21 13:42:08 +0200142 # Search for tests that run in reference component and not in driver component
143 driver_test_passed = False
144 reference_test_passed = False
145 for entry in outcomes[key].successes:
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100146 if component_driver in entry:
Przemek Stekiel4e955902022-10-21 13:42:08 +0200147 driver_test_passed = True
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100148 if component_ref in entry:
Przemek Stekiel4e955902022-10-21 13:42:08 +0200149 reference_test_passed = True
Manuel Pégourié-Gonnard371165a2023-10-18 12:44:54 +0200150 seen_reference_passing = True
Manuel Pégourié-Gonnardc6967d22022-12-30 13:40:34 +0100151 if(reference_test_passed and not driver_test_passed):
Manuel Pégourié-Gonnard371165a2023-10-18 12:44:54 +0200152 if not ignored:
153 results.error("PASS -> SKIP/FAIL: {}", key)
154 else:
155 if ignored:
156 results.error("uselessly ignored: {}", key)
157
158 if not seen_reference_passing:
159 results.error("no passing test in reference component: bad outcome file?")
Przemek Stekiel4e955902022-10-21 13:42:08 +0200160
Valerio Setti781c2342023-10-17 12:47:35 +0200161def analyze_outcomes(results: Results, outcomes, args):
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200162 """Run all analyses on the given outcome collection."""
Valerio Settif075e472023-10-17 11:03:16 +0200163 analyze_coverage(results, outcomes, args['allow_list'],
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100164 args['full_coverage'])
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200165
166def read_outcome_file(outcome_file):
167 """Parse an outcome file and return an outcome collection.
168
169An outcome collection is a dictionary mapping keys to TestCaseOutcomes objects.
170The keys are the test suite name and the test case description, separated
171by a semicolon.
172"""
173 outcomes = {}
174 with open(outcome_file, 'r', encoding='utf-8') as input_file:
175 for line in input_file:
176 (platform, config, suite, case, result, _cause) = line.split(';')
177 key = ';'.join([suite, case])
178 setup = ';'.join([platform, config])
179 if key not in outcomes:
180 outcomes[key] = TestCaseOutcomes()
181 if result == 'PASS':
182 outcomes[key].successes.append(setup)
183 elif result == 'FAIL':
184 outcomes[key].failures.append(setup)
185 return outcomes
186
Valerio Setti781c2342023-10-17 12:47:35 +0200187def do_analyze_coverage(results: Results, outcome_file, args):
Przemek Stekiel6856f4c2022-11-09 10:50:29 +0100188 """Perform coverage analysis."""
Valerio Setti2cff8202023-10-18 14:36:47 +0200189 results.new_section("Analyze coverage")
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200190 outcomes = read_outcome_file(outcome_file)
Valerio Setti781c2342023-10-17 12:47:35 +0200191 analyze_outcomes(results, outcomes, args)
Przemek Stekiel4e955902022-10-21 13:42:08 +0200192
Valerio Setti781c2342023-10-17 12:47:35 +0200193def do_analyze_driver_vs_reference(results: Results, outcome_file, args):
Przemek Stekiel4e955902022-10-21 13:42:08 +0200194 """Perform driver vs reference analyze."""
Valerio Setti2cff8202023-10-18 14:36:47 +0200195 results.new_section("Analyze driver {} vs reference {}",
196 args['component_driver'], args['component_ref'])
Valerio Settib0c618e2023-10-16 14:19:49 +0200197
Valerio Setti781c2342023-10-17 12:47:35 +0200198 execute_reference_driver_tests(results, args['component_ref'], \
199 args['component_driver'], outcome_file)
Valerio Settia2663322023-03-24 08:20:18 +0100200
Valerio Setti3002c992023-01-18 17:28:36 +0100201 ignored_suites = ['test_suite_' + x for x in args['ignored_suites']]
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100202
Przemek Stekiel4e955902022-10-21 13:42:08 +0200203 outcomes = read_outcome_file(outcome_file)
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200204
Valerio Setti781c2342023-10-17 12:47:35 +0200205 analyze_driver_vs_reference(results, outcomes,
206 args['component_ref'], args['component_driver'],
207 ignored_suites, args['ignored_tests'])
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200208
Przemek Stekiel6856f4c2022-11-09 10:50:29 +0100209# List of tasks with a function that can handle this task and additional arguments if required
Valerio Settidfd7ca62023-10-09 16:30:11 +0200210KNOWN_TASKS = {
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200211 'analyze_coverage': {
212 'test_function': do_analyze_coverage,
Tomás González07bdcc22023-08-11 14:59:03 +0100213 'args': {
Tomás González358c6c62023-08-14 15:43:46 +0100214 'allow_list': [
Tomás González50223112023-08-22 09:52:06 +0100215 # Algorithm not supported yet
216 'test_suite_psa_crypto_metadata;Asymmetric signature: pure EdDSA',
217 # Algorithm not supported yet
218 'test_suite_psa_crypto_metadata;Cipher: XTS',
Tomás Gonzálezd43cab32023-08-24 09:12:40 +0100219 ],
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100220 'full_coverage': False,
Tomás González07bdcc22023-08-11 14:59:03 +0100221 }
Tomás Gonzálezd43cab32023-08-24 09:12:40 +0100222 },
Valerio Settia2663322023-03-24 08:20:18 +0100223 # There are 2 options to use analyze_driver_vs_reference_xxx locally:
224 # 1. Run tests and then analysis:
225 # - tests/scripts/all.sh --outcome-file "$PWD/out.csv" <component_ref> <component_driver>
226 # - tests/scripts/analyze_outcomes.py out.csv analyze_driver_vs_reference_xxx
227 # 2. Let this script run both automatically:
228 # - tests/scripts/analyze_outcomes.py out.csv analyze_driver_vs_reference_xxx
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200229 'analyze_driver_vs_reference_hash': {
230 'test_function': do_analyze_driver_vs_reference,
231 'args': {
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100232 'component_ref': 'test_psa_crypto_config_reference_hash_use_psa',
233 'component_driver': 'test_psa_crypto_config_accel_hash_use_psa',
Manuel Pégourié-Gonnard10e39632022-12-29 12:29:09 +0100234 'ignored_suites': [
235 'shax', 'mdx', # the software implementations that are being excluded
Manuel Pégourié-Gonnard7d381f52023-03-17 15:13:08 +0100236 'md.psa', # purposefully depends on whether drivers are present
Gilles Peskine35b49c42023-10-04 12:28:41 +0200237 'psa_crypto_low_hash.generated', # testing the builtins
Valerio Setti3002c992023-01-18 17:28:36 +0100238 ],
239 'ignored_tests': {
240 }
241 }
242 },
Valerio Settib6b301f2023-10-04 12:05:05 +0200243 'analyze_driver_vs_reference_cipher_aead': {
244 'test_function': do_analyze_driver_vs_reference,
245 'args': {
246 'component_ref': 'test_psa_crypto_config_reference_cipher_aead',
247 'component_driver': 'test_psa_crypto_config_accel_cipher_aead',
Valerio Setti507e08f2023-10-26 09:44:06 +0200248 # Modules replaced by drivers.
Valerio Settib6b301f2023-10-04 12:05:05 +0200249 'ignored_suites': [
Valerio Setti507e08f2023-10-26 09:44:06 +0200250 # low-level (block/stream) cipher modules
251 'aes', 'aria', 'camellia', 'des', 'chacha20',
252 # AEAD modes
253 'ccm', 'chachapoly', 'cmac', 'gcm',
254 # The Cipher abstraction layer
255 'cipher',
Valerio Settib6b301f2023-10-04 12:05:05 +0200256 ],
257 'ignored_tests': {
Valerio Setti507e08f2023-10-26 09:44:06 +0200258 # PEM decryption is not supported so far.
259 # The rest of PEM (write, unencrypted read) works though.
Valerio Setti7448cee2023-10-04 15:46:42 +0200260 'test_suite_pem': [
261 'PEM read (AES-128-CBC + invalid iv)'
262 'PEM read (DES-CBC + invalid iv)',
263 'PEM read (DES-EDE3-CBC + invalid iv)',
264 'PEM read (malformed PEM AES-128-CBC)',
265 'PEM read (malformed PEM DES-CBC)',
266 'PEM read (malformed PEM DES-EDE3-CBC)',
267 'PEM read (unknown encryption algorithm)',
268 'PEM read (AES-128-CBC + invalid iv)',
269 'PEM read (DES-CBC + invalid iv)',
270 ],
Valerio Setti507e08f2023-10-26 09:44:06 +0200271 # Following tests depend on AES_C/DES_C but are not about
272 # them really, just need to know some error code is there.
Valerio Setti7448cee2023-10-04 15:46:42 +0200273 'test_suite_error': [
274 'Low and high error',
275 'Single low error'
276 ],
Valerio Setti507e08f2023-10-26 09:44:06 +0200277 # Similar to test_suite_error above.
Valerio Setti7448cee2023-10-04 15:46:42 +0200278 'test_suite_version': [
279 'Check for MBEDTLS_AES_C when already present',
Valerio Setti93941442023-10-13 09:19:52 +0200280 ],
Valerio Setti507e08f2023-10-26 09:44:06 +0200281 # The en/decryption part of PKCS#12 is not supported so far.
282 # The rest of PKCS#12 (key derivation) works though.
Valerio Setti93941442023-10-13 09:19:52 +0200283 'test_suite_pkcs12': [
284 'PBE Decrypt, (Invalid padding & PKCS7 padding enabled)',
285 'PBE Decrypt, pad = 7 (OK)',
286 'PBE Decrypt, pad = 8 (Invalid output size)',
287 'PBE Decrypt, pad = 8 (OK)',
288 'PBE Encrypt, pad = 7 (OK)',
289 'PBE Encrypt, pad = 8 (Invalid output size)',
290 'PBE Encrypt, pad = 8 (OK)',
291 ],
Valerio Setti507e08f2023-10-26 09:44:06 +0200292 # The en/decryption part of PKCS#5 is not supported so far.
293 # The rest of PKCS#5 (PBKDF2) works though.
Valerio Setti93941442023-10-13 09:19:52 +0200294 'test_suite_pkcs5': [
295 'PBES2 Decrypt (Invalid output size)',
296 'PBES2 Decrypt (Invalid padding & PKCS7 padding enabled)',
297 'PBES2 Decrypt (KDF != PBKDF2)',
298 'PBES2 Decrypt (OK)',
299 'PBES2 Decrypt (OK, PBKDF2 params explicit keylen)',
300 'PBES2 Decrypt (OK, PBKDF2 params explicit prf_alg)',
301 'PBES2 Decrypt (bad KDF AlgId: not a sequence)',
302 'PBES2 Decrypt (bad KDF AlgId: overlong)',
303 'PBES2 Decrypt (bad PBKDF2 params explicit keylen: overlong)',
304 'PBES2 Decrypt (bad PBKDF2 params iter: not an int)',
305 'PBES2 Decrypt (bad PBKDF2 params iter: overlong)',
306 'PBES2 Decrypt (bad PBKDF2 params salt: not an octet string)',
307 'PBES2 Decrypt (bad PBKDF2 params salt: overlong)',
308 'PBES2 Decrypt (bad PBKDF2 params: not a sequence)',
309 'PBES2 Decrypt (bad PBKDF2 params: overlong)',
310 'PBES2 Decrypt (bad enc_scheme_alg params: len != iv_len)',
311 'PBES2 Decrypt (bad enc_scheme_alg params: not an octet string)',
312 'PBES2 Decrypt (bad enc_scheme_alg params: overlong)',
313 'PBES2 Decrypt (bad enc_scheme_alg: not a sequence)',
314 'PBES2 Decrypt (bad enc_scheme_alg: overlong)',
315 'PBES2 Decrypt (bad enc_scheme_alg: unknown oid)',
316 'PBES2 Decrypt (bad iter value)',
317 'PBES2 Decrypt (bad params tag)',
318 'PBES2 Decrypt (bad password)',
319 'PBES2 Decrypt (bad, PBKDF2 params explicit prf_alg != HMAC-SHA*)',
320 'PBES2 Decrypt (bad, PBKDF2 params explicit prf_alg not a sequence)',
321 'PBES2 Decrypt (bad, PBKDF2 params explicit prf_alg overlong)',
322 'PBES2 Decrypt (bad, PBKDF2 params extra data)',
323 'PBES2 Encrypt, pad=6 (OK)',
324 'PBES2 Encrypt, pad=8 (Invalid output size)',
325 'PBES2 Encrypt, pad=8 (OK)',
326 ],
Valerio Setti507e08f2023-10-26 09:44:06 +0200327 # Encrypted keys are not supported so far.
Valerio Setti5cd18f92023-10-13 15:14:07 +0200328 # pylint: disable=line-too-long
Valerio Setti93941442023-10-13 09:19:52 +0200329 'test_suite_pkparse': [
330 'Key ASN1 (Encrypted key PKCS12, trailing garbage data)',
331 'Key ASN1 (Encrypted key PKCS5, trailing garbage data)',
332 'Parse RSA Key #20 (PKCS#8 encrypted SHA1-3DES)',
333 'Parse RSA Key #20.1 (PKCS#8 encrypted SHA1-3DES, wrong PW)',
334 'Parse RSA Key #20.2 (PKCS#8 encrypted SHA1-3DES, no PW)',
335 'Parse RSA Key #21 (PKCS#8 encrypted SHA1-3DES, 2048-bit)',
336 'Parse RSA Key #21.1 (PKCS#8 encrypted SHA1-3DES, 2048-bit, wrong PW)',
337 'Parse RSA Key #21.2 (PKCS#8 encrypted SHA1-3DES, 2048-bit, no PW)',
338 'Parse RSA Key #22 (PKCS#8 encrypted SHA1-3DES, 4096-bit)',
339 'Parse RSA Key #22.1 (PKCS#8 encrypted SHA1-3DES, 4096-bit, wrong PW)',
340 'Parse RSA Key #22.2 (PKCS#8 encrypted SHA1-3DES, 4096-bit, no PW)',
341 'Parse RSA Key #23 (PKCS#8 encrypted SHA1-3DES DER)',
342 'Parse RSA Key #24 (PKCS#8 encrypted SHA1-3DES DER, 2048-bit)',
343 'Parse RSA Key #25 (PKCS#8 encrypted SHA1-3DES DER, 4096-bit)',
344 'Parse RSA Key #26 (PKCS#8 encrypted SHA1-2DES)',
345 'Parse RSA Key #26.1 (PKCS#8 encrypted SHA1-2DES, wrong PW)',
346 'Parse RSA Key #26.2 (PKCS#8 encrypted SHA1-2DES, no PW)',
347 'Parse RSA Key #27 (PKCS#8 encrypted SHA1-2DES, 2048-bit)',
348 'Parse RSA Key #27.1 (PKCS#8 encrypted SHA1-2DES, 2048-bit, wrong PW)',
349 'Parse RSA Key #27.2 (PKCS#8 encrypted SHA1-2DES, 2048-bit no PW)',
350 'Parse RSA Key #28 (PKCS#8 encrypted SHA1-2DES, 4096-bit)',
351 'Parse RSA Key #28.1 (PKCS#8 encrypted SHA1-2DES, 4096-bit, wrong PW)',
352 'Parse RSA Key #28.2 (PKCS#8 encrypted SHA1-2DES, 4096-bit, no PW)',
353 'Parse RSA Key #29 (PKCS#8 encrypted SHA1-2DES DER)',
354 'Parse RSA Key #30 (PKCS#8 encrypted SHA1-2DES DER, 2048-bit)',
355 'Parse RSA Key #31 (PKCS#8 encrypted SHA1-2DES DER, 4096-bit)',
356 'Parse RSA Key #38 (PKCS#8 encrypted v2 PBKDF2 3DES)',
357 'Parse RSA Key #38.1 (PKCS#8 encrypted v2 PBKDF2 3DES, wrong PW)',
358 'Parse RSA Key #38.2 (PKCS#8 encrypted v2 PBKDF2 3DES, no PW)',
359 'Parse RSA Key #39 (PKCS#8 encrypted v2 PBKDF2 3DES, 2048-bit)',
360 'Parse RSA Key #39.1 (PKCS#8 encrypted v2 PBKDF2 3DES, 2048-bit, wrong PW)',
361 'Parse RSA Key #39.2 (PKCS#8 encrypted v2 PBKDF2 3DES, 2048-bit, no PW)',
362 'Parse RSA Key #40 (PKCS#8 encrypted v2 PBKDF2 3DES, 4096-bit)',
363 'Parse RSA Key #40.1 (PKCS#8 encrypted v2 PBKDF2 3DES, 4096-bit, wrong PW)',
364 'Parse RSA Key #40.2 (PKCS#8 encrypted v2 PBKDF2 3DES, 4096-bit, no PW)',
365 'Parse RSA Key #41 (PKCS#8 encrypted v2 PBKDF2 3DES DER)',
366 'Parse RSA Key #41.1 (PKCS#8 encrypted v2 PBKDF2 3DES DER, wrong PW)',
367 'Parse RSA Key #41.2 (PKCS#8 encrypted v2 PBKDF2 3DES DER, no PW)',
368 'Parse RSA Key #42 (PKCS#8 encrypted v2 PBKDF2 3DES DER, 2048-bit)',
369 'Parse RSA Key #42.1 (PKCS#8 encrypted v2 PBKDF2 3DES DER, 2048-bit, wrong PW)',
370 'Parse RSA Key #42.2 (PKCS#8 encrypted v2 PBKDF2 3DES DER, 2048-bit, no PW)',
371 'Parse RSA Key #43 (PKCS#8 encrypted v2 PBKDF2 3DES DER, 4096-bit)',
372 'Parse RSA Key #43.1 (PKCS#8 encrypted v2 PBKDF2 3DES DER, 4096-bit, wrong PW)',
373 'Parse RSA Key #43.2 (PKCS#8 encrypted v2 PBKDF2 3DES DER, 4096-bit, no PW)',
374 'Parse RSA Key #44 (PKCS#8 encrypted v2 PBKDF2 DES)',
375 'Parse RSA Key #44.1 (PKCS#8 encrypted v2 PBKDF2 DES, wrong PW)',
376 'Parse RSA Key #44.2 (PKCS#8 encrypted v2 PBKDF2 DES, no PW)',
377 'Parse RSA Key #45 (PKCS#8 encrypted v2 PBKDF2 DES, 2048-bit)',
378 'Parse RSA Key #45.1 (PKCS#8 encrypted v2 PBKDF2 DES, 2048-bit, wrong PW)',
379 'Parse RSA Key #45.2 (PKCS#8 encrypted v2 PBKDF2 DES, 2048-bit, no PW)',
380 'Parse RSA Key #46 (PKCS#8 encrypted v2 PBKDF2 DES, 4096-bit)',
381 'Parse RSA Key #46.1 (PKCS#8 encrypted v2 PBKDF2 DES, 4096-bit, wrong PW)',
382 'Parse RSA Key #46.2 (PKCS#8 encrypted v2 PBKDF2 DES, 4096-bit, no PW)',
383 'Parse RSA Key #47 (PKCS#8 encrypted v2 PBKDF2 DES DER)',
384 'Parse RSA Key #47.1 (PKCS#8 encrypted v2 PBKDF2 DES DER, wrong PW)',
385 'Parse RSA Key #47.2 (PKCS#8 encrypted v2 PBKDF2 DES DER, no PW)',
386 'Parse RSA Key #48 (PKCS#8 encrypted v2 PBKDF2 DES DER, 2048-bit)',
387 'Parse RSA Key #48.1 (PKCS#8 encrypted v2 PBKDF2 DES DER, 2048-bit, wrong PW)',
388 'Parse RSA Key #48.2 (PKCS#8 encrypted v2 PBKDF2 DES DER, 2048-bit, no PW)',
389 'Parse RSA Key #49 (PKCS#8 encrypted v2 PBKDF2 DES DER, 4096-bit)',
390 'Parse RSA Key #49.1 (PKCS#8 encrypted v2 PBKDF2 DES DER, 4096-bit, wrong PW)',
391 'Parse RSA Key #49.2 (PKCS#8 encrypted v2 PBKDF2 DES DER, 4096-bit, no PW)',
392 'Parse RSA Key #50 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224)',
393 'Parse RSA Key #50.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, wrong PW)',
394 'Parse RSA Key #50.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, no PW)',
395 'Parse RSA Key #51 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, 2048-bit)',
396 'Parse RSA Key #51.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, 2048-bit, wrong PW)',
397 'Parse RSA Key #51.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, 2048-bit, no PW)',
398 'Parse RSA Key #52 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, 4096-bit)',
399 'Parse RSA Key #52.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, 4096-bit, wrong PW)',
400 'Parse RSA Key #52.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224, 4096-bit, no PW)',
401 'Parse RSA Key #53 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER)',
402 'Parse RSA Key #53.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, wrong PW)',
403 'Parse RSA Key #53.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, no PW)',
404 'Parse RSA Key #54 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, 2048-bit)',
405 'Parse RSA Key #54.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, 2048-bit, wrong PW)',
406 'Parse RSA Key #54.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, 2048-bit, no PW)',
407 'Parse RSA Key #55 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, 4096-bit)',
408 'Parse RSA Key #55.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, 4096-bit, wrong PW)',
409 'Parse RSA Key #55.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA224 DER, 4096-bit, no PW)',
410 'Parse RSA Key #56 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224)',
411 'Parse RSA Key #56.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, wrong PW)',
412 'Parse RSA Key #56.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, no PW)',
413 'Parse RSA Key #57 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, 2048-bit)',
414 'Parse RSA Key #57.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, 2048-bit, wrong PW)',
415 'Parse RSA Key #57.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, 2048-bit, no PW)',
416 'Parse RSA Key #58 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, 4096-bit)',
417 'Parse RSA Key #58.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, 4096-bit, wrong PW)',
418 'Parse RSA Key #58.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224, 4096-bit, no PW)',
419 'Parse RSA Key #59 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER)',
420 'Parse RSA Key #59.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, wrong PW)',
421 'Parse RSA Key #59.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, no PW)',
422 'Parse RSA Key #60 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, 2048-bit)',
423 'Parse RSA Key #60.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, 2048-bit, wrong PW)',
424 'Parse RSA Key #60.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, 2048-bit, no PW)',
425 'Parse RSA Key #61 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, 4096-bit)',
426 'Parse RSA Key #61.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, 4096-bit, wrong PW)',
427 'Parse RSA Key #61.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA224 DER, 4096-bit, no PW)',
428 'Parse RSA Key #62 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256)',
429 'Parse RSA Key #62.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, wrong PW)',
430 'Parse RSA Key #62.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, no PW)',
431 'Parse RSA Key #63 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, 2048-bit)',
432 'Parse RSA Key #63.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, 2048-bit, wrong PW)',
433 'Parse RSA Key #63.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, 2048-bit, no PW)',
434 'Parse RSA Key #64 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, 4096-bit)',
435 'Parse RSA Key #64.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, 4096-bit, wrong PW)',
436 'Parse RSA Key #64.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256, 4096-bit, no PW)',
437 'Parse RSA Key #65 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER)',
438 'Parse RSA Key #65.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, wrong PW)',
439 'Parse RSA Key #65.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, no PW)',
440 'Parse RSA Key #66 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, 2048-bit)',
441 'Parse RSA Key #66.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, 2048-bit, wrong PW)',
442 'Parse RSA Key #66.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, 2048-bit, no PW)',
443 'Parse RSA Key #67 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, 4096-bit)',
444 'Parse RSA Key #68.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, 4096-bit, wrong PW)',
445 'Parse RSA Key #68.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA256 DER, 4096-bit, no PW)',
446 'Parse RSA Key #69 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256)',
447 'Parse RSA Key #69.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, wrong PW)',
448 'Parse RSA Key #69.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, no PW)',
449 'Parse RSA Key #70 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, 2048-bit)',
450 'Parse RSA Key #70.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, 2048-bit, wrong PW)',
451 'Parse RSA Key #70.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, 2048-bit, no PW)',
452 'Parse RSA Key #71 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, 4096-bit)',
453 'Parse RSA Key #71.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, 4096-bit, wrong PW)',
454 'Parse RSA Key #71.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256, 4096-bit, no PW)',
455 'Parse RSA Key #72 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER)',
456 'Parse RSA Key #72.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, wrong PW)',
457 'Parse RSA Key #72.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, no PW)',
458 'Parse RSA Key #73 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, 2048-bit)',
459 'Parse RSA Key #73.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, 2048-bit, wrong PW)',
460 'Parse RSA Key #73.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, 2048-bit, no PW)',
461 'Parse RSA Key #74 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, 4096-bit)',
462 'Parse RSA Key #74.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, 4096-bit, wrong PW)',
463 'Parse RSA Key #74.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA256 DER, 4096-bit, no PW)',
464 'Parse RSA Key #75 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384)',
465 'Parse RSA Key #75.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, wrong PW)',
466 'Parse RSA Key #75.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, no PW)',
467 'Parse RSA Key #76 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, 2048-bit)',
468 'Parse RSA Key #76.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, 2048-bit, wrong PW)',
469 'Parse RSA Key #76.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, 2048-bit, no PW)',
470 'Parse RSA Key #77 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, 4096-bit)',
471 'Parse RSA Key #77.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, 4096-bit, wrong PW)',
472 'Parse RSA Key #77.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384, 4096-bit, no PW)',
473 'Parse RSA Key #78 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER)',
474 'Parse RSA Key #78.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, wrong PW)',
475 'Parse RSA Key #78.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, no PW)',
476 'Parse RSA Key #79 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, 2048-bit)',
477 'Parse RSA Key #79.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, 2048-bit, wrong PW)',
478 'Parse RSA Key #79.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, 2048-bit, no PW)',
479 'Parse RSA Key #80 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, 4096-bit)',
480 'Parse RSA Key #80.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, 4096-bit, wrong PW)',
481 'Parse RSA Key #80.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA384 DER, 4096-bit, no PW)',
482 'Parse RSA Key #81 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384)',
483 'Parse RSA Key #81.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, wrong PW)',
484 'Parse RSA Key #81.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, no PW)',
485 'Parse RSA Key #82 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, 2048-bit)',
486 'Parse RSA Key #82.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, 2048-bit, wrong PW)',
487 'Parse RSA Key #82.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, 2048-bit, no PW)',
488 'Parse RSA Key #83 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, 4096-bit)',
489 'Parse RSA Key #83.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, 4096-bit, wrong PW)',
490 'Parse RSA Key #83.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384, 4096-bit, no PW)',
491 'Parse RSA Key #84 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER)',
492 'Parse RSA Key #84.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, wrong PW)',
493 'Parse RSA Key #85.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, no PW)',
494 'Parse RSA Key #86 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, 2048-bit)',
495 'Parse RSA Key #86.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, 2048-bit, wrong PW)',
496 'Parse RSA Key #86.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, 2048-bit, no PW)',
497 'Parse RSA Key #87 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, 4096-bit)',
498 'Parse RSA Key #87.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, 4096-bit, wrong PW)',
499 'Parse RSA Key #87.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA384 DER, 4096-bit, no PW)',
500 'Parse RSA Key #88 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512)',
501 'Parse RSA Key #88.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, wrong PW)',
502 'Parse RSA Key #88.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, no PW)',
503 'Parse RSA Key #89 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, 2048-bit)',
504 'Parse RSA Key #89.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, 2048-bit, wrong PW)',
505 'Parse RSA Key #89.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, 2048-bit, no PW)',
506 'Parse RSA Key #90 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, 4096-bit)',
507 'Parse RSA Key #90.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, 4096-bit, wrong PW)',
508 'Parse RSA Key #90.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512, 4096-bit, no PW)',
509 'Parse RSA Key #91 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER)',
510 'Parse RSA Key #91.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, wrong PW)',
511 'Parse RSA Key #91.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, no PW)',
512 'Parse RSA Key #92 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, 2048-bit)',
513 'Parse RSA Key #92.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, 2048-bit, wrong PW)',
514 'Parse RSA Key #92.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, 2048-bit, no PW)',
515 'Parse RSA Key #93 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, 4096-bit)',
516 'Parse RSA Key #93.1 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, 4096-bit, wrong PW)',
517 'Parse RSA Key #93.2 (PKCS#8 encrypted v2 PBKDF2 3DES hmacWithSHA512 DER, 4096-bit, no PW)',
518 'Parse RSA Key #94 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512)',
519 'Parse RSA Key #94.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, wrong PW)',
520 'Parse RSA Key #94.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, no PW)',
521 'Parse RSA Key #95 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, 2048-bit)',
522 'Parse RSA Key #95.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, 2048-bit, wrong PW)',
523 'Parse RSA Key #95.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, 2048-bit, no PW)',
524 'Parse RSA Key #96 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, 4096-bit)',
525 'Parse RSA Key #96.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, 4096-bit, wrong PW)',
526 'Parse RSA Key #96.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512, 4096-bit, no PW)',
527 'Parse RSA Key #97 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER)',
528 'Parse RSA Key #97.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, wrong PW)',
529 'Parse RSA Key #97.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, no PW)',
530 'Parse RSA Key #98 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, 2048-bit)',
531 'Parse RSA Key #98.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, 2048-bit, wrong PW)',
532 'Parse RSA Key #98.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, 2048-bit, no PW)',
533 'Parse RSA Key #99 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, 4096-bit)',
534 'Parse RSA Key #99.1 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, 4096-bit, wrong PW)',
535 'Parse RSA Key #99.2 (PKCS#8 encrypted v2 PBKDF2 DES hmacWithSHA512 DER, 4096-bit, no PW)',
536 ],
Valerio Settib6b301f2023-10-04 12:05:05 +0200537 }
538 }
539 },
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200540 'analyze_driver_vs_reference_ecp_light_only': {
Valerio Setti42d5f192023-03-20 13:54:41 +0100541 'test_function': do_analyze_driver_vs_reference,
542 'args': {
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200543 'component_ref': 'test_psa_crypto_config_reference_ecc_ecp_light_only',
544 'component_driver': 'test_psa_crypto_config_accel_ecc_ecp_light_only',
Valerio Setti42d5f192023-03-20 13:54:41 +0100545 'ignored_suites': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200546 # Modules replaced by drivers
547 'ecdsa', 'ecdh', 'ecjpake',
Valerio Setti42d5f192023-03-20 13:54:41 +0100548 ],
549 'ignored_tests': {
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200550 # This test wants a legacy function that takes f_rng, p_rng
551 # arguments, and uses legacy ECDSA for that. The test is
552 # really about the wrapper around the PSA RNG, not ECDSA.
Valerio Setti42d5f192023-03-20 13:54:41 +0100553 'test_suite_random': [
554 'PSA classic wrapper: ECDSA signature (SECP256R1)',
555 ],
Valerio Setti0c477d32023-04-07 15:54:20 +0200556 # In the accelerated test ECP_C is not set (only ECP_LIGHT is)
557 # so we must ignore disparities in the tests for which ECP_C
558 # is required.
559 'test_suite_ecp': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200560 re.compile(r'ECP check public-private .*'),
561 re.compile(r'ECP gen keypair .*'),
562 re.compile(r'ECP point muladd .*'),
563 re.compile(r'ECP point multiplication .*'),
564 re.compile(r'ECP test vectors .*'),
Valerio Settie50a75f2023-05-19 17:43:06 +0200565 ],
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200566 'test_suite_ssl': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200567 # This deprecated function is only present when ECP_C is On.
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200568 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
569 ],
Valerio Setti5f540202023-06-30 17:20:49 +0200570 }
Valerio Setti42d5f192023-03-20 13:54:41 +0100571 }
572 },
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200573 'analyze_driver_vs_reference_no_ecp_at_all': {
Valerio Settie618cb02023-04-12 14:59:16 +0200574 'test_function': do_analyze_driver_vs_reference,
575 'args': {
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200576 'component_ref': 'test_psa_crypto_config_reference_ecc_no_ecp_at_all',
577 'component_driver': 'test_psa_crypto_config_accel_ecc_no_ecp_at_all',
Valerio Settie618cb02023-04-12 14:59:16 +0200578 'ignored_suites': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200579 # Modules replaced by drivers
580 'ecp', 'ecdsa', 'ecdh', 'ecjpake',
Valerio Settie618cb02023-04-12 14:59:16 +0200581 ],
582 'ignored_tests': {
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200583 # See ecp_light_only
Valerio Settie618cb02023-04-12 14:59:16 +0200584 'test_suite_random': [
585 'PSA classic wrapper: ECDSA signature (SECP256R1)',
586 ],
Valerio Settiaddeee42023-06-14 10:46:55 +0200587 'test_suite_pkparse': [
Valerio Setti5bd25232023-06-19 19:32:14 +0200588 # When PK_PARSE_C and ECP_C are defined then PK_PARSE_EC_COMPRESSED
589 # is automatically enabled in build_info.h (backward compatibility)
590 # even if it is disabled in config_psa_crypto_no_ecp_at_all(). As a
591 # consequence compressed points are supported in the reference
592 # component but not in the accelerated one, so they should be skipped
593 # while checking driver's coverage.
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200594 re.compile(r'Parse EC Key .*compressed\)'),
595 re.compile(r'Parse Public EC Key .*compressed\)'),
Valerio Settiaddeee42023-06-14 10:46:55 +0200596 ],
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200597 # See ecp_light_only
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200598 'test_suite_ssl': [
599 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
600 ],
Valerio Settie618cb02023-04-12 14:59:16 +0200601 }
602 }
603 },
Valerio Setti307810b2023-08-15 10:12:25 +0200604 'analyze_driver_vs_reference_ecc_no_bignum': {
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200605 'test_function': do_analyze_driver_vs_reference,
606 'args': {
607 'component_ref': 'test_psa_crypto_config_reference_ecc_no_bignum',
608 'component_driver': 'test_psa_crypto_config_accel_ecc_no_bignum',
609 'ignored_suites': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200610 # Modules replaced by drivers
611 'ecp', 'ecdsa', 'ecdh', 'ecjpake',
612 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw',
613 'bignum.generated', 'bignum.misc',
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200614 ],
615 'ignored_tests': {
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200616 # See ecp_light_only
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200617 'test_suite_random': [
618 'PSA classic wrapper: ECDSA signature (SECP256R1)',
619 ],
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200620 # See no_ecp_at_all
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200621 'test_suite_pkparse': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200622 re.compile(r'Parse EC Key .*compressed\)'),
623 re.compile(r'Parse Public EC Key .*compressed\)'),
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200624 ],
Valerio Setti9b3dbcc2023-07-26 18:00:31 +0200625 'test_suite_asn1parse': [
Valerio Setti9b3dbcc2023-07-26 18:00:31 +0200626 'INTEGER too large for mpi',
627 ],
628 'test_suite_asn1write': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200629 re.compile(r'ASN.1 Write mpi.*'),
Valerio Setti9b3dbcc2023-07-26 18:00:31 +0200630 ],
Valerio Settie0be95e2023-08-01 09:07:43 +0200631 'test_suite_debug': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200632 re.compile(r'Debug print mbedtls_mpi.*'),
Valerio Settie0be95e2023-08-01 09:07:43 +0200633 ],
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200634 # See ecp_light_only
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200635 'test_suite_ssl': [
636 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
637 ],
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200638 }
639 }
640 },
Valerio Setti307810b2023-08-15 10:12:25 +0200641 'analyze_driver_vs_reference_ecc_ffdh_no_bignum': {
642 'test_function': do_analyze_driver_vs_reference,
643 'args': {
644 'component_ref': 'test_psa_crypto_config_reference_ecc_ffdh_no_bignum',
645 'component_driver': 'test_psa_crypto_config_accel_ecc_ffdh_no_bignum',
646 'ignored_suites': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200647 # Modules replaced by drivers
648 'ecp', 'ecdsa', 'ecdh', 'ecjpake', 'dhm',
649 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw',
650 'bignum.generated', 'bignum.misc',
Valerio Setti307810b2023-08-15 10:12:25 +0200651 ],
652 'ignored_tests': {
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200653 # See ecp_light_only
Valerio Setti307810b2023-08-15 10:12:25 +0200654 'test_suite_random': [
655 'PSA classic wrapper: ECDSA signature (SECP256R1)',
656 ],
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200657 # See no_ecp_at_all
Valerio Setti307810b2023-08-15 10:12:25 +0200658 'test_suite_pkparse': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200659 re.compile(r'Parse EC Key .*compressed\)'),
660 re.compile(r'Parse Public EC Key .*compressed\)'),
Valerio Setti307810b2023-08-15 10:12:25 +0200661 ],
662 'test_suite_asn1parse': [
Valerio Setti307810b2023-08-15 10:12:25 +0200663 'INTEGER too large for mpi',
664 ],
665 'test_suite_asn1write': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200666 re.compile(r'ASN.1 Write mpi.*'),
Valerio Setti307810b2023-08-15 10:12:25 +0200667 ],
668 'test_suite_debug': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200669 re.compile(r'Debug print mbedtls_mpi.*'),
Valerio Setti307810b2023-08-15 10:12:25 +0200670 ],
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200671 # See ecp_light_only
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200672 'test_suite_ssl': [
673 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
674 ],
Valerio Setti307810b2023-08-15 10:12:25 +0200675 }
676 }
677 },
Przemek Stekiel85b64422023-05-26 09:55:23 +0200678 'analyze_driver_vs_reference_ffdh_alg': {
679 'test_function': do_analyze_driver_vs_reference,
680 'args': {
681 'component_ref': 'test_psa_crypto_config_reference_ffdh',
682 'component_driver': 'test_psa_crypto_config_accel_ffdh',
Przemek Stekiel84f4ff12023-07-04 12:35:31 +0200683 'ignored_suites': ['dhm'],
Przemek Stekiel565353e2023-07-05 11:07:07 +0200684 'ignored_tests': {}
Przemek Stekiel85b64422023-05-26 09:55:23 +0200685 }
686 },
Valerio Settif01d6482023-08-04 13:51:18 +0200687 'analyze_driver_vs_reference_tfm_config': {
688 'test_function': do_analyze_driver_vs_reference,
689 'args': {
690 'component_ref': 'test_tfm_config',
691 'component_driver': 'test_tfm_config_p256m_driver_accel_ec',
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200692 'ignored_suites': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200693 # Modules replaced by drivers
694 'ecp', 'ecdsa', 'ecdh', 'ecjpake',
695 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw',
696 'bignum.generated', 'bignum.misc',
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200697 ],
Valerio Settif01d6482023-08-04 13:51:18 +0200698 'ignored_tests': {
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200699 # See ecp_light_only
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200700 'test_suite_random': [
701 'PSA classic wrapper: ECDSA signature (SECP256R1)',
702 ],
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200703 'test_suite_asn1parse': [
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200704 'INTEGER too large for mpi',
705 ],
706 'test_suite_asn1write': [
Manuel Pégourié-Gonnard4fd5a6a2023-10-20 10:21:09 +0200707 re.compile(r'ASN.1 Write mpi.*'),
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200708 ],
Valerio Settif01d6482023-08-04 13:51:18 +0200709 }
710 }
711 }
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200712}
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200713
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200714def main():
Valerio Settif075e472023-10-17 11:03:16 +0200715 main_results = Results()
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200716
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200717 try:
718 parser = argparse.ArgumentParser(description=__doc__)
Przemek Stekiel58bbc232022-10-24 08:10:10 +0200719 parser.add_argument('outcomes', metavar='OUTCOMES.CSV',
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200720 help='Outcome file to analyze')
Valerio Settidfd7ca62023-10-09 16:30:11 +0200721 parser.add_argument('specified_tasks', default='all', nargs='?',
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100722 help='Analysis to be done. By default, run all tasks. '
723 'With one or more TASK, run only those. '
724 'TASK can be the name of a single task or '
Przemek Stekiel85c54ea2022-11-17 11:50:23 +0100725 'comma/space-separated list of tasks. ')
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100726 parser.add_argument('--list', action='store_true',
727 help='List all available tasks and exit.')
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100728 parser.add_argument('--require-full-coverage', action='store_true',
729 dest='full_coverage', help="Require all available "
730 "test cases to be executed and issue an error "
731 "otherwise. This flag is ignored if 'task' is "
732 "neither 'all' nor 'analyze_coverage'")
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200733 options = parser.parse_args()
Przemek Stekiel4e955902022-10-21 13:42:08 +0200734
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100735 if options.list:
Valerio Settidfd7ca62023-10-09 16:30:11 +0200736 for task in KNOWN_TASKS:
Valerio Setti5329ff02023-10-17 09:44:36 +0200737 print(task)
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100738 sys.exit(0)
739
Valerio Settidfd7ca62023-10-09 16:30:11 +0200740 if options.specified_tasks == 'all':
741 tasks_list = KNOWN_TASKS.keys()
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100742 else:
Valerio Settidfd7ca62023-10-09 16:30:11 +0200743 tasks_list = re.split(r'[, ]+', options.specified_tasks)
Valerio Settidfd7ca62023-10-09 16:30:11 +0200744 for task in tasks_list:
745 if task not in KNOWN_TASKS:
Manuel Pégourié-Gonnard62d61312023-10-20 10:51:57 +0200746 sys.stderr.write('invalid task: {}\n'.format(task))
Valerio Settifb2750e2023-10-17 10:11:45 +0200747 sys.exit(2)
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100748
Valerio Settidfd7ca62023-10-09 16:30:11 +0200749 KNOWN_TASKS['analyze_coverage']['args']['full_coverage'] = options.full_coverage
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100750
Valerio Settifb2750e2023-10-17 10:11:45 +0200751 for task in tasks_list:
752 test_function = KNOWN_TASKS[task]['test_function']
753 test_args = KNOWN_TASKS[task]['args']
Valerio Setti781c2342023-10-17 12:47:35 +0200754 test_function(main_results, options.outcomes, test_args)
Valerio Settidfd7ca62023-10-09 16:30:11 +0200755
Valerio Settif6f64cf2023-10-17 12:28:26 +0200756 main_results.info("Overall results: {} warnings and {} errors",
757 main_results.warning_count, main_results.error_count)
Valerio Settif075e472023-10-17 11:03:16 +0200758
Valerio Setti8d178be2023-10-17 12:23:55 +0200759 sys.exit(0 if (main_results.error_count == 0) else 1)
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200760
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200761 except Exception: # pylint: disable=broad-except
762 # Print the backtrace and exit explicitly with our chosen status.
763 traceback.print_exc()
764 sys.exit(120)
765
766if __name__ == '__main__':
767 main()