eap_gpsk_common.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * EAP server/peer: EAP-GPSK shared routines
  3. * Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef EAP_GPSK_COMMON_H
  9. #define EAP_GPSK_COMMON_H
  10. #define EAP_GPSK_OPCODE_GPSK_1 1
  11. #define EAP_GPSK_OPCODE_GPSK_2 2
  12. #define EAP_GPSK_OPCODE_GPSK_3 3
  13. #define EAP_GPSK_OPCODE_GPSK_4 4
  14. #define EAP_GPSK_OPCODE_FAIL 5
  15. #define EAP_GPSK_OPCODE_PROTECTED_FAIL 6
  16. /* Failure-Code in GPSK-Fail and GPSK-Protected-Fail */
  17. #define EAP_GPSK_FAIL_PSK_NOT_FOUND 0x00000001
  18. #define EAP_GPSK_FAIL_AUTHENTICATION_FAILURE 0x00000002
  19. #define EAP_GPSK_FAIL_AUTHORIZATION_FAILURE 0x00000003
  20. #define EAP_GPSK_RAND_LEN 32
  21. #define EAP_GPSK_MAX_SK_LEN 32
  22. #define EAP_GPSK_MAX_PK_LEN 32
  23. #define EAP_GPSK_MAX_MIC_LEN 32
  24. #define EAP_GPSK_VENDOR_IETF 0x00000000
  25. #define EAP_GPSK_CIPHER_RESERVED 0x000000
  26. #define EAP_GPSK_CIPHER_AES 0x000001
  27. #define EAP_GPSK_CIPHER_SHA256 0x000002
  28. #ifdef _MSC_VER
  29. #pragma pack(push, 1)
  30. #endif /* _MSC_VER */
  31. struct eap_gpsk_csuite {
  32. u8 vendor[4];
  33. u8 specifier[2];
  34. } STRUCT_PACKED;
  35. #ifdef _MSC_VER
  36. #pragma pack(pop)
  37. #endif /* _MSC_VER */
  38. int eap_gpsk_supported_ciphersuite(int vendor, int specifier);
  39. int eap_gpsk_derive_keys(const u8 *psk, size_t psk_len, int vendor,
  40. int specifier,
  41. const u8 *rand_client, const u8 *rand_server,
  42. const u8 *id_client, size_t id_client_len,
  43. const u8 *id_server, size_t id_server_len,
  44. u8 *msk, u8 *emsk, u8 *sk, size_t *sk_len,
  45. u8 *pk, size_t *pk_len);
  46. int eap_gpsk_derive_session_id(const u8 *psk, size_t psk_len, int vendor,
  47. int specifier,
  48. const u8 *rand_peer, const u8 *rand_server,
  49. const u8 *id_peer, size_t id_peer_len,
  50. const u8 *id_server, size_t id_server_len,
  51. u8 method_type, u8 *sid, size_t *sid_len);
  52. size_t eap_gpsk_mic_len(int vendor, int specifier);
  53. int eap_gpsk_compute_mic(const u8 *sk, size_t sk_len, int vendor,
  54. int specifier, const u8 *data, size_t len, u8 *mic);
  55. #endif /* EAP_GPSK_COMMON_H */