From e940fc9282bf164f5265c13b9b724f46a760bd47 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Wed, 17 Apr 2019 17:02:06 -0700 Subject: [PATCH] handshake: add handshake_state_get_kek_len --- src/handshake.c | 10 ++++++++++ src/handshake.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/handshake.c b/src/handshake.c index 76573d6f..d5787f5f 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -453,6 +453,16 @@ const uint8_t *handshake_state_get_kck(struct handshake_state *s) return s->ptk; } +size_t handshake_state_get_kek_len(struct handshake_state *s) +{ + size_t kek_size; + + if (!handshake_get_key_sizes(s, NULL, NULL, &kek_size)) + return 0; + + return kek_size; +} + const uint8_t *handshake_state_get_kek(struct handshake_state *s) { size_t kck_size; diff --git a/src/handshake.h b/src/handshake.h index 508950fe..2f97e0b2 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -169,6 +169,7 @@ void handshake_state_set_pmkid(struct handshake_state *s, const uint8_t *pmkid); bool handshake_state_derive_ptk(struct handshake_state *s); size_t handshake_state_get_ptk_size(struct handshake_state *s); const uint8_t *handshake_state_get_kck(struct handshake_state *s); +size_t handshake_state_get_kek_len(struct handshake_state *s); const uint8_t *handshake_state_get_kek(struct handshake_state *s); void handshake_state_install_ptk(struct handshake_state *s);