From: damien Date: Tue, 12 Aug 2008 16:05:15 +0000 (+0000) Subject: simplify ieee80211_derive_ptk() prototype. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=69c91a8a1899a022ebcae50f10a951609bd6a651;p=openbsd simplify ieee80211_derive_ptk() prototype. pass the AKMP so we can support other key derivation functions in the future. --- diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c index 801323d6ca0..980fc7c6f65 100644 --- a/sys/net80211/ieee80211_crypto.c +++ b/sys/net80211/ieee80211_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_crypto.c,v 1.44 2008/08/12 15:59:40 damien Exp $ */ +/* $OpenBSD: ieee80211_crypto.c,v 1.45 2008/08/12 16:05:15 damien Exp $ */ /*- * Copyright (c) 2008 Damien Bergamini @@ -257,9 +257,9 @@ ieee80211_prf(const u_int8_t *key, size_t key_len, const u_int8_t *label, * Derive Pairwise Transient Key (PTK) (see 8.5.1.2). */ void -ieee80211_derive_ptk(const u_int8_t *pmk, size_t pmk_len, const u_int8_t *aa, - const u_int8_t *spa, const u_int8_t *anonce, const u_int8_t *snonce, - u_int8_t *ptk, size_t ptk_len) +ieee80211_derive_ptk(enum ieee80211_akm akm, const u_int8_t *pmk, + const u_int8_t *aa, const u_int8_t *spa, const u_int8_t *anonce, + const u_int8_t *snonce, struct ieee80211_ptk *ptk) { u_int8_t buf[2 * IEEE80211_ADDR_LEN + 2 * EAPOL_KEY_NONCE_LEN]; int ret; @@ -274,8 +274,8 @@ ieee80211_derive_ptk(const u_int8_t *pmk, size_t pmk_len, const u_int8_t *aa, memcpy(&buf[12], ret ? anonce : snonce, EAPOL_KEY_NONCE_LEN); memcpy(&buf[44], ret ? snonce : anonce, EAPOL_KEY_NONCE_LEN); - ieee80211_prf(pmk, pmk_len, "Pairwise key expansion", 23, - buf, sizeof buf, ptk, ptk_len); + ieee80211_prf(pmk, IEEE80211_PMK_LEN, "Pairwise key expansion", 23, + buf, sizeof buf, (u_int8_t *)ptk, sizeof(*ptk)); } /* diff --git a/sys/net80211/ieee80211_crypto.h b/sys/net80211/ieee80211_crypto.h index e9e506b407b..178e7144ead 100644 --- a/sys/net80211/ieee80211_crypto.h +++ b/sys/net80211/ieee80211_crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_crypto.h,v 1.13 2008/04/21 19:37:18 damien Exp $ */ +/* $OpenBSD: ieee80211_crypto.h,v 1.14 2008/08/12 16:05:15 damien Exp $ */ /* $NetBSD: ieee80211_crypto.h,v 1.2 2003/09/14 01:14:55 dyoung Exp $ */ /*- @@ -140,9 +140,9 @@ extern void ieee80211_eapol_key_encrypt(struct ieee80211com *, extern int ieee80211_eapol_key_decrypt(struct ieee80211_eapol_key *, const u_int8_t *); -extern void ieee80211_derive_ptk(const u_int8_t *, size_t, const u_int8_t *, - const u_int8_t *, const u_int8_t *, const u_int8_t *, u_int8_t *, - size_t); +extern void ieee80211_derive_ptk(enum ieee80211_akm, const u_int8_t *, + const u_int8_t *, const u_int8_t *, const u_int8_t *, + const u_int8_t *, struct ieee80211_ptk *); extern int ieee80211_cipher_keylen(enum ieee80211_cipher); extern void ieee80211_map_ptk(const struct ieee80211_ptk *, enum ieee80211_cipher, u_int64_t, struct ieee80211_key *); diff --git a/sys/net80211/ieee80211_pae_input.c b/sys/net80211/ieee80211_pae_input.c index b3406b9238d..8dc336e990a 100644 --- a/sys/net80211/ieee80211_pae_input.c +++ b/sys/net80211/ieee80211_pae_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_pae_input.c,v 1.5 2008/08/02 08:25:59 damien Exp $ */ +/* $OpenBSD: ieee80211_pae_input.c,v 1.6 2008/08/12 16:05:15 damien Exp $ */ /*- * Copyright (c) 2007,2008 Damien Bergamini @@ -204,9 +204,8 @@ ieee80211_recv_4way_msg1(struct ieee80211com *ic, /* no PMK configured for this STA/PMKID */ return; } - ieee80211_derive_ptk(pmk, IEEE80211_PMK_LEN, ni->ni_macaddr, - ic->ic_myaddr, key->nonce, ic->ic_nonce, (u_int8_t *)&tptk, - sizeof(tptk)); + ieee80211_derive_ptk(ni->ni_rsnakms, pmk, ni->ni_macaddr, + ic->ic_myaddr, key->nonce, ic->ic_nonce, &tptk); if (ic->ic_if.if_flags & IFF_DEBUG) printf("%s: received msg %d/%d of the %s handshake from %s\n", @@ -248,9 +247,8 @@ ieee80211_recv_4way_msg2(struct ieee80211com *ic, /* no PMK configured for this STA */ return; /* will timeout.. */ } - ieee80211_derive_ptk(pmk, IEEE80211_PMK_LEN, ic->ic_myaddr, - ni->ni_macaddr, ni->ni_nonce, key->nonce, (u_int8_t *)&tptk, - sizeof(tptk)); + ieee80211_derive_ptk(ni->ni_rsnakms, pmk, ic->ic_myaddr, + ni->ni_macaddr, ni->ni_nonce, key->nonce, &tptk); /* check Key MIC field using KCK */ if (ieee80211_eapol_key_check_mic(key, tptk.kck) != 0) { @@ -322,9 +320,8 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, /* no PMK configured for this STA */ return; } - ieee80211_derive_ptk(pmk, IEEE80211_PMK_LEN, ni->ni_macaddr, - ic->ic_myaddr, key->nonce, ic->ic_nonce, (u_int8_t *)&tptk, - sizeof(tptk)); + ieee80211_derive_ptk(ni->ni_rsnakms, pmk, ni->ni_macaddr, + ic->ic_myaddr, key->nonce, ic->ic_nonce, &tptk); info = BE_READ_2(key->info);