summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-08-25 00:35:48 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-25 00:40:52 +0200
commit5ec167e240a8002bba3cc37e22553c888c7d4133 (patch)
tree230abd9334eb0c156297a1f2467902ee2b606613
parentd9c91873ac6dee10aeb7e165dee3aefc5f79bba8 (diff)
downloadcryptodev-linux-5ec167e240a8002bba3cc37e22553c888c7d4133.tar.gz
cryptodev-linux-5ec167e240a8002bba3cc37e22553c888c7d4133.tar.xz
cryptodev-linux-5ec167e240a8002bba3cc37e22553c888c7d4133.zip
Fix wrapping test conversions
-rw-r--r--examples/ncr.c8
-rw-r--r--examples/pk.c9
2 files changed, 11 insertions, 6 deletions
diff --git a/examples/ncr.c b/examples/ncr.c
index 9112873..a7d34f0 100644
--- a/examples/ncr.c
+++ b/examples/ncr.c
@@ -606,7 +606,8 @@ test_ncr_wrap_key2(int cfd)
}
/* convert it to key */
- if (ioctl(cfd, NCRIO_KEY_INIT, &key)) {
+ key = ioctl(cfd, NCRIO_KEY_INIT);
+ if (key == -1) {
perror("ioctl(NCRIO_KEY_INIT)");
return 1;
}
@@ -638,7 +639,8 @@ test_ncr_wrap_key2(int cfd)
/* convert it to key */
- if (ioctl(cfd, NCRIO_KEY_INIT, &key2)) {
+ key2 = ioctl(cfd, NCRIO_KEY_INIT);
+ if (key2 == -1) {
perror("ioctl(NCRIO_KEY_INIT)");
return 1;
}
@@ -680,7 +682,7 @@ test_ncr_wrap_key2(int cfd)
strcpy(kwrap.algo, NCR_WALG_AES_RFC3394);
ret = ioctl(cfd, NCRIO_KEY_WRAP, &kwrap);
- if (ret < 0) {
+ if (ret >= 0) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
/* wrapping shouldn't have been allowed */
return 1;
diff --git a/examples/pk.c b/examples/pk.c
index 1ad5873..6acbadf 100644
--- a/examples/pk.c
+++ b/examples/pk.c
@@ -650,13 +650,15 @@ test_ncr_wrap_key3(int cfd)
fflush(stdout);
/* convert it to key */
- if (ioctl(cfd, NCRIO_KEY_INIT, &privkey)) {
+ privkey = ioctl(cfd, NCRIO_KEY_INIT);
+ if (privkey == -1) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
perror("ioctl(NCRIO_KEY_INIT)");
return 1;
}
- if (ioctl(cfd, NCRIO_KEY_INIT, &pubkey)) {
+ pubkey = ioctl(cfd, NCRIO_KEY_INIT);
+ if (pubkey == -1) {
fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__);
perror("ioctl(NCRIO_KEY_INIT)");
return 1;
@@ -669,7 +671,8 @@ test_ncr_wrap_key3(int cfd)
}
/* make a wrapping key */
- if (ioctl(cfd, NCRIO_KEY_INIT, &key)) {
+ key = ioctl(cfd, NCRIO_KEY_INIT);
+ if (key == -1) {
perror("ioctl(NCRIO_KEY_INIT)");
return 1;
}