Issues with #include directives in aesce.c #548

Closed
opened 2025-10-26 07:25:04 -05:00 by irwir · 2 comments
irwir commented 2025-10-26 07:25:04 -05:00 (Migrated from github.com)

github.com/Mbed-TLS/TF-PSA-Crypto@8fa3370f74/drivers/builtin/src/aesce.c (L41-L44)
Compiling this file in Visual Studio 2022 with v141_xp platform toolset gives two warnings C4133 and two errors C2466 in CRT headers.

  1. These headers may be moved down below the condition at line 44, provided that the headers would not add or change MBEDTLS_AESCE_C macro . There is a number of other .c files with similar structure, where some headers could be considered for hiding and thus decrease compiler's work.

  2. tf_psa_crypto_common.h is responsible for the library configuration, it defines macros that are expected to modify compilation of the code below. For this reason, tf_psa_crypto_common.h must be before <string.h>.

Changes described in points (1) and/or (2) fix the errors.
Preferably both points should be addressed.

https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/8fa3370f747c5eae3c5004f47241cf45203c6a83/drivers/builtin/src/aesce.c#L41-L44 Compiling this file in Visual Studio 2022 with v141_xp platform toolset gives two warnings C4133 and two errors C2466 in CRT headers. 1. These headers may be moved down below the condition at line 44, provided that the headers would not add or change `MBEDTLS_AESCE_C` macro . There is a number of other `.c` files with similar structure, where some headers could be considered for hiding and thus decrease compiler's work. 2. `tf_psa_crypto_common.h` is responsible for the library configuration, it defines macros that are expected to modify compilation of the code below. For this reason, `tf_psa_crypto_common.h` must be before `<string.h>`. Changes described in points (1) and/or (2) fix the errors. Preferably both points should be addressed.
gilles-peskine-arm commented 2025-10-27 12:17:10 -05:00 (Migrated from github.com)

I'm not sure I fully understand the problem and I don't have Visual Studio. Can you please check if https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/550 fully resolves this?

I'm not sure I fully understand the problem and I don't have Visual Studio. Can you please check if https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/550 fully resolves this?
irwir commented 2025-10-28 06:23:21 -05:00 (Migrated from github.com)

The change in pk.c is unrelated to the issue, other five .c files now got simpler logical structure and compiled correctly.

The change in `pk.c` is unrelated to the issue, other five `.c` files now got simpler logical structure and compiled correctly.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#548
No description provided.