LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   loadable kernel module compilation error for SHA1 functions (http://www.linuxquestions.org/questions/programming-9/loadable-kernel-module-compilation-error-for-sha1-functions-630417/)

nikhil86 03-25-2008 05:35 AM

loadable kernel module compilation error for SHA1 functions
 
Hi
I'm writing a loadable kernel module for integrity checking.

My first goal was to get a SHA1 on every file invoked on a Linux system.
For this i'm using the LSM hook inode_permission.
I've #include <linux/crypto.h>, but still i get the following compilation error:

/root/project/ver_6.4/m2.c: In function ‘do_readfile’:
/root/project/ver_6.4/m2.c:27: error: invalid use of undefined type ‘struct page’
/root/project/ver_6.4/m2.c:28: error: implicit declaration of function ‘offset_in_page’
/root/project/ver_6.4/m2.c:31: error: implicit declaration of function ‘crypto_digest_update’
/root/project/ver_6.4/m2.c: In function ‘calculate_sha1’:
/root/project/ver_6.4/m2.c:49: error: implicit declaration of function ‘crypto_digest_init’
/root/project/ver_6.4/m2.c:56: error: implicit declaration of function ‘crypto_digest_final’


My makefile is as follows:

obj-m := m2.o

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules


What could be the error?

Nikhil.

osor 03-25-2008 10:08 PM

Your problem is that you are using the old crypto api. Use the new functions such as crypto_alloc_hash(), crypto_hash_digest(), and crypto_free_hash().


All times are GMT -5. The time now is 11:39 AM.