README-libgcrypt-ADNP9200.txt Seite:1/4 :\_FTP\ Letzte Änderung am: 29.06.2012 13:19:38

Quick step -by -step guide libgcrypt on ADNP/ 9200 ======

This short step -by -step guide is for Linux programmers and should point you into the right direction to build and use the crypto library Libgcrypt . Please read the documentation details in the libraries and on the internet .

References ------* Websites:

http://www.gnupg.org/documentation/manuals/gcrypt/ http://www.gnupg.org/documentation/manuals/gcrypt/FIPS-Mode.html (FIPS mode )

* Downloads:

ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2 ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.9.tar.bz2

* Files:

gcrypt .devel .tgz - Pre compiled and installed binaries for development system gcrypt -DNP 9200-flash .tgz - Files installed in /flash on ADNP/ 9200 gcrypt .src .tgz - Scripts to build library and examples libgcrypt -1.5.0.tar .bz 2 - GNU library source libgpg -error -1.9.tar .bz 2 - GNU library source

Build from source and install on ADNP/ 9200 ------* Before building the library you need to install the toolchain for the ADNP/ 9200 on your desktop . The toolchain is named "arm -ssv 1-linux " and exists on the cdrom "DNP 9200-V.1.5" in the directory /ADNP 9200/toolchain and as a copy on this cdrom .

* Unpack the archive gcrypt .src .tgz into your user 's home .

tar xzf gcrypt .src .tgz

* Build the library and examples

PSPad editor 4.5.4 (2356) www.pspad.com 29.06.2012 13:21:20 kdw README-libgcrypt-ADNP9200.txt Seite:2/4 C:\_FTP\ Letzte Änderung am: 29.06.2012 13:19:38

cd gcrypt ./build -ADNP 9200.sh

* Installing Upload these files via FTP into the directory /flash/ gcrypt on ADNP/ 9200:

LIBGCRYPT/ lib/ libgcrypt .so .11 LIBGCRYPT/ lib/ libgpg -error .so .0 examples/ basic examples/ version /usr/ local/ arm -ssv 1-linux/ arm -ssv 1-linux/ lib/ libgcc _s.so .1

Attention , libgcrypt .so .11 and libgpg -error .so .0 are softlinks . Please resolve softlinks while copying the libraries !

* Set executable bit for exe -files:

chmod a+x /flash/ gcrypt/ basic chmod a+x /flash/ gcrypt/ version

* Enable FIPS -Mode

mkdir /etc/ gcrypt touch /etc/ gcrypt/ fips _enabled

* Remember , that the file "fips _enabled " must be created again after every boot . To hold this file enabled persistent , create it as "/wr/ etc/ gcrypt/ fips _enabled " and reboot:

mkdir /rw/ etc/ gcrypt touch /rw/ etc/ gcrypt/ fips _enabled reboot

Scripts inside IGW/ 922 will automatically be linked to the directory /rw/ etc/ gcrypt to /etc/ gcrypt at boot time

Run example programs ------* Run versions checker

export LD _LIBRARY _PATH =/flash/ gcrypt

PSPad editor 4.5.4 (2356) www.pspad.com 29.06.2012 13:21:20 kdw README-libgcrypt-ADNP9200.txt Seite:3/4 C:\_FTP\ Letzte Änderung am: 29.06.2012 13:19:38

cd /flash/ gcrypt ./version

Output:

version: 1.5.0: ciphers: arcfour: : cast 5:des: aes: : : rfc 2268:seed: : pubkeys: dsa: elgamal: : ecc: digests: crc: md 4:md 5:rmd 160:sha 1:sha 256:sha 512:: whirlpool: rnd -mod: linux: mpi -asm: generic/ mpih -add 1.c: generic/ mpih -sub 1.c: generic/ mpih -mul 1.c: generic/ mpih -mul 2.c: generic/ mpih -mul 3.c: generic/ mpih -lshift .c: generic/ mpih -rshift .c: hwflist: fips -mode: y: n:

* Run basic tests

export LD _LIBRARY _PATH =/flash/ gcrypt cd /flash/ gcrypt ./basic --verbose

Output:

Starting Cipher checks . algorithm 4 not available in fips mode algorithm 302 not available in fips mode checking 3DES [2] algorithm 3 not available in fips mode checking AES [7] checking AES 192 [8] checking AES 256 [9] algorithm 10 not available in fips mode algorithm 303 not available in fips mode algorithm 304 not available in fips mode algorithm 305 not available in fips mode algorithm 306 not available in fips mode algorithm 307 not available in fips mode [...snip ...] Completed additional public key checks . Note: Two lines with error messages follow - this is expected error in libgcrypt , file md .c, line 1055, function md _get _algo: possible usage error WARNING: more than one algorithm in md _get _algo ()

PSPad editor 4.5.4 (2356) www.pspad.com 29.06.2012 13:21:20 kdw README-libgcrypt-ADNP9200.txt Seite:4/4 C:\_FTP\ Letzte Änderung am: 29.06.2012 13:19:38

All tests completed . Errors: 1

Use Libgcrypt in sources written by yourself ------* First , build libraries from the source and install them . Or unpack the archive gcrypt .devel .tgz under any users directory (we named it "INSTDIR ").

* How to use the library in self programmed sources ?

"INSTDIR " is the installed directory on development system , like "$HOME/ gcrypt/ LIBGCRYPT " Add the options for header and library to CFLAGS and LDFLAGS for gcc:

INSTDIR = ${HOME }/gcrypt/ LIBGCRYPT CFLAGS += -I${INSTDIR }/include LDFLAGS += -L${INSTDIR }/lib -lgcrypt -lgpg -error

Run 'build ' from makefile . The complete gcc line looks like this:

arm -ssv 1-linux -gcc -Os -Wall -I../LIBGCRYPT/ include -o basic basic .c -Wl ,-s -L../LIBGCRYPT/ lib -lgcrypt -lgpg -error

2012-06-29 SSV/ HNE/ KGE

PSPad editor 4.5.4 (2356) www.pspad.com 29.06.2012 13:21:20 kdw