Replace PMKSA cache inline stubs with wrapper function stubs

PMKSA cache API is included in libpasn.so used by external modules,
e.g., Wi-Fi Aware. To avoid dependency on IEEE8021X_EAPOL define for the
external modules at compile time, remove PMKSA cache static inline
functions from the header file and add wrapper function stubs.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Vinay Gannevaram 2024-02-05 21:58:02 +05:30 committed by Jouni Malinen
parent ba55088a73
commit ab37a57314
5 changed files with 101 additions and 97 deletions

View file

@ -851,4 +851,99 @@ void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa)
}
}
#else /* IEEE8021X_EAPOL */
struct rsn_pmksa_cache *
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx, enum pmksa_free_reason reason),
bool (*is_current_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx),
void (*notify_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx),
void *ctx, struct wpa_sm *sm)
{
return (void *) -1;
}
void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
{
}
struct rsn_pmksa_cache_entry *
pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *spa,
const u8 *pmkid, const void *network_ctx, int akmp)
{
return NULL;
}
struct rsn_pmksa_cache_entry *
pmksa_cache_get_current(struct wpa_sm *sm)
{
return NULL;
}
int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len)
{
return -1;
}
struct rsn_pmksa_cache_entry *
pmksa_cache_head(struct rsn_pmksa_cache *pmksa)
{
return NULL;
}
struct rsn_pmksa_cache_entry *
pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
struct rsn_pmksa_cache_entry *entry)
{
return NULL;
}
struct rsn_pmksa_cache_entry *
pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
const u8 *pmkid, const u8 *kck, size_t kck_len,
const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
const u8 *cache_id)
{
return NULL;
}
void pmksa_cache_clear_current(struct wpa_sm *sm)
{
}
int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, const u8 *bssid,
void *network_ctx, int try_opportunistic,
const u8 *fils_cache_id, int akmp, bool associated)
{
return -1;
}
void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx,
const u8 *pmk, size_t pmk_len, bool external_only)
{
}
void pmksa_cache_remove(struct rsn_pmksa_cache *pmksa,
struct rsn_pmksa_cache_entry *entry)
{
}
void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa)
{
}
#endif /* IEEE8021X_EAPOL */

View file

@ -64,8 +64,6 @@ enum pmksa_free_reason {
PMKSA_EXPIRE,
};
#if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
struct rsn_pmksa_cache *
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx, enum pmksa_free_reason reason),
@ -105,95 +103,4 @@ void pmksa_cache_remove(struct rsn_pmksa_cache *pmksa,
struct rsn_pmksa_cache_entry *entry);
void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa);
#else /* IEEE8021X_EAPOL */
static inline struct rsn_pmksa_cache *
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx, enum pmksa_free_reason reason),
bool (*is_current_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx),
void (*notify_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx),
void *ctx, struct wpa_sm *sm)
{
return (void *) -1;
}
static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
{
}
static inline struct rsn_pmksa_cache_entry *
pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *spa,
const u8 *pmkid, const void *network_ctx, int akmp)
{
return NULL;
}
static inline struct rsn_pmksa_cache_entry *
pmksa_cache_get_current(struct wpa_sm *sm)
{
return NULL;
}
static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf,
size_t len)
{
return -1;
}
static inline struct rsn_pmksa_cache_entry *
pmksa_cache_head(struct rsn_pmksa_cache *pmksa)
{
return NULL;
}
static inline struct rsn_pmksa_cache_entry *
pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
struct rsn_pmksa_cache_entry *entry)
{
return NULL;
}
static inline struct rsn_pmksa_cache_entry *
pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
const u8 *pmkid, const u8 *kck, size_t kck_len,
const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
const u8 *cache_id)
{
return NULL;
}
static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
{
}
static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
const u8 *bssid,
void *network_ctx,
int try_opportunistic,
const u8 *fils_cache_id,
int akmp, bool associated)
{
return -1;
}
static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
void *network_ctx,
const u8 *pmk, size_t pmk_len,
bool external_only)
{
}
static inline void pmksa_cache_remove(struct rsn_pmksa_cache *pmksa,
struct rsn_pmksa_cache_entry *entry)
{
}
static inline void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa)
{
}
#endif /* IEEE8021X_EAPOL */
#endif /* PMKSA_CACHE_H */

View file

@ -26,6 +26,7 @@ OBJS += $(SRC)/crypto/sha384-prf.o
OBJS += $(SRC)/crypto/sha256-kdf.o
OBJS += $(SRC)/crypto/sha384-kdf.o
OBJS += $(SRC)/rsn_supp/wpa_ie.o
OBJS += $(SRC)/rsn_supp/pmksa_cache.o
OBJS += $(SRC)/pasn/pasn_initiator.o
OBJS += pasn-init.o

View file

@ -101,6 +101,7 @@ OBJS += src/utils/bitfield.c
OBJS += src/utils/ip_addr.c
OBJS += src/utils/crc32.c
OBJS += src/common/ptksa_cache.c
OBJS += src/rsn_supp/pmksa_cache.c
OBJS += twt.c
OBJS_p = wpa_passphrase.c
OBJS_p += src/utils/common.c
@ -337,7 +338,6 @@ endif
ifndef CONFIG_NO_WPA
OBJS += src/rsn_supp/wpa.c
OBJS += src/rsn_supp/preauth.c
OBJS += src/rsn_supp/pmksa_cache.c
OBJS += src/rsn_supp/wpa_ie.c
OBJS += src/common/wpa_common.c
NEED_AES=y
@ -1802,8 +1802,9 @@ endif
PASNOBJS += src/common/ptksa_cache.c
ifndef CONFIG_NO_WPA
PASNOBJS += src/rsn_supp/pmksa_cache.c
ifndef CONFIG_NO_WPA
PASNOBJS += src/rsn_supp/wpa_ie.c
endif

View file

@ -113,6 +113,7 @@ OBJS += ../src/utils/bitfield.o
OBJS += ../src/utils/ip_addr.o
OBJS += ../src/utils/crc32.o
OBJS += ../src/common/ptksa_cache.o
OBJS += ../src/rsn_supp/pmksa_cache.o
OBJS += twt.o
OBJS_p = wpa_passphrase.o
OBJS_p += ../src/utils/common.o
@ -371,7 +372,6 @@ endif
ifndef CONFIG_NO_WPA
OBJS += ../src/rsn_supp/wpa.o
OBJS += ../src/rsn_supp/preauth.o
OBJS += ../src/rsn_supp/pmksa_cache.o
OBJS += ../src/rsn_supp/wpa_ie.o
OBJS += ../src/common/wpa_common.o
NEED_AES=y
@ -2222,9 +2222,9 @@ LIBPASNSO += ../src/common/dragonfly.c
endif
LIBPASNSO += ../src/common/ptksa_cache.c
LIBPASNSO += ../src/rsn_supp/pmksa_cache.c
ifndef CONFIG_NO_WPA
LIBPASNSO += ../src/rsn_supp/pmksa_cache.c
LIBPASNSO += ../src/rsn_supp/wpa_ie.c
endif