-/* $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 <damien.bergamini@free.fr>
* 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;
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));
}
/*
-/* $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 $ */
/*-
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 *);
-/* $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 <damien.bergamini@free.fr>
/* 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",
/* 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) {
/* 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);