summaryrefslogtreecommitdiffstats
path: root/example-cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'example-cipher.c')
-rw-r--r--example-cipher.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/example-cipher.c b/example-cipher.c
index c6aa55d..500d773 100644
--- a/example-cipher.c
+++ b/example-cipher.c
@@ -54,10 +54,18 @@ test_crypto(int cfd)
perror("ioctl(CIOCCRYPT)");
return 1;
}
+
+ if (ioctl(cfd, CIOCGSESSION, &sess)) {
+ perror("ioctl(CIOCGSESSION)");
+ return 1;
+ }
/* Decrypt data.encrypted to data.decrypted */
+ cryp.ses = sess.ses;
+ cryp.len = sizeof(plaintext);
cryp.src = ciphertext;
cryp.dst = ciphertext;
+ cryp.iv = iv;
cryp.op = COP_DECRYPT;
if (ioctl(cfd, CIOCCRYPT, &cryp)) {
perror("ioctl(CIOCCRYPT)");