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