Skip to content

Commit

Permalink
Merge pull request #7731 from ThomasWaldmann/authenticated_no_key-fix…
Browse files Browse the repository at this point in the history
…-1.2

bugfix: skip TAM check with BORG_WORKAROUNDS=authenticated_no_key
  • Loading branch information
ThomasWaldmann authored Jul 20, 2023
2 parents b067aea + 104cc19 commit aa913cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/borg/crypto/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ def unpack_and_verify_manifest(self, data, force_tam_not_required=False):
unpacker = get_limited_unpacker('manifest')
unpacker.feed(data)
unpacked = unpacker.unpack()
if AUTHENTICATED_NO_KEY:
return unpacked, True # True is a lie.
if b'tam' not in unpacked:
if tam_required:
raise TAMRequiredError(self.repository._location.canonical_path())
Expand All @@ -258,8 +260,6 @@ def unpack_and_verify_manifest(self, data, force_tam_not_required=False):
offset = data.index(tam_hmac)
data[offset:offset + 64] = bytes(64)
tam_key = self._tam_key(tam_salt, context=b'manifest')
if AUTHENTICATED_NO_KEY:
return unpacked, True # True is a lie.
calculated_hmac = hmac.digest(tam_key, data, 'sha512')
if not hmac.compare_digest(calculated_hmac, tam_hmac):
raise TAMInvalid()
Expand Down

0 comments on commit aa913cd

Please sign in to comment.