MODSIGN: Move the magic string to the end of a module and eliminate the search
Emit the magic string that indicates a module has a signature after the signature data instead of before it. This allows module_sig_check() to be made simpler and faster by the elimination of the search for the magic string. Instead we just need to do a single memcmp(). This works because at the end of the signature data there is the fixed-length signature information block. This block then falls immediately prior to the magic number. From the contents of the information block, it is trivial to calculate the size of the signature data and thus the size of the actual module data. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
b6bb324dbd
commit
caabe24057
@@ -403,11 +403,11 @@ my $info = pack("CCCCCxxxN",
|
||||
|
||||
if ($verbose) {
|
||||
print "Size of unsigned module: ", length($unsigned_module), "\n";
|
||||
print "Size of magic number : ", length($magic_number), "\n";
|
||||
print "Size of signer's name : ", length($signers_name), "\n";
|
||||
print "Size of key identifier : ", length($key_identifier), "\n";
|
||||
print "Size of signature : ", length($signature), "\n";
|
||||
print "Size of informaton : ", length($info), "\n";
|
||||
print "Size of magic number : ", length($magic_number), "\n";
|
||||
print "Signer's name : '", $signers_name, "'\n";
|
||||
print "Digest : $dgst\n";
|
||||
}
|
||||
@@ -416,11 +416,11 @@ open(FD, ">$dest") || die $dest;
|
||||
binmode FD;
|
||||
print FD
|
||||
$unsigned_module,
|
||||
$magic_number,
|
||||
$signers_name,
|
||||
$key_identifier,
|
||||
$signature,
|
||||
$info
|
||||
$info,
|
||||
$magic_number
|
||||
;
|
||||
close FD || die $dest;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user