From c3695ab5f06af533deaf1de75cdd4631a9d77d00 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 28 May 2010 13:55:45 +0200 Subject: Added some initial for of key. Added helper functions to enforce per user and per process limits. --- examples/new.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/new.c b/examples/new.c index db46927..8d0adb5 100644 --- a/examples/new.c +++ b/examples/new.c @@ -130,12 +130,24 @@ test_ncr_data(int cfd) if (ioctl(cfd, NCRIO_DATA_GET, &kdata)) { perror("ioctl"); fprintf(stderr, "Verified that unexportable data cannot be exported\n"); - return 0; + } else { + fprintf(stderr, "Unexportable data were exported!?\n"); + return 1; /* ok */ } - fprintf(stderr, "Unexportable data were exported!?\n"); - - return 1; /* ok */ + for (i=0;i<512;i++ ) { + init.max_object_size = DATA_SIZE; + init.flags = 0; + init.initial_data = data; + init.initial_data_size = sizeof(data); + + if (ioctl(cfd, NCRIO_DATA_INIT, &init)) { + perror("ioctl(NCRIO_DATA_INIT)"); + fprintf(stderr, "Reached maximum limit at: %d data\n", i); + } + } + + return 0; } int -- cgit