X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fmodsign%2Fmodsign.sh;h=588cac0b256335c15a688b9fa878c0c53a17b415;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=4d3eaa23324f07ce28f2df3fca3b92cb638e14e1;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/scripts/modsign/modsign.sh b/scripts/modsign/modsign.sh index 4d3eaa233..588cac0b2 100644 --- a/scripts/modsign/modsign.sh +++ b/scripts/modsign/modsign.sh @@ -1,35 +1,57 @@ #!/bin/bash +############################################################################### +# +# Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. +# Written by David Howells (dhowells@redhat.com) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +############################################################################### +verbose= + +if [ $# -gt 1 -a "x$1" = "x-v" ] + then + verbose=-v + shift +fi -if [ $# = "0" ] ; then +if [ $# = 0 ] + then echo -# echo "usage: $0 " - echo "usage: $0 " + echo "usage: $0 [-v] []" echo exit 1 fi module=$1 -#key=$2 + +if [ -z "$KEYFLAGS" ] + then + KEYFLAGS="--no-default-keyring --secret-keyring ../kernel.sec --keyring ../kernel.pub" +fi + +if [ $# -eq 2 ] + then + KEYFLAGS="$KEYFLAGS --default-key $2" +fi # strip out only the sections that we care about -sh scripts/modsign/mod-extract.sh $module $module.out +scripts/modsign/mod-extract $verbose $module $module.out || exit $? # sign the sections -#gpg --no-greeting --default-key $key -b $module.out -gpg --no-greeting --no-default-keyring --secret-keyring ../kernel.sec --keyring ../kernel.pub -b $module.out +gpg --no-greeting $KEYFLAGS -b $module.out || exit $? # check the signature #gpg --verify rxrpc.ko.out.sig rxrpc.ko.out ## sha1 the sections #sha1sum $module.out | awk "{print \$1}" > $module.sha1 -# -## encrypt the sections -#gpg --no-greeting -e -o - -r $key $module.sha1 > $module.crypt # add the encrypted data to the module -#objcopy --add-section module_sig=$module.crypt $module $module.signed -objcopy --add-section module_sig=$module.out.sig $module $module.signed -objcopy --set-section-flags module_sig=alloc $module.signed +objcopy --add-section .module_sig=$module.out.sig $module $module.signed || exit $? +objcopy --set-section-flags .module_sig=alloc $module.signed || exit $? rm -f $module.out*