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

« back to all changes in this revision

Viewing changes to src/eap_peer/eap_tls_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 peer: EAP-TLS/PEAP/TTLS/FAST common functions
3
 
 * Copyright (c) 2004-2006, 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_TLS_COMMON_H
16
 
#define EAP_TLS_COMMON_H
17
 
 
18
 
/**
19
 
 * struct eap_ssl_data - TLS data for EAP methods
20
 
 */
21
 
struct eap_ssl_data {
22
 
        /**
23
 
         * conn - TLS connection context data from tls_connection_init()
24
 
         */
25
 
        struct tls_connection *conn;
26
 
 
27
 
        /**
28
 
         * tls_out - TLS message to be sent out in fragments
29
 
         */
30
 
        u8 *tls_out;
31
 
 
32
 
        /**
33
 
         * tls_out_len - Total length of the outgoing TLS message
34
 
         */
35
 
        size_t tls_out_len;
36
 
 
37
 
        /**
38
 
         * tls_out_pos - The current position in the outgoing TLS message
39
 
         */
40
 
        size_t tls_out_pos;
41
 
 
42
 
        /**
43
 
         * tls_out_limit - Maximum fragment size for outgoing TLS messages
44
 
         */
45
 
        size_t tls_out_limit;
46
 
 
47
 
        /**
48
 
         * tls_in - Received TLS message buffer for re-assembly
49
 
         */
50
 
        u8 *tls_in;
51
 
 
52
 
        /**
53
 
         * tls_in_len - Number of bytes of the received TLS message in tls_in
54
 
         */
55
 
        size_t tls_in_len;
56
 
 
57
 
        /**
58
 
         * tls_in_left - Number of remaining bytes in the incoming TLS message
59
 
         */
60
 
        size_t tls_in_left;
61
 
 
62
 
        /**
63
 
         * tls_in_total - Total number of bytes in the incoming TLS message
64
 
         */
65
 
        size_t tls_in_total;
66
 
 
67
 
        /**
68
 
         * phase2 - Whether this TLS connection is used in EAP phase 2 (tunnel)
69
 
         */
70
 
        int phase2;
71
 
 
72
 
        /**
73
 
         * include_tls_length - Whether the TLS length field is included even
74
 
         * if the TLS data is not fragmented
75
 
         */
76
 
        int include_tls_length;
77
 
 
78
 
        /**
79
 
         * tls_ia - Whether TLS/IA is enabled for this TLS connection
80
 
         */
81
 
        int tls_ia;
82
 
 
83
 
        /**
84
 
         * eap - Pointer to EAP state machine allocated with eap_peer_sm_init()
85
 
         */
86
 
        struct eap_sm *eap;
87
 
};
88
 
 
89
 
 
90
 
/* EAP TLS Flags */
91
 
#define EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80
92
 
#define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40
93
 
#define EAP_TLS_FLAGS_START 0x20
94
 
#define EAP_PEAP_VERSION_MASK 0x07
95
 
 
96
 
 /* could be up to 128 bytes, but only the first 64 bytes are used */
97
 
#define EAP_TLS_KEY_LEN 64
98
 
 
99
 
 
100
 
int eap_peer_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
101
 
                          struct wpa_ssid *config);
102
 
void eap_peer_tls_ssl_deinit(struct eap_sm *sm, struct eap_ssl_data *data);
103
 
u8 * eap_peer_tls_derive_key(struct eap_sm *sm, struct eap_ssl_data *data,
104
 
                             const char *label, size_t len);
105
 
const u8 * eap_peer_tls_data_reassemble(
106
 
        struct eap_ssl_data *data, const u8 *in_data, size_t in_len,
107
 
        size_t *out_len, int *need_more_input);
108
 
int eap_peer_tls_process_helper(struct eap_sm *sm, struct eap_ssl_data *data,
109
 
                                EapType eap_type, int peap_version,
110
 
                                u8 id, const u8 *in_data, size_t in_len,
111
 
                                u8 **out_data, size_t *out_len);
112
 
u8 * eap_peer_tls_build_ack(struct eap_ssl_data *data, size_t *respDataLen,
113
 
                            u8 id, EapType eap_type, int peap_version);
114
 
int eap_peer_tls_reauth_init(struct eap_sm *sm, struct eap_ssl_data *data);
115
 
int eap_peer_tls_status(struct eap_sm *sm, struct eap_ssl_data *data,
116
 
                        char *buf, size_t buflen, int verbose);
117
 
const u8 * eap_peer_tls_process_init(struct eap_sm *sm,
118
 
                                     struct eap_ssl_data *data,
119
 
                                     EapType eap_type,
120
 
                                     struct eap_method_ret *ret,
121
 
                                     const u8 *reqData, size_t reqDataLen,
122
 
                                     size_t *len, u8 *flags);
123
 
void eap_peer_tls_reset_input(struct eap_ssl_data *data);
124
 
void eap_peer_tls_reset_output(struct eap_ssl_data *data);
125
 
int eap_peer_tls_decrypt(struct eap_sm *sm, struct eap_ssl_data *data,
126
 
                         const u8 *in_data, size_t in_len,
127
 
                         u8 **in_decrypted, size_t *len_decrypted);
128
 
int eap_peer_tls_encrypt(struct eap_sm *sm, struct eap_ssl_data *data,
129
 
                         EapType eap_type, int peap_version, u8 id,
130
 
                         const u8 *in_data, size_t in_len,
131
 
                         u8 **out_data, size_t *out_len);
132
 
int eap_peer_select_phase2_methods(struct wpa_ssid *config, const char *prefix,
133
 
                                   struct eap_method_type **types,
134
 
                                   size_t *num_types);
135
 
int eap_peer_tls_phase2_nak(struct eap_method_type *types, size_t num_types,
136
 
                            struct eap_hdr *hdr, u8 **resp, size_t *resp_len);
137
 
 
138
 
#endif /* EAP_TLS_COMMON_H */