From 5689c9734223fb349bba526d620823a803c3b67e Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Wed, 21 Jul 2010 20:02:50 +0200 Subject: Modified NCR-USER API to "simplify" and allow setting of size of data structure without special system call. --- examples/Makefile | 4 + examples/ncr-user.c | 930 ++++++++++++++++++++++++++++++++++++++++++++++++++++ examples/ncr.c | 11 +- examples/pk.c | 7 - 4 files changed, 935 insertions(+), 17 deletions(-) create mode 100644 examples/ncr-user.c (limited to 'examples') diff --git a/examples/Makefile b/examples/Makefile index c65297f..a2849d3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -17,11 +17,15 @@ hmac: hmac.c ncr: ncr.c $(CC) $(CFLAGS) $< -o $@ +ncr-user: ncr-user.c + $(CC) $(CFLAGS) $< -o $@ + pk: pk.c $(CC) $(CFLAGS) $< -o $@ -L/usr/local/lib -lgnutls check: $(progs) ./ncr + ./ncr-user ./pk ./cipher ./hmac diff --git a/examples/ncr-user.c b/examples/ncr-user.c new file mode 100644 index 0000000..613f81c --- /dev/null +++ b/examples/ncr-user.c @@ -0,0 +1,930 @@ +/* + * Demo on how to use /dev/crypto device for HMAC. + * + * Placed under public domain. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include "../ncr.h" +#include + +#define DATA_SIZE 4096 + +static void randomize_data(uint8_t * data, size_t data_size) +{ +int i; + + srand(time(0)*getpid()); + for (i=0;i