Skip to content

Commit 3c7fd8e

Browse files
authored
Make Openssl CMAC API (omac1_aes_vector) Availalable in Non FIPs Mode (#85)
Wpa_supplicant OpenSSL CMAC wrapper API (omac1_aes_vector) is only available when FIPs is enabled for build. Which should not be the case. Openssl CMAC wrapper API should also be available under non FIPS mode. When wpa-supplicant is referencing to use openssl, openssl CMAC should be triggered instead of wpa internal one. The fix is mostly taking from hostap with those changes already: https://w1.fi/cgit/hostap/commit/src/crypto?id=ae0f6ee97ed4924189f2cd68548d2a971f17d67e https://w1.fi/cgit/hostap/commit/wpa_supplicant/Makefile?id=ae0f6ee97ed4924189f2cd68548d2a971f17d67e Testing has been done with the changes with FIPS and non FIPS mode by running sonic macsec testing suite. It's observed in all scenario openssl CMAC API is triggered.
1 parent 13e6f11 commit 3c7fd8e

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

hostapd/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,11 +919,13 @@ endif
919919
ifdef NEED_AES_ENCBLOCK
920920
AESOBJS += ../src/crypto/aes-encblock.o
921921
endif
922+
ifneq ($(CONFIG_TLS), openssl)
922923
ifneq ($(CONFIG_TLS), linux)
923924
ifneq ($(CONFIG_TLS), wolfssl)
924925
AESOBJS += ../src/crypto/aes-omac1.o
925926
endif
926927
endif
928+
endif
927929
ifdef NEED_AES_UNWRAP
928930
ifneq ($(CONFIG_TLS), openssl)
929931
ifneq ($(CONFIG_TLS), linux)

src/crypto/crypto_openssl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#include <openssl/dh.h>
1717
#include <openssl/hmac.h>
1818
#include <openssl/rand.h>
19-
#ifdef CONFIG_OPENSSL_CMAC
19+
#if OPENSSL_VERSION_NUMBER < 0x30000000L
2020
#include <openssl/cmac.h>
21-
#endif /* CONFIG_OPENSSL_CMAC */
21+
#endif /* OpenSSL version < 3.0 */
2222
#ifdef CONFIG_ECC
2323
#include <openssl/ec.h>
2424
#include <openssl/x509.h>
@@ -1214,7 +1214,6 @@ int crypto_get_random(void *buf, size_t len)
12141214
}
12151215

12161216

1217-
#ifdef CONFIG_OPENSSL_CMAC
12181217
int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
12191218
const u8 *addr[], const size_t *len, u8 *mac)
12201219
{
@@ -1308,7 +1307,6 @@ int omac1_aes_256(const u8 *key, const u8 *data, size_t data_len, u8 *mac)
13081307
{
13091308
return omac1_aes_vector(key, 32, 1, &data, &data_len, mac);
13101309
}
1311-
#endif /* CONFIG_OPENSSL_CMAC */
13121310

13131311

13141312
struct crypto_bignum * crypto_bignum_init(void)

wpa_supplicant/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ endif
7575

7676
ifdef CONFIG_FIPS
7777
CONFIG_NO_RANDOM_POOL=
78-
CONFIG_OPENSSL_CMAC=y
7978
endif
8079

8180
OBJS = config.o
@@ -1330,9 +1329,7 @@ ifdef NEED_AES_ENCBLOCK
13301329
AESOBJS += ../src/crypto/aes-encblock.o
13311330
endif
13321331
NEED_AES_ENC=y
1333-
ifdef CONFIG_OPENSSL_CMAC
1334-
CFLAGS += -DCONFIG_OPENSSL_CMAC
1335-
else
1332+
ifneq ($(CONFIG_TLS), openssl)
13361333
ifneq ($(CONFIG_TLS), linux)
13371334
ifneq ($(CONFIG_TLS), wolfssl)
13381335
AESOBJS += ../src/crypto/aes-omac1.o

0 commit comments

Comments
 (0)