Skip to content

Commit

Permalink
Support gettbsdata for Apkv3 packages
Browse files Browse the repository at this point in the history
Also die() in the replacesignature function for apkv3.
  • Loading branch information
mlschroe committed Jan 22, 2025
1 parent f99ca41 commit 84c788c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Build/Apk.pm
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ sub mktar {
sub replacesignature {
my ($handle, $ohandle, $signature, $time, $algo, $hash, $keyname, $keyid) = @_;
if (is_apkv3($handle)) {
die("replacesignature: apkv3 support is not implemented\n");
}
my $sigtype;
$sigtype = 'RSA' if $algo eq 'rsa' && $hash eq 'sha1';
$sigtype = 'RSA256' if $algo eq 'rsa' && $hash eq 'sha256';
Expand Down
3 changes: 2 additions & 1 deletion Build/Apkv3.pm
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ sub calcapkchksum {
my ($file, $type, $section) = @_;
$section ||= 'ctrl';
$type ||= 'Q1';
die("unsupported apkchksum type $type\n") unless $type eq 'Q1' || $type eq 'Q2' || $type eq 'X1' || $type eq 'X2' || $type eq 'md5';
die("unsupported apkchksum type $type\n") unless $type eq 'Q1' || $type eq 'Q2' || $type eq 'X1' || $type eq 'X2' || $type eq 'md5' || $type eq 'raw';
die("unsupported apkchksum section $section\n") unless $section eq 'ctrl';
my $fd = open_apk($file);
die("nor an apk package file\n") unless read_file_header($fd) eq 'pckg';
Expand All @@ -491,6 +491,7 @@ sub calcapkchksum {
die("oversized adb block\n") if $adbsize > 0x10000000; # 256 MB
my $adb = doread($fd, $adbsize);
close($fd);
return $adb if $type eq 'raw';
return calcapkchksum_adb($adb, $type);
}

Expand Down

0 comments on commit 84c788c

Please sign in to comment.