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