2
0
Эх сурвалжийг харах

use hmac.compare_digest instead of ==, fixes 6470

Thomas Waldmann 3 жил өмнө
parent
commit
f8cb7147a7

+ 1 - 1
src/borg/crypto/key.py

@@ -641,7 +641,7 @@ class KeyfileKeyBase(AESKeyBase):
         assert enc_key.algorithm == 'sha256'
         key = passphrase.kdf(enc_key.salt, enc_key.iterations, 32)
         data = AES(is_encrypt=False, key=key).decrypt(enc_key.data)
-        if hmac_sha256(key, data) == enc_key.hash:
+        if compare_digest(hmac_sha256(key, data), enc_key.hash):
             return data
 
     def encrypt_key_file(self, data, passphrase):