summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-23 08:34:38 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-23 08:34:38 +0200
commitf58e82a071a25531f7e7f83cc4ed8982131dea5c (patch)
tree1edbb95023077ef7d9b0276f2c11defda1aba7ca /examples
parent4b54c5727b7a22e0beacd40b94889b29bb57abcd (diff)
downloadcryptodev-linux-f58e82a071a25531f7e7f83cc4ed8982131dea5c.tar.gz
cryptodev-linux-f58e82a071a25531f7e7f83cc4ed8982131dea5c.tar.xz
cryptodev-linux-f58e82a071a25531f7e7f83cc4ed8982131dea5c.zip
Minor fixes in example programs.
Diffstat (limited to 'examples')
-rw-r--r--examples/ncr.c19
-rw-r--r--examples/speed.c1
2 files changed, 11 insertions, 9 deletions
diff --git a/examples/ncr.c b/examples/ncr.c
index f99450a..22efc83 100644
--- a/examples/ncr.c
+++ b/examples/ncr.c
@@ -114,7 +114,7 @@ test_ncr_key(int cfd)
}
/* now read data */
- memset(data, 0, sizeof(data));
+ memset(&kdata, 0, sizeof(kdata));
kdata.desc = dinit.desc;
kdata.data = data;
@@ -434,7 +434,7 @@ test_ncr_wrap_key(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -597,7 +597,7 @@ test_ncr_store_wrap_key(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -781,7 +781,7 @@ test_ncr_aes(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -800,7 +800,7 @@ test_ncr_aes(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -855,7 +855,7 @@ test_ncr_aes(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -875,7 +875,7 @@ test_ncr_aes(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -1068,7 +1068,7 @@ test_ncr_hash(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -1088,7 +1088,7 @@ test_ncr_hash(int cfd)
if (ioctl(cfd, NCRIO_DATA_SET, &kdata)) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
- perror("ioctl(NCRIO_DATA_INIT)");
+ perror("ioctl(NCRIO_DATA_SET)");
return 1;
}
@@ -1108,6 +1108,7 @@ test_ncr_hash(int cfd)
}
/* verify */
+ memset(&kdata, 0, sizeof(kdata));
kdata.desc = dd2;
kdata.data = data;
kdata.data_size = sizeof(data);
diff --git a/examples/speed.c b/examples/speed.c
index fc6c29e..f4119c8 100644
--- a/examples/speed.c
+++ b/examples/speed.c
@@ -152,6 +152,7 @@ int encrypt_data_ncr(int cfd, int algo, int chunksize)
buffer = malloc(chunksize);
memset(iv, 0x23, 32);
+ memset(&dinit, 0, sizeof(dinit));
dinit.max_object_size = chunksize;
dinit.flags = NCR_DATA_FLAG_EXPORTABLE;
dinit.initial_data = buffer;