Closed gilles-peskine-arm closed 1 year ago
The culprit is https://github.com/Mbed-TLS/mbedtls/pull/6836. It changes casts to be spaced (type) value
instead of (type)value
.
I made that change because it aligns with K&R, which is our reference. I may also have been influenced by a weak personal preference for having the space.
The PSA crypto specification does not mandate any particular definition for PSA_KEY_ID_NULL
(it just has to have to be a compile-time constant with the correct numerical value and type), and it's a bug in the compliance test that it requires this. However, the PSA crypto specification (as well as the PSA error code specification) does mandate that there is no space in the similar definitions for error codes. For example
#define PSA_ERROR_GENERIC_ERROR ((psa_status_t)-132)
is correct and
#define PSA_ERROR_GENERIC_ERROR ((psa_status_t) -132)
is wrong. We will have a test for this once https://github.com/Mbed-TLS/mbedtls/pull/5998 is merged — and it would fail.
So we must preserve the absence of spaces in these casts in PSA macro definitions.
Since last night (evening of 2023-01-03), the nightly tests are failing on PSA compliance testing with the new code style. There is no such failure with the official branches.
Failure example: https://jenkins-mbedtls.oss.arm.com/blue/rest/organizations/jenkins/pipelines/mbed-tls-nightly-tests/runs/3118/nodes/432/steps/5850/log/
Seen both on development (acea8a11e9104657df6ef0ba3a1549b47aee2acc based on 7a389ddc847f25e4b98d07e641dac123d9e7a53c) and 2.28 (f0b24594495edf36d298536e8069031a59552ac6 based on a6ad7f47023b235fc8d02c3f2bbb5d5277c2f20f).