-
Notifications
You must be signed in to change notification settings - Fork 45
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
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.
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 (which would resolve Mbed-TLS/mbedtls#1767).
We have a report that this does fix 7087. Can you please add a changelog entry and make a backport to 3.6? |
Can confirm. I had the same issue and just replacing "crypto_extra.h" and "crypto.h" in version 3.6.3 fixed it. |
@ronald-cron-arm |
That way when API are declared, the types they use 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]>
Signed-off-by: Ronald Cron <[email protected]>
be9d9f0
to
44219f3
Compare
Rolling back changes in
No other lines in the file are using these forward declarations; hence both lines could be safely deleted.
This compiles and builds successfully. |
I've removed the changes related to crypto_extra.h as they are going to be done in #258. |
Apparentely, there is no need for any extensive changes; deleting the declarations already resolves the issue. |
I've added a comment in #258, thanks. |
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
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, thanks!
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