Odroid XU4 and /dev/crypto support

Post Reply
lungfish
Posts: 18
Joined: Tue Feb 19, 2019 8:13 pm
languages_spoken: english
ODROIDs: C2, XU4, N2 (soon).
Has thanked: 0
Been thanked: 0
Contact:

Odroid XU4 and /dev/crypto support

Unread post by lungfish » Wed Feb 20, 2019 12:23 pm

Just a general note for anyone wanting to use the Exynos crypto via /dev/crypto, it works fine and is a straightforward install as per the instruction on the cryptodev page. No kernel panics or anything, but initially install it with insmod /root/cryptodev-linux-master/cryptodev.ko before hardcoding it into your boot process just to be safe.

Before everyone rushes out and installs it, don't get too excited about it, firstly only the hashes have hardware support enabled:
CIOCGSESSION for CRYPTO_3DES_CBC failed, status EINVAL.
Crypto cbc(aes-generic) is a software-only implementation, skipping...
Enabling crypto hardware support for exynos-sha1.
Enabling crypto hardware support for exynos-sha256.
and secondly, as with a lot of other hardware crypto done as separate IP cores rather than instruction set extensions, the performance is awful, slightly slower than software-only for unrealistically large data blocks, much, much slower than software-only for more typical data blocks.

Randell
Posts: 1
Joined: Tue Feb 19, 2019 7:23 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid XU4 and /dev/crypto support

Unread post by Randell » Wed Feb 20, 2019 11:17 pm

That sounds promising. Are they going to improve it any further btw?

lungfish
Posts: 18
Joined: Tue Feb 19, 2019 8:13 pm
languages_spoken: english
ODROIDs: C2, XU4, N2 (soon).
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid XU4 and /dev/crypto support

Unread post by lungfish » Thu Feb 21, 2019 9:56 am

Dunno. It'd need to be done at the kernel crypto level, i.e add support for Exynos AES to the kernel crypto, which would then be exposed to userspace via cryptodev. AFAIK only the hash stuff has been done that way, there's a start at support for AES but I guess Arm NEON AES is used as a preference, which will be both easier and faster than using the S5P AES hardware. And then with Armv8 you've got all that in the instruction set, so I guess people aren't too motivated to spend more time on adding support for the hardware, particularly since it's typically a net loss in performance.

lungfish
Posts: 18
Joined: Tue Feb 19, 2019 8:13 pm
languages_spoken: english
ODROIDs: C2, XU4, N2 (soon).
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid XU4 and /dev/crypto support

Unread post by lungfish » Thu Feb 21, 2019 8:27 pm

If anyone else wants to try this, the following should get you started:
sudo apt install build-essential
sudo apt install module-assistant
sudo module-assistant prepare
wget https://github.com/cryptodev-linux/cryptodev-linux/archive/master.zip
unzip master.zip
cd cryptodev-linux-master
sudo make
sudo make install


Note that this won't work for a standard C2 install, see this thread for details. In brief, the kernel is too old for there to be kernel headers available for it.

Alternatively, if I can get SSH access to a system I can do it for you. Mostly interested in non-XU4 and non-x86 systems since I already know what happens on those, and see the caveat about about the C2.

lungfish
Posts: 18
Joined: Tue Feb 19, 2019 8:13 pm
languages_spoken: english
ODROIDs: C2, XU4, N2 (soon).
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid XU4 and /dev/crypto support

Unread post by lungfish » Thu Feb 21, 2019 11:30 pm

With help from elatllat I've now got it built for the C2, if anyone else wants to try it the following should do it:
sudo apt install build-essential
sudo apt install module-assistant
sudo module-assistant prepare
git clone --depth 1 --branch odroidc2-v3.16.y https://github.com/hardkernel/linux
cd linux
make odroidc2_defconfig
make headers_install
make modules
sudo ln -s /home/odroid/linux/ /lib/modules/3.16.57-25/build
wget https://github.com/cryptodev-linux/cryp ... master.zip
unzip master.zip
cd cryptodev-linux-master
sudo make
sudo make install
sudo apt install kmod
sudo insmod /home/odroid/cryptodev-linux-master/cryptodev.ko

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 0 guests