Skip to content
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

Test that operation contexts are movable #4599

Open
gilles-peskine-arm opened this issue Jun 1, 2021 · 2 comments
Open

Test that operation contexts are movable #4599

gilles-peskine-arm opened this issue Jun 1, 2021 · 2 comments
Labels
component-test Test framework and CI scripts enhancement size-l Estimated task size: large (2w+)

Comments

@gilles-peskine-arm
Copy link
Contributor

Test that it's possible to move contexts in memory. That is, sequences like the following must work:

mbedtls_xxx_context ctx1, ctx2;
mbedtls_xxx_init(&ctx1);
mbedtls_xxx_setup(&ctx1, …);
ctx2 = ctx1;
memset(&ctx1, 0, sizeof(ctx1));
mbedtls_xxx_do_stuff(&ctx2, …);
mbedtls_xxx_free(&ctx2);

Counter-example: the AES context in Mbed TLS 2.x.

We explicitly require this for alternative implementations in since Mbed TLS 3.0 (documented in alternative-implementations.md since #4595).

@mpg
Copy link
Contributor

mpg commented Jun 18, 2021

@gilles-peskine-arm I was about to add this to 3.x as I was thinking of it as finishing something we started in 3.0 - "documented but not tested" falls under "unfinished". But then I saw you did that but change your mind later, so I'm not sure - can you elaborate on why you didn't leave this in 3.x?

Also, do you have an idea how much work this would be? Seems like a lot as there's a large number of contexts, but OTOH we'll probably use the same pattern everywhere for testing. Also, I'm not sure the scope is clear: is it just contexts that may have alt implementation, all crypto contexts except Cipher/MD/PK?

@gilles-peskine-arm
Copy link
Contributor Author

gilles-peskine-arm commented Jun 18, 2021

I'm on the fence about making it a should-have-been-3.0 requirement (i.e. 3.x) vs a backlog of things we don't test properly about alt implementations.

I think it'll be a lot of work to do properly: it'll involve ad hoc code for each context type, even if the general principle is the same. I can't think of an automated way to generate the code that is worth the trouble unless we can leverage an existing third-party FFI.

@mpg mpg added the size-l Estimated task size: large (2w+) label Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-test Test framework and CI scripts enhancement size-l Estimated task size: large (2w+)
Projects
None yet
Development

No branches or pull requests

4 participants