-
Notifications
You must be signed in to change notification settings - Fork 38
Move the inclusion of crypto_sizes.h and crypto_struct.h in crypto.h #260
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
base: development
Are you sure you want to change the base?
Move the inclusion of crypto_sizes.h and crypto_struct.h in crypto.h #260
Conversation
include/psa/crypto.h
Outdated
@@ -39,6 +39,18 @@ extern "C" { | |||
* algorithms, key types, policies, etc. */ | |||
#include "crypto_types.h" | |||
|
|||
/* The file "crypto_sizes.h" contains definitions for size calculation | |||
* macros whose definitions are implementation-specific. */ | |||
#include "crypto_sizes.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crypto_sizes.h
uses macros from crypto_values.h
, so it would make more sense to include crypto_values.h
first. I don't think it actually matters for the sake of the C language, because crypto_sizes.h
itself only defines macros, it doesn't expand them. But then crypto_struct.h
does expand macros from crypto_sizes.h
, and that can result in expanding macros from crypto_values.h
. It works because crypto_struct.h
(indirectly) includes crypto_driver_common.h
which includes crypto_values.h
. But it would make more sense to include crypto_values.h
at the logical place in crypto.h
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I missed that, thanks. I've changed it and while at it I've tried to fix the similar issues in crypto_extra.h pointed to by #7087.
That way when API are declared, the types they used are defined. This should resolve the issues related to psa_xyz_init functions returning a structure described in #7087. Signed-off-by: Ronald Cron <[email protected]>
Move the definitions of psa_pake_cipher_suite_s and psa_pake_operation_s before the declarations of respectively psa_pake_cipher_suite_init and psa_pake_operation init. This is to avoid the following pattern that some C++ compilers fail to compile: typedef struct foo_s foo_t; foo_t get_a_foo(int search); struct foo_s { int foo_int; }; Signed-off-by: Ronald Cron <[email protected]>
Define the structure then the associated type. Signed-off-by: Ronald Cron <[email protected]>
037a7ac
to
be9d9f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the code change. I don't know if it actually fixes Mbed-TLS/mbedtls#7087, but at worst it's harmless.
If this does fix Mbed-TLS/mbedtls#7087 then we need a changelog entry, and preferably a non-regression test.
Description
Move the inclusion of crypto_sizes.h and crypto_struct.h in crypto.h
That way when API are declared, the types they used are defined.
This should resolve the issues related to psa_xyz_init functions returning a structure described in Mbed-TLS/mbedtls#7087.
PR checklist