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 | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 10 | import typing |
Gilles Peskine | 15c2cbf | 2020-06-25 18:36:28 +0200 | [diff] [blame] | 11 | |
Gilles Peskine | 738a597 | 2024-10-03 18:52:58 +0200 | [diff] [blame] | 12 | import scripts_path # pylint: disable=unused-import |
| 13 | from mbedtls_framework import outcome_analysis |
Gilles Peskine | 8d3c70a | 2020-06-25 18:37:43 +0200 | [diff] [blame] | 14 | |
Pengyu Lv | c2e8f3a | 2023-11-28 17:22:04 +0800 | [diff] [blame] | 15 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 16 | class CoverageTask(outcome_analysis.CoverageTask): |
Gilles Peskine | 4e606db | 2024-10-04 16:24:26 +0200 | [diff] [blame] | 17 | """Justify test cases that are never executed.""" |
Gilles Peskine | 95b2b0c | 2024-09-16 20:23:40 +0200 | [diff] [blame] | 18 | |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 19 | @staticmethod |
Gilles Peskine | 72396da | 2024-09-17 17:15:29 +0200 | [diff] [blame] | 20 | def _has_word_re(words: typing.Iterable[str], |
| 21 | exclude: typing.Optional[str] = None) -> typing.Pattern: |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 22 | """Construct a regex that matches if any of the words appears. |
| 23 | |
| 24 | The occurrence must start and end at a word boundary. |
Gilles Peskine | 72396da | 2024-09-17 17:15:29 +0200 | [diff] [blame] | 25 | |
| 26 | If exclude is specified, strings containing a match for that |
| 27 | regular expression will not match the returned pattern. |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 28 | """ |
Gilles Peskine | 72396da | 2024-09-17 17:15:29 +0200 | [diff] [blame] | 29 | exclude_clause = r'' |
| 30 | if exclude: |
| 31 | exclude_clause = r'(?!.*' + exclude + ')' |
| 32 | return re.compile(exclude_clause + |
| 33 | r'.*\b(?:' + r'|'.join(words) + r')\b.*', |
Gilles Peskine | 1abc800 | 2024-10-11 12:00:44 +0200 | [diff] [blame] | 34 | re.DOTALL) |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 35 | |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 36 | IGNORED_TESTS = { |
Gilles Peskine | 419a584 | 2024-09-17 18:32:05 +0200 | [diff] [blame] | 37 | 'ssl-opt': [ |
| 38 | # We don't run ssl-opt.sh with Valgrind on the CI because |
| 39 | # it's extremely slow. We don't intend to change this. |
| 40 | 'DTLS client reconnect from same port: reconnect, nbio, valgrind', |
Gilles Peskine | 419a584 | 2024-09-17 18:32:05 +0200 | [diff] [blame] | 41 | # We don't have IPv6 in our CI environment. |
| 42 | # https://github.com/Mbed-TLS/mbedtls-test/issues/176 |
| 43 | 'DTLS cookie: enabled, IPv6', |
| 44 | # Disabled due to OpenSSL bug. |
| 45 | # https://github.com/openssl/openssl/issues/18887 |
| 46 | 'DTLS fragmenting: 3d, openssl client, DTLS 1.2', |
| 47 | # We don't run ssl-opt.sh with Valgrind on the CI because |
| 48 | # it's extremely slow. We don't intend to change this. |
| 49 | 'DTLS fragmenting: proxy MTU: auto-reduction (with valgrind)', |
| 50 | # It seems that we don't run `ssl-opt.sh` with |
| 51 | # `MBEDTLS_USE_PSA_CRYPTO` enabled but `MBEDTLS_SSL_ASYNC_PRIVATE` |
| 52 | # disabled. |
| 53 | # https://github.com/Mbed-TLS/mbedtls/issues/9581 |
| 54 | 'Opaque key for server authentication: invalid key: decrypt with ECC key, no async', |
| 55 | 'Opaque key for server authentication: invalid key: ecdh with RSA key, no async', |
| 56 | ], |
Gilles Peskine | 47243fd | 2024-09-17 19:46:18 +0200 | [diff] [blame] | 57 | 'test_suite_config.mbedtls_boolean': [ |
| 58 | # We never test with CBC/PKCS5/PKCS12 enabled but |
| 59 | # PKCS7 padding disabled. |
| 60 | # https://github.com/Mbed-TLS/mbedtls/issues/9580 |
| 61 | 'Config: !MBEDTLS_CIPHER_PADDING_PKCS7', |
| 62 | # https://github.com/Mbed-TLS/mbedtls/issues/9583 |
| 63 | 'Config: !MBEDTLS_ECP_NIST_OPTIM', |
Gilles Peskine | 44fdd92 | 2024-10-10 18:19:23 +0200 | [diff] [blame] | 64 | # MBEDTLS_ECP_NO_FALLBACK only affects builds using a partial |
| 65 | # alternative implementation of ECP arithmetic (with |
| 66 | # MBEDTLS_ECP_INTERNAL_ALT enabled). We don't test those builds. |
| 67 | # The configuration enumeration script skips xxx_ALT options |
| 68 | # but not MBEDTLS_ECP_NO_FALLBACK, so it appears in the report, |
| 69 | # but we don't care about it. |
| 70 | 'Config: MBEDTLS_ECP_NO_FALLBACK', |
Gilles Peskine | 47243fd | 2024-09-17 19:46:18 +0200 | [diff] [blame] | 71 | # Missing coverage of test configurations. |
| 72 | # https://github.com/Mbed-TLS/mbedtls/issues/9585 |
| 73 | 'Config: !MBEDTLS_SSL_DTLS_ANTI_REPLAY', |
| 74 | # Missing coverage of test configurations. |
| 75 | # https://github.com/Mbed-TLS/mbedtls/issues/9585 |
| 76 | 'Config: !MBEDTLS_SSL_DTLS_HELLO_VERIFY', |
| 77 | # We don't run test_suite_config when we test this. |
| 78 | # https://github.com/Mbed-TLS/mbedtls/issues/9586 |
| 79 | 'Config: !MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED', |
| 80 | # We only test multithreading with pthreads. |
| 81 | # https://github.com/Mbed-TLS/mbedtls/issues/9584 |
| 82 | 'Config: !MBEDTLS_THREADING_PTHREAD', |
| 83 | # Built but not tested. |
| 84 | # https://github.com/Mbed-TLS/mbedtls/issues/9587 |
| 85 | 'Config: MBEDTLS_AES_USE_HARDWARE_ONLY', |
| 86 | # Untested platform-specific optimizations. |
| 87 | # https://github.com/Mbed-TLS/mbedtls/issues/9588 |
| 88 | 'Config: MBEDTLS_HAVE_SSE2', |
Gilles Peskine | 47243fd | 2024-09-17 19:46:18 +0200 | [diff] [blame] | 89 | # Untested aspect of the platform interface. |
| 90 | # https://github.com/Mbed-TLS/mbedtls/issues/9589 |
| 91 | 'Config: MBEDTLS_PLATFORM_NO_STD_FUNCTIONS', |
| 92 | # In a client-server build, test_suite_config runs in the |
| 93 | # client configuration, so it will never report |
| 94 | # MBEDTLS_PSA_CRYPTO_SPM as enabled. That's ok. |
| 95 | 'Config: MBEDTLS_PSA_CRYPTO_SPM', |
| 96 | # We don't test on armv8 yet. |
| 97 | 'Config: MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT', |
| 98 | 'Config: MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY', |
| 99 | 'Config: MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY', |
| 100 | 'Config: MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY', |
| 101 | # We don't run test_suite_config when we test this. |
| 102 | # https://github.com/Mbed-TLS/mbedtls/issues/9586 |
| 103 | 'Config: MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND', |
| 104 | ], |
| 105 | 'test_suite_config.psa_boolean': [ |
| 106 | # We don't test with HMAC disabled. |
| 107 | # https://github.com/Mbed-TLS/mbedtls/issues/9591 |
| 108 | 'Config: !PSA_WANT_ALG_HMAC', |
Gilles Peskine | 47243fd | 2024-09-17 19:46:18 +0200 | [diff] [blame] | 109 | # The DERIVE key type is always enabled. |
| 110 | 'Config: !PSA_WANT_KEY_TYPE_DERIVE', |
| 111 | # More granularity of key pair type enablement macros |
| 112 | # than we care to test. |
| 113 | # https://github.com/Mbed-TLS/mbedtls/issues/9590 |
| 114 | 'Config: !PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT', |
| 115 | 'Config: !PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE', |
| 116 | 'Config: !PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT', |
| 117 | # More granularity of key pair type enablement macros |
| 118 | # than we care to test. |
| 119 | # https://github.com/Mbed-TLS/mbedtls/issues/9590 |
| 120 | 'Config: !PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT', |
| 121 | 'Config: !PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT', |
| 122 | # We don't test with HMAC disabled. |
| 123 | # https://github.com/Mbed-TLS/mbedtls/issues/9591 |
| 124 | 'Config: !PSA_WANT_KEY_TYPE_HMAC', |
| 125 | # The PASSWORD key type is always enabled. |
| 126 | 'Config: !PSA_WANT_KEY_TYPE_PASSWORD', |
| 127 | # The PASSWORD_HASH key type is always enabled. |
| 128 | 'Config: !PSA_WANT_KEY_TYPE_PASSWORD_HASH', |
| 129 | # The RAW_DATA key type is always enabled. |
| 130 | 'Config: !PSA_WANT_KEY_TYPE_RAW_DATA', |
| 131 | # More granularity of key pair type enablement macros |
| 132 | # than we care to test. |
| 133 | # https://github.com/Mbed-TLS/mbedtls/issues/9590 |
| 134 | 'Config: !PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT', |
| 135 | 'Config: !PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT', |
| 136 | # Algorithm declared but not supported. |
| 137 | 'Config: PSA_WANT_ALG_CBC_MAC', |
| 138 | # Algorithm declared but not supported. |
| 139 | 'Config: PSA_WANT_ALG_XTS', |
| 140 | # Family declared but not supported. |
| 141 | 'Config: PSA_WANT_ECC_SECP_K1_224', |
| 142 | # More granularity of key pair type enablement macros |
| 143 | # than we care to test. |
| 144 | # https://github.com/Mbed-TLS/mbedtls/issues/9590 |
| 145 | 'Config: PSA_WANT_KEY_TYPE_DH_KEY_PAIR_DERIVE', |
| 146 | 'Config: PSA_WANT_KEY_TYPE_ECC_KEY_PAIR', |
| 147 | 'Config: PSA_WANT_KEY_TYPE_RSA_KEY_PAIR', |
| 148 | 'Config: PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE', |
| 149 | ], |
| 150 | 'test_suite_config.psa_combinations': [ |
| 151 | # We don't test this unusual, but sensible configuration. |
| 152 | # https://github.com/Mbed-TLS/mbedtls/issues/9592 |
| 153 | 'Config: PSA_WANT_ALG_DETERMINSTIC_ECDSA without PSA_WANT_ALG_ECDSA', |
| 154 | ], |
Gilles Peskine | 1a17627 | 2024-09-17 18:33:29 +0200 | [diff] [blame] | 155 | 'test_suite_pkcs12': [ |
Gilles Peskine | 47243fd | 2024-09-17 19:46:18 +0200 | [diff] [blame] | 156 | # We never test with CBC/PKCS5/PKCS12 enabled but |
| 157 | # PKCS7 padding disabled. |
Gilles Peskine | 1a17627 | 2024-09-17 18:33:29 +0200 | [diff] [blame] | 158 | # https://github.com/Mbed-TLS/mbedtls/issues/9580 |
| 159 | 'PBE Decrypt, (Invalid padding & PKCS7 padding disabled)', |
| 160 | 'PBE Encrypt, pad = 8 (PKCS7 padding disabled)', |
| 161 | ], |
| 162 | 'test_suite_pkcs5': [ |
Gilles Peskine | 47243fd | 2024-09-17 19:46:18 +0200 | [diff] [blame] | 163 | # We never test with CBC/PKCS5/PKCS12 enabled but |
| 164 | # PKCS7 padding disabled. |
Gilles Peskine | 1a17627 | 2024-09-17 18:33:29 +0200 | [diff] [blame] | 165 | # https://github.com/Mbed-TLS/mbedtls/issues/9580 |
| 166 | 'PBES2 Decrypt (Invalid padding & PKCS7 padding disabled)', |
| 167 | 'PBES2 Encrypt, pad=6 (PKCS7 padding disabled)', |
| 168 | 'PBES2 Encrypt, pad=8 (PKCS7 padding disabled)', |
| 169 | ], |
Gilles Peskine | 8729b10 | 2024-04-19 19:08:34 +0200 | [diff] [blame] | 170 | 'test_suite_psa_crypto': [ |
| 171 | # We don't test this unusual, but sensible configuration. |
| 172 | # https://github.com/Mbed-TLS/mbedtls/issues/9592 |
| 173 | re.compile(r'.*ECDSA.*only deterministic supported'), |
| 174 | ], |
Gilles Peskine | 1a17627 | 2024-09-17 18:33:29 +0200 | [diff] [blame] | 175 | 'test_suite_psa_crypto_metadata': [ |
| 176 | # Algorithms declared but not supported. |
| 177 | # https://github.com/Mbed-TLS/mbedtls/issues/9579 |
| 178 | 'Asymmetric signature: Ed25519ph', |
| 179 | 'Asymmetric signature: Ed448ph', |
| 180 | 'Asymmetric signature: pure EdDSA', |
| 181 | 'Cipher: XTS', |
| 182 | 'MAC: CBC_MAC-3DES', |
| 183 | 'MAC: CBC_MAC-AES-128', |
| 184 | 'MAC: CBC_MAC-AES-192', |
| 185 | 'MAC: CBC_MAC-AES-256', |
| 186 | ], |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 187 | 'test_suite_psa_crypto_not_supported.generated': [ |
Gilles Peskine | 1abc800 | 2024-10-11 12:00:44 +0200 | [diff] [blame] | 188 | # We never test with DH key support disabled but support |
Gilles Peskine | 1fac371 | 2024-09-17 17:57:11 +0200 | [diff] [blame] | 189 | # for a DH group enabled. The dependencies of these test |
| 190 | # cases don't really make sense. |
| 191 | # https://github.com/Mbed-TLS/mbedtls/issues/9574 |
| 192 | re.compile(r'PSA \w+ DH_.*type not supported'), |
| 193 | # We only test partial support for DH with the 2048-bit group |
| 194 | # enabled and the other groups disabled. |
| 195 | # https://github.com/Mbed-TLS/mbedtls/issues/9575 |
| 196 | 'PSA generate DH_KEY_PAIR(RFC7919) 2048-bit group not supported', |
| 197 | 'PSA import DH_KEY_PAIR(RFC7919) 2048-bit group not supported', |
| 198 | 'PSA import DH_PUBLIC_KEY(RFC7919) 2048-bit group not supported', |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 199 | ], |
| 200 | 'test_suite_psa_crypto_op_fail.generated': [ |
Gilles Peskine | 8729b10 | 2024-04-19 19:08:34 +0200 | [diff] [blame] | 201 | # We don't test this unusual, but sensible configuration. |
| 202 | # https://github.com/Mbed-TLS/mbedtls/issues/9592 |
| 203 | re.compile(r'.*: !ECDSA but DETERMINISTIC_ECDSA with ECC_.*'), |
Gilles Peskine | 1fac371 | 2024-09-17 17:57:11 +0200 | [diff] [blame] | 204 | # PBKDF2_HMAC is not in the default configuration, so we don't |
| 205 | # enable it in depends.py where we remove hashes. |
| 206 | # https://github.com/Mbed-TLS/mbedtls/issues/9576 |
| 207 | re.compile(r'PSA key_derivation PBKDF2_HMAC\(\w+\): !(?!PBKDF2_HMAC\Z).*'), |
Gilles Peskine | 1fac371 | 2024-09-17 17:57:11 +0200 | [diff] [blame] | 208 | |
| 209 | # We never test with the HMAC algorithm enabled but the HMAC |
| 210 | # key type disabled. Those dependencies don't really make sense. |
| 211 | # https://github.com/Mbed-TLS/mbedtls/issues/9573 |
| 212 | re.compile(r'.* !HMAC with HMAC'), |
| 213 | # There's something wrong with PSA_WANT_ALG_RSA_PSS_ANY_SALT |
| 214 | # differing from PSA_WANT_ALG_RSA_PSS. |
| 215 | # https://github.com/Mbed-TLS/mbedtls/issues/9578 |
| 216 | re.compile(r'PSA sign RSA_PSS_ANY_SALT.*!(?:MD|RIPEMD|SHA).*'), |
Gilles Peskine | a6c1f56 | 2025-01-16 19:49:12 +0100 | [diff] [blame] | 217 | # We don't test with ECDH disabled but the key type enabled. |
| 218 | # https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/161 |
| 219 | re.compile(r'PSA key_agreement.* !ECDH with ECC_KEY_PAIR\(.*'), |
| 220 | # We don't test with FFDH disabled but the key type enabled. |
| 221 | # https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/160 |
| 222 | re.compile(r'PSA key_agreement.* !FFDH with DH_KEY_PAIR\(.*'), |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 223 | ], |
Gilles Peskine | 8729b10 | 2024-04-19 19:08:34 +0200 | [diff] [blame] | 224 | 'test_suite_psa_crypto_op_fail.misc': [ |
| 225 | # We don't test this unusual, but sensible configuration. |
| 226 | # https://github.com/Mbed-TLS/mbedtls/issues/9592 |
| 227 | 'PSA sign DETERMINISTIC_ECDSA(SHA_256): !ECDSA but DETERMINISTIC_ECDSA with ECC_KEY_PAIR(SECP_R1)', #pylint: disable=line-too-long |
| 228 | ], |
Gilles Peskine | 419a584 | 2024-09-17 18:32:05 +0200 | [diff] [blame] | 229 | 'tls13-misc': [ |
| 230 | # Disabled due to OpenSSL bug. |
| 231 | # https://github.com/openssl/openssl/issues/10714 |
| 232 | 'TLS 1.3 O->m: resumption', |
| 233 | # Disabled due to OpenSSL command line limitation. |
| 234 | # https://github.com/Mbed-TLS/mbedtls/issues/9582 |
| 235 | 'TLS 1.3 m->O: resumption with early data', |
| 236 | ], |
Gilles Peskine | d8da2fc | 2024-09-17 15:07:22 +0200 | [diff] [blame] | 237 | } |
| 238 | |
Gilles Peskine | 17e071b | 2024-09-16 19:57:10 +0200 | [diff] [blame] | 239 | |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 240 | # The names that we give to classes derived from DriverVSReference do not |
| 241 | # follow the usual naming convention, because it's more readable to use |
| 242 | # underscores and parts of the configuration names. Also, these classes |
| 243 | # are just there to specify some data, so they don't need repetitive |
| 244 | # documentation. |
| 245 | #pylint: disable=invalid-name,missing-class-docstring |
| 246 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 247 | class DriverVSReference_hash(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 248 | REFERENCE = 'test_psa_crypto_config_reference_hash_use_psa' |
| 249 | DRIVER = 'test_psa_crypto_config_accel_hash_use_psa' |
| 250 | IGNORED_SUITES = [ |
| 251 | 'shax', 'mdx', # the software implementations that are being excluded |
| 252 | 'md.psa', # purposefully depends on whether drivers are present |
| 253 | 'psa_crypto_low_hash.generated', # testing the builtins |
| 254 | ] |
| 255 | IGNORED_TESTS = { |
| 256 | 'test_suite_config': [ |
| 257 | re.compile(r'.*\bMBEDTLS_(MD5|RIPEMD160|SHA[0-9]+)_.*'), |
| 258 | ], |
| 259 | 'test_suite_platform': [ |
| 260 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 261 | # component uses a sanitizer but the reference component |
| 262 | # doesn't, we have a PASS vs SKIP mismatch. |
| 263 | 'Check mbedtls_calloc overallocation', |
| 264 | ], |
| 265 | } |
| 266 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 267 | class DriverVSReference_hmac(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 268 | REFERENCE = 'test_psa_crypto_config_reference_hmac' |
| 269 | DRIVER = 'test_psa_crypto_config_accel_hmac' |
| 270 | IGNORED_SUITES = [ |
| 271 | # These suites require legacy hash support, which is disabled |
| 272 | # in the accelerated component. |
| 273 | 'shax', 'mdx', |
| 274 | # This suite tests builtins directly, but these are missing |
| 275 | # in the accelerated case. |
| 276 | 'psa_crypto_low_hash.generated', |
| 277 | ] |
| 278 | IGNORED_TESTS = { |
| 279 | 'test_suite_config': [ |
| 280 | re.compile(r'.*\bMBEDTLS_(MD5|RIPEMD160|SHA[0-9]+)_.*'), |
| 281 | re.compile(r'.*\bMBEDTLS_MD_C\b') |
| 282 | ], |
| 283 | 'test_suite_md': [ |
| 284 | # Builtin HMAC is not supported in the accelerate component. |
| 285 | re.compile('.*HMAC.*'), |
| 286 | # Following tests make use of functions which are not available |
| 287 | # when MD_C is disabled, as it happens in the accelerated |
| 288 | # test component. |
| 289 | re.compile('generic .* Hash file .*'), |
| 290 | 'MD list', |
| 291 | ], |
| 292 | 'test_suite_md.psa': [ |
| 293 | # "legacy only" tests require hash algorithms to be NOT |
| 294 | # accelerated, but this of course false for the accelerated |
| 295 | # test component. |
| 296 | re.compile('PSA dispatch .* legacy only'), |
| 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 | } |
| 305 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 306 | class DriverVSReference_cipher_aead_cmac(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 307 | REFERENCE = 'test_psa_crypto_config_reference_cipher_aead_cmac' |
| 308 | DRIVER = 'test_psa_crypto_config_accel_cipher_aead_cmac' |
| 309 | # Modules replaced by drivers. |
| 310 | IGNORED_SUITES = [ |
| 311 | # low-level (block/stream) cipher modules |
| 312 | 'aes', 'aria', 'camellia', 'des', 'chacha20', |
| 313 | # AEAD modes and CMAC |
| 314 | 'ccm', 'chachapoly', 'cmac', 'gcm', |
| 315 | # The Cipher abstraction layer |
| 316 | 'cipher', |
| 317 | ] |
| 318 | IGNORED_TESTS = { |
| 319 | 'test_suite_config': [ |
| 320 | re.compile(r'.*\bMBEDTLS_(AES|ARIA|CAMELLIA|CHACHA20|DES)_.*'), |
| 321 | re.compile(r'.*\bMBEDTLS_(CCM|CHACHAPOLY|CMAC|GCM)_.*'), |
| 322 | re.compile(r'.*\bMBEDTLS_AES(\w+)_C\b.*'), |
| 323 | re.compile(r'.*\bMBEDTLS_CIPHER_.*'), |
| 324 | ], |
| 325 | # PEM decryption is not supported so far. |
| 326 | # The rest of PEM (write, unencrypted read) works though. |
| 327 | 'test_suite_pem': [ |
| 328 | re.compile(r'PEM read .*(AES|DES|\bencrypt).*'), |
| 329 | ], |
| 330 | 'test_suite_platform': [ |
| 331 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 332 | # component uses a sanitizer but the reference component |
| 333 | # doesn't, we have a PASS vs SKIP mismatch. |
| 334 | 'Check mbedtls_calloc overallocation', |
| 335 | ], |
| 336 | # Following tests depend on AES_C/DES_C but are not about |
| 337 | # them really, just need to know some error code is there. |
| 338 | 'test_suite_error': [ |
| 339 | 'Low and high error', |
| 340 | 'Single low error' |
| 341 | ], |
| 342 | # Similar to test_suite_error above. |
| 343 | 'test_suite_version': [ |
| 344 | 'Check for MBEDTLS_AES_C when already present', |
| 345 | ], |
| 346 | # The en/decryption part of PKCS#12 is not supported so far. |
| 347 | # The rest of PKCS#12 (key derivation) works though. |
| 348 | 'test_suite_pkcs12': [ |
| 349 | re.compile(r'PBE Encrypt, .*'), |
| 350 | re.compile(r'PBE Decrypt, .*'), |
| 351 | ], |
| 352 | # The en/decryption part of PKCS#5 is not supported so far. |
| 353 | # The rest of PKCS#5 (PBKDF2) works though. |
| 354 | 'test_suite_pkcs5': [ |
| 355 | re.compile(r'PBES2 Encrypt, .*'), |
| 356 | re.compile(r'PBES2 Decrypt .*'), |
| 357 | ], |
| 358 | # Encrypted keys are not supported so far. |
| 359 | # pylint: disable=line-too-long |
| 360 | 'test_suite_pkparse': [ |
| 361 | 'Key ASN1 (Encrypted key PKCS12, trailing garbage data)', |
| 362 | 'Key ASN1 (Encrypted key PKCS5, trailing garbage data)', |
| 363 | re.compile(r'Parse (RSA|EC) Key .*\(.* ([Ee]ncrypted|password).*\)'), |
| 364 | ], |
| 365 | # Encrypted keys are not supported so far. |
| 366 | 'ssl-opt': [ |
| 367 | 'TLS: password protected server key', |
| 368 | 'TLS: password protected client key', |
| 369 | 'TLS: password protected server key, two certificates', |
| 370 | ], |
| 371 | } |
| 372 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 373 | class DriverVSReference_ecp_light_only(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 374 | REFERENCE = 'test_psa_crypto_config_reference_ecc_ecp_light_only' |
| 375 | DRIVER = 'test_psa_crypto_config_accel_ecc_ecp_light_only' |
| 376 | IGNORED_SUITES = [ |
| 377 | # Modules replaced by drivers |
| 378 | 'ecdsa', 'ecdh', 'ecjpake', |
Gilles Peskine | 9a09443 | 2024-10-29 20:55:11 +0100 | [diff] [blame] | 379 | # Unit tests for the built-in implementation |
| 380 | 'psa_crypto_ecp', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 381 | ] |
| 382 | IGNORED_TESTS = { |
| 383 | 'test_suite_config': [ |
| 384 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 385 | ], |
| 386 | 'test_suite_platform': [ |
| 387 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 388 | # component uses a sanitizer but the reference component |
| 389 | # doesn't, we have a PASS vs SKIP mismatch. |
| 390 | 'Check mbedtls_calloc overallocation', |
| 391 | ], |
| 392 | # This test wants a legacy function that takes f_rng, p_rng |
| 393 | # arguments, and uses legacy ECDSA for that. The test is |
| 394 | # really about the wrapper around the PSA RNG, not ECDSA. |
| 395 | 'test_suite_random': [ |
| 396 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 397 | ], |
| 398 | # In the accelerated test ECP_C is not set (only ECP_LIGHT is) |
| 399 | # so we must ignore disparities in the tests for which ECP_C |
| 400 | # is required. |
| 401 | 'test_suite_ecp': [ |
| 402 | re.compile(r'ECP check public-private .*'), |
| 403 | re.compile(r'ECP calculate public: .*'), |
| 404 | re.compile(r'ECP gen keypair .*'), |
| 405 | re.compile(r'ECP point muladd .*'), |
| 406 | re.compile(r'ECP point multiplication .*'), |
| 407 | re.compile(r'ECP test vectors .*'), |
| 408 | ], |
| 409 | 'test_suite_ssl': [ |
| 410 | # This deprecated function is only present when ECP_C is On. |
Valerio Setti | 1a0ee06 | 2025-01-22 11:03:46 +0100 | [diff] [blame] | 411 | 'Test configuration of EC groups through mbedtls_ssl_conf_curves()', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 412 | ], |
| 413 | } |
| 414 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 415 | class DriverVSReference_no_ecp_at_all(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 416 | REFERENCE = 'test_psa_crypto_config_reference_ecc_no_ecp_at_all' |
| 417 | DRIVER = 'test_psa_crypto_config_accel_ecc_no_ecp_at_all' |
| 418 | IGNORED_SUITES = [ |
| 419 | # Modules replaced by drivers |
| 420 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', |
Gilles Peskine | 9a09443 | 2024-10-29 20:55:11 +0100 | [diff] [blame] | 421 | # Unit tests for the built-in implementation |
| 422 | 'psa_crypto_ecp', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 423 | ] |
| 424 | IGNORED_TESTS = { |
| 425 | 'test_suite_config': [ |
| 426 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 427 | re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'), |
| 428 | ], |
| 429 | 'test_suite_platform': [ |
| 430 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 431 | # component uses a sanitizer but the reference component |
| 432 | # doesn't, we have a PASS vs SKIP mismatch. |
| 433 | 'Check mbedtls_calloc overallocation', |
| 434 | ], |
| 435 | # See ecp_light_only |
| 436 | 'test_suite_random': [ |
| 437 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 438 | ], |
| 439 | 'test_suite_pkparse': [ |
| 440 | # When PK_PARSE_C and ECP_C are defined then PK_PARSE_EC_COMPRESSED |
| 441 | # is automatically enabled in build_info.h (backward compatibility) |
| 442 | # even if it is disabled in config_psa_crypto_no_ecp_at_all(). As a |
| 443 | # consequence compressed points are supported in the reference |
| 444 | # component but not in the accelerated one, so they should be skipped |
| 445 | # while checking driver's coverage. |
| 446 | re.compile(r'Parse EC Key .*compressed\)'), |
| 447 | re.compile(r'Parse Public EC Key .*compressed\)'), |
| 448 | ], |
| 449 | # See ecp_light_only |
| 450 | 'test_suite_ssl': [ |
Valerio Setti | 1a0ee06 | 2025-01-22 11:03:46 +0100 | [diff] [blame] | 451 | 'Test configuration of EC groups through mbedtls_ssl_conf_curves()', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 452 | ], |
| 453 | } |
| 454 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 455 | class DriverVSReference_ecc_no_bignum(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 456 | REFERENCE = 'test_psa_crypto_config_reference_ecc_no_bignum' |
| 457 | DRIVER = 'test_psa_crypto_config_accel_ecc_no_bignum' |
| 458 | IGNORED_SUITES = [ |
| 459 | # Modules replaced by drivers |
| 460 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', |
| 461 | 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw', |
| 462 | 'bignum.generated', 'bignum.misc', |
Gilles Peskine | 9a09443 | 2024-10-29 20:55:11 +0100 | [diff] [blame] | 463 | # Unit tests for the built-in implementation |
| 464 | 'psa_crypto_ecp', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 465 | ] |
| 466 | IGNORED_TESTS = { |
| 467 | 'test_suite_config': [ |
| 468 | re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'), |
| 469 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 470 | re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'), |
| 471 | ], |
| 472 | 'test_suite_platform': [ |
| 473 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 474 | # component uses a sanitizer but the reference component |
| 475 | # doesn't, we have a PASS vs SKIP mismatch. |
| 476 | 'Check mbedtls_calloc overallocation', |
| 477 | ], |
| 478 | # See ecp_light_only |
| 479 | 'test_suite_random': [ |
| 480 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 481 | ], |
| 482 | # See no_ecp_at_all |
| 483 | 'test_suite_pkparse': [ |
| 484 | re.compile(r'Parse EC Key .*compressed\)'), |
| 485 | re.compile(r'Parse Public EC Key .*compressed\)'), |
| 486 | ], |
| 487 | 'test_suite_asn1parse': [ |
| 488 | 'INTEGER too large for mpi', |
| 489 | ], |
| 490 | 'test_suite_asn1write': [ |
| 491 | re.compile(r'ASN.1 Write mpi.*'), |
| 492 | ], |
| 493 | 'test_suite_debug': [ |
| 494 | re.compile(r'Debug print mbedtls_mpi.*'), |
| 495 | ], |
| 496 | # See ecp_light_only |
| 497 | 'test_suite_ssl': [ |
Valerio Setti | 1a0ee06 | 2025-01-22 11:03:46 +0100 | [diff] [blame] | 498 | 'Test configuration of EC groups through mbedtls_ssl_conf_curves()', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 499 | ], |
| 500 | } |
| 501 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 502 | class DriverVSReference_ecc_ffdh_no_bignum(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 503 | REFERENCE = 'test_psa_crypto_config_reference_ecc_ffdh_no_bignum' |
| 504 | DRIVER = 'test_psa_crypto_config_accel_ecc_ffdh_no_bignum' |
| 505 | IGNORED_SUITES = [ |
| 506 | # Modules replaced by drivers |
| 507 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', 'dhm', |
| 508 | 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw', |
| 509 | 'bignum.generated', 'bignum.misc', |
Gilles Peskine | 9a09443 | 2024-10-29 20:55:11 +0100 | [diff] [blame] | 510 | # Unit tests for the built-in implementation |
| 511 | 'psa_crypto_ecp', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 512 | ] |
| 513 | IGNORED_TESTS = { |
| 514 | 'ssl-opt': [ |
| 515 | # DHE support in TLS 1.2 requires built-in MBEDTLS_DHM_C |
| 516 | # (because it needs custom groups, which PSA does not |
| 517 | # provide), even with MBEDTLS_USE_PSA_CRYPTO. |
| 518 | re.compile(r'PSK callback:.*\bdhe-psk\b.*'), |
| 519 | ], |
| 520 | 'test_suite_config': [ |
| 521 | re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'), |
| 522 | re.compile(r'.*\bMBEDTLS_DHM_C\b.*'), |
| 523 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'), |
| 524 | re.compile(r'.*\bMBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED\b.*'), |
| 525 | re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'), |
| 526 | ], |
| 527 | 'test_suite_platform': [ |
| 528 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 529 | # component uses a sanitizer but the reference component |
| 530 | # doesn't, we have a PASS vs SKIP mismatch. |
| 531 | 'Check mbedtls_calloc overallocation', |
| 532 | ], |
| 533 | # See ecp_light_only |
| 534 | 'test_suite_random': [ |
| 535 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 536 | ], |
| 537 | # See no_ecp_at_all |
| 538 | 'test_suite_pkparse': [ |
| 539 | re.compile(r'Parse EC Key .*compressed\)'), |
| 540 | re.compile(r'Parse Public EC Key .*compressed\)'), |
| 541 | ], |
| 542 | 'test_suite_asn1parse': [ |
| 543 | 'INTEGER too large for mpi', |
| 544 | ], |
| 545 | 'test_suite_asn1write': [ |
| 546 | re.compile(r'ASN.1 Write mpi.*'), |
| 547 | ], |
| 548 | 'test_suite_debug': [ |
| 549 | re.compile(r'Debug print mbedtls_mpi.*'), |
| 550 | ], |
| 551 | # See ecp_light_only |
| 552 | 'test_suite_ssl': [ |
Valerio Setti | 1a0ee06 | 2025-01-22 11:03:46 +0100 | [diff] [blame] | 553 | 'Test configuration of EC groups through mbedtls_ssl_conf_curves()', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 554 | ], |
| 555 | } |
| 556 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 557 | class DriverVSReference_ffdh_alg(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 558 | REFERENCE = 'test_psa_crypto_config_reference_ffdh' |
| 559 | DRIVER = 'test_psa_crypto_config_accel_ffdh' |
| 560 | IGNORED_SUITES = ['dhm'] |
| 561 | IGNORED_TESTS = { |
| 562 | 'test_suite_config': [ |
| 563 | re.compile(r'.*\bMBEDTLS_DHM_C\b.*'), |
| 564 | ], |
| 565 | 'test_suite_platform': [ |
| 566 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 567 | # component uses a sanitizer but the reference component |
| 568 | # doesn't, we have a PASS vs SKIP mismatch. |
| 569 | 'Check mbedtls_calloc overallocation', |
| 570 | ], |
| 571 | } |
| 572 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 573 | class DriverVSReference_tfm_config(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 574 | REFERENCE = 'test_tfm_config_no_p256m' |
| 575 | DRIVER = 'test_tfm_config_p256m_driver_accel_ec' |
| 576 | IGNORED_SUITES = [ |
| 577 | # Modules replaced by drivers |
| 578 | 'asn1parse', 'asn1write', |
| 579 | 'ecp', 'ecdsa', 'ecdh', 'ecjpake', |
| 580 | 'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw', |
| 581 | 'bignum.generated', 'bignum.misc', |
Gilles Peskine | 9a09443 | 2024-10-29 20:55:11 +0100 | [diff] [blame] | 582 | # Unit tests for the built-in implementation |
| 583 | 'psa_crypto_ecp', |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 584 | ] |
| 585 | IGNORED_TESTS = { |
| 586 | 'test_suite_config': [ |
| 587 | re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'), |
| 588 | re.compile(r'.*\bMBEDTLS_(ASN1\w+)_C\b.*'), |
| 589 | re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECP)_.*'), |
| 590 | re.compile(r'.*\bMBEDTLS_PSA_P256M_DRIVER_ENABLED\b.*') |
| 591 | ], |
| 592 | 'test_suite_config.crypto_combinations': [ |
| 593 | 'Config: ECC: Weierstrass curves only', |
| 594 | ], |
| 595 | 'test_suite_platform': [ |
| 596 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 597 | # component uses a sanitizer but the reference component |
| 598 | # doesn't, we have a PASS vs SKIP mismatch. |
| 599 | 'Check mbedtls_calloc overallocation', |
| 600 | ], |
| 601 | # See ecp_light_only |
| 602 | 'test_suite_random': [ |
| 603 | 'PSA classic wrapper: ECDSA signature (SECP256R1)', |
| 604 | ], |
| 605 | } |
| 606 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 607 | class DriverVSReference_rsa(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 608 | REFERENCE = 'test_psa_crypto_config_reference_rsa_crypto' |
| 609 | DRIVER = 'test_psa_crypto_config_accel_rsa_crypto' |
| 610 | IGNORED_SUITES = [ |
| 611 | # Modules replaced by drivers. |
| 612 | 'rsa', 'pkcs1_v15', 'pkcs1_v21', |
| 613 | # We temporarily don't care about PK stuff. |
| 614 | 'pk', 'pkwrite', 'pkparse' |
| 615 | ] |
| 616 | IGNORED_TESTS = { |
| 617 | 'test_suite_config': [ |
| 618 | re.compile(r'.*\bMBEDTLS_(PKCS1|RSA)_.*'), |
| 619 | re.compile(r'.*\bMBEDTLS_GENPRIME\b.*') |
| 620 | ], |
| 621 | 'test_suite_platform': [ |
| 622 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 623 | # component uses a sanitizer but the reference component |
| 624 | # doesn't, we have a PASS vs SKIP mismatch. |
| 625 | 'Check mbedtls_calloc overallocation', |
| 626 | ], |
| 627 | # Following tests depend on RSA_C but are not about |
| 628 | # them really, just need to know some error code is there. |
| 629 | 'test_suite_error': [ |
| 630 | 'Low and high error', |
| 631 | 'Single high error' |
| 632 | ], |
| 633 | # Constant time operations only used for PKCS1_V15 |
| 634 | 'test_suite_constant_time': [ |
| 635 | re.compile(r'mbedtls_ct_zeroize_if .*'), |
| 636 | re.compile(r'mbedtls_ct_memmove_left .*') |
| 637 | ], |
| 638 | 'test_suite_psa_crypto': [ |
| 639 | # We don't support generate_key_custom entry points |
| 640 | # in drivers yet. |
| 641 | re.compile(r'PSA generate key custom: RSA, e=.*'), |
| 642 | re.compile(r'PSA generate key ext: RSA, e=.*'), |
| 643 | ], |
| 644 | } |
| 645 | |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 646 | class DriverVSReference_block_cipher_dispatch(outcome_analysis.DriverVSReference): |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 647 | REFERENCE = 'test_full_block_cipher_legacy_dispatch' |
| 648 | DRIVER = 'test_full_block_cipher_psa_dispatch' |
| 649 | IGNORED_SUITES = [ |
| 650 | # Skipped in the accelerated component |
| 651 | 'aes', 'aria', 'camellia', |
| 652 | # These require AES_C, ARIA_C or CAMELLIA_C to be enabled in |
| 653 | # order for the cipher module (actually cipher_wrapper) to work |
| 654 | # properly. However these symbols are disabled in the accelerated |
| 655 | # component so we ignore them. |
| 656 | 'cipher.ccm', 'cipher.gcm', 'cipher.aes', 'cipher.aria', |
| 657 | 'cipher.camellia', |
| 658 | ] |
| 659 | IGNORED_TESTS = { |
| 660 | 'test_suite_config': [ |
| 661 | re.compile(r'.*\bMBEDTLS_(AES|ARIA|CAMELLIA)_.*'), |
| 662 | re.compile(r'.*\bMBEDTLS_AES(\w+)_C\b.*'), |
| 663 | ], |
| 664 | 'test_suite_cmac': [ |
| 665 | # Following tests require AES_C/ARIA_C/CAMELLIA_C to be enabled, |
| 666 | # but these are not available in the accelerated component. |
| 667 | 'CMAC null arguments', |
| 668 | re.compile('CMAC.* (AES|ARIA|Camellia).*'), |
| 669 | ], |
| 670 | 'test_suite_cipher.padding': [ |
| 671 | # Following tests require AES_C/CAMELLIA_C to be enabled, |
| 672 | # but these are not available in the accelerated component. |
| 673 | re.compile('Set( non-existent)? padding with (AES|CAMELLIA).*'), |
| 674 | ], |
| 675 | 'test_suite_pkcs5': [ |
| 676 | # The AES part of PKCS#5 PBES2 is not yet supported. |
| 677 | # The rest of PKCS#5 (PBKDF2) works, though. |
| 678 | re.compile(r'PBES2 .* AES-.*') |
| 679 | ], |
| 680 | 'test_suite_pkparse': [ |
| 681 | # PEM (called by pkparse) requires AES_C in order to decrypt |
| 682 | # the key, but this is not available in the accelerated |
| 683 | # component. |
| 684 | re.compile('Parse RSA Key.*(password|AES-).*'), |
| 685 | ], |
| 686 | 'test_suite_pem': [ |
| 687 | # Following tests require AES_C, but this is diabled in the |
| 688 | # accelerated component. |
| 689 | re.compile('PEM read .*AES.*'), |
| 690 | 'PEM read (unknown encryption algorithm)', |
| 691 | ], |
| 692 | 'test_suite_error': [ |
| 693 | # Following tests depend on AES_C but are not about them |
| 694 | # really, just need to know some error code is there. |
| 695 | 'Single low error', |
| 696 | 'Low and high error', |
| 697 | ], |
| 698 | 'test_suite_version': [ |
| 699 | # Similar to test_suite_error above. |
| 700 | 'Check for MBEDTLS_AES_C when already present', |
| 701 | ], |
| 702 | 'test_suite_platform': [ |
| 703 | # Incompatible with sanitizers (e.g. ASan). If the driver |
| 704 | # component uses a sanitizer but the reference component |
| 705 | # doesn't, we have a PASS vs SKIP mismatch. |
| 706 | 'Check mbedtls_calloc overallocation', |
| 707 | ], |
| 708 | } |
| 709 | |
| 710 | #pylint: enable=invalid-name,missing-class-docstring |
| 711 | |
| 712 | |
Przemek Stekiel | 6856f4c | 2022-11-09 10:50:29 +0100 | [diff] [blame] | 713 | # 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] | 714 | KNOWN_TASKS = { |
Gilles Peskine | 0316f10 | 2024-09-16 19:15:29 +0200 | [diff] [blame] | 715 | 'analyze_coverage': CoverageTask, |
Gilles Peskine | 92cc8db | 2024-09-16 20:14:26 +0200 | [diff] [blame] | 716 | 'analyze_driver_vs_reference_hash': DriverVSReference_hash, |
| 717 | 'analyze_driver_vs_reference_hmac': DriverVSReference_hmac, |
| 718 | 'analyze_driver_vs_reference_cipher_aead_cmac': DriverVSReference_cipher_aead_cmac, |
| 719 | 'analyze_driver_vs_reference_ecp_light_only': DriverVSReference_ecp_light_only, |
| 720 | 'analyze_driver_vs_reference_no_ecp_at_all': DriverVSReference_no_ecp_at_all, |
| 721 | 'analyze_driver_vs_reference_ecc_no_bignum': DriverVSReference_ecc_no_bignum, |
| 722 | 'analyze_driver_vs_reference_ecc_ffdh_no_bignum': DriverVSReference_ecc_ffdh_no_bignum, |
| 723 | 'analyze_driver_vs_reference_ffdh_alg': DriverVSReference_ffdh_alg, |
| 724 | 'analyze_driver_vs_reference_tfm_config': DriverVSReference_tfm_config, |
| 725 | 'analyze_driver_vs_reference_rsa': DriverVSReference_rsa, |
| 726 | 'analyze_block_cipher_dispatch': DriverVSReference_block_cipher_dispatch, |
Przemek Stekiel | 4d13c83 | 2022-10-26 16:11:26 +0200 | [diff] [blame] | 727 | } |
Przemek Stekiel | 4d13c83 | 2022-10-26 16:11:26 +0200 | [diff] [blame] | 728 | |
Gilles Peskine | 15c2cbf | 2020-06-25 18:36:28 +0200 | [diff] [blame] | 729 | if __name__ == '__main__': |
Gilles Peskine | 45a32b1 | 2024-10-03 18:42:37 +0200 | [diff] [blame] | 730 | outcome_analysis.main(KNOWN_TASKS) |