]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Make ‘keybytes’ a bytes object rather than a list
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 18 Oct 2023 04:08:01 +0000 (17:08 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 19 Oct 2023 21:37:36 +0000 (21:37 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/kcrypto.py

index 79df0b58a3e3962f5840562d010aba28bcd191d3..98b8465f3abffbccae1072632682e4c7023ef5a8 100755 (executable)
@@ -279,9 +279,9 @@ class _DES3CBC(_SimplifiedEnctype):
                 b &= ~1
                 return b if bin(b & ~1).count('1') % 2 else b | 1
             assert len(seed) == 7
-            firstbytes = [parity(b & ~1) for b in seed]
+            firstbytes = bytes(parity(b & ~1) for b in seed)
             lastbyte = parity(sum((seed[i] & 1) << i + 1 for i in range(7)))
-            keybytes = bytes([b for b in firstbytes + [lastbyte]])
+            keybytes = firstbytes + bytes([lastbyte])
             if _is_weak_des_key(keybytes):
                 keybytes[7] = bytes([keybytes[7] ^ 0xF0])
             return keybytes