Gilles Peskine | 15c2cbf | 2020-06-25 18:36:28 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | """Analyze the test outcomes from a full CI run. |
| 4 | |
| 5 | This script can also run on outcomes from a partial run, but the results are |
| 6 | less likely to be useful. |
| 7 | """ |
| 8 | |
Przemek Stekiel | 85c54ea | 2022-11-17 11:50:23 +0100 | [diff] [blame] | 9 | import re |
Gilles Peskine | 15c2cbf | 2020-06-25 18:36:28 +0200 | [diff] [blame] | 10 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 11 | import outcome_analysis |
Gilles Peskine | 8d3c70a | 2020-06-25 18:37:43 +0200 | [diff] [blame] | 12 | |
Pengyu Lv | c2e8f3a | 2023-11-28 17:22:04 +0800 | [diff] [blame] | 13 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 14 | class CoverageTask(outcome_analysis.CoverageTask): |
| 15 | pass # We'll populate IGNORED_TESTS soon |
Gilles Peskine | 95b2b0c | 2024-09-16 20:23:40 +0200 | [diff] [blame] | 16 | |
Gilles Peskine | 17e071b | 2024-09-16 19:57:10 +0200 | [diff] [blame] | 17 | |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 18 | # The names that we give to classes derived from DriverVSReference do not |
| 19 | # follow the usual naming convention, because it's more readable to use |
| 20 | # underscores and parts of the configuration names. Also, these classes |
| 21 | # are just there to specify some data, so they don't need repetitive |
| 22 | # documentation. |
| 23 | #pylint: disable=invalid-name,missing-class-docstring |
| 24 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 25 | class DriverVSReference_hash(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 26 | REFERENCE = 'test_psa_crypto_config_reference_hash_use_psa' |
| 27 | DRIVER = 'test_psa_crypto_config_accel_hash_use_psa' |
| 28 | IGNORED_SUITES = [ |
| 29 | 'shax', 'mdx', # the software implementations that are being excluded |
| 30 | 'md.psa', # purposefully depends on whether drivers are present |
| 31 | 'psa_crypto_low_hash.generated', # testing the builtins |
| 32 | ] |
| 33 | IGNORED_TESTS = { |
| 34 | 'test_suite_config': [ |
| 35 | re.compile(r'.*\bMBEDTLS_(MD5|RIPEMD160|SHA[0-9]+)_.*'), |
| 36 | ], |
| 37 | 'test_suite_platform': [ |
| 38 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 39 | # component uses a sanitizer but the reference component |
| 40 | # doesn't, we have a PASS vs SKIP mismatch. |
| 41 | 'Check mbedtls_calloc overallocation', |
| 42 | ], |
| 43 | } |
| 44 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 45 | class DriverVSReference_hmac(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 46 | REFERENCE = 'test_psa_crypto_config_reference_hmac' |
| 47 | DRIVER = 'test_psa_crypto_config_accel_hmac' |
| 48 | IGNORED_SUITES = [ |
| 49 | # These suites require legacy hash support, which is disabled |
| 50 | # in the accelerated component. |
| 51 | 'shax', 'mdx', |
| 52 | # This suite tests builtins directly, but these are missing |
| 53 | # in the accelerated case. |
| 54 | 'psa_crypto_low_hash.generated', |
| 55 | ] |
| 56 | IGNORED_TESTS = { |
| 57 | 'test_suite_config': [ |
| 58 | re.compile(r'.*\bMBEDTLS_(MD5|RIPEMD160|SHA[0-9]+)_.*'), |
| 59 | re.compile(r'.*\bMBEDTLS_MD_C\b') |
| 60 | ], |
| 61 | 'test_suite_md': [ |
| 62 | # Builtin HMAC is not supported in the accelerate component. |
| 63 | re.compile('.*HMAC.*'), |
| 64 | # Following tests make use of functions which are not available |
| 65 | # when MD_C is disabled, as it happens in the accelerated |
| 66 | # test component. |
| 67 | re.compile('generic .* Hash file .*'), |
| 68 | 'MD list', |
| 69 | ], |
| 70 | 'test_suite_md.psa': [ |
| 71 | # "legacy only" tests require hash algorithms to be NOT |
| 72 | # accelerated, but this of course false for the accelerated |
| 73 | # test component. |
| 74 | re.compile('PSA dispatch .* legacy only'), |
| 75 | ], |
| 76 | 'test_suite_platform': [ |
| 77 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 78 | # component uses a sanitizer but the reference component |
| 79 | # doesn't, we have a PASS vs SKIP mismatch. |
| 80 | 'Check mbedtls_calloc overallocation', |
| 81 | ], |
| 82 | } |
| 83 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 84 | class DriverVSReference_cipher_aead_cmac(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 85 | REFERENCE = 'test_psa_crypto_config_reference_cipher_aead_cmac' |
| 86 | DRIVER = 'test_psa_crypto_config_accel_cipher_aead_cmac' |
| 87 | # Modules replaced by drivers. |
| 88 | IGNORED_SUITES = [ |
| 89 | # low-level (block/stream) cipher modules |
| 90 | 'aes', 'aria', 'camellia', 'des', 'chacha20', |
| 91 | # AEAD modes and CMAC |
| 92 | 'ccm', 'chachapoly', 'cmac', 'gcm', |
| 93 | # The Cipher abstraction layer |
| 94 | 'cipher', |
| 95 | ] |
| 96 | IGNORED_TESTS = { |
| 97 | 'test_suite_config': [ |
| 98 | re.compile(r'.*\bMBEDTLS_(AES|ARIA|CAMELLIA|CHACHA20|DES)_.*'), |
| 99 | re.compile(r'.*\bMBEDTLS_(CCM|CHACHAPOLY|CMAC|GCM)_.*'), |
| 100 | re.compile(r'.*\bMBEDTLS_AES(\w+)_C\b.*'), |
| 101 | re.compile(r'.*\bMBEDTLS_CIPHER_.*'), |
| 102 | ], |
| 103 | # PEM decryption is not supported so far. |
| 104 | # The rest of PEM (write, unencrypted read) works though. |
| 105 | 'test_suite_pem': [ |
| 106 | re.compile(r'PEM read .*(AES|DES|\bencrypt).*'), |
| 107 | ], |
| 108 | 'test_suite_platform': [ |
| 109 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 110 | # component uses a sanitizer but the reference component |
| 111 | # doesn't, we have a PASS vs SKIP mismatch. |
| 112 | 'Check mbedtls_calloc overallocation', |
| 113 | ], |
| 114 | # Following tests depend on AES_C/DES_C but are not about |
| 115 | # them really, just need to know some error code is there. |
| 116 | 'test_suite_error': [ |
| 117 | 'Low and high error', |
| 118 | 'Single low error' |
| 119 | ], |
| 120 | # Similar to test_suite_error above. |
| 121 | 'test_suite_version': [ |
| 122 | 'Check for MBEDTLS_AES_C when already present', |
| 123 | ], |
| 124 | # The en/decryption part of PKCS#12 is not supported so far. |
| 125 | # The rest of PKCS#12 (key derivation) works though. |
| 126 | 'test_suite_pkcs12': [ |
| 127 | re.compile(r'PBE Encrypt, .*'), |
| 128 | re.compile(r'PBE Decrypt, .*'), |
| 129 | ], |
| 130 | # The en/decryption part of PKCS#5 is not supported so far. |
| 131 | # The rest of PKCS#5 (PBKDF2) works though. |
| 132 | 'test_suite_pkcs5': [ |
| 133 | re.compile(r'PBES2 Encrypt, .*'), |
| 134 | re.compile(r'PBES2 Decrypt .*'), |
| 135 | ], |
| 136 | # Encrypted keys are not supported so far. |
| 137 | # pylint: disable=line-too-long |
| 138 | 'test_suite_pkparse': [ |
| 139 | 'Key ASN1 (Encrypted key PKCS12, trailing garbage data)', |
| 140 | 'Key ASN1 (Encrypted key PKCS5, trailing garbage data)', |
| 141 | re.compile(r'Parse (RSA|EC) Key .*\(.* ([Ee]ncrypted|password).*\)'), |
| 142 | ], |
| 143 | # Encrypted keys are not supported so far. |
| 144 | 'ssl-opt': [ |
| 145 | 'TLS: password protected server key', |
| 146 | 'TLS: password protected client key', |
| 147 | 'TLS: password protected server key, two certificates', |
| 148 | ], |
| 149 | } |
| 150 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 151 | class DriverVSReference_ecp_light_only(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 152 | REFERENCE = 'test_psa_crypto_config_reference_ecc_ecp_light_only' |
| 153 | DRIVER = 'test_psa_crypto_config_accel_ecc_ecp_light_only' |
| 154 | IGNORED_SUITES = [ |
| 155 | # Modules replaced by drivers |
| 156 | 'ecdsa', 'ecdh', 'ecjpake', |
| 157 | ] |
| 158 | IGNORED_TESTS = { |
| 159 | 'test_suite_config': [ |
| 160 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 161 | ], |
| 162 | 'test_suite_platform': [ |
| 163 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 164 | # component uses a sanitizer but the reference component |
| 165 | # doesn't, we have a PASS vs SKIP mismatch. |
| 166 | 'Check mbedtls_calloc overallocation', |
| 167 | ], |
| 168 | # This test wants a legacy function that takes f_rng, p_rng |
| 169 | # arguments, and uses legacy ECDSA for that. The test is |
| 170 | # really about the wrapper around the PSA RNG, not ECDSA. |
| 171 | 'test_suite_random': [ |
| 172 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 173 | ], |
| 174 | # In the accelerated test ECP_C is not set (only ECP_LIGHT is) |
| 175 | # so we must ignore disparities in the tests for which ECP_C |
| 176 | # is required. |
| 177 | 'test_suite_ecp': [ |
| 178 | re.compile(r'ECP check public-private .*'), |
| 179 | re.compile(r'ECP calculate public: .*'), |
| 180 | re.compile(r'ECP gen keypair .*'), |
| 181 | re.compile(r'ECP point muladd .*'), |
| 182 | re.compile(r'ECP point multiplication .*'), |
| 183 | re.compile(r'ECP test vectors .*'), |
| 184 | ], |
| 185 | 'test_suite_ssl': [ |
| 186 | # This deprecated function is only present when ECP_C is On. |
| 187 | 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()', |
| 188 | ], |
| 189 | } |
| 190 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 191 | class DriverVSReference_no_ecp_at_all(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 192 | REFERENCE = 'test_psa_crypto_config_reference_ecc_no_ecp_at_all' |
| 193 | DRIVER = 'test_psa_crypto_config_accel_ecc_no_ecp_at_all' |
| 194 | IGNORED_SUITES = [ |
| 195 | # Modules replaced by drivers |
| 196 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', |
| 197 | ] |
| 198 | IGNORED_TESTS = { |
| 199 | 'test_suite_config': [ |
| 200 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 201 | re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'), |
| 202 | ], |
| 203 | 'test_suite_platform': [ |
| 204 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 205 | # component uses a sanitizer but the reference component |
| 206 | # doesn't, we have a PASS vs SKIP mismatch. |
| 207 | 'Check mbedtls_calloc overallocation', |
| 208 | ], |
| 209 | # See ecp_light_only |
| 210 | 'test_suite_random': [ |
| 211 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 212 | ], |
| 213 | 'test_suite_pkparse': [ |
| 214 | # When PK_PARSE_C and ECP_C are defined then PK_PARSE_EC_COMPRESSED |
| 215 | # is automatically enabled in build_info.h (backward compatibility) |
| 216 | # even if it is disabled in config_psa_crypto_no_ecp_at_all(). As a |
| 217 | # consequence compressed points are supported in the reference |
| 218 | # component but not in the accelerated one, so they should be skipped |
| 219 | # while checking driver's coverage. |
| 220 | re.compile(r'Parse EC Key .*compressed\)'), |
| 221 | re.compile(r'Parse Public EC Key .*compressed\)'), |
| 222 | ], |
| 223 | # See ecp_light_only |
| 224 | 'test_suite_ssl': [ |
| 225 | 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()', |
| 226 | ], |
| 227 | } |
| 228 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 229 | class DriverVSReference_ecc_no_bignum(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 230 | REFERENCE = 'test_psa_crypto_config_reference_ecc_no_bignum' |
| 231 | DRIVER = 'test_psa_crypto_config_accel_ecc_no_bignum' |
| 232 | IGNORED_SUITES = [ |
| 233 | # Modules replaced by drivers |
| 234 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', |
| 235 | 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw', |
| 236 | 'bignum.generated', 'bignum.misc', |
| 237 | ] |
| 238 | IGNORED_TESTS = { |
| 239 | 'test_suite_config': [ |
| 240 | re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'), |
| 241 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 242 | re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'), |
| 243 | ], |
| 244 | 'test_suite_platform': [ |
| 245 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 246 | # component uses a sanitizer but the reference component |
| 247 | # doesn't, we have a PASS vs SKIP mismatch. |
| 248 | 'Check mbedtls_calloc overallocation', |
| 249 | ], |
| 250 | # See ecp_light_only |
| 251 | 'test_suite_random': [ |
| 252 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 253 | ], |
| 254 | # See no_ecp_at_all |
| 255 | 'test_suite_pkparse': [ |
| 256 | re.compile(r'Parse EC Key .*compressed\)'), |
| 257 | re.compile(r'Parse Public EC Key .*compressed\)'), |
| 258 | ], |
| 259 | 'test_suite_asn1parse': [ |
| 260 | 'INTEGER too large for mpi', |
| 261 | ], |
| 262 | 'test_suite_asn1write': [ |
| 263 | re.compile(r'ASN.1 Write mpi.*'), |
| 264 | ], |
| 265 | 'test_suite_debug': [ |
| 266 | re.compile(r'Debug print mbedtls_mpi.*'), |
| 267 | ], |
| 268 | # See ecp_light_only |
| 269 | 'test_suite_ssl': [ |
| 270 | 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()', |
| 271 | ], |
| 272 | } |
| 273 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 274 | class DriverVSReference_ecc_ffdh_no_bignum(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 275 | REFERENCE = 'test_psa_crypto_config_reference_ecc_ffdh_no_bignum' |
| 276 | DRIVER = 'test_psa_crypto_config_accel_ecc_ffdh_no_bignum' |
| 277 | IGNORED_SUITES = [ |
| 278 | # Modules replaced by drivers |
| 279 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', 'dhm', |
| 280 | 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw', |
| 281 | 'bignum.generated', 'bignum.misc', |
| 282 | ] |
| 283 | IGNORED_TESTS = { |
| 284 | 'ssl-opt': [ |
| 285 | # DHE support in TLS 1.2 requires built-in MBEDTLS_DHM_C |
| 286 | # (because it needs custom groups, which PSA does not |
| 287 | # provide), even with MBEDTLS_USE_PSA_CRYPTO. |
| 288 | re.compile(r'PSK callback:.*\bdhe-psk\b.*'), |
| 289 | ], |
| 290 | 'test_suite_config': [ |
| 291 | re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'), |
| 292 | re.compile(r'.*\bMBEDTLS_DHM_C\b.*'), |
| 293 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 294 | re.compile(r'.*\bMBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED\b.*'), |
| 295 | re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'), |
| 296 | ], |
| 297 | 'test_suite_platform': [ |
| 298 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 299 | # component uses a sanitizer but the reference component |
| 300 | # doesn't, we have a PASS vs SKIP mismatch. |
| 301 | 'Check mbedtls_calloc overallocation', |
| 302 | ], |
| 303 | # See ecp_light_only |
| 304 | 'test_suite_random': [ |
| 305 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 306 | ], |
| 307 | # See no_ecp_at_all |
| 308 | 'test_suite_pkparse': [ |
| 309 | re.compile(r'Parse EC Key .*compressed\)'), |
| 310 | re.compile(r'Parse Public EC Key .*compressed\)'), |
| 311 | ], |
| 312 | 'test_suite_asn1parse': [ |
| 313 | 'INTEGER too large for mpi', |
| 314 | ], |
| 315 | 'test_suite_asn1write': [ |
| 316 | re.compile(r'ASN.1 Write mpi.*'), |
| 317 | ], |
| 318 | 'test_suite_debug': [ |
| 319 | re.compile(r'Debug print mbedtls_mpi.*'), |
| 320 | ], |
| 321 | # See ecp_light_only |
| 322 | 'test_suite_ssl': [ |
| 323 | 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()', |
| 324 | ], |
| 325 | } |
| 326 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 327 | class DriverVSReference_ffdh_alg(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 328 | REFERENCE = 'test_psa_crypto_config_reference_ffdh' |
| 329 | DRIVER = 'test_psa_crypto_config_accel_ffdh' |
| 330 | IGNORED_SUITES = ['dhm'] |
| 331 | IGNORED_TESTS = { |
| 332 | 'test_suite_config': [ |
| 333 | re.compile(r'.*\bMBEDTLS_DHM_C\b.*'), |
| 334 | ], |
| 335 | 'test_suite_platform': [ |
| 336 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 337 | # component uses a sanitizer but the reference component |
| 338 | # doesn't, we have a PASS vs SKIP mismatch. |
| 339 | 'Check mbedtls_calloc overallocation', |
| 340 | ], |
| 341 | } |
| 342 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 343 | class DriverVSReference_tfm_config(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 344 | REFERENCE = 'test_tfm_config_no_p256m' |
| 345 | DRIVER = 'test_tfm_config_p256m_driver_accel_ec' |
| 346 | IGNORED_SUITES = [ |
| 347 | # Modules replaced by drivers |
| 348 | 'asn1parse', 'asn1write', |
| 349 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', |
| 350 | 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw', |
| 351 | 'bignum.generated', 'bignum.misc', |
| 352 | ] |
| 353 | IGNORED_TESTS = { |
| 354 | 'test_suite_config': [ |
| 355 | re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'), |
| 356 | re.compile(r'.*\bMBEDTLS_(ASN1\w+)_C\b.*'), |
| 357 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECP)_.*'), |
| 358 | re.compile(r'.*\bMBEDTLS_PSA_P256M_DRIVER_ENABLED\b.*') |
| 359 | ], |
| 360 | 'test_suite_config.crypto_combinations': [ |
| 361 | 'Config: ECC: Weierstrass curves only', |
| 362 | ], |
| 363 | 'test_suite_platform': [ |
| 364 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 365 | # component uses a sanitizer but the reference component |
| 366 | # doesn't, we have a PASS vs SKIP mismatch. |
| 367 | 'Check mbedtls_calloc overallocation', |
| 368 | ], |
| 369 | # See ecp_light_only |
| 370 | 'test_suite_random': [ |
| 371 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 372 | ], |
| 373 | } |
| 374 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 375 | class DriverVSReference_rsa(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 376 | REFERENCE = 'test_psa_crypto_config_reference_rsa_crypto' |
| 377 | DRIVER = 'test_psa_crypto_config_accel_rsa_crypto' |
| 378 | IGNORED_SUITES = [ |
| 379 | # Modules replaced by drivers. |
| 380 | 'rsa', 'pkcs1_v15', 'pkcs1_v21', |
| 381 | # We temporarily don't care about PK stuff. |
| 382 | 'pk', 'pkwrite', 'pkparse' |
| 383 | ] |
| 384 | IGNORED_TESTS = { |
| 385 | 'test_suite_config': [ |
| 386 | re.compile(r'.*\bMBEDTLS_(PKCS1|RSA)_.*'), |
| 387 | re.compile(r'.*\bMBEDTLS_GENPRIME\b.*') |
| 388 | ], |
| 389 | 'test_suite_platform': [ |
| 390 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 391 | # component uses a sanitizer but the reference component |
| 392 | # doesn't, we have a PASS vs SKIP mismatch. |
| 393 | 'Check mbedtls_calloc overallocation', |
| 394 | ], |
| 395 | # Following tests depend on RSA_C but are not about |
| 396 | # them really, just need to know some error code is there. |
| 397 | 'test_suite_error': [ |
| 398 | 'Low and high error', |
| 399 | 'Single high error' |
| 400 | ], |
| 401 | # Constant time operations only used for PKCS1_V15 |
| 402 | 'test_suite_constant_time': [ |
| 403 | re.compile(r'mbedtls_ct_zeroize_if .*'), |
| 404 | re.compile(r'mbedtls_ct_memmove_left .*') |
| 405 | ], |
| 406 | 'test_suite_psa_crypto': [ |
| 407 | # We don't support generate_key_custom entry points |
| 408 | # in drivers yet. |
| 409 | re.compile(r'PSA generate key custom: RSA, e=.*'), |
| 410 | re.compile(r'PSA generate key ext: RSA, e=.*'), |
| 411 | ], |
| 412 | } |
| 413 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 414 | class DriverVSReference_block_cipher_dispatch(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 415 | REFERENCE = 'test_full_block_cipher_legacy_dispatch' |
| 416 | DRIVER = 'test_full_block_cipher_psa_dispatch' |
| 417 | IGNORED_SUITES = [ |
| 418 | # Skipped in the accelerated component |
| 419 | 'aes', 'aria', 'camellia', |
| 420 | # These require AES_C, ARIA_C or CAMELLIA_C to be enabled in |
| 421 | # order for the cipher module (actually cipher_wrapper) to work |
| 422 | # properly. However these symbols are disabled in the accelerated |
| 423 | # component so we ignore them. |
| 424 | 'cipher.ccm', 'cipher.gcm', 'cipher.aes', 'cipher.aria', |
| 425 | 'cipher.camellia', |
| 426 | ] |
| 427 | IGNORED_TESTS = { |
| 428 | 'test_suite_config': [ |
| 429 | re.compile(r'.*\bMBEDTLS_(AES|ARIA|CAMELLIA)_.*'), |
| 430 | re.compile(r'.*\bMBEDTLS_AES(\w+)_C\b.*'), |
| 431 | ], |
| 432 | 'test_suite_cmac': [ |
| 433 | # Following tests require AES_C/ARIA_C/CAMELLIA_C to be enabled, |
| 434 | # but these are not available in the accelerated component. |
| 435 | 'CMAC null arguments', |
| 436 | re.compile('CMAC.* (AES|ARIA|Camellia).*'), |
| 437 | ], |
| 438 | 'test_suite_cipher.padding': [ |
| 439 | # Following tests require AES_C/CAMELLIA_C to be enabled, |
| 440 | # but these are not available in the accelerated component. |
| 441 | re.compile('Set( non-existent)? padding with (AES|CAMELLIA).*'), |
| 442 | ], |
| 443 | 'test_suite_pkcs5': [ |
| 444 | # The AES part of PKCS#5 PBES2 is not yet supported. |
| 445 | # The rest of PKCS#5 (PBKDF2) works, though. |
| 446 | re.compile(r'PBES2 .* AES-.*') |
| 447 | ], |
| 448 | 'test_suite_pkparse': [ |
| 449 | # PEM (called by pkparse) requires AES_C in order to decrypt |
| 450 | # the key, but this is not available in the accelerated |
| 451 | # component. |
| 452 | re.compile('Parse RSA Key.*(password|AES-).*'), |
| 453 | ], |
| 454 | 'test_suite_pem': [ |
| 455 | # Following tests require AES_C, but this is diabled in the |
| 456 | # accelerated component. |
| 457 | re.compile('PEM read .*AES.*'), |
| 458 | 'PEM read (unknown encryption algorithm)', |
| 459 | ], |
| 460 | 'test_suite_error': [ |
| 461 | # Following tests depend on AES_C but are not about them |
| 462 | # really, just need to know some error code is there. |
| 463 | 'Single low error', |
| 464 | 'Low and high error', |
| 465 | ], |
| 466 | 'test_suite_version': [ |
| 467 | # Similar to test_suite_error above. |
| 468 | 'Check for MBEDTLS_AES_C when already present', |
| 469 | ], |
| 470 | 'test_suite_platform': [ |
| 471 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 472 | # component uses a sanitizer but the reference component |
| 473 | # doesn't, we have a PASS vs SKIP mismatch. |
| 474 | 'Check mbedtls_calloc overallocation', |
| 475 | ], |
| 476 | } |
| 477 | |
| 478 | #pylint: enable=invalid-name,missing-class-docstring |
| 479 | |
| 480 | |
Przemek Stekiel | 6856f4c | 2022-11-09 10:50:29 +0100 | [diff] [blame] | 481 | # List of tasks with a function that can handle this task and additional arguments if required |
Valerio Setti | dfd7ca6 | 2023-10-09 16:30:11 +0200 | [diff] [blame] | 482 | KNOWN_TASKS = { |
Gilles Peskine | 0316f10 | 2024-09-16 19:15:29 +0200 | [diff] [blame] | 483 | 'analyze_coverage': CoverageTask, |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 484 | 'analyze_driver_vs_reference_hash': DriverVSReference_hash, |
| 485 | 'analyze_driver_vs_reference_hmac': DriverVSReference_hmac, |
| 486 | 'analyze_driver_vs_reference_cipher_aead_cmac': DriverVSReference_cipher_aead_cmac, |
| 487 | 'analyze_driver_vs_reference_ecp_light_only': DriverVSReference_ecp_light_only, |
| 488 | 'analyze_driver_vs_reference_no_ecp_at_all': DriverVSReference_no_ecp_at_all, |
| 489 | 'analyze_driver_vs_reference_ecc_no_bignum': DriverVSReference_ecc_no_bignum, |
| 490 | 'analyze_driver_vs_reference_ecc_ffdh_no_bignum': DriverVSReference_ecc_ffdh_no_bignum, |
| 491 | 'analyze_driver_vs_reference_ffdh_alg': DriverVSReference_ffdh_alg, |
| 492 | 'analyze_driver_vs_reference_tfm_config': DriverVSReference_tfm_config, |
| 493 | 'analyze_driver_vs_reference_rsa': DriverVSReference_rsa, |
| 494 | 'analyze_block_cipher_dispatch': DriverVSReference_block_cipher_dispatch, |
Przemek Stekiel | 4d13c83 | 2022-10-26 16:11:26 +0200 | [diff] [blame] | 495 | } |
Przemek Stekiel | 4d13c83 | 2022-10-26 16:11:26 +0200 | [diff] [blame] | 496 | |
Gilles Peskine | 15c2cbf | 2020-06-25 18:36:28 +0200 | [diff] [blame] | 497 | if __name__ == '__main__': |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame^] | 498 | outcome_analysis.main(KNOWN_TASKS) |