diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-07 19:33:33 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-07 19:33:33 +0200 |
commit | b673efed4a10dc31567b1c29b140b7910daeaf95 (patch) | |
tree | 9dbd383a19543719bf6f3e25b7c3259aa1f461f6 /examples | |
parent | 4334f22638344873c4361f663be9d3dcad2b6bc4 (diff) | |
download | kernel-crypto-b673efed4a10dc31567b1c29b140b7910daeaf95.tar.gz kernel-crypto-b673efed4a10dc31567b1c29b140b7910daeaf95.tar.xz kernel-crypto-b673efed4a10dc31567b1c29b140b7910daeaf95.zip |
Public and private keys are being generated in a new workqueue. Some other fixes and optimizations.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile | 29 | ||||
-rw-r--r-- | examples/cipher.c | 24 | ||||
-rw-r--r-- | examples/ncr.c (renamed from examples/new.c) | 0 |
3 files changed, 33 insertions, 20 deletions
diff --git a/examples/Makefile b/examples/Makefile index 3190c4ade56..9dce9b7926a 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,14 +1,27 @@ -KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build +CC = gcc +CFLAGS = -Wall -g -O2 -hostprogs := cipher hmac new -example-cipher-objs := cipher.o -example-hmac-objs := hmac.o -new-objs := new.o +progs := cipher hmac ncr pk -check: $(hostprogs) - ./new +all: $(progs) + +cipher: cipher.c + $(CC) $(CFLAGS) $< -o $@ + +hmac: hmac.c + $(CC) $(CFLAGS) $< -o $@ + +ncr: ncr.c + $(CC) $(CFLAGS) $< -o $@ + +pk: pk.c + $(CC) $(CFLAGS) $< -o $@ -L/usr/local/lib -lgnutls + +check: $(progs) + ./ncr + ./pk ./cipher ./hmac clean: - rm -f *.o *~ hmac cipher new + rm -f *.o *~ hmac cipher ncr pk diff --git a/examples/cipher.c b/examples/cipher.c index c7ce2c24936..1334f02304c 100644 --- a/examples/cipher.c +++ b/examples/cipher.c @@ -19,10 +19,10 @@ static int test_crypto(int cfd) { - char plaintext[DATA_SIZE]; - char ciphertext[DATA_SIZE]; - char iv[BLOCK_SIZE]; - char key[KEY_SIZE]; + uint8_t plaintext[DATA_SIZE]; + uint8_t ciphertext[DATA_SIZE]; + uint8_t iv[BLOCK_SIZE]; + uint8_t key[KEY_SIZE]; struct session_op sess; struct crypt_op cryp; @@ -91,14 +91,14 @@ test_crypto(int cfd) static int test_aes(int cfd) { - char plaintext1[BLOCK_SIZE]; - char ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 }; - char iv1[BLOCK_SIZE]; - char key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - char plaintext2[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 }; - char ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 }; - char iv2[BLOCK_SIZE]; - char key2[KEY_SIZE]; + uint8_t plaintext1[BLOCK_SIZE]; + uint8_t ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 }; + uint8_t iv1[BLOCK_SIZE]; + uint8_t key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + uint8_t plaintext2[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 }; + uint8_t ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 }; + uint8_t iv2[BLOCK_SIZE]; + uint8_t key2[KEY_SIZE]; struct session_op sess; struct crypt_op cryp; diff --git a/examples/new.c b/examples/ncr.c index 3cfc2065557..3cfc2065557 100644 --- a/examples/new.c +++ b/examples/ncr.c |