fix -Werror=return-type when runtime detection enabled and plain c disabled

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2023-08-16 16:07:57 +08:00
parent e62ff09569
commit cc068ae631

View file

@ -655,6 +655,13 @@ int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key,
}
#endif
/* When runtime detection enabled and plain C is disabled, compiler
reports `-Werror=return-type`. */
#if defined(MBEDTLS_HAVE_X86) && defined(MBEDTLS_AES_USE_HARDWARE_ONLY) && \
defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_AESNI_HAVE_CODE)
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
#endif
#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
for (i = 0; i < (keybits >> 5); i++) {
RK[i] = MBEDTLS_GET_UINT32_LE(key, i << 2);
@ -1101,6 +1108,13 @@ int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx,
}
#endif
/* When runtime detection enabled and plain C is disabled, compiler
reports `-Werror=return-type`. */
#if defined(MBEDTLS_HAVE_X86) && defined(MBEDTLS_AES_USE_HARDWARE_ONLY) && \
defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_AESNI_HAVE_CODE)
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
#endif
#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
if (mode == MBEDTLS_AES_ENCRYPT) {
return mbedtls_internal_aes_encrypt(ctx, input, output);