aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer/eap_fast.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-05-02 13:42:19 (GMT)
committerJouni Malinen <j@w1.fi>2015-05-03 13:32:23 (GMT)
commitd36c803c698044c349bdd495200bafd4d9659285 (patch)
tree82c8121a55ccdf15218b97c83a55ccda5b2baf10 /src/eap_peer/eap_fast.c
parent8d9f3b8ed6fcf8f642a50218434db897944eadb8 (diff)
downloadhostap-d36c803c698044c349bdd495200bafd4d9659285.zip
hostap-d36c803c698044c349bdd495200bafd4d9659285.tar.gz
hostap-d36c803c698044c349bdd495200bafd4d9659285.tar.bz2
EAP-TLS/PEAP/TTLS/FAST: Move more towards using struct wpabuf
The EAP-TLS-based helper functions can easily use struct wpabuf in more places, so continue cleanup in that direction by replacing separate pointer and length arguments with a single struct wpabuf argument. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/eap_peer/eap_fast.c')
-rw-r--r--src/eap_peer/eap_fast.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/eap_peer/eap_fast.c b/src/eap_peer/eap_fast.c
index baca3c7..248b57b 100644
--- a/src/eap_peer/eap_fast.c
+++ b/src/eap_peer/eap_fast.c
@@ -1528,6 +1528,7 @@ static struct wpabuf * eap_fast_process(struct eap_sm *sm, void *priv,
struct wpabuf *resp;
const u8 *pos;
struct eap_fast_data *data = priv;
+ struct wpabuf msg;
pos = eap_peer_tls_process_init(sm, &data->ssl, EAP_TYPE_FAST, ret,
reqData, &left, &flags);
@@ -1544,12 +1545,12 @@ static struct wpabuf * eap_fast_process(struct eap_sm *sm, void *priv,
left = 0; /* A-ID is not used in further packet processing */
}
+ wpabuf_set(&msg, pos, left);
+
resp = NULL;
if (tls_connection_established(sm->ssl_ctx, data->ssl.conn) &&
!data->resuming) {
/* Process tunneled (encrypted) phase 2 data. */
- struct wpabuf msg;
- wpabuf_set(&msg, pos, left);
res = eap_fast_decrypt(sm, data, ret, id, &msg, &resp);
if (res < 0) {
ret->methodState = METHOD_DONE;
@@ -1564,8 +1565,8 @@ static struct wpabuf * eap_fast_process(struct eap_sm *sm, void *priv,
/* Continue processing TLS handshake (phase 1). */
res = eap_peer_tls_process_helper(sm, &data->ssl,
EAP_TYPE_FAST,
- data->fast_version, id, pos,
- left, &resp);
+ data->fast_version, id, &msg,
+ &resp);
if (tls_connection_established(sm->ssl_ctx, data->ssl.conn)) {
char cipher[80];
@@ -1589,14 +1590,12 @@ static struct wpabuf * eap_fast_process(struct eap_sm *sm, void *priv,
}
if (res == 2) {
- struct wpabuf msg;
/*
* Application data included in the handshake message.
*/
wpabuf_free(data->pending_phase2_req);
data->pending_phase2_req = resp;
resp = NULL;
- wpabuf_set(&msg, pos, left);
res = eap_fast_decrypt(sm, data, ret, id, &msg, &resp);
}
}