tests: Fix struct.unpack() call for a single octet with python3
python3 needs this to be a bytes object, not the first octet of that object. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
fd86ea402e
commit
786ce912ce
1 changed files with 2 additions and 2 deletions
|
@ -6179,7 +6179,7 @@ def get_wsc_msg(dev):
|
||||||
# Parse EAP expanded header
|
# Parse EAP expanded header
|
||||||
if len(data) < 1:
|
if len(data) < 1:
|
||||||
raise Exception("No EAP type included")
|
raise Exception("No EAP type included")
|
||||||
msg['eap_type'], = struct.unpack('B', data[0])
|
msg['eap_type'], = struct.unpack('B', data[0:1])
|
||||||
data = data[1:]
|
data = data[1:]
|
||||||
|
|
||||||
if msg['eap_type'] == 254:
|
if msg['eap_type'] == 254:
|
||||||
|
@ -6324,7 +6324,7 @@ def decrypt_attr_encr_settings(authkey, keywrapkey, data):
|
||||||
encr = data[16:]
|
encr = data[16:]
|
||||||
aes = AES.new(keywrapkey, AES.MODE_CBC, iv)
|
aes = AES.new(keywrapkey, AES.MODE_CBC, iv)
|
||||||
decrypted = aes.decrypt(encr)
|
decrypted = aes.decrypt(encr)
|
||||||
pad_len, = struct.unpack('B', decrypted[-1])
|
pad_len, = struct.unpack('B', decrypted[-1:])
|
||||||
if pad_len > len(decrypted):
|
if pad_len > len(decrypted):
|
||||||
raise Exception("Invalid padding in Encrypted Settings")
|
raise Exception("Invalid padding in Encrypted Settings")
|
||||||
for i in range(-pad_len, -1):
|
for i in range(-pad_len, -1):
|
||||||
|
|
Loading…
Reference in a new issue