From: Juliusz Sosinowicz Date: Thu, 23 Mar 2023 15:58:50 +0000 (+0100) Subject: wolfSSL: Old FIPS APIs have void return X-Git-Tag: hostap_2_11~838 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=890953a32cefef17f5afa263bebbe87bf9279b18;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c index 09e3e42bc..269174321 100644 --- a/src/crypto/crypto_wolfssl.c +++ b/src/crypto/crypto_wolfssl.c @@ -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; }