]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wolfSSL: Old FIPS APIs have void return
authorJuliusz Sosinowicz <juliusz@wolfssl.com>
Thu, 23 Mar 2023 15:58:50 +0000 (16:58 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 4 Nov 2023 16:41:26 +0000 (18:41 +0200)
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>
src/crypto/crypto_wolfssl.c

index 09e3e42bc41b3cae222f1bd978790d3f4e576ce7..269174321bdf1e196a83629235dbd70c5b804de6 100644 (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;
 }