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