Skip to content

Commit

Permalink
Change to securesystemslib.hash.digest_filename API
Browse files Browse the repository at this point in the history
This is needed ahead of the removal of securesystemslib.util.get_file_hashes in secure-systems-lab/securesystemslib#773

Signed-off-by: Marcela Melara <[email protected]>
  • Loading branch information
marcelamelara committed Apr 12, 2024
1 parent 5e55ea6 commit 240bb1a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $(PYTHON_DIR):
. $(abspath $(VENVDIR)/bin/activate) && pip install --upgrade pip
. $(abspath $(VENVDIR)/bin/activate) && pip install --upgrade wheel
. $(abspath $(VENVDIR)/bin/activate) && pip install --upgrade in-toto
. $(abspath $(VENVDIR)/bin/activate) && pip install --upgrade in-toto-attestation>=0.9.2
. $(abspath $(VENVDIR)/bin/activate) && pip install --upgrade in-toto-attestation>=0.9.3
. $(abspath $(VENVDIR)/bin/activate) && pip install --upgrade ./python

$(VENVDIR):
Expand Down
3 changes: 0 additions & 3 deletions examples/gcc-helloworld/run-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Copyright 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

VENV_DIR="${VENVDIR:=../../scai-venv}"
EXAMPLE_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

# -----------------------------------------------------------------
Expand All @@ -12,8 +11,6 @@ EXAMPLE_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

mkdir -p ${EXAMPLE_DIR}/metadata

source ${VENV_DIR}/bin/activate

echo RUN GCC

gcc -fstack-protector -o ${EXAMPLE_DIR}/hello-world ${EXAMPLE_DIR}/hello-world.c
Expand Down
2 changes: 0 additions & 2 deletions python/scai_generator/cli/gen_attr_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

import google.protobuf.json_format as pb_json

from securesystemslib.util import get_file_hashes

def Main():
parser = argparse.ArgumentParser(allow_abbrev=False)

Expand Down
7 changes: 5 additions & 2 deletions python/scai_generator/cli/gen_resource_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from scai_generator.utility import load_json_file
from in_toto_attestation.v1.resource_descriptor import ResourceDescriptor

from securesystemslib.util import get_file_hashes
from securesystemslib.hash import digest_filename
import google.protobuf.json_format as pb_json

def Main():
Expand Down Expand Up @@ -57,7 +57,10 @@ def Main():

resource_digest_set = {}
if options.digest and resource_file_path:
resource_digest_set = get_file_hashes(resource_file_path)
# we're ok with using the default hash algorithm (sha256)
hash_obj = digest_filename(resource_file_path)
# convert the hash object into a digest set
resource_digest_set.update({hash_obj.name: hash_obj.hexdigest()})

resource_bytes = bytes()
if options.content and resource_file_path:
Expand Down

0 comments on commit 240bb1a

Please sign in to comment.