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