-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate test cases for PSA key generation #5060
Comments
@gilles-peskine-arm I would like to clarify and confirm if my understanding is correct. We want to have test class to verify all cases (positive and negative) of key generation. I need to add test that takes all possible key attributes, tries to create a key based on given attributes and verifies the result (additionally verifies attributes of the created key on success) . I can see the following key attributes that can be specified:
The function may look like this:
Now for this function I need to create python class to generate test cases data (e.g. When test function, script and test data is ready I need to refactor Key derivation is out of scope for this task? ( Is there a documentation where is specified which key can be created and when we expect error? |
In this task, the only attributes that matter are the key type and size (
I see two possible ways to structure the script: either group all the generate test cases (both supported and not-supported), or group all the not-supported test cases (both import and generate). I'm not sure what the simplest way is. In the task description I wrote “moving the existing support for key generation from NotSupported (…) out to the new class. (…) I think this will make the generation script easier to maintain” — but now that I start spelling it out I see that this means that “generate test cases(s)” above will have to enumerate all the not-supported cases. (For example, if the key type is
Right. It should be added later but I think it would add too much to the scope to do it together with generate.
The documentation of |
@gilles-peskine-arm Thank you for clarification. Now everything is clear to me. |
tests/scripts/generate_psa_tests.py
generates test cases in a systematic way for combinations of key types, algorithms, operations, etc. The following families of test cases are already covered in the development branch or in work in progress:NotSupported
).OpFail
in PSA storage format: exercise keys (2.26) #4444).The goal of this task is to add another family of test cases: attempting to generate or derive a key. This includes both positive and negative test cases. This should have its own Python class and its own
.data
file, and probably its own.function
file. Requirements for this task:NotSupported
(added in Fix psa_generate_key(): return PSA_ERROR_INVALID_ARGUMENT for public key #5037) out to the new class. This may require refactoring some code from theNotSupported
class so that it's available to the new class. (I think this will make the generation script easier to maintain; if you think it's better to keep all not-supported tests together, please let me know why and let's discuss it.)Likely follow-ups, out of scope here:
exercise_key
). This needs extra machinery to know what algorithms a key type supports, which I'm working on in PSA storage format: exercise keys (2.26) #4444.test_suite_psa_crypto
that are redundant with the new automatic test cases. There's not much to do until we exercise the generated keys here.The text was updated successfully, but these errors were encountered: