]> git.baikalelectronics.ru Git - kernel.git/commit
kbuild: Fix module signature generation
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Oct 2012 19:43:19 +0000 (12:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Oct 2012 19:43:19 +0000 (12:43 -0700)
commite6c8236daa83bf4fc72c9a85200c9d4bd24b9e2f
tree30a74a1d0475a2d651cb67b324c4b494d65038bd
parent41cad1aaaa06dd7a36034fb6e9942656b02fcaa0
kbuild: Fix module signature generation

Rusty had clearly not actually tested his module signing changes that I
(trustingly) applied as commit f56d9d4c3e9b ("kbuild: sign the modules
at install time"). That commit had multiple bugs:

 - using "${#VARIABLE}" to get the number of characters in a shell
   variable may look clever, but it's locale-dependent: it returns the
   number of *characters*, not bytes. And we do need bytes.

   So don't use "${#..}" expansion, do the stupid "wc -c" thing instead
   (where "c" stands for "bytes", not "characters", despite the letter.

 - Rusty had confused "siglen" and "signerlen", and his conversion
   didn't set "signerlen" at all, and incorrectly set "siglen" to the
   size of the signer, not the size of the signature.

End result: the modified sign-file script did create something that
superficially *looked* like a signature, but didn't actually work at
all, and would fail the signature check. Oops.

Tssk, tssk, Rusty.

But Rusty was definitely right that this whole thing should be rewritten
in perl by somebody who has the perl-fu to do so.  That is not me,
though - I'm just doing an emergency fix for the shell script.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/sign-file