From 1b3ea65db78ef3dcc8200812117171531c62fe8b Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 31 May 2010 13:22:09 +0200 Subject: Added ncr_key_import/export, generate and info. Those work with secret keys. Added test program for those. --- examples/Makefile | 6 +- examples/new-key.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 examples/new-key.c (limited to 'examples') diff --git a/examples/Makefile b/examples/Makefile index 3190c4a..a3fe416 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,14 +1,16 @@ KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build -hostprogs := cipher hmac new +hostprogs := cipher hmac new new-key example-cipher-objs := cipher.o example-hmac-objs := hmac.o new-objs := new.o +new-key-objs := new-key.c check: $(hostprogs) + ./new-key ./new ./cipher ./hmac clean: - rm -f *.o *~ hmac cipher new + rm -f *.o *~ hmac cipher new new-key diff --git a/examples/new-key.c b/examples/new-key.c new file mode 100644 index 0000000..2a5faa4 --- /dev/null +++ b/examples/new-key.c @@ -0,0 +1,235 @@ +/* + * Demo on how to use /dev/crypto device for HMAC. + * + * Placed under public domain. + * + */ +#include +#include +#include +#include + +#include +#include "../ncr.h" +#include + +#define DATA_SIZE 16 + +static void randomize_data(uint8_t * data, size_t data_size) +{ +int i; + + srand(time(0)*getpid()); + for (i=0;i