aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_common
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2019-08-19 22:34:12 (GMT)
committerJouni Malinen <j@w1.fi>2019-08-19 22:34:12 (GMT)
commitcc661c160a63f372b1c413e680f7781ce717c2ad (patch)
tree06091b5b2044c18032a64878f95f1f1581d00ada /src/eap_common
parentd11c41bb7590e256c17cdd3fe892b0099e53f09b (diff)
downloadhostap-cc661c160a63f372b1c413e680f7781ce717c2ad.zip
hostap-cc661c160a63f372b1c413e680f7781ce717c2ad.tar.gz
hostap-cc661c160a63f372b1c413e680f7781ce717c2ad.tar.bz2
EAP-TEAP: Add parsing and generation routines for Identity-Type TLV
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_common')
-rw-r--r--src/eap_common/eap_teap_common.c27
-rw-r--r--src/eap_common/eap_teap_common.h8
2 files changed, 35 insertions, 0 deletions
diff --git a/src/eap_common/eap_teap_common.c b/src/eap_common/eap_teap_common.c
index 3c21d8b..ffb9a62 100644
--- a/src/eap_common/eap_teap_common.c
+++ b/src/eap_common/eap_teap_common.c
@@ -427,6 +427,17 @@ int eap_teap_parse_tlv(struct eap_teap_tlv_parse *tlv,
int tlv_type, u8 *pos, size_t len)
{
switch (tlv_type) {
+ case TEAP_TLV_IDENTITY_TYPE:
+ if (len < 2) {
+ wpa_printf(MSG_INFO,
+ "EAP-TEAP: Too short Identity-Type TLV");
+ tlv->result = TEAP_STATUS_FAILURE;
+ break;
+ }
+ tlv->identity_type = WPA_GET_BE16(pos);
+ wpa_printf(MSG_DEBUG, "EAP-TEAP: Identity-Type: %u",
+ tlv->identity_type);
+ break;
case TEAP_TLV_RESULT:
wpa_hexdump(MSG_MSGDUMP, "EAP-TEAP: Result TLV", pos, len);
if (tlv->result) {
@@ -679,6 +690,22 @@ struct wpabuf * eap_teap_tlv_error(enum teap_error_codes error)
}
+struct wpabuf * eap_teap_tlv_identity_type(enum teap_identity_types id)
+{
+ struct wpabuf *buf;
+
+ buf = wpabuf_alloc(4 + 2);
+ if (!buf)
+ return NULL;
+ wpa_printf(MSG_DEBUG,
+ "EAP-TEAP: Add Identity-Type TLV(Identity-Type=%d)", id);
+ wpabuf_put_be16(buf, TEAP_TLV_IDENTITY_TYPE);
+ wpabuf_put_be16(buf, 2);
+ wpabuf_put_be16(buf, id);
+ return buf;
+}
+
+
int eap_teap_allowed_anon_prov_phase2_method(int vendor, enum eap_type type)
{
/* RFC 7170, Section 3.8.3: MUST provide mutual authentication,
diff --git a/src/eap_common/eap_teap_common.h b/src/eap_common/eap_teap_common.h
index d92e4ca..3a25879 100644
--- a/src/eap_common/eap_teap_common.h
+++ b/src/eap_common/eap_teap_common.h
@@ -151,6 +151,12 @@ enum teap_tlv_result_status {
TEAP_STATUS_FAILURE = 2
};
+/* Identity-Type values within Identity-Type TLV */
+enum teap_identity_types {
+ TEAP_IDENTITY_TYPE_USER = 1,
+ TEAP_IDENTITY_TYPE_MACHINE = 2,
+};
+
#define TEAP_TLV_MANDATORY 0x8000
#define TEAP_TLV_TYPE_MASK 0x3fff
@@ -189,6 +195,7 @@ struct eap_teap_tlv_parse {
u8 *basic_auth_resp;
size_t basic_auth_resp_len;
u32 error_code;
+ u16 identity_type;
};
void eap_teap_put_tlv_hdr(struct wpabuf *buf, u16 type, u16 len);
@@ -215,6 +222,7 @@ int eap_teap_parse_tlv(struct eap_teap_tlv_parse *tlv,
const char * eap_teap_tlv_type_str(enum teap_tlv_types type);
struct wpabuf * eap_teap_tlv_result(int status, int intermediate);
struct wpabuf * eap_teap_tlv_error(enum teap_error_codes error);
+struct wpabuf * eap_teap_tlv_identity_type(enum teap_identity_types id);
enum eap_type;
int eap_teap_allowed_anon_prov_phase2_method(int vendor, enum eap_type type);
int eap_teap_allowed_anon_prov_cipher_suite(u16 cs);