~ubuntu-branches/ubuntu/gutsy/wpasupplicant/gutsy

« back to all changes in this revision

Viewing changes to src/eap_common/eap_psk_common.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler, Alexander Sack
  • Date: 2007-08-26 16:06:57 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070826160657-2m8pxoweuxe8f93t
Tags: 0.6.0+0.5.8-0ubuntu1
* New upstream release
* remove patch 11_erroneous_manpage_ref, applied upstream
* remove patch 25_wpas_dbus_unregister_iface_fix, applied upstream

[ Alexander Sack ]
* bumping upstream version to replace development version 0.6.0 with
  this package from stable release branch.
* attempt to fix wierd timeout and high latency issues by going
  back to stable upstream version (0.5.9) (LP: #140763,
  LP: #141233).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * EAP server/peer: EAP-PSK shared routines
3
 
 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License version 2 as
7
 
 * published by the Free Software Foundation.
8
 
 *
9
 
 * Alternatively, this software may be distributed under the terms of BSD
10
 
 * license.
11
 
 *
12
 
 * See README and COPYING for more details.
13
 
 */
14
 
 
15
 
#ifndef EAP_PSK_COMMON_H
16
 
#define EAP_PSK_COMMON_H
17
 
 
18
 
 
19
 
#define EAP_PSK_RAND_LEN 16
20
 
#define EAP_PSK_MAC_LEN 16
21
 
#define EAP_PSK_TEK_LEN 16
22
 
#define EAP_PSK_PSK_LEN 16
23
 
#define EAP_PSK_AK_LEN 16
24
 
#define EAP_PSK_KDK_LEN 16
25
 
 
26
 
#define EAP_PSK_R_FLAG_CONT 1
27
 
#define EAP_PSK_R_FLAG_DONE_SUCCESS 2
28
 
#define EAP_PSK_R_FLAG_DONE_FAILURE 3
29
 
#define EAP_PSK_E_FLAG 0x20
30
 
 
31
 
#define EAP_PSK_FLAGS_GET_T(flags) (((flags) & 0xc0) >> 6)
32
 
#define EAP_PSK_FLAGS_SET_T(t) ((u8) (t) << 6)
33
 
 
34
 
#ifdef _MSC_VER
35
 
#pragma pack(push, 1)
36
 
#endif /* _MSC_VER */
37
 
 
38
 
/* Shared prefix for all EAP-PSK frames */
39
 
struct eap_psk_hdr {
40
 
        u8 code;
41
 
        u8 identifier;
42
 
        u16 length; /* including code, identifier, and length */
43
 
        u8 type; /* EAP_TYPE_PSK */
44
 
        u8 flags;
45
 
} STRUCT_PACKED;
46
 
 
47
 
/* EAP-PSK First Message (AS -> Supplicant) */
48
 
struct eap_psk_hdr_1 {
49
 
        u8 code;
50
 
        u8 identifier;
51
 
        be16 length; /* including code, identifier, and length */
52
 
        u8 type; /* EAP_TYPE_PSK */
53
 
        u8 flags;
54
 
        u8 rand_s[EAP_PSK_RAND_LEN];
55
 
        /* Followed by variable length ID_S */
56
 
} STRUCT_PACKED;
57
 
 
58
 
/* EAP-PSK Second Message (Supplicant -> AS) */
59
 
struct eap_psk_hdr_2 {
60
 
        u8 code;
61
 
        u8 identifier;
62
 
        be16 length; /* including code, identifier, and length */
63
 
        u8 type; /* EAP_TYPE_PSK */
64
 
        u8 flags;
65
 
        u8 rand_s[EAP_PSK_RAND_LEN];
66
 
        u8 rand_p[EAP_PSK_RAND_LEN];
67
 
        u8 mac_p[EAP_PSK_MAC_LEN];
68
 
        /* Followed by variable length ID_P */
69
 
} STRUCT_PACKED;
70
 
 
71
 
/* EAP-PSK Third Message (AS -> Supplicant) */
72
 
struct eap_psk_hdr_3 {
73
 
        u8 code;
74
 
        u8 identifier;
75
 
        be16 length; /* including code, identifier, and length */
76
 
        u8 type; /* EAP_TYPE_PSK */
77
 
        u8 flags;
78
 
        u8 rand_s[EAP_PSK_RAND_LEN];
79
 
        u8 mac_s[EAP_PSK_MAC_LEN];
80
 
        /* Followed by variable length PCHANNEL */
81
 
} STRUCT_PACKED;
82
 
 
83
 
/* EAP-PSK Fourth Message (Supplicant -> AS) */
84
 
struct eap_psk_hdr_4 {
85
 
        u8 code;
86
 
        u8 identifier;
87
 
        be16 length; /* including code, identifier, and length */
88
 
        u8 type; /* EAP_TYPE_PSK */
89
 
        u8 flags;
90
 
        u8 rand_s[EAP_PSK_RAND_LEN];
91
 
        /* Followed by variable length PCHANNEL */
92
 
} STRUCT_PACKED;
93
 
 
94
 
#ifdef _MSC_VER
95
 
#pragma pack(pop)
96
 
#endif /* _MSC_VER */
97
 
 
98
 
 
99
 
void eap_psk_key_setup(const u8 *psk, u8 *ak, u8 *kdk);
100
 
void eap_psk_derive_keys(const u8 *kdk, const u8 *rand_p, u8 *tek, u8 *msk,
101
 
                         u8 *emsk);
102
 
 
103
 
#endif /* EAP_PSK_COMMON_H */