From: Joseph Sutton Date: Wed, 18 Oct 2023 02:59:56 +0000 (+1300) Subject: tests/krb5: Fix DES3CBC random_to_key() X-Git-Tag: talloc-2.4.2~1216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d363c7bf55a2b913e8a4d2730910467df6694dc1;p=thirdparty%2Fsamba.git tests/krb5: Fix DES3CBC random_to_key() Because ‘keybytes’ is an immutable bytes object, ‘keybytes[7] = …’ has no hope of working. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/krb5/kcrypto.py b/python/samba/tests/krb5/kcrypto.py index 98b8465f3ab..c0a09908ea9 100755 --- a/python/samba/tests/krb5/kcrypto.py +++ b/python/samba/tests/krb5/kcrypto.py @@ -283,7 +283,7 @@ class _DES3CBC(_SimplifiedEnctype): lastbyte = parity(sum((seed[i] & 1) << i + 1 for i in range(7))) keybytes = firstbytes + bytes([lastbyte]) if _is_weak_des_key(keybytes): - keybytes[7] = bytes([keybytes[7] ^ 0xF0]) + keybytes = firstbytes + bytes([lastbyte ^ 0xF0]) return keybytes if len(seed) != 21: