Skip to content

Commit

Permalink
Remove uses of keyid_hash_algorithms
Browse files Browse the repository at this point in the history
PR theupdateframework#1014 removed uses of keyid_hash_algorithms in favour of using the calculated
keyid values from the metadata. A few instances of this removal were
unintentionally reintroduced in PR theupdateframework#1016, when changing to explicitly passing
a list of hash algorithms rather than changing securesystemslib settings
values.

This change removes uneccessary uses of keyid_hash_algorithms.

Signed-off-by: Joshua Lock <jlock@vmware.com>
  • Loading branch information
joshuagl authored and MVrachev committed Sep 17, 2020
1 parent 0130e7c commit 5961e1a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tuf/client/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,7 @@ def _import_delegations(self, parent_role):
# We specify the keyid to ensure that it's the correct keyid
# for the key.
try:
key, _ = securesystemslib.keys.format_metadata_to_key(keyinfo, keyid,
keyid_hash_algorithms=keyinfo['keyid_hash_algorithms'])
key, _ = securesystemslib.keys.format_metadata_to_key(keyinfo, keyid)

tuf.keydb.add_key(key, repository_name=self.repository_name)

Expand Down
2 changes: 1 addition & 1 deletion tuf/keydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def create_keydb_from_root_metadata(root_metadata, repository_name='default'):
# All other keyids returned are ignored.

key_dict, _ = securesystemslib.keys.format_metadata_to_key(key_metadata,
keyid, keyid_hash_algorithms=key_metadata['keyid_hash_algorithms'])
keyid)

# Make sure to update key_dict['keyid'] to use one of the other valid
# keyids, otherwise add_key() will have no reference to it.
Expand Down
2 changes: 1 addition & 1 deletion tuf/repository_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def _load_top_level_metadata(repository, top_level_filenames, repository_name):

# Use the keyid found in the delegation
key_object, _ = securesystemslib.keys.format_metadata_to_key(key_metadata,
keyid, keyid_hash_algorithms=key_metadata['keyid_hash_algorithms'])
keyid)

# Add 'key_object' to the list of recognized keys. Keys may be shared,
# so do not raise an exception if 'key_object' has already been loaded.
Expand Down

0 comments on commit 5961e1a

Please sign in to comment.