How sign kernel module please?

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.

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

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.

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

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 Documentation/module-signing.txt - kernel/msm - Git at Google

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.