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