$search
00001 /* 00002 * EAP server/peer: EAP-GPSK shared routines 00003 * Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef EAP_GPSK_COMMON_H 00016 #define EAP_GPSK_COMMON_H 00017 00018 #define EAP_GPSK_OPCODE_GPSK_1 1 00019 #define EAP_GPSK_OPCODE_GPSK_2 2 00020 #define EAP_GPSK_OPCODE_GPSK_3 3 00021 #define EAP_GPSK_OPCODE_GPSK_4 4 00022 #define EAP_GPSK_OPCODE_FAIL 5 00023 #define EAP_GPSK_OPCODE_PROTECTED_FAIL 6 00024 00025 /* Failure-Code in GPSK-Fail and GPSK-Protected-Fail */ 00026 #define EAP_GPSK_FAIL_PSK_NOT_FOUND 0x00000001 00027 #define EAP_GPSK_FAIL_AUTHENTICATION_FAILURE 0x00000002 00028 #define EAP_GPSK_FAIL_AUTHORIZATION_FAILURE 0x00000003 00029 00030 #define EAP_GPSK_RAND_LEN 32 00031 #define EAP_GPSK_MAX_SK_LEN 32 00032 #define EAP_GPSK_MAX_PK_LEN 32 00033 #define EAP_GPSK_MAX_MIC_LEN 32 00034 00035 #define EAP_GPSK_VENDOR_IETF 0x00000000 00036 #define EAP_GPSK_CIPHER_RESERVED 0x000000 00037 #define EAP_GPSK_CIPHER_AES 0x000001 00038 #define EAP_GPSK_CIPHER_SHA256 0x000002 00039 00040 00041 #ifdef _MSC_VER 00042 #pragma pack(push, 1) 00043 #endif /* _MSC_VER */ 00044 00045 struct eap_gpsk_csuite { 00046 u8 vendor[4]; 00047 u8 specifier[2]; 00048 } STRUCT_PACKED; 00049 00050 #ifdef _MSC_VER 00051 #pragma pack(pop) 00052 #endif /* _MSC_VER */ 00053 00054 int eap_gpsk_supported_ciphersuite(int vendor, int specifier); 00055 int eap_gpsk_derive_keys(const u8 *psk, size_t psk_len, int vendor, 00056 int specifier, 00057 const u8 *rand_client, const u8 *rand_server, 00058 const u8 *id_client, size_t id_client_len, 00059 const u8 *id_server, size_t id_server_len, 00060 u8 *msk, u8 *emsk, u8 *sk, size_t *sk_len, 00061 u8 *pk, size_t *pk_len); 00062 size_t eap_gpsk_mic_len(int vendor, int specifier); 00063 int eap_gpsk_compute_mic(const u8 *sk, size_t sk_len, int vendor, 00064 int specifier, const u8 *data, size_t len, u8 *mic); 00065 00066 #endif /* EAP_GPSK_COMMON_H */