diff options
author | David Howells <dhowells@redhat.com> | 2012-10-19 20:19:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-19 20:30:40 -0400 |
commit | caabe240574aec05b2f5667414ce80f9075c2ba1 (patch) | |
tree | d92bf96b009bd0b0caec44c21348812b06805909 /scripts/sign-file | |
parent | b6bb324dbddd704b4b9a85971e1f7ae79abb2e1d (diff) |
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>
Diffstat (limited to 'scripts/sign-file')
-rwxr-xr-x | scripts/sign-file | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/sign-file b/scripts/sign-file index d37d1309531e..87ca59d36e7e 100755 --- a/scripts/sign-file +++ b/scripts/sign-file | |||
@@ -403,11 +403,11 @@ my $info = pack("CCCCCxxxN", | |||
403 | 403 | ||
404 | if ($verbose) { | 404 | if ($verbose) { |
405 | print "Size of unsigned module: ", length($unsigned_module), "\n"; | 405 | print "Size of unsigned module: ", length($unsigned_module), "\n"; |
406 | print "Size of magic number : ", length($magic_number), "\n"; | ||
407 | print "Size of signer's name : ", length($signers_name), "\n"; | 406 | print "Size of signer's name : ", length($signers_name), "\n"; |
408 | print "Size of key identifier : ", length($key_identifier), "\n"; | 407 | print "Size of key identifier : ", length($key_identifier), "\n"; |
409 | print "Size of signature : ", length($signature), "\n"; | 408 | print "Size of signature : ", length($signature), "\n"; |
410 | print "Size of informaton : ", length($info), "\n"; | 409 | print "Size of informaton : ", length($info), "\n"; |
410 | print "Size of magic number : ", length($magic_number), "\n"; | ||
411 | print "Signer's name : '", $signers_name, "'\n"; | 411 | print "Signer's name : '", $signers_name, "'\n"; |
412 | print "Digest : $dgst\n"; | 412 | print "Digest : $dgst\n"; |
413 | } | 413 | } |
@@ -416,11 +416,11 @@ open(FD, ">$dest") || die $dest; | |||
416 | binmode FD; | 416 | binmode FD; |
417 | print FD | 417 | print FD |
418 | $unsigned_module, | 418 | $unsigned_module, |
419 | $magic_number, | ||
420 | $signers_name, | 419 | $signers_name, |
421 | $key_identifier, | 420 | $key_identifier, |
422 | $signature, | 421 | $signature, |
423 | $info | 422 | $info, |
423 | $magic_number | ||
424 | ; | 424 | ; |
425 | close FD || die $dest; | 425 | close FD || die $dest; |
426 | 426 | ||