[PATCH] wolfSSL: Old fips APIs have void return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is intended to be applied on top of the previous patchset I submitted.

Fix the calls to wc_AesEncryptDirect. Old versions of wolfCrypt fips had wc_AesEncryptDirect return void instead of int. This patch fixes this build issue.

Signed-off-by: Juliusz Sosinowicz <juliusz@xxxxxxxxxxx>
---
 src/crypto/crypto_wolfssl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c
index 52f4c70c6..20e922da5 100644
--- a/src/crypto/crypto_wolfssl.c
+++ b/src/crypto/crypto_wolfssl.c
@@ -566,11 +566,17 @@ 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;
 }
 
@@ -608,11 +614,17 @@ 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;
 }
 
-- 
2.25.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux