summaryrefslogtreecommitdiffstats
path: root/examples/new.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-05-28 13:55:45 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-17 20:47:38 +0200
commitc3695ab5f06af533deaf1de75cdd4631a9d77d00 (patch)
tree89a2c59d982accae5760d86fc5ae4dfa6b55c087 /examples/new.c
parentbda013fbafabd0d0826441cb40c93a46d4dc2301 (diff)
downloadkernel-crypto-c3695ab5f06af533deaf1de75cdd4631a9d77d00.tar.gz
kernel-crypto-c3695ab5f06af533deaf1de75cdd4631a9d77d00.tar.xz
kernel-crypto-c3695ab5f06af533deaf1de75cdd4631a9d77d00.zip
Added some initial for of key. Added helper functions to enforce per user and per process limits.
Diffstat (limited to 'examples/new.c')
-rw-r--r--examples/new.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/examples/new.c b/examples/new.c
index db46927c28c..8d0adb5bee1 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