summaryrefslogtreecommitdiffstats
path: root/contrib/hostapd/eap_sim_db.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/hostapd/eap_sim_db.h')
-rw-r--r--contrib/hostapd/eap_sim_db.h97
1 files changed, 76 insertions, 21 deletions
diff --git a/contrib/hostapd/eap_sim_db.h b/contrib/hostapd/eap_sim_db.h
index 57a9871..6754bc3 100644
--- a/contrib/hostapd/eap_sim_db.h
+++ b/contrib/hostapd/eap_sim_db.h
@@ -1,39 +1,94 @@
+/*
+ * hostapd / EAP-SIM database/authenticator gateway
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
#ifndef EAP_SIM_DB_H
#define EAP_SIM_DB_H
#ifdef EAP_SIM
-/* Initialize EAP-SIM database/authentication gateway interface.
- * Returns pointer to a private data structure. */
-void * eap_sim_db_init(const char *config);
+#include "eap_sim_common.h"
+
+/* Identity prefixes */
+#define EAP_SIM_PERMANENT_PREFIX '1'
+#define EAP_SIM_PSEUDONYM_PREFIX '3'
+#define EAP_SIM_REAUTH_ID_PREFIX '5'
+#define EAP_AKA_PERMANENT_PREFIX '0'
+#define EAP_AKA_PSEUDONYM_PREFIX '2'
+#define EAP_AKA_REAUTH_ID_PREFIX '4'
+
+void * eap_sim_db_init(const char *config,
+ void (*get_complete_cb)(void *ctx, void *session_ctx),
+ void *ctx);
-/* Deinitialize EAP-SIM database/authentication gateway interface.
- * priv is the pointer from eap_sim_db_init(). */
void eap_sim_db_deinit(void *priv);
-/* Get GSM triplets for user name identity (identity_len bytes). In most cases,
- * the user name is '1' | IMSI, i.e., 1 followed by the IMSI in ASCII format.
- * priv is the pointer from eap_sim_db_init().
- * Returns the number of triplets received (has to be less than or equal to
- * max_chal) or -1 on error (e.g., user not found). rand, kc, and sres are
- * pointers to data areas for the triplets. */
int eap_sim_db_get_gsm_triplets(void *priv, const u8 *identity,
size_t identity_len, int max_chal,
- u8 *rand, u8 *kc, u8 *sres);
-
-/* Verify whether the given user identity (identity_len bytes) is known. In
- * most cases, the user name is '1' | IMSI, i.e., 1 followed by the IMSI in
- * ASCII format.
- * priv is the pointer from eap_sim_db_init().
- * Returns 0 if the user is found and GSM triplets would be available for it or
- * -1 on error (e.g., user not found or no triplets available). */
+ u8 *_rand, u8 *kc, u8 *sres,
+ void *cb_session_ctx);
+
+#define EAP_SIM_DB_FAILURE -1
+#define EAP_SIM_DB_PENDING -2
+
int eap_sim_db_identity_known(void *priv, const u8 *identity,
size_t identity_len);
+char * eap_sim_db_get_next_pseudonym(void *priv, int aka);
+
+char * eap_sim_db_get_next_reauth_id(void *priv, int aka);
+
+int eap_sim_db_add_pseudonym(void *priv, const u8 *identity,
+ size_t identity_len, char *pseudonym);
+
+int eap_sim_db_add_reauth(void *priv, const u8 *identity,
+ size_t identity_len, char *reauth_id, u16 counter,
+ const u8 *mk);
+
+const u8 * eap_sim_db_get_permanent(void *priv, const u8 *identity,
+ size_t identity_len, size_t *len);
+
+struct eap_sim_reauth {
+ struct eap_sim_reauth *next;
+ u8 *identity;
+ size_t identity_len;
+ char *reauth_id;
+ u16 counter;
+ u8 mk[EAP_SIM_MK_LEN];
+};
+
+struct eap_sim_reauth *
+eap_sim_db_get_reauth_entry(void *priv, const u8 *identity,
+ size_t identity_len);
+
+void eap_sim_db_remove_reauth(void *priv, struct eap_sim_reauth *reauth);
+
+int eap_sim_db_get_aka_auth(void *priv, const u8 *identity,
+ size_t identity_len, u8 *_rand, u8 *autn, u8 *ik,
+ u8 *ck, u8 *res, size_t *res_len,
+ void *cb_session_ctx);
+
+int eap_sim_db_resynchronize(void *priv, const u8 *identity,
+ size_t identity_len, const u8 *auts,
+ const u8 *_rand);
+
#else /* EAP_SIM */
-static inline void * eap_sim_db_init(const char *config)
+static inline void *
+eap_sim_db_init(const char *config,
+ void (*get_complete_cb)(void *ctx, void *session_ctx),
+ void *ctx)
{
- return NULL;
+ return (void *) 1;
}
static inline void eap_sim_db_deinit(void *priv)
OpenPOWER on IntegriCloud