~ubuntu-branches/ubuntu/utopic/moonshot-gss-eap/utopic-backports

« back to all changes in this revision

Viewing changes to libeap/src/eap_common/eap_sake_common.h

  • Committer: Package Import Robot
  • Author(s): Sam Hartman
  • Date: 2014-09-16 08:38:39 UTC
  • Revision ID: package-import@ubuntu.com-20140916083839-ipqco3thb1wcwvs0
Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * EAP server/peer: EAP-SAKE shared routines
 
3
 * Copyright (c) 2006-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_SAKE_COMMON_H
 
16
#define EAP_SAKE_COMMON_H
 
17
 
 
18
#ifdef __cplusplus
 
19
extern "C" {
 
20
#endif
 
21
 
 
22
#define EAP_SAKE_VERSION 2
 
23
 
 
24
#define EAP_SAKE_SUBTYPE_CHALLENGE 1
 
25
#define EAP_SAKE_SUBTYPE_CONFIRM 2
 
26
#define EAP_SAKE_SUBTYPE_AUTH_REJECT 3
 
27
#define EAP_SAKE_SUBTYPE_IDENTITY 4
 
28
 
 
29
#define EAP_SAKE_AT_RAND_S 1
 
30
#define EAP_SAKE_AT_RAND_P 2
 
31
#define EAP_SAKE_AT_MIC_S 3
 
32
#define EAP_SAKE_AT_MIC_P 4
 
33
#define EAP_SAKE_AT_SERVERID 5
 
34
#define EAP_SAKE_AT_PEERID 6
 
35
#define EAP_SAKE_AT_SPI_S 7
 
36
#define EAP_SAKE_AT_SPI_P 8
 
37
#define EAP_SAKE_AT_ANY_ID_REQ 9
 
38
#define EAP_SAKE_AT_PERM_ID_REQ 10
 
39
#define EAP_SAKE_AT_ENCR_DATA 128
 
40
#define EAP_SAKE_AT_IV 129
 
41
#define EAP_SAKE_AT_PADDING 130
 
42
#define EAP_SAKE_AT_NEXT_TMPID 131
 
43
#define EAP_SAKE_AT_MSK_LIFE 132
 
44
 
 
45
#define EAP_SAKE_RAND_LEN 16
 
46
#define EAP_SAKE_MIC_LEN 16
 
47
#define EAP_SAKE_ROOT_SECRET_LEN 16
 
48
#define EAP_SAKE_SMS_LEN 16
 
49
#define EAP_SAKE_TEK_AUTH_LEN 16
 
50
#define EAP_SAKE_TEK_CIPHER_LEN 16
 
51
#define EAP_SAKE_TEK_LEN (EAP_SAKE_TEK_AUTH_LEN + EAP_SAKE_TEK_CIPHER_LEN)
 
52
 
 
53
#ifdef _MSC_VER
 
54
#pragma pack(push, 1)
 
55
#endif /* _MSC_VER */
 
56
 
 
57
struct eap_sake_hdr {
 
58
        u8 version; /* EAP_SAKE_VERSION */
 
59
        u8 session_id;
 
60
        u8 subtype;
 
61
} STRUCT_PACKED;
 
62
 
 
63
#ifdef _MSC_VER
 
64
#pragma pack(pop)
 
65
#endif /* _MSC_VER */
 
66
 
 
67
 
 
68
struct eap_sake_parse_attr {
 
69
        const u8 *rand_s;
 
70
        const u8 *rand_p;
 
71
        const u8 *mic_s;
 
72
        const u8 *mic_p;
 
73
        const u8 *serverid;
 
74
        size_t serverid_len;
 
75
        const u8 *peerid;
 
76
        size_t peerid_len;
 
77
        const u8 *spi_s;
 
78
        size_t spi_s_len;
 
79
        const u8 *spi_p;
 
80
        size_t spi_p_len;
 
81
        const u8 *any_id_req;
 
82
        const u8 *perm_id_req;
 
83
        const u8 *encr_data;
 
84
        size_t encr_data_len;
 
85
        const u8 *iv;
 
86
        size_t iv_len;
 
87
        const u8 *next_tmpid;
 
88
        size_t next_tmpid_len;
 
89
        const u8 *msk_life;
 
90
};
 
91
 
 
92
int eap_sake_parse_attributes(const u8 *buf, size_t len,
 
93
                              struct eap_sake_parse_attr *attr);
 
94
void eap_sake_derive_keys(const u8 *root_secret_a, const u8 *root_secret_b,
 
95
                          const u8 *rand_s, const u8 *rand_p,
 
96
                          u8 *tek, u8 *msk, u8 *emsk);
 
97
int eap_sake_compute_mic(const u8 *tek_auth,
 
98
                         const u8 *rand_s, const u8 *rand_p,
 
99
                         const u8 *serverid, size_t serverid_len,
 
100
                         const u8 *peerid, size_t peerid_len,
 
101
                         int peer, const u8 *eap, size_t eap_len,
 
102
                         const u8 *mic_pos, u8 *mic);
 
103
void eap_sake_add_attr(struct wpabuf *buf, u8 type, const u8 *data,
 
104
                       size_t len);
 
105
 
 
106
#ifdef __cplusplus
 
107
}
 
108
#endif
 
109
 
 
110
#endif /* EAP_SAKE_COMMON_H */