Fredrik Hesse | cc207bc | 2021-09-28 21:06:08 +0200 | [diff] [blame] | 1 | # Mbed TLS driver interface test strategy |
Gilles Peskine | b26c8d8 | 2019-09-04 19:26:17 +0200 | [diff] [blame] | 2 | |
Fredrik Hesse | cc207bc | 2021-09-28 21:06:08 +0200 | [diff] [blame] | 3 | This document describes the test strategy for the driver interfaces in Mbed TLS. Mbed TLS has interfaces for secure element drivers, accelerator drivers and entropy drivers. This document is about testing Mbed TLS itself; testing drivers is out of scope. |
Gilles Peskine | b26c8d8 | 2019-09-04 19:26:17 +0200 | [diff] [blame] | 4 | |
| 5 | The driver interfaces are standardized through PSA Cryptography functional specifications. |
| 6 | |
Gilles Peskine | f0e2853 | 2020-11-30 17:51:14 +0100 | [diff] [blame] | 7 | ## Secure element driver interface testing |
Gilles Peskine | b26c8d8 | 2019-09-04 19:26:17 +0200 | [diff] [blame] | 8 | |
Gilles Peskine | f0e2853 | 2020-11-30 17:51:14 +0100 | [diff] [blame] | 9 | ### Secure element driver interfaces |
| 10 | |
| 11 | #### Opaque driver interface |
| 12 | |
| 13 | The [unified driver interface](../../proposed/psa-driver-interface.md) supports both transparent drivers (for accelerators) and opaque drivers (for secure elements). |
| 14 | |
| 15 | Drivers exposing this interface need to be registered at compile time by declaring their JSON description file. |
| 16 | |
| 17 | #### Dynamic secure element driver interface |
| 18 | |
Fredrik Hesse | cc207bc | 2021-09-28 21:06:08 +0200 | [diff] [blame] | 19 | The dynamic secure element driver interface (SE interface for short) is defined by [`psa/crypto_se_driver.h`](../../../include/psa/crypto_se_driver.h). This is an interface between Mbed TLS and one or more third-party drivers. |
Gilles Peskine | b26c8d8 | 2019-09-04 19:26:17 +0200 | [diff] [blame] | 20 | |
Fredrik Hesse | cc207bc | 2021-09-28 21:06:08 +0200 | [diff] [blame] | 21 | The SE interface consists of one function provided by Mbed TLS (`psa_register_se_driver`) and many functions that drivers must implement. To make a driver usable by Mbed TLS, the initialization code must call `psa_register_se_driver` with a structure that describes the driver. The structure mostly contains function pointers, pointing to the driver's methods. All calls to a driver function are triggered by a call to a PSA crypto API function. |
Gilles Peskine | b26c8d8 | 2019-09-04 19:26:17 +0200 | [diff] [blame] | 22 | |
Gilles Peskine | 92bcfdb | 2019-09-04 19:26:50 +0200 | [diff] [blame] | 23 | ### SE driver interface unit tests |
| 24 | |
| 25 | This section describes unit tests that must be implemented to validate the secure element driver interface. Note that a test case may cover multiple requirements; for example a “good case” test can validate that the proper function is called, that it receives the expected inputs and that it produces the expected outputs. |
| 26 | |
| 27 | Many SE driver interface unit tests could be covered by running the existing API tests with a key in a secure element. |
| 28 | |
| 29 | #### SE driver registration |
| 30 | |
Gilles Peskine | f0e2853 | 2020-11-30 17:51:14 +0100 | [diff] [blame] | 31 | This applies to dynamic drivers only. |
| 32 | |
Gilles Peskine | 92bcfdb | 2019-09-04 19:26:50 +0200 | [diff] [blame] | 33 | * Test `psa_register_se_driver` with valid and with invalid arguments. |
| 34 | * Make at least one failing call to `psa_register_se_driver` followed by a successful call. |
| 35 | * Make at least one test that successfully registers the maximum number of drivers and fails to register one more. |
| 36 | |
| 37 | #### Dispatch to SE driver |
| 38 | |
| 39 | For each API function that can lead to a driver call (more precisely, for each driver method call site, but this is practically equivalent): |
| 40 | |
| 41 | * Make at least one test with a key in a secure element that checks that the driver method is called. A few API functions involve multiple driver methods; these should validate that all the expected driver methods are called. |
| 42 | * Make at least one test with a key that is not in a secure element that checks that the driver method is not called. |
| 43 | * Make at least one test with a key in a secure element with a driver that does not have the requisite method (i.e. the method pointer is `NULL`) but has the substructure containing that method, and check that the return value is `PSA_ERROR_NOT_SUPPORTED`. |
| 44 | * Make at least one test with a key in a secure element with a driver that does not have the substructure containing that method (i.e. the pointer to the substructure is `NULL`), and check that the return value is `PSA_ERROR_NOT_SUPPORTED`. |
| 45 | * At least one test should register multiple drivers with a key in each driver and check that the expected driver is called. This does not need to be done for all operations (use a white-box approach to determine if operations may use different code paths to choose the driver). |
| 46 | * At least one test should register the same driver structure with multiple lifetime values and check that the driver receives the expected lifetime value. |
| 47 | |
| 48 | Some methods only make sense as a group (for example a driver that provides the MAC methods must provide all or none). In those cases, test with all of them null and none of them null. |
| 49 | |
| 50 | #### SE driver inputs |
| 51 | |
| 52 | For each API function that can lead to a driver call (more precisely, for each driver method call site, but this is practically equivalent): |
| 53 | |
| 54 | * Wherever the specification guarantees parameters that satisfy certain preconditions, check these preconditions whenever practical. |
| 55 | * If the API function can take parameters that are invalid and must not reach the driver, call the API function with such parameters and verify that the driver method is not called. |
Gilles Peskine | 8b193c1 | 2019-09-05 17:58:13 +0200 | [diff] [blame] | 56 | * Check that the expected inputs reach the driver. This may be implicit in a test that checks the outputs if the only realistic way to obtain the correct outputs is to start from the expected inputs (as is often the case for cryptographic material, but not for metadata). |
Gilles Peskine | 92bcfdb | 2019-09-04 19:26:50 +0200 | [diff] [blame] | 57 | |
| 58 | #### SE driver outputs |
| 59 | |
Fredrik Hesse | cc207bc | 2021-09-28 21:06:08 +0200 | [diff] [blame] | 60 | For each API function that leads to a driver call, call it with parameters that cause a driver to be invoked and check how Mbed TLS handles the outputs. |
Gilles Peskine | 92bcfdb | 2019-09-04 19:26:50 +0200 | [diff] [blame] | 61 | |
| 62 | * Correct outputs. |
| 63 | * Incorrect outputs such as an invalid output length. |
| 64 | * Expected errors (e.g. `PSA_ERROR_INVALID_SIGNATURE` from a signature verification method). |
| 65 | * Unexpected errors. At least test that if the driver returns `PSA_ERROR_GENERIC_ERROR`, this is propagated correctly. |
| 66 | |
| 67 | Key creation functions invoke multiple methods and need more complex error handling: |
| 68 | |
| 69 | * Check the consequence of errors detected at each stage (slot number allocation or validation, key creation method, storage accesses). |
| 70 | * Check that the storage ends up in the expected state. At least make sure that no intermediate file remains after a failure. |
| 71 | |
| 72 | #### Persistence of SE keys |
| 73 | |
| 74 | The following tests must be performed at least one for each key creation method (import, generate, ...). |
| 75 | |
| 76 | * Test that keys in a secure element survive `psa_close_key(); psa_open_key()`. |
| 77 | * Test that keys in a secure element survive `mbedtls_psa_crypto_free(); psa_crypto_init()`. |
| 78 | * Test that the driver's persistent data survives `mbedtls_psa_crypto_free(); psa_crypto_init()`. |
| 79 | * Test that `psa_destroy_key()` does not leave any trace of the key. |
| 80 | |
| 81 | #### Resilience for SE drivers |
| 82 | |
| 83 | Creating or removing a key in a secure element involves multiple storage modifications (M<sub>1</sub>, ..., M<sub>n</sub>). If the operation is interrupted by a reset at any point, it must be either rolled back or completed. |
| 84 | |
| 85 | * For each potential interruption point (before M<sub>1</sub>, between M<sub>1</sub> and M<sub>2</sub>, ..., after M<sub>n</sub>), call `mbedtls_psa_crypto_free(); psa_crypto_init()` at that point and check that this either rolls back or completes the operation that was started. |
| 86 | * This must be done for each key creation method and for key destruction. |
| 87 | * This must be done for each possible flow, including error cases (e.g. a key creation that fails midway due to `OUT_OF_MEMORY`). |
| 88 | * The recovery during `psa_crypto_init` can itself be interrupted. Test those interruptions too. |
| 89 | * Two things need to be tested: the key that is being created or destroyed, and the driver's persistent storage. |
bootstrap-prime | 6dbbf44 | 2022-05-17 19:30:44 -0400 | [diff] [blame] | 90 | * Check both that the storage has the expected content (this can be done by e.g. using a key that is supposed to be present) and does not have any unexpected content (for keys, this can be done by checking that `psa_open_key` fails with `PSA_ERROR_DOES_NOT_EXIST`). |
Gilles Peskine | 92bcfdb | 2019-09-04 19:26:50 +0200 | [diff] [blame] | 91 | |
| 92 | This requires instrumenting the storage implementation, either to force it to fail at each point or to record successive storage states and replay each of them. Each `psa_its_xxx` function call is assumed to be atomic. |
| 93 | |
| 94 | ### SE driver system tests |
| 95 | |
| 96 | #### Real-world use case |
| 97 | |
| 98 | We must have at least one driver that is close to real-world conditions: |
| 99 | |
| 100 | * With its own source tree. |
| 101 | * Running on actual hardware. |
| 102 | * Run the full driver validation test suite (which does not yet exist). |
| 103 | * Run at least one test application (e.g. the Mbed OS TLS example). |
| 104 | |
Gilles Peskine | 545c28b | 2019-09-04 19:41:16 +0200 | [diff] [blame] | 105 | This requirement shall be fulfilled by the [Microchip ATECC508A driver](https://github.com/ARMmbed/mbed-os-atecc608a/). |
Gilles Peskine | 92bcfdb | 2019-09-04 19:26:50 +0200 | [diff] [blame] | 106 | |
| 107 | #### Complete driver |
| 108 | |
| 109 | We should have at least one driver that covers the whole interface: |
| 110 | |
| 111 | * With its own source tree. |
| 112 | * Implementing all the methods. |
| 113 | * Run the full driver validation test suite (which does not yet exist). |
| 114 | |
| 115 | A PKCS#11 driver would be a good candidate. It would be useful as part of our product offering. |
Gilles Peskine | 24cebf6 | 2020-11-30 17:51:53 +0100 | [diff] [blame] | 116 | |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 117 | ## Unified driver interface testing |
Gilles Peskine | 24cebf6 | 2020-11-30 17:51:53 +0100 | [diff] [blame] | 118 | |
| 119 | The [unified driver interface](../../proposed/psa-driver-interface.md) defines interfaces for accelerators. |
| 120 | |
| 121 | ### Test requirements |
| 122 | |
| 123 | #### Requirements for transparent driver testing |
| 124 | |
| 125 | Every cryptographic mechanism for which a transparent driver interface exists (key creation, cryptographic operations, …) must be exercised in at least one build. The test must verify that the driver code is called. |
| 126 | |
| 127 | #### Requirements for fallback |
| 128 | |
| 129 | The driver interface includes a fallback mechanism so that a driver can reject a request at runtime and let another driver handle the request. For each entry point, there must be at least three test runs with two or more drivers available with driver A configured to fall back to driver B, with one run where A returns `PSA_SUCCESS`, one where A returns `PSA_ERROR_NOT_SUPPORTED` and B is invoked, and one where A returns a different error and B is not invoked. |
| 130 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 131 | ### Test drivers |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 132 | |
| 133 | We have test drivers that are enabled by `PSA_CRYPTO_DRIVER_TEST` (not present |
| 134 | in the usual config files, must be defined on the command line or in a custom |
| 135 | config file). Those test drivers are implemented in `tests/src/drivers/*.c` |
| 136 | and their API is declared in `tests/include/test/drivers/*.h`. |
| 137 | |
| 138 | We have two test driver registered: `mbedtls_test_opaque_driver` and |
| 139 | `mbedtls_test_transparent_driver`. These are described in |
| 140 | `scripts/data_files/driver_jsons/mbedtls_test_xxx_driver.json` (as much as our |
| 141 | JSON support currently allows). Each of the drivers can potentially implement |
| 142 | support for several mechanism; conversely, each of the file mentioned in the |
| 143 | previous paragraph can potentially contribute to both the opaque and the |
| 144 | transparent test driver. |
| 145 | |
| 146 | Each entry point is instrumented to record the number of hits for each part of |
| 147 | the driver (same division as the files) and the status of the last call. It is |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 148 | also possible to force the next call to return a specified status, and |
| 149 | sometimes more things can be forced: see the various |
| 150 | `mbedtls_test_driver_XXX_hooks_t` structures declared by each driver. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 151 | |
| 152 | The drivers can use one of two back-ends: |
| 153 | - internal: this requires the built-in implementation to be present. |
| 154 | - libtestdriver1: this allows the built-in implementation to be omitted from |
| 155 | the build. |
| 156 | |
| 157 | Historical note: internal was initially the only back-end; then support for |
| 158 | libtestdriver1 was added gradually. |
| 159 | |
| 160 | Question: if/when we have complete libtestdriver1 support, do we still need |
| 161 | internal? Thoughts: |
| 162 | - It's useful to have builds with both a driver and the built-in, in |
| 163 | order to test fallback to built-in, but this could be achieved with |
| 164 | libtestdriver1 too. |
| 165 | - Performance might be better with internal though? |
| 166 | - The instrumentation works the same with both back-ends. |
| 167 | |
| 168 | Our implementation of PSA Crypto is structured in a way that the built-in |
| 169 | implementation of each operation follows the driver API, see |
| 170 | [`../architecture/psa-crypto-implementation-structure.md`](../architecture/psa-crypto-implementation-structure.html). |
| 171 | This makes implementing the test drivers very easy: each entry point has a |
| 172 | corresponding `mbedtls_psa_xxx()` function that it can call as its |
| 173 | implementation - with the `libtestdriver1` back-end the function is called |
| 174 | `libtestdriver1_mbedtls_psa_xxx()` instead. |
| 175 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 176 | A nice consequence of that strategy is that when an entry point has |
| 177 | test-driver support, most of the time, it automatically works for all |
| 178 | algorithms and key types supported by the library. (The exception being when |
| 179 | the driver needs to call a different function for different key types, as is |
| 180 | the case with some asymmetric key management operations.) |
| 181 | |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 182 | The renaming process for `libtestdriver1` is implemented as a few Perl regexes |
| 183 | applied to a copy of the library code, see the `libtestdriver1.a` target in |
| 184 | `tests/Makefile`. Another modification that's done to this copy is appending |
| 185 | `tests/include/test/drivers/crypto_config_test_driver_extension.h` to |
| 186 | `psa/crypto_config.h`. This file reverses the `ACCEL`/`BUILTIN` macros so that |
| 187 | `libtestdriver1` includes as built-in what the main `libmbedcrypto.a` will |
| 188 | have accelerated; see that file's initial comment for details. See also |
| 189 | `helper_libtestdriver1_` functions and the preceding comment in `all.sh` for |
| 190 | how libtestdriver is used in practice. |
| 191 | |
| 192 | This general framework needs specific code for each family of operations. At a |
| 193 | given point in time, not all operations have the same level of support. The |
| 194 | following sub-sections describe the status of the test driver support, mostly |
| 195 | following the structure and order of sections 9.6 and 10.2 to 10.10 of the |
| 196 | [PSA Crypto standard](https://arm-software.github.io/psa-api/crypto/1.1/) as |
| 197 | that is also a natural division for implementing test drivers (that's how the |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 198 | code is divided into files). |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 199 | |
| 200 | #### Key management |
| 201 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 202 | The following entry points are declared in `test/drivers/key_management.h`: |
| 203 | |
| 204 | - `"init"` (transparent and opaque) |
| 205 | - `"generate_key"` (transparent and opaque) |
| 206 | - `"export_public_key"` (transparent and opaque) |
| 207 | - `"import_key"` (transparent and opaque) |
| 208 | - `"export_key"` (opaque only) |
| 209 | - `"get_builtin_key"` (opaque only) |
| 210 | - `"copy_key"` (opaque only) |
| 211 | |
| 212 | The transparent driver fully implements the declared entry points, and can use |
| 213 | any backend: internal or libtestdriver1. |
| 214 | |
| 215 | The opaque's driver implementation status is as follows: |
| 216 | - `"generate_key"`: not implemented, always returns `NOT_SUPPORTED`. |
| 217 | - `"export_public_key"`: implemented only for ECC and RSA keys, both backends. |
| 218 | - `"import_key"`: implemented except for DH keys, both backends. |
| 219 | - `"export_key"`: implemented for built-in keys (ECC and AES), and for |
| 220 | non-builtin keys except DH keys. (Backend not relevant.) |
| 221 | - `"get_builtin_key"`: implemented - provisioned keys: AES-128 and ECC |
| 222 | secp2456r1. (Backend not relevant.) |
| 223 | - `"copy_key"`: implemented - emulates a SE without storage. (Backend not |
| 224 | relevant.) |
| 225 | |
| 226 | Note: the `"init"` entry point is not part of the "key management" family, but |
| 227 | listed here as it's declared and implemented in the same file. With the |
| 228 | transparent driver and the libtestdriver1 backend, it calls |
| 229 | `libtestdriver1_psa_crypto_init()`, which partially but not fully ensures |
| 230 | that this entry point is called before other entry points in the test drivers. |
| 231 | With the opaque driver, this entry point just does nothing an returns success. |
| 232 | |
| 233 | The following entry points are defined by the driver interface but missing |
| 234 | from our test drivers: |
| 235 | - `"allocate_key"`, `"destroy_key"`: this is for opaque drivers that store the |
| 236 | key material internally. |
| 237 | |
| 238 | Note: the instrumentation also allows forcing the output and its length. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 239 | |
| 240 | #### Message digests (Hashes) |
| 241 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 242 | The following entry points are declared (transparent only): |
| 243 | - `"hash_compute"` |
| 244 | - `"hash_setup"` |
| 245 | - `"hash_clone"` |
| 246 | - `"hash_update"` |
| 247 | - `"hash_finish"` |
| 248 | - `"hash_abort"` |
| 249 | |
| 250 | The transparent driver fully implements the declared entry points, and can use |
| 251 | any backend: internal or libtestdriver1. |
| 252 | |
| 253 | This familly is not part of the opaque driver as it doesn't use keys. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 254 | |
| 255 | #### Message authentication codes (MAC) |
| 256 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 257 | The following entry points are declared (transparent and opaque): |
| 258 | - `"mac_compute"` |
| 259 | - `"mac_sign_setup"` |
| 260 | - `"mac_verify_setup"` |
| 261 | - `"mac_update"` |
| 262 | - `"mac_sign_finish"` |
| 263 | - `"mac_verify_finish"` |
| 264 | - `"mac_abort"` |
| 265 | |
| 266 | The transparent driver fully implements the declared entry points, and can use |
| 267 | any backend: internal or libtestdriver1. |
| 268 | |
| 269 | The opaque driver only implements the instrumentation but not the actual |
| 270 | operations: entry points will always return `NOT_SUPPORTED`, unless another |
| 271 | status is forced. |
| 272 | |
| 273 | The following entry points are not implemented: |
| 274 | - `mac_verify`: this mostly makes sense for opaque drivers; the code will fall |
| 275 | back to using `"mac_compute"` if this is not implemented. So, perhaps |
| 276 | ideally we should test both with `"mac_verify"` implemented and with it not |
| 277 | implemented? Anyway, we have a test gap here. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 278 | |
| 279 | #### Unauthenticated ciphers |
| 280 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 281 | The following entry points are declared (transparent and opaque): |
| 282 | - `"cipher_encrypt"` |
| 283 | - `"cipher_decrypt"` |
| 284 | - `"cipher_encrypt_setup"` |
| 285 | - `"cipher_decrypt_setup"` |
| 286 | - `"cipher_set_iv"` |
| 287 | - `"cipher_update"` |
| 288 | - `"cipher_finish"` |
| 289 | - `"cipher_abort"` |
| 290 | |
| 291 | The transparent driver fully implements the declared entry points, and can use |
| 292 | any backend: internal or libtestdriver1. |
| 293 | |
| 294 | The opaque driver is not implemented at all, neither instumentation nor the |
| 295 | operation: entry points always return `NOT_SUPPORTED`. |
| 296 | |
| 297 | Note: the instrumentation also allows forcing a specific output and output |
| 298 | length. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 299 | |
| 300 | #### Authenticated encryption with associated data (AEAD) |
| 301 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 302 | The following entry points are declared (transparent only): |
| 303 | - `"aead_encrypt"` |
| 304 | - `"aead_decrypt"` |
| 305 | - `"aead_encrypt_setup"` |
| 306 | - `"aead_decrypt_setup"` |
| 307 | - `"aead_set_nonce"` |
| 308 | - `"aead_set_lengths"` |
| 309 | - `"aead_update_ad"` |
| 310 | - `"aead_update"` |
| 311 | - `"aead_finish"` |
| 312 | - `"aead_verify"` |
| 313 | - `"aead_abort"` |
| 314 | |
| 315 | The transparent driver fully implements the declared entry points, and can use |
| 316 | any backend: internal or libtestdriver1. |
| 317 | |
| 318 | The opaque driver does not implement or even declare entry points for this |
| 319 | family. |
| 320 | |
| 321 | Note: the instrumentation records the number of hits per entry point, not just |
| 322 | the total number of hits for this family. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 323 | |
| 324 | #### Key derivation |
| 325 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 326 | Not covered at all by the test drivers. |
| 327 | |
| 328 | That's a gap in our testing, as the driver interface does define a key |
| 329 | derivation family of entry points. This gap is probably related to the fact |
| 330 | that our internal code structure doesn't obey the guidelines and is not |
| 331 | aligned with the driver interface, see #5488 and related issues. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 332 | |
| 333 | #### Asymmetric signature |
| 334 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 335 | The following entry points are declared (transparent and opaque): |
| 336 | |
| 337 | - `"sign_message"` |
| 338 | - `"verify_message"` |
| 339 | - `"sign_hash"` |
| 340 | - `"verify_hash"` |
| 341 | |
| 342 | The transparent driver fully implements the declared entry points, and can use |
| 343 | any backend: internal or libtestdriver1. |
| 344 | |
| 345 | The opaque driver is not implemented at all, neither instumentation nor the |
| 346 | operation: entry points always return `NOT_SUPPORTED`. |
| 347 | |
| 348 | Note: the instrumentation also allows forcing a specific output and output |
| 349 | length, and has two instance of the hooks structure: one for sign, the other |
| 350 | for verify. |
| 351 | |
| 352 | Note: when a driver implements only the `"xxx_hash"` entry points, the core is |
| 353 | supposed to implement the `psa_xxx_message()` functions by computing the hash |
| 354 | itself before calling the `"xxx_hash"` entry point. Since the test driver does |
| 355 | implement the `"xxx_message"` entry point, it's not exercising that part of |
| 356 | the core's expected behaviour. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 357 | |
| 358 | #### Asymmetric encryption |
| 359 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 360 | The following entry points are declared (transparent and opaque): |
| 361 | |
| 362 | - `"asymmetric_encrypt"` |
| 363 | - `"asymmetric_decrypt"` |
| 364 | |
| 365 | The transparent driver fully implements the declared entry points, and can use |
| 366 | any backend: internal or libtestdriver1. |
| 367 | |
| 368 | The opaque driver is not implemented at all, neither instumentation nor the |
| 369 | operation: entry points always return `NOT_SUPPORTED`. |
| 370 | |
| 371 | Note: the instrumentation also allows forcing a specific output and output |
| 372 | length. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 373 | |
| 374 | #### Key agreement |
| 375 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 376 | The following entry points are declared (transparent and opaque): |
| 377 | |
| 378 | - `"key_agreement"` |
| 379 | |
| 380 | The transparent driver fully implements the declared entry points, and can use |
| 381 | any backend: internal or libtestdriver1. |
| 382 | |
| 383 | The opaque driver is not implemented at all, neither instumentation nor the |
| 384 | operation: entry points always return `NOT_SUPPORTED`. |
| 385 | |
| 386 | Note: the instrumentation also allows forcing a specific output and output |
| 387 | length. |
Manuel Pégourié-Gonnard | 1a827a3 | 2023-11-13 10:01:21 +0100 | [diff] [blame] | 388 | |
| 389 | #### Other cryptographic services (Random number generation) |
Gilles Peskine | 24cebf6 | 2020-11-30 17:51:53 +0100 | [diff] [blame] | 390 | |
Manuel Pégourié-Gonnard | b66f9db | 2023-11-13 11:32:37 +0100 | [diff] [blame] | 391 | Not covered at all by the test drivers. |
| 392 | |
| 393 | The driver interface defines a `"get_entropy"` entry point, as well as a |
| 394 | "Random generation" family of entry points. None of those are currently |
| 395 | implemented in the library. Part of it will be planned for 4.0, see #8150. |
| 396 | |
| 397 | #### PAKE extension |
| 398 | |
| 399 | The following entry points are declared (transparent only): |
| 400 | - `"pake_setup"` |
| 401 | - `"pake_output"` |
| 402 | - `"pake_input"` |
| 403 | - `"pake_get_implicit_key"` |
| 404 | - `"pake_abort"` |
| 405 | |
| 406 | Note: the instrumentation records hits per entry point and allows forcing the |
| 407 | output and its length, as well as forcing the status of setup independently |
| 408 | from the others. |
| 409 | |
| 410 | The transparent driver fully implements the declared entry points, and can use |
| 411 | any backend: internal or libtestdriver1. |
| 412 | |
| 413 | The opaque driver does not implement or even declare entry points for this |
| 414 | family. |