summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShikha Panwar <shikhapanwar@google.com>2022-12-21 12:54:45 +0000
committerShikha Panwar <shikhapanwar@google.com>2023-01-31 14:13:38 +0000
commitf3d1e8c24cba69b93d9fdd2f01d770927988eeb1 (patch)
treeccb801e6332efbe744e23a35c69acaa68544ba18
parenta8033c94db8a676d095f588158c219435d79b0a0 (diff)
Expose avb_hash_algorithm as a property.
When avb_hash_algorithm is set, for filesystem type build targets, add_hashtree_footer will be called with the appropriate --hash_algorithm flag. Bug: 262892300 Test: Build succeeds Merged-In: If2f9c9aa1e98314b3d3e2f8bf25c1bab193f908e Merged-In: Ief4b0f0fd89ebf64b45b29962a3811698bc922d6 Change-Id: I3bf5aecbfd717036a5b167696b107ee6cb1830b4
-rw-r--r--filesystem/filesystem.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index ccf9e9d3b..665faaaed 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -66,9 +66,13 @@ type filesystemProperties struct {
// TODO(jiyong): allow apex_key to be specified here
Avb_private_key *string `android:"path"`
- // Hash and signing algorithm for avbtool. Default is SHA256_RSA4096.
+ // Signing algorithm for avbtool. Default is SHA256_RSA4096.
Avb_algorithm *string
+ // Hash algorithm used for avbtool (for descriptors). This is passed as hash_algorithm to
+ // avbtool. Default used by avbtool is sha1.
+ Avb_hash_algorithm *string
+
// Name of the partition stored in vbmeta desc. Defaults to the name of this module.
Partition_name *string
@@ -318,7 +322,11 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (propFile android.
addStr("avb_algorithm", algorithm)
key := android.PathForModuleSrc(ctx, proptools.String(f.properties.Avb_private_key))
addPath("avb_key_path", key)
- addStr("avb_add_hashtree_footer_args", "--do_not_generate_fec")
+ avb_add_hashtree_footer_args := "--do_not_generate_fec"
+ if hashAlgorithm := proptools.String(f.properties.Avb_hash_algorithm); hashAlgorithm != "" {
+ avb_add_hashtree_footer_args += " --hash_algorithm " + hashAlgorithm
+ }
+ addStr("avb_add_hashtree_footer_args", avb_add_hashtree_footer_args)
partitionName := proptools.StringDefault(f.properties.Partition_name, f.Name())
addStr("partition_name", partitionName)
}