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