AnsweredAssumed Answered

RIoTboard : "sm_test" & "tcrypt" in order to use the CAAM encryption

Question asked by fmajeric on Mar 2, 2015

Dear All,

 

I bought an RIoTboard with an iMX6solo embedded processor.

 

I download on the element14 web site the source code, and compiler on git page:

The source code are from here : http://www.element14.com/community/docs/DOC-68442/l/riotboard-bsp-images-and-tools-download--android-and-linux?ICID=sbc-riotboard-topban

i.e. :

- BSP Linux ubuntu v3.0.35 : http://downloads.element14.com/downloads/riotboard/Linux/image_SVN2487.zip?COM=RIoTboard

- Mfg Tool : http://downloads.element14.com/downloads/riotboard/Linux/tools_SVN2652.zip?COM=RIoTboard

- Compiler tools from : $git clone git://github.com/embest-tech/fsl-linaro-toolchain.git

 

I want to use "sm_test.c" and "tcrypt.c" which seem to be kernel modules.

 

I tried to compile “sm_test.c” with this Makefile :

#

# Makefile for Freescale iMX6solo modules

#

export ARCH=arm

export CROSS_COMPILE=/home/fmajeric/Bureau/Board/Riotboard/Sources/fsl-linaro-toolchain-master/bin/arm-fsl-linux-gnueabi-

#

#

#

obj-m := sm_test.o

KDIR := /home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0

PWD := $(shell pwd)

all:

$(MAKE) -C $(KDIR) M=$(PWD) modules

clean:

$(MAKE) -C $(KDIR) M=$(PWD) clean

 

But the compiler return me this error :

 

fmajeric@fmajeric-VirtualBox:~/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam$ make

make -C /home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0 M=/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam modules

make[1]: Entering directory '/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0'

CC [M] /home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.o

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c: In function 'caam_sm_example_init':

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c:174:17: error: dereferencing pointer to incomplete type

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c: In function '__inittest':

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c:800:1: warning: return from incompatible pointer type [enabled by default]

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c: In function '__exittest':

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c:801:1: error: 'caam_sm_example_shutdow' undeclared (first use in this function)

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c:801:1: note: each undeclared identifier is reported only once for each function it appears in

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c: At top level:

/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.c:801:1: error: 'cleanup_module' aliased to undefined symbol 'caam_sm_example_shutdow'

scripts/Makefile.build:311: recipe for target '/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.o' failed

make[2]: *** [/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam/sm_test.o] Error 1

Makefile:1360: recipe for target '_module_/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam' failed

make[1]: *** [_module_/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam] Error 2

make[1]: Leaving directory '/home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0'

Makefile:13: recipe for target 'all' failed

make: *** [all] Error 2

fmajeric@fmajeric-VirtualBox:~/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0/drivers/crypto/caam$

 

Also I tried to compile “tcrypt.c” with this Makefile:

#

# Makefile for Freescale iMX6solo modules

#

export ARCH=arm

export CROSS_COMPILE=/home/fmajeric/Bureau/Board/Riotboard/Sources/fsl-linaro-toolchain-master/bin/arm-fsl-linux-gnueabi-

#

#

#

obj-m := tcrypt.o

KDIR := /home/fmajeric/Bureau/Board/Riotboard/Sources/linux-imx/linux-imx-embest_imx_3.0.35_4.0.0

PWD := $(shell pwd)

all:

$(MAKE) -C $(KDIR) M=$(PWD) modules

clean:

$(MAKE) -C $(KDIR) M=$(PWD) clean

 

And it succeed.

I copy the file “tcrypt.ko” on my board.

Try a insmod and I have this error :

root@linaro-ubuntu-desktop:/home/linaro/Dev# ls

tcrypt.ko

root@linaro-ubuntu-desktop:/home/linaro/Dev# lsmod

Module Size  Used by

vivante 943  1

drm 137754  2 vivante

root@linaro-ubuntu-desktop:/home/linaro/Dev# insmod tcrypt.ko

alg: hash: Failed to load transform for md4: -2

alg: hash: Failed to load transform for md4: -2

alg: skcipher: Failed to load transform for ecb(blowfish): -2

alg: skcipher: Failed to load transform for ecb(blowfish): -2

alg: skcipher: Failed to load transform for cbc(blowfish): -2

alg: skcipher: Failed to load transform for cbc(blowfish): -2

alg: skcipher: Failed to load transform for ecb(twofish): -2

alg: skcipher: Failed to load transform for ecb(twofish): -2

alg: skcipher: Failed to load transform for cbc(twofish): -2

alg: skcipher: Failed to load transform for cbc(twofish): -2

alg: skcipher: Failed to load transform for ecb(serpent): -2

alg: skcipher: Failed to load transform for ecb(serpent): -2

alg: hash: Failed to load transform for sha384: -2

alg: hash: Failed to load transform for sha384: -2

alg: hash: Failed to load transform for sha512: -2

alg: hash: Failed to load transform for sha512: -2

alg: skcipher: Failed to load transform for ecb(cast5): -2

alg: skcipher: Failed to load transform for ecb(cast5): -2

alg: skcipher: Failed to load transform for ecb(cast6): -2

alg: skcipher: Failed to load transform for ecb(cast6): -2

alg: hash: Failed to load transform for crc32c: -2

alg: hash: Failed to load transform for crc32c: -2

alg: skcipher: Failed to load transform for ecb(tea): -2

alg: skcipher: Failed to load transform for ecb(tea): -2

alg: skcipher: Failed to load transform for ecb(xtea): -2

alg: skcipher: Failed to load transform for ecb(xtea): -2

alg: skcipher: Failed to load transform for ecb(khazad): -2

alg: skcipher: Failed to load transform for ecb(khazad): -2

alg: hash: Failed to load transform for wp512: -2

alg: hash: Failed to load transform for wp512: -2

alg: hash: Failed to load transform for wp384: -2

alg: hash: Failed to load transform for wp384: -2

alg: hash: Failed to load transform for wp256: -2

alg: hash: Failed to load transform for wp256: -2

alg: skcipher: Failed to load transform for ecb(tnepres): -2

alg: skcipher: Failed to load transform for ecb(tnepres): -2

alg: skcipher: Failed to load transform for ecb(anubis): -2

alg: skcipher: Failed to load transform for ecb(anubis): -2

alg: skcipher: Failed to load transform for cbc(anubis): -2

alg: skcipher: Failed to load transform for cbc(anubis): -2

alg: hash: Failed to load transform for tgr192: -2

alg: hash: Failed to load transform for tgr192: -2

alg: hash: Failed to load transform for tgr160: -2

alg: hash: Failed to load transform for tgr160: -2

alg: hash: Failed to load transform for tgr128: -2

alg: hash: Failed to load transform for tgr128: -2

alg: skcipher: Failed to load transform for ecb(xeta): -2

alg: skcipher: Failed to load transform for ecb(xeta): -2

alg: skcipher: Failed to load transform for pcbc(fcrypt): -2

alg: skcipher: Failed to load transform for pcbc(fcrypt): -2

alg: skcipher: Failed to load transform for ecb(camellia): -2

alg: skcipher: Failed to load transform for ecb(camellia): -2

alg: skcipher: Failed to load transform for cbc(camellia): -2

alg: skcipher: Failed to load transform for cbc(camellia): -2

alg: skcipher: Failed to load transform for salsa20: -2

alg: skcipher: Failed to load transform for salsa20: -2

alg: hash: Failed to load transform for rmd128: -2

alg: hash: Failed to load transform for rmd128: -2

alg: hash: Failed to load transform for rmd160: -2

alg: hash: Failed to load transform for rmd160: -2

alg: hash: Failed to load transform for rmd256: -2

alg: hash: Failed to load transform for rmd256: -2

alg: hash: Failed to load transform for rmd320: -2

alg: hash: Failed to load transform for rmd320: -2

alg: skcipher: Failed to load transform for ecb(seed): -2

alg: skcipher: Failed to load transform for ecb(seed): -2

alg: pcomp: Failed to load transform for zlib: -2

alg: pcomp: Failed to load transform for zlib: -2

alg: hash: Failed to load transform for hmac(sha384): -2

alg: hash: Failed to load transform for hmac(sha384): -2

alg: hash: Failed to load transform for hmac(sha512): -2

alg: hash: Failed to load transform for hmac(sha512): -2

alg: hash: Failed to load transform for xcbc(aes): -2

alg: hash: Failed to load transform for xcbc(aes): -2

alg: hash: Failed to load transform for hmac(rmd128): -2

alg: hash: Failed to load transform for hmac(rmd128): -2

alg: hash: Failed to load transform for hmac(rmd160): -2

alg: hash: Failed to load transform for hmac(rmd160): -2

alg: hash: Failed to load transform for vmac(aes): -2

alg: hash: Failed to load transform for vmac(aes): -2

alg: cprng: Failed to load transform for ansi_cprng: -2

alg: cprng: Failed to load transform for ansi_cprng: -2

tcrypt: one or more tests failed!

insmod: error inserting 'tcrypt.ko': -1 Attempting to link in too many shared libraries

 

Moreover during the u-boot session I’ve set “caam” in bootargs.

 

So I don’t understand what is wrong.

I think the problem is my kernel version... (3.0.35_4.0.0)

Anybody have a suggestion ?

 

Cheers,

Fabien.

Outcomes