NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Build Crypto Module for Sitara

From Texas Instruments Wiki
Jump to: navigation, search


Introduction[edit]

This page is obsolete. We don't use or need ocf_omap3_crypto anymore.
We just use OCF and cryptosoft. This invokes the kernel's software crypto API which calls our
hardware driver transparently, these hardware drivers are already built into the kernel provided
with the SDK and need note  be separately load (unlike before where one would need to load
ocf_omap3_crypto).

The section of the page on cryptotest still applies so you can use it.

This is the second of three articles written as a how-to guide for enabling hardware accelerated cryptographic functions for OpenSSL version 1.0.0a.

In the first article, the OCF-Linux module is created and test with the cryptotest application which comes with OCF-Linux

This article describes how to build the Linux module that will access the cryptographic hardware accelerators.  The module is loaded in Linux with the "insmod" or "modprobe" command.  The module is available to OpenSSL through the Open Cryptograhic Framework (OCF).

The third article describes how to build and use OpenSSL version 1.0.0a with OCF support.

 

Assumptions[edit]

The module has been built successfully on a Ubuntu 10.04 Linux development system with CodeSourcery cross-compiler tools.

  • Linux host development system - Ubuntu 10.04
  • CodeSourcery Arm cross-compiler tools installed in dev system (Sourcery G++ Lite 2009q1-203 4.3.3)
  • Tarball with module source code (omap3_crypto.tar.gz). 
  • PSP 3.0.1.6 for AM35x/OMAP35x with kernel source code extracted.



 

Build the Module
[edit]

  • Copy omap3_crypto.tar.gz to the host development system and extract it in place.  The tarball will create its own sub-directory "omap3_crypto".
  • Edit the Makefile contained in the tarball.  Modify the LINUXKERNEL_INSTALL_DIR parameter.  The value for this parameter should be the path to the target kernel source code.  In this case, the kernel source is from PSP 3.0.1.6.
LINUXKERNEL_INSTALL_DIR=/home/user/AM35x-OMAP35x-PSP-SDK-03.00.01.06/src/kernel/linux-03.00.01.06


  • Run make.  This will create the module ocf_omap3_cryptok.ko.


The module must now be copied into the root filesystem that will be mounted when the target board boots up.  If development is done in a sub-directory of the NFS mount point then the module will automatically show up in the target filesystem.  For the examples here the module was developed in the /home/root/omap3_crypto sub-directory of the NFS mount.  So when the board boots up the module is located as shown below:

root@arago:~# cd omap3_crypto
omap3_crypto/ omap3_crypto_August/ omap3_crypto_July/
root@arago:~# cd omap3_crypto/
root@arago:~/omap3_crypto# ls -l
-rw-r--r-- 1 1000 1000 1537 Sep 14 2010 Makefile
-rw-r--r-- 1 1000 1000 0 Sep 14 2010 Module.symvers
-rw-r--r-- 1 1000 1000 114 Sep 14 2010 modules.order
-rw-rw-r-- 1 1000 1000 14640 Sep 13 2010 ocf_omap3_crypto.c
-rw-r--r-- 1 1000 1000 57032 Sep 14 2010 ocf_omap3_crypto.o
-rw-r--r-- 1 1000 1000 227454 Sep 14 2010 ocf_omap3_cryptok.ko
-rw-r--r-- 1 1000 1000 1438 Sep 14 2010 ocf_omap3_cryptok.mod.c
-rw-r--r-- 1 1000 1000 15948 Sep 14 2010 ocf_omap3_cryptok.mod.o
-rw-r--r-- 1 1000 1000 212655 Sep 14 2010 ocf_omap3_cryptok.o
-rwxrwxr-x 1 1000 1000 47386 Sep 14 2010 omap3_crypto.c
-rw-rw-r-- 1 1000 1000 2890 Sep 8 2010 omap3_crypto.h
-rw-r--r-- 1 1000 1000 158284 Sep 14 2010 omap3_crypto.o
root@arago:~/omap3_crypto# pwd
/home/root/omap3_crypto
root@arago:~/omap3_crypto#

Test the Module[edit]

The module is tested using the same cryptotest applications from the first article.  The difference is that the ocf_omap3_cryptok.ko module is loaded with cryptodev.ko instead of cryptosoft.ko.  The example run below shows that the number of cryptographic functions has changed.  There is now support for DES, 3DES, AES128/192/256, MD5, SHA1, and SHA256.  The speed performance is seen mostly for the larger data block sizes.  The most dramatic improvement is seen in the CPU usage.  For this entire test, the CPU usage has dropped from 99% in the pure software case to about 9% in the hardware accelerated case.

NOTE: For current SDKs ocf_omap3_cryptok need not be loaded. All the Hardware Accelerators are built into the provided kernel with SDK.
Just the cryptosoft module need to be loaded. Instead of "ocf_omap3_cryptok", you should see "cryptosoft" in the lsmod below.
For more info, read note at the top of the page.


root@arago:~/crypto-tools# insmod /home/root/omap3_crypto/ocf_omap3_cryptok.ko
root@arago:~/crypto-tools# lsmod
Module Size Used by
ocf_omap3_cryptok 17695 0
cryptodev 10560 0
root@arago:~/crypto-tools# time -v cryptotest -z 1024
0.051 sec, 2048 des crypts, 8 bytes, 320231 byte/sec, 2.4 Mb/sec
0.052 sec, 2048 des crypts, 16 bytes, 632978 byte/sec, 4.8 Mb/sec
0.052 sec, 2048 des crypts, 32 bytes, 1263734 byte/sec, 9.6 Mb/sec
0.057 sec, 2048 des crypts, 64 bytes, 2300235 byte/sec, 17.5 Mb/sec
0.062 sec, 2048 des crypts, 128 bytes, 4219011 byte/sec, 32.2 Mb/sec
0.449 sec, 2048 des crypts, 256 bytes, 1168778 byte/sec, 8.9 Mb/sec
0.480 sec, 2048 des crypts, 512 bytes, 2186428 byte/sec, 16.7 Mb/sec
0.471 sec, 2048 des crypts, 1024 bytes, 4451323 byte/sec, 34.0 Mb/sec
0.359 sec, 2048 des crypts, 2048 bytes, 11695939 byte/sec, 89.2 Mb/sec
0.716 sec, 2048 des crypts, 4096 bytes, 11715868 byte/sec, 89.4 Mb/sec
1.373 sec, 2048 des crypts, 8192 bytes, 12215978 byte/sec, 93.2 Mb/sec
2.501 sec, 2048 des crypts, 16384 bytes, 13415553 byte/sec, 102.4 Mb/sec
4.798 sec, 2048 des crypts, 32768 bytes, 13985672 byte/sec, 106.7 Mb/sec
9.355 sec, 2048 des crypts, 65280 bytes, 14291152 byte/sec, 109.0 Mb/sec
0.051 sec, 2048 3des crypts, 8 bytes, 319756 byte/sec, 2.4 Mb/sec
0.052 sec, 2048 3des crypts, 16 bytes, 631977 byte/sec, 4.8 Mb/sec
0.052 sec, 2048 3des crypts, 32 bytes, 1262468 byte/sec, 9.6 Mb/sec
0.060 sec, 2048 3des crypts, 64 bytes, 2180173 byte/sec, 16.6 Mb/sec
0.068 sec, 2048 3des crypts, 128 bytes, 3872828 byte/sec, 29.5 Mb/sec
0.473 sec, 2048 3des crypts, 256 bytes, 1108164 byte/sec, 8.5 Mb/sec
0.287 sec, 2048 3des crypts, 512 bytes, 3659581 byte/sec, 27.9 Mb/sec
0.250 sec, 2048 3des crypts, 1024 bytes, 8402994 byte/sec, 64.1 Mb/sec
0.455 sec, 2048 3des crypts, 2048 bytes, 9222243 byte/sec, 70.4 Mb/sec
0.872 sec, 2048 3des crypts, 4096 bytes, 9615486 byte/sec, 73.4 Mb/sec
1.560 sec, 2048 3des crypts, 8192 bytes, 10755694 byte/sec, 82.1 Mb/sec
2.851 sec, 2048 3des crypts, 16384 bytes, 11769681 byte/sec, 89.8 Mb/sec
5.610 sec, 2048 3des crypts, 32768 bytes, 11961550 byte/sec, 91.3 Mb/sec
11.032 sec, 2048 3des crypts, 65280 bytes, 12118848 byte/sec, 92.5 Mb/sec
0.052 sec, 2048 aes crypts, 16 bytes, 632721 byte/sec, 4.8 Mb/sec
0.052 sec, 2048 aes crypts, 32 bytes, 1258058 byte/sec, 9.6 Mb/sec
0.058 sec, 2048 aes crypts, 64 bytes, 2261695 byte/sec, 17.3 Mb/sec
0.064 sec, 2048 aes crypts, 128 bytes, 4098241 byte/sec, 31.3 Mb/sec
0.478 sec, 2048 aes crypts, 256 bytes, 1096913 byte/sec, 8.4 Mb/sec
0.441 sec, 2048 aes crypts, 512 bytes, 2375041 byte/sec, 18.1 Mb/sec
0.477 sec, 2048 aes crypts, 1024 bytes, 4392705 byte/sec, 33.5 Mb/sec
0.497 sec, 2048 aes crypts, 2048 bytes, 8432881 byte/sec, 64.3 Mb/sec
0.636 sec, 2048 aes crypts, 4096 bytes, 13188661 byte/sec, 100.6 Mb/sec
1.309 sec, 2048 aes crypts, 8192 bytes, 12817514 byte/sec, 97.8 Mb/sec
2.426 sec, 2048 aes crypts, 16384 bytes, 13831033 byte/sec, 105.5 Mb/sec
4.663 sec, 2048 aes crypts, 32768 bytes, 14390665 byte/sec, 109.8 Mb/sec
9.140 sec, 2048 aes crypts, 65280 bytes, 14626584 byte/sec, 111.6 Mb/sec
0.052 sec, 2048 aes192 crypts, 16 bytes, 631989 byte/sec, 4.8 Mb/sec
0.052 sec, 2048 aes192 crypts, 32 bytes, 1254374 byte/sec, 9.6 Mb/sec
0.059 sec, 2048 aes192 crypts, 64 bytes, 2240470 byte/sec, 17.1 Mb/sec
0.067 sec, 2048 aes192 crypts, 128 bytes, 3918797 byte/sec, 29.9 Mb/sec
0.488 sec, 2048 aes192 crypts, 256 bytes, 1075154 byte/sec, 8.2 Mb/sec
0.408 sec, 2048 aes192 crypts, 512 bytes, 2567227 byte/sec, 19.6 Mb/sec
0.494 sec, 2048 aes192 crypts, 1024 bytes, 4244036 byte/sec, 32.4 Mb/sec
0.493 sec, 2048 aes192 crypts, 2048 bytes, 8503835 byte/sec, 64.9 Mb/sec
0.803 sec, 2048 aes192 crypts, 4096 bytes, 10446468 byte/sec, 79.7 Mb/sec
1.435 sec, 2048 aes192 crypts, 8192 bytes, 11691212 byte/sec, 89.2 Mb/sec
2.615 sec, 2048 aes192 crypts, 16384 bytes, 12833368 byte/sec, 97.9 Mb/sec
5.012 sec, 2048 aes192 crypts, 32768 bytes, 13390797 byte/sec, 102.2 Mb/sec
9.870 sec, 2048 aes192 crypts, 65280 bytes, 13545776 byte/sec, 103.3 Mb/sec
0.052 sec, 2048 aes256 crypts, 16 bytes, 632355 byte/sec, 4.8 Mb/sec
0.054 sec, 2048 aes256 crypts, 32 bytes, 1220842 byte/sec, 9.3 Mb/sec
0.060 sec, 2048 aes256 crypts, 64 bytes, 2196909 byte/sec, 16.8 Mb/sec
0.068 sec, 2048 aes256 crypts, 128 bytes, 3874603 byte/sec, 29.6 Mb/sec
0.243 sec, 2048 aes256 crypts, 256 bytes, 2159626 byte/sec, 16.5 Mb/sec
0.363 sec, 2048 aes256 crypts, 512 bytes, 2889069 byte/sec, 22.0 Mb/sec
0.461 sec, 2048 aes256 crypts, 1024 bytes, 4547036 byte/sec, 34.7 Mb/sec
0.515 sec, 2048 aes256 crypts, 2048 bytes, 8141150 byte/sec, 62.1 Mb/sec
0.870 sec, 2048 aes256 crypts, 4096 bytes, 9640782 byte/sec, 73.6 Mb/sec
1.561 sec, 2048 aes256 crypts, 8192 bytes, 10751070 byte/sec, 82.0 Mb/sec
2.850 sec, 2048 aes256 crypts, 16384 bytes, 11773588 byte/sec, 89.8 Mb/sec
5.607 sec, 2048 aes256 crypts, 32768 bytes, 11968058 byte/sec, 91.3 Mb/sec
11.036 sec, 2048 aes256 crypts, 65280 bytes, 12114089 byte/sec, 92.4 Mb/sec
0.019 sec, 1024 md5 crypts, 8 bytes, 438638 byte/sec, 3.3 Mb/sec
0.019 sec, 1024 md5 crypts, 16 bytes, 854892 byte/sec, 6.5 Mb/sec
0.020 sec, 1024 md5 crypts, 32 bytes, 1624430 byte/sec, 12.4 Mb/sec
0.024 sec, 1024 md5 crypts, 64 bytes, 2739112 byte/sec, 20.9 Mb/sec
0.039 sec, 1024 md5 crypts, 128 bytes, 3352825 byte/sec, 25.6 Mb/sec
0.248 sec, 1024 md5 crypts, 256 bytes, 1056053 byte/sec, 8.1 Mb/sec
0.211 sec, 1024 md5 crypts, 512 bytes, 2484071 byte/sec, 19.0 Mb/sec
0.223 sec, 1024 md5 crypts, 1024 bytes, 4701017 byte/sec, 35.9 Mb/sec
0.229 sec, 1024 md5 crypts, 2048 bytes, 9163831 byte/sec, 69.9 Mb/sec
0.189 sec, 1024 md5 crypts, 4096 bytes, 22214064 byte/sec, 169.5 Mb/sec
0.259 sec, 1024 md5 crypts, 8192 bytes, 32327164 byte/sec, 246.6 Mb/sec
0.484 sec, 1024 md5 crypts, 16384 bytes, 34682731 byte/sec, 264.6 Mb/sec
0.938 sec, 1024 md5 crypts, 32768 bytes, 35766977 byte/sec, 272.9 Mb/sec
1.811 sec, 1024 md5 crypts, 65280 bytes, 36914513 byte/sec, 281.6 Mb/sec
0.019 sec, 1024 sha1 crypts, 8 bytes, 430886 byte/sec, 3.3 Mb/sec
0.019 sec, 1024 sha1 crypts, 16 bytes, 844144 byte/sec, 6.4 Mb/sec
0.021 sec, 1024 sha1 crypts, 32 bytes, 1597815 byte/sec, 12.2 Mb/sec
0.025 sec, 1024 sha1 crypts, 64 bytes, 2667752 byte/sec, 20.4 Mb/sec
0.040 sec, 1024 sha1 crypts, 128 bytes, 3241468 byte/sec, 24.7 Mb/sec
0.218 sec, 1024 sha1 crypts, 256 bytes, 1203412 byte/sec, 9.2 Mb/sec
0.177 sec, 1024 sha1 crypts, 512 bytes, 2965111 byte/sec, 22.6 Mb/sec
0.235 sec, 1024 sha1 crypts, 1024 bytes, 4454198 byte/sec, 34.0 Mb/sec
0.231 sec, 1024 sha1 crypts, 2048 bytes, 9097129 byte/sec, 69.4 Mb/sec
0.241 sec, 1024 sha1 crypts, 4096 bytes, 17412783 byte/sec, 132.8 Mb/sec
0.275 sec, 1024 sha1 crypts, 8192 bytes, 30508134 byte/sec, 232.8 Mb/sec
0.466 sec, 1024 sha1 crypts, 16384 bytes, 35969419 byte/sec, 274.4 Mb/sec
0.935 sec, 1024 sha1 crypts, 32768 bytes, 35873127 byte/sec, 273.7 Mb/sec
1.811 sec, 1024 sha1 crypts, 65280 bytes, 36907665 byte/sec, 281.6 Mb/sec
0.019 sec, 1024 sha256 crypts, 8 bytes, 422050 byte/sec, 3.2 Mb/sec
0.020 sec, 1024 sha256 crypts, 16 bytes, 825973 byte/sec, 6.3 Mb/sec
0.021 sec, 1024 sha256 crypts, 32 bytes, 1569800 byte/sec, 12.0 Mb/sec
0.026 sec, 1024 sha256 crypts, 64 bytes, 2568730 byte/sec, 19.6 Mb/sec
0.041 sec, 1024 sha256 crypts, 128 bytes, 3210031 byte/sec, 24.5 Mb/sec
0.232 sec, 1024 sha256 crypts, 256 bytes, 1132044 byte/sec, 8.6 Mb/sec
0.194 sec, 1024 sha256 crypts, 512 bytes, 2706352 byte/sec, 20.6 Mb/sec
0.205 sec, 1024 sha256 crypts, 1024 bytes, 5108476 byte/sec, 39.0 Mb/sec
0.242 sec, 1024 sha256 crypts, 2048 bytes, 8652652 byte/sec, 66.0 Mb/sec
0.243 sec, 1024 sha256 crypts, 4096 bytes, 17277076 byte/sec, 131.8 Mb/sec
0.311 sec, 1024 sha256 crypts, 8192 bytes, 26980564 byte/sec, 205.8 Mb/sec
0.473 sec, 1024 sha256 crypts, 16384 bytes, 35472726 byte/sec, 270.6 Mb/sec
0.925 sec, 1024 sha256 crypts, 32768 bytes, 36258794 byte/sec, 276.6 Mb/sec
1.812 sec, 1024 sha256 crypts, 65280 bytes, 36900229 byte/sec, 281.5 Mb/sec
Command being timed: "cryptotest -z 1024"
User time (seconds): 0.79
System time (seconds): 10.64
Percent of CPU this job got: 9%
Elapsed (wall clock) time (h:mm:ss or m:ss): 2m 4.91s
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 3216
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 510
Voluntary context switches: 138596
Involuntary context switches: 72362
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
root@arago:~/crypto-tools#
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Build Crypto Module for Sitara here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Build Crypto Module for Sitara here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Build Crypto Module for Sitara here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Build Crypto Module for Sitara here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Build Crypto Module for Sitara here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Build Crypto Module for Sitara here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Build Crypto Module for Sitara here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Build Crypto Module for Sitara here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Build Crypto Module for Sitara here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity