wolfSSL: Old FIPS APIs have void return

Fix the calls to wc_AesEncryptDirect(). Old versions of wolfCrypt FIPS
had wc_AesEncryptDirect() return void instead of int. Fix this build
issue.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
This commit is contained in:
Juliusz Sosinowicz 2023-03-23 16:58:50 +01:00 committed by Jouni Malinen
parent ec7f064fa7
commit 890953a32c

View file

@ -578,12 +578,18 @@ void * aes_encrypt_init(const u8 *key, size_t len)
int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
{
#if defined(HAVE_FIPS) && \
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION <= 2))
/* Old FIPS has void return on this API */
wc_AesEncryptDirect(ctx, crypt, plain);
#else
int err = wc_AesEncryptDirect(ctx, crypt, plain);
if (err != 0) {
LOG_WOLF_ERROR_FUNC(wc_AesEncryptDirect, err);
return -1;
}
#endif
return 0;
}
@ -621,12 +627,18 @@ void * aes_decrypt_init(const u8 *key, size_t len)
int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
{
#if defined(HAVE_FIPS) && \
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION <= 2))
/* Old FIPS has void return on this API */
wc_AesDecryptDirect(ctx, plain, crypt);
#else
int err = wc_AesDecryptDirect(ctx, plain, crypt);
if (err != 0) {
LOG_WOLF_ERROR_FUNC(wc_AesDecryptDirect, err);
return -1;
}
#endif
return 0;
}