PKI stack: avoid ignoring const qualifier of certificate in ValidateCertificate
Context : Function PKIProviderStack_ValidateCertificate()
in src/Common/crypto/cyclone_crypto/pki_stack.c
The argument const SOPC_CertificateList* pToValidate
is const because we (legitimately) don't want it to be modified during the process of validation.
Problem : In the function we want to link pToValidate
with the IssuerLinks of the PKI, so that MbedTLS can go up the chain and build the verification chain. We then unlink the IssuerLinks from the cert at the end of the function. We all agree that, during this process, pToValidate
was not modified. But, to do so, we have to force pToValidate
to be a non-const object and use the macro SOPC_GCC_DIAGNOSTIC_IGNORE_CAST_CONST
.
Potential solution : Perform a copy of pToValidate and call the MbedTLS function with this copy as argument.