3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-14 16:09:24 +01:00

crypto: Add crypto_derive_pairwise_ptk

This commit is contained in:
Denis Kenzior 2014-12-26 14:14:02 -06:00
parent 1c4e3bc774
commit 5e7771ef66
2 changed files with 21 additions and 0 deletions

View File

@ -161,3 +161,13 @@ bool crypto_derive_ptk(const uint8_t *pmk, size_t pmk_len, const char *label,
return prf_sha1(pmk, pmk_len, label, strlen(label),
data, sizeof(data), out_ptk, ptk_len);
}
bool crypto_derive_pairwise_ptk(const uint8_t *pmk,
const uint8_t *addr1, const uint8_t *addr2,
const uint8_t *nonce1, const uint8_t *nonce2,
struct crypto_ptk *out_ptk, size_t ptk_len)
{
return crypto_derive_ptk(pmk, 32, "Pairwise key expansion",
addr1, addr2, nonce1, nonce2,
(uint8_t *) out_ptk, ptk_len);
}

View File

@ -31,6 +31,12 @@ enum crypto_cipher {
CRYPTO_CIPHER_BIP,
};
struct crypto_ptk {
uint8_t kck[16];
uint8_t kek[16];
uint8_t tk[0];
};
int crypto_cipher_key_len(enum crypto_cipher cipher);
int crypto_cipher_tk_bits(enum crypto_cipher cipher);
@ -42,3 +48,8 @@ bool crypto_derive_ptk(const uint8_t *pmk, size_t pmk_len, const char *label,
const uint8_t *addr1, const uint8_t *addr2,
const uint8_t *nonce1, const uint8_t *nonce2,
uint8_t *out_ptk, size_t ptk_len);
bool crypto_derive_pairwise_ptk(const uint8_t *pmk,
const uint8_t *addr1, const uint8_t *addr2,
const uint8_t *nonce1, const uint8_t *nonce2,
struct crypto_ptk *out_ptk, size_t ptk_len);