How sign kernel module please?


#1

hello,

I am running Android marshmallow on dragon board. I try to load simple module hello.ko but I need to sign it before.
If i try without signature, I have this error:

insmod hello-1.ko

insmod: failed to load hello-1.ko: Required key not available

i see in the config.gz the module signature verifiication enabled.
CONFIG_MODULE_SIG=y
CONFIG_MODULE_SIG_FORCE=y
CONFIG_MODULE_SIG_SHA512=y

Please can you tell me where I can find the keys to sign the module?
the file /proc/keys does not exist and /proc/key-users has just one line:
0: 5 4/4 0/200 0/20000

Any help would be wonderful. Kind regards.


#2

To be honest it might be easier just to rebuild the android image with these options disabled!


#3

Hi @skxo

I talked to the internal expert, he recommended the same thing Daniel has recommended. turn off the three options and recompile Android. I have asked if there is a way to actually sign a module, but I don’t know if or when I might get an answer.

Full Disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.


#4

Hi danielt & ljking,

thanks for your answer. I have finally compiled a new kernel. Do not hesitate to post if you have some news. Thanks again :wink:

regards.
skxo


#5

Hi @skxo

I have been asking around, and I finally found a blog post that shows you how to sign a module. Please take a look at these articles: https://www.intrinsyc.com/android-loadable-module-signing/ and https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/Documentation/module-signing.txt

Hope this helps.

Full Disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.