diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-24 13:43:43 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-24 18:38:58 +0200 |
commit | ffb3e747f8b50ca18701530d1729a4ee3aa4ae69 (patch) | |
tree | efa9b3552566ce2891c1c105cd9fd5f4c3baa269 /examples/pk.c | |
parent | 4b45720ea1dffc3514c81439c7f93928d05c5521 (diff) | |
download | cryptodev-linux-ffb3e747f8b50ca18701530d1729a4ee3aa4ae69.tar.gz cryptodev-linux-ffb3e747f8b50ca18701530d1729a4ee3aa4ae69.tar.xz cryptodev-linux-ffb3e747f8b50ca18701530d1729a4ee3aa4ae69.zip |
Added a support for reading session data directly from userspace.
Diffstat (limited to 'examples/pk.c')
-rw-r--r-- | examples/pk.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/examples/pk.c b/examples/pk.c index ce9dff8..287e9f3 100644 --- a/examples/pk.c +++ b/examples/pk.c @@ -371,8 +371,9 @@ static int rsa_key_encrypt(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int oae nop.init.params.params.rsa.type = RSA_PKCS1_V1_5; } nop.init.op = NCR_OP_ENCRYPT; - nop.op.input = datad; - nop.op.output = encd; + nop.op.data.ndata.input = datad; + nop.op.data.ndata.output = encd; + nop.op.type = NCR_DATA; if (ioctl(cfd, NCRIO_SESSION_ONCE, &nop)) { fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__); @@ -391,8 +392,9 @@ static int rsa_key_encrypt(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int oae } else { nop.init.params.params.rsa.type = RSA_PKCS1_V1_5; } - nop.op.input = encd; - nop.op.output = encd; + nop.op.data.ndata.input = encd; + nop.op.data.ndata.output = encd; + nop.op.type = NCR_DATA; if (ioctl(cfd, NCRIO_SESSION_ONCE, &nop)) { fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__); @@ -466,8 +468,9 @@ static int rsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int nop.init.params.params.rsa.sign_hash = NCR_ALG_SHA1; nop.init.op = NCR_OP_SIGN; - nop.op.input = datad; - nop.op.output = signd; + nop.op.data.ndata.input = datad; + nop.op.data.ndata.output = signd; + nop.op.type = NCR_DATA; if (ioctl(cfd, NCRIO_SESSION_ONCE, &nop)) { fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__); @@ -483,8 +486,9 @@ static int rsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int nop.init.params.params.rsa.sign_hash = NCR_ALG_SHA1; nop.init.op = NCR_OP_VERIFY; - nop.op.input = datad; - nop.op.output = signd; + nop.op.data.ndata.input = datad; + nop.op.data.ndata.output = signd; + nop.op.type = NCR_DATA; if (ioctl(cfd, NCRIO_SESSION_ONCE, &nop)) { fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__); @@ -545,8 +549,9 @@ static int dsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey) nop.init.params.params.dsa.sign_hash = NCR_ALG_SHA1; nop.init.op = NCR_OP_SIGN; - nop.op.input = datad; - nop.op.output = signd; + nop.op.data.ndata.input = datad; + nop.op.data.ndata.output = signd; + nop.op.type = NCR_DATA; if (ioctl(cfd, NCRIO_SESSION_ONCE, &nop)) { fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__); @@ -561,8 +566,9 @@ static int dsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey) nop.init.params.params.dsa.sign_hash = NCR_ALG_SHA1; nop.init.op = NCR_OP_VERIFY; - nop.op.input = datad; - nop.op.output = signd; + nop.op.data.ndata.input = datad; + nop.op.data.ndata.output = signd; + nop.op.type = NCR_DATA; if (ioctl(cfd, NCRIO_SESSION_ONCE, &nop)) { fprintf(stderr, "Error: %s:%d\n", __func__, __LINE__); |