tests: Fix ft_psk_key_lifetime_in_memory with new PTK derivation debug

PTK is not printed out anymore as a single entry, so fetch KCK, KEK, and
TK separately.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-01-26 02:07:32 +02:00
parent 399e61353a
commit f918b95b9d

View file

@ -499,21 +499,23 @@ def test_ft_psk_key_lifetime_in_memory(dev, apdev, params):
if "FT: PMK-R1 - hexdump" in l: if "FT: PMK-R1 - hexdump" in l:
val = l.strip().split(':')[3].replace(' ', '') val = l.strip().split(':')[3].replace(' ', '')
pmkr1 = binascii.unhexlify(val) pmkr1 = binascii.unhexlify(val)
if "FT: PTK - hexdump" in l: if "FT: KCK - hexdump" in l:
val = l.strip().split(':')[3].replace(' ', '') val = l.strip().split(':')[3].replace(' ', '')
ptk = binascii.unhexlify(val) kck = binascii.unhexlify(val)
if "FT: KEK - hexdump" in l:
val = l.strip().split(':')[3].replace(' ', '')
kek = binascii.unhexlify(val)
if "FT: TK - hexdump" in l:
val = l.strip().split(':')[3].replace(' ', '')
tk = binascii.unhexlify(val)
if "WPA: Group Key - hexdump" in l: if "WPA: Group Key - hexdump" in l:
val = l.strip().split(':')[3].replace(' ', '') val = l.strip().split(':')[3].replace(' ', '')
gtk = binascii.unhexlify(val) gtk = binascii.unhexlify(val)
if not pmkr0 or not pmkr1 or not ptk or not gtk: if not pmkr0 or not pmkr1 or not kck or not kek or not tk or not gtk:
raise Exception("Could not find keys from debug log") raise Exception("Could not find keys from debug log")
if len(gtk) != 16: if len(gtk) != 16:
raise Exception("Unexpected GTK length") raise Exception("Unexpected GTK length")
kck = ptk[0:16]
kek = ptk[16:32]
tk = ptk[32:48]
logger.info("Checking keys in memory while associated") logger.info("Checking keys in memory while associated")
get_key_locations(buf, pmk, "PMK") get_key_locations(buf, pmk, "PMK")
get_key_locations(buf, pmkr0, "PMK-R0") get_key_locations(buf, pmkr0, "PMK-R0")