|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
make menuconfigMake sure the openssl binary and the associated helper scripts will be installed to the target file system:
Target packages --> Libraries --> Crypto --> cryptodev --> openssl support (BR2_PACKAGE_OPENSSL [=y]) --> ssl library (<choice> [=y]) --> openssl (BR2_PACKAGE_LIBOPENSSL [=y])Enter the buildroot source directory and select cryptodev. cryptodev-linux can be selected in:
Target packages --> Libraries --> Crypto --> cryptodevIf you want to use ocf-linux, select it: If you want to use additional openssl engines, like af_alg, select the following: If cryptodev is built and installed in root filesystem, when board startup, enter command
modprobe cryptodeva device node /dev/crypto will appear. If not, the hardware drivers cannot be used in user space program. Note, the Linux kernel must be enabled in buildroot.
make menuconfig Cryptographic API --> Hardware crypto devicesThe following configs will be enabled in .config
CONFIG_CRYPTO_HW=y CONFIG_CRYPTO_DEV_ATMEL_AES=y CONFIG_CRYPTO_DEV_ATMEL_TDES=y CONFIG_CRYPTO_DEV_ATMEL_SHA=yIf you select them as modules, please enter the following commands after board up.
modprobe atmel-sha modprobe atmel-aes modprobe atmel-tdesAfter the hardware drivers are loaded, the algorithms will be registered to crypto framework. Using the following command to see them:
root@sama5d4ek:~# cat /proc/crypto | grep atmel driver : atmel-ofb-tdes driver : atmel-cfb32-tdes driver : atmel-cfb16-tdes driver : atmel-cfb8-tdes driver : atmel-cfb-tdes driver : atmel-cbc-tdes driver : atmel-ecb-tdes driver : atmel-ofb-des driver : atmel-cfb32-des driver : atmel-cfb16-des driver : atmel-cfb8-des driver : atmel-cfb-des driver : atmel-cbc-des driver : atmel-ecb-des driver : atmel-sha512 driver : atmel-sha384 driver : atmel-sha224 driver : atmel-sha256 driver : atmel-sha1 driver : atmel-cfb64-aes driver : atmel-ctr-aes driver : atmel-cfb8-aes driver : atmel-cfb16-aes driver : atmel-cfb32-aes driver : atmel-cfb-aes driver : atmel-ofb-aes driver : atmel-cbc-aes driver : atmel-ecb-aes
cat /proc/interrupts CPU0 ... 27: 0 atmel-aic5 12 Level atmel-sha 28: 0 atmel-aic5 9 Level atmel-aes ... 49: 0 atmel-aic5 11 Level atmel-tdesKeep in mind the number of interrupts and then run an openssl speed test. AES with 128bits key example:
time -v openssl speed -evp aes-128-cbc -elapsed -mrVerify that the number of interrupts increased on the AES IP:
cat /proc/interrupts CPU0 ... 27: 0 atmel-aic5 12 Level atmel-sha 28: 247 atmel-aic5 9 Level atmel-aes ... 49: 0 atmel-aic5 11 Level atmel-tdesIf you want to accelerate the algotithm through afalg, do the following:
time -v openssl speed -evp aes-128-cbc -engine afalg -elapsed -mrVerify that the number of interrupts increased on the AES IP:
CPU0 ... 27: 0 atmel-aic5 12 Level atmel-sha 28: 495 atmel-aic5 9 Level atmel-aes ... 49: 0 atmel-aic5 11 Level atmel-tdes
scp -v -c aes128-cbc /tmp/test_20M PC_user@PC_IP:/tmp
scp -v -c aes128-cbc PC_user@PC_IP:/tmp/test_20M /tmp/
scp -v -c aes128-cbc board_user@board_IP:/tmp/test_20M /tmp
scp -v -c aes128-cbc /tmp/test_20M board_user@board_IP:/tmp
dev tun #Server remote 192.168.2.2 ifconfig 10.1.0.2 10.1.0.1 up ./atmel-board.up secret static.key script-security 3 system no-replay tun-mtu 60000 fragment 0 mssfix 0
#!/bin/sh route add -net 10.0.0.0 netmask 255.255.255.0 gw $5PC configuration files:
dev tun ifconfig 10.1.0.1 10.1.0.2 up ./PC.up secret static.key script-security 3 system no-replay tun-mtu 60000 fragment 0 mssfix 0
#!/bin/sh route add -net 10.0.1.0 netmask 255.255.255.0 gw $5In order to change the cipher we add this parameter to both the Atmel board and the PC at openVPN startup: --cipher algorithm_name (DES-EDE3-CBC, AES-128-CBC and AES-256-CBC). Moreover on Atmel board we also give the following parameter to openVPN to tell it to use hardware cryptography drivers: --engine cryptodev. AES 256 bits key example:
openvpn --config atmel-board.conf --cipher AES-2 56-CBC
openvpn --config atmel-board.conf --engine cryptodev --cipher AES-2 56-CBC
openvpn --config PC.conf --cipher AES-2 56-CBCOnce VPN is up performances are measured with "iperf" tool. Both client and server mode are tested.
iperf -s
iperf -c server_IP
root@buildroot:~# cat /proc/crypto name : ofb(des3_ede) driver : atmel-ofb-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 16 max keysize : 24 ivsize : 8 geniv : <default> name : cfb32(des3_ede) driver : atmel-cfb32-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 4 min keysize : 16 max keysize : 16 ivsize : 8 geniv : <default> name : cfb16(des3_ede) driver : atmel-cfb16-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 2 min keysize : 16 max keysize : 16 ivsize : 8 geniv : <default> name : cfb8(des3_ede) driver : atmel-cfb8-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 1 min keysize : 16 max keysize : 16 ivsize : 8 geniv : <default> name : cfb(des3_ede) driver : atmel-cfb-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 16 max keysize : 16 ivsize : 8 geniv : <default> name : cbc(des3_ede) driver : atmel-cbc-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 16 max keysize : 24 ivsize : 8 geniv : <default> name : ecb(des3_ede) driver : atmel-ecb-tdes module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 16 max keysize : 24 ivsize : 0 geniv : <default> name : ofb(des) driver : atmel-ofb-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 8 max keysize : 8 ivsize : 8 geniv : <default> name : cfb32(des) driver : atmel-cfb32-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 4 min keysize : 8 max keysize : 8 ivsize : 8 geniv : <default> name : cfb16(des) driver : atmel-cfb16-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 2 min keysize : 8 max keysize : 8 ivsize : 8 geniv : <default> name : cfb8(des) driver : atmel-cfb8-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 1 min keysize : 8 max keysize : 8 ivsize : 8 geniv : <default> name : cfb(des) driver : atmel-cfb-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 8 max keysize : 8 ivsize : 8 geniv : <default> name : cbc(des) driver : atmel-cbc-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 8 max keysize : 8 ivsize : 8 geniv : <default> name : ecb(des) driver : atmel-ecb-des module : atmel_tdes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 8 max keysize : 8 ivsize : 0 geniv : <default> name : sha512 driver : atmel-sha512 module : atmel_sha priority : 100 refcnt : 1 selftest : passed type : ahash async : yes blocksize : 128 digestsize : 64 name : sha384 driver : atmel-sha384 module : atmel_sha priority : 100 refcnt : 1 selftest : passed type : ahash async : yes blocksize : 128 digestsize : 48 name : sha224 driver : atmel-sha224 module : atmel_sha priority : 100 refcnt : 1 selftest : passed type : ahash async : yes blocksize : 64 digestsize : 28 name : sha256 driver : atmel-sha256 module : atmel_sha priority : 100 refcnt : 1 selftest : passed type : ahash async : yes blocksize : 64 digestsize : 32 name : sha1 driver : atmel-sha1 module : atmel_sha priority : 100 refcnt : 1 selftest : passed type : ahash async : yes blocksize : 64 digestsize : 20 name : cfb64(aes) driver : atmel-cfb64-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : ctr(aes) driver : atmel-ctr-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 16 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : cfb8(aes) driver : atmel-cfb8-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 8 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : cfb16(aes) driver : atmel-cfb16-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 2 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : cfb32(aes) driver : atmel-cfb32-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 4 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : cfb(aes) driver : atmel-cfb-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 16 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : ofb(aes) driver : atmel-ofb-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 16 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : cbc(aes) driver : atmel-cbc-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 16 min keysize : 16 max keysize : 32 ivsize : 16 geniv : <default> name : ecb(aes) driver : atmel-ecb-aes module : atmel_aes priority : 100 refcnt : 1 selftest : passed type : ablkcipher async : yes blocksize : 16 min keysize : 16 max keysize : 32 ivsize : 0 geniv : <default> name : stdrng driver : krng module : kernel priority : 200 refcnt : 1 selftest : passed type : rng seedsize : 0 name : lzo driver : lzo-generic module : kernel priority : 0 refcnt : 2 selftest : passed type : compression name : crc32c driver : crc32c-generic module : kernel priority : 100 refcnt : 1 selftest : passed type : shash blocksize : 1 digestsize : 4 name : deflate driver : deflate-generic module : kernel priority : 0 refcnt : 2 selftest : passed type : compression name : aes driver : aes-generic module : kernel priority : 100 refcnt : 2 selftest : passed type : cipher blocksize : 16 min keysize : 16 max keysize : 32 name : des3_ede driver : des3_ede-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : cipher blocksize : 8 min keysize : 24 max keysize : 24 name : des driver : des-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : cipher blocksize : 8 min keysize : 8 max keysize : 8 name : sha384 driver : sha384-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 128 digestsize : 48 name : sha512 driver : sha512-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 128 digestsize : 64 name : sha224 driver : sha224-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 64 digestsize : 28 name : sha256 driver : sha256-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 64 digestsize : 32 name : sha1 driver : sha1-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 64 digestsize : 20 name : md5 driver : md5-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 64 digestsize : 16 name : md4 driver : md4-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 64 digestsize : 16
WebFaqBaseForm | |
---|---|
Boards | Sama5d29Curiosity, Sam9x75Curiosity, Sam9x60Curiosity, Sama5d2-icp, Sam9x60EK, Sama5d27WLSom1EK, Sama5d27Som1EK, Sama5d2PtcEK, Sama5d2Xplained, Sama5d4Xplained, Sama5d4ek, Sama5d3Xplained, Sama5d3xek |
Components | Kernel, linux-3.18-at91, linux-4.1-at91, linux-4.4-at91, linux-4.9-at91, linux-4.14-at91, linux-4.19-at91, linux-5.4-at91, linux-5.10-at91, linux-5.15-mchp, linux-6.1-mchp, linux-6.6-mchp |
Summary | How to configure Crypto driver |
|
|||||||||||||||||||||||||||||||||||||||||||
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
Microchip and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries.
Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.
Ideas, requests, contributions ? Connect to LinksToCommunities page.