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