eap_sake_common.h
Go to the documentation of this file.00001
00016 #ifndef EAP_SAKE_COMMON_H
00017 #define EAP_SAKE_COMMON_H
00018
00019 #define EAP_SAKE_VERSION 2
00020
00021 #define EAP_SAKE_SUBTYPE_CHALLENGE 1
00022 #define EAP_SAKE_SUBTYPE_CONFIRM 2
00023 #define EAP_SAKE_SUBTYPE_AUTH_REJECT 3
00024 #define EAP_SAKE_SUBTYPE_IDENTITY 4
00025
00026 #define EAP_SAKE_AT_RAND_S 1
00027 #define EAP_SAKE_AT_RAND_P 2
00028 #define EAP_SAKE_AT_MIC_S 3
00029 #define EAP_SAKE_AT_MIC_P 4
00030 #define EAP_SAKE_AT_SERVERID 5
00031 #define EAP_SAKE_AT_PEERID 6
00032 #define EAP_SAKE_AT_SPI_S 7
00033 #define EAP_SAKE_AT_SPI_P 8
00034 #define EAP_SAKE_AT_ANY_ID_REQ 9
00035 #define EAP_SAKE_AT_PERM_ID_REQ 10
00036 #define EAP_SAKE_AT_ENCR_DATA 128
00037 #define EAP_SAKE_AT_IV 129
00038 #define EAP_SAKE_AT_PADDING 130
00039 #define EAP_SAKE_AT_NEXT_TMPID 131
00040 #define EAP_SAKE_AT_MSK_LIFE 132
00041
00042 #define EAP_SAKE_RAND_LEN 16
00043 #define EAP_SAKE_MIC_LEN 16
00044 #define EAP_SAKE_ROOT_SECRET_LEN 16
00045 #define EAP_SAKE_SMS_LEN 16
00046 #define EAP_SAKE_TEK_AUTH_LEN 16
00047 #define EAP_SAKE_TEK_CIPHER_LEN 16
00048 #define EAP_SAKE_TEK_LEN (EAP_SAKE_TEK_AUTH_LEN + EAP_SAKE_TEK_CIPHER_LEN)
00049
00050 #ifdef _MSC_VER
00051 #pragma pack(push, 1)
00052 #endif
00053
00054 struct eap_sake_hdr {
00055 u8 version;
00056 u8 session_id;
00057 u8 subtype;
00058 } STRUCT_PACKED;
00059
00060 #ifdef _MSC_VER
00061 #pragma pack(pop)
00062 #endif
00063
00064
00065 struct eap_sake_parse_attr {
00066 const u8 *rand_s;
00067 const u8 *rand_p;
00068 const u8 *mic_s;
00069 const u8 *mic_p;
00070 const u8 *serverid;
00071 size_t serverid_len;
00072 const u8 *peerid;
00073 size_t peerid_len;
00074 const u8 *spi_s;
00075 size_t spi_s_len;
00076 const u8 *spi_p;
00077 size_t spi_p_len;
00078 const u8 *any_id_req;
00079 const u8 *perm_id_req;
00080 const u8 *encr_data;
00081 size_t encr_data_len;
00082 const u8 *iv;
00083 size_t iv_len;
00084 const u8 *next_tmpid;
00085 size_t next_tmpid_len;
00086 const u8 *msk_life;
00087 };
00088
00089 int eap_sake_parse_attributes(const u8 *buf, size_t len,
00090 struct eap_sake_parse_attr *attr);
00091 void eap_sake_derive_keys(const u8 *root_secret_a, const u8 *root_secret_b,
00092 const u8 *rand_s, const u8 *rand_p,
00093 u8 *tek, u8 *msk, u8 *emsk);
00094 int eap_sake_compute_mic(const u8 *tek_auth,
00095 const u8 *rand_s, const u8 *rand_p,
00096 const u8 *serverid, size_t serverid_len,
00097 const u8 *peerid, size_t peerid_len,
00098 int peer, const u8 *eap, size_t eap_len,
00099 const u8 *mic_pos, u8 *mic);
00100 void eap_sake_add_attr(struct wpabuf *buf, u8 type, const u8 *data,
00101 size_t len);
00102
00103 #endif
00104