summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-23 09:10:28 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-23 09:10:28 +0200
commit6fbb3400ff70070dc12460c5336b201cfa275ab4 (patch)
tree6ffd48aec7a4b511555186b0a7c781a6b7d637d6 /examples
parentf58e82a071a25531f7e7f83cc4ed8982131dea5c (diff)
downloadcryptodev-linux-6fbb3400ff70070dc12460c5336b201cfa275ab4.tar.gz
cryptodev-linux-6fbb3400ff70070dc12460c5336b201cfa275ab4.tar.xz
cryptodev-linux-6fbb3400ff70070dc12460c5336b201cfa275ab4.zip
Splitted key from key_params structure. Also separated dsa from rsa structure in params.
Diffstat (limited to 'examples')
-rw-r--r--examples/ncr.c10
-rw-r--r--examples/pk.c36
-rw-r--r--examples/speed.c2
3 files changed, 24 insertions, 24 deletions
diff --git a/examples/ncr.c b/examples/ncr.c
index 22efc83..234e8bd 100644
--- a/examples/ncr.c
+++ b/examples/ncr.c
@@ -464,7 +464,7 @@ test_ncr_wrap_key(int cfd)
memset(&kwrap, 0, sizeof(kwrap));
kwrap.algorithm = NCR_WALG_AES_RFC3394;
kwrap.keytowrap = key2;
- kwrap.key.key = key;
+ kwrap.key = key;
kwrap.data = kdata.desc;
if (ioctl(cfd, NCRIO_KEY_WRAP, &kwrap)) {
@@ -513,7 +513,7 @@ test_ncr_wrap_key(int cfd)
memset(&kwrap, 0, sizeof(kwrap));
kwrap.algorithm = NCR_WALG_AES_RFC3394;
kwrap.keytowrap = key2;
- kwrap.key.key = key;
+ kwrap.key = key;
kwrap.data = kdata.desc;
if (ioctl(cfd, NCRIO_KEY_UNWRAP, &kwrap)) {
@@ -807,7 +807,7 @@ test_ncr_aes(int cfd)
/* encrypt */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_AES_ECB;
- nop.init.params.key = key;
+ nop.init.key = key;
nop.init.op = NCR_OP_ENCRYPT;
nop.op.data.cipher.plaintext = dd;
nop.op.data.cipher.ciphertext = dd2;
@@ -882,7 +882,7 @@ test_ncr_aes(int cfd)
/* decrypt */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_AES_ECB;
- nop.init.params.key = key;
+ nop.init.key = key;
nop.init.op = NCR_OP_DECRYPT;
nop.op.data.cipher.ciphertext = dd;
nop.op.data.cipher.plaintext = dd2;
@@ -1096,7 +1096,7 @@ test_ncr_hash(int cfd)
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = hash_vectors[i].algorithm;
if (hash_vectors[i].key != NULL)
- nop.init.params.key = key;
+ nop.init.key = key;
nop.init.op = hash_vectors[i].op;
nop.op.data.sign.text = dd;
nop.op.data.sign.output = dd2;
diff --git a/examples/pk.c b/examples/pk.c
index 1f3d3c1..fef695c 100644
--- a/examples/pk.c
+++ b/examples/pk.c
@@ -363,12 +363,12 @@ static int rsa_key_encrypt(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int oae
/* do encryption */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_RSA;
- nop.init.params.key = pubkey;
+ nop.init.key = pubkey;
if (oaep) {
- nop.init.params.params.pk.type = RSA_PKCS1_OAEP;
- nop.init.params.params.pk.oaep_hash = NCR_ALG_SHA1;
+ nop.init.params.params.rsa.type = RSA_PKCS1_OAEP;
+ nop.init.params.params.rsa.oaep_hash = NCR_ALG_SHA1;
} else {
- nop.init.params.params.pk.type = RSA_PKCS1_V1_5;
+ nop.init.params.params.rsa.type = RSA_PKCS1_V1_5;
}
nop.init.op = NCR_OP_ENCRYPT;
nop.op.data.cipher.plaintext = datad;
@@ -383,13 +383,13 @@ static int rsa_key_encrypt(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int oae
/* decrypt data */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_RSA;
- nop.init.params.key = privkey;
+ nop.init.key = privkey;
nop.init.op = NCR_OP_DECRYPT;
if (oaep) {
- nop.init.params.params.pk.type = RSA_PKCS1_OAEP;
- nop.init.params.params.pk.oaep_hash = NCR_ALG_SHA1;
+ nop.init.params.params.rsa.type = RSA_PKCS1_OAEP;
+ nop.init.params.params.rsa.oaep_hash = NCR_ALG_SHA1;
} else {
- nop.init.params.params.pk.type = RSA_PKCS1_V1_5;
+ nop.init.params.params.rsa.type = RSA_PKCS1_V1_5;
}
nop.op.data.cipher.plaintext = encd;
nop.op.data.cipher.ciphertext = encd;
@@ -461,9 +461,9 @@ static int rsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int
/* sign datad */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_RSA;
- nop.init.params.key = privkey;
- nop.init.params.params.pk.type = (pss!=0)?RSA_PKCS1_PSS:RSA_PKCS1_V1_5;
- nop.init.params.params.pk.sign_hash = NCR_ALG_SHA1;
+ nop.init.key = privkey;
+ nop.init.params.params.rsa.type = (pss!=0)?RSA_PKCS1_PSS:RSA_PKCS1_V1_5;
+ nop.init.params.params.rsa.sign_hash = NCR_ALG_SHA1;
nop.init.op = NCR_OP_SIGN;
nop.op.data.sign.text = datad;
@@ -478,9 +478,9 @@ static int rsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey, int
/* verify signature */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_RSA;
- nop.init.params.key = pubkey;
- nop.init.params.params.pk.type = (pss!=0)?RSA_PKCS1_PSS:RSA_PKCS1_V1_5;
- nop.init.params.params.pk.sign_hash = NCR_ALG_SHA1;
+ nop.init.key = pubkey;
+ nop.init.params.params.rsa.type = (pss!=0)?RSA_PKCS1_PSS:RSA_PKCS1_V1_5;
+ nop.init.params.params.rsa.sign_hash = NCR_ALG_SHA1;
nop.init.op = NCR_OP_VERIFY;
nop.op.data.verify.text = datad;
@@ -541,8 +541,8 @@ static int dsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey)
/* sign datad */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_DSA;
- nop.init.params.key = privkey;
- nop.init.params.params.pk.sign_hash = NCR_ALG_SHA1;
+ nop.init.key = privkey;
+ nop.init.params.params.dsa.sign_hash = NCR_ALG_SHA1;
nop.init.op = NCR_OP_SIGN;
nop.op.data.sign.text = datad;
@@ -557,8 +557,8 @@ static int dsa_key_sign_verify(int cfd, ncr_key_t privkey, ncr_key_t pubkey)
/* verify signature */
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = NCR_ALG_DSA;
- nop.init.params.key = pubkey;
- nop.init.params.params.pk.sign_hash = NCR_ALG_SHA1;
+ nop.init.key = pubkey;
+ nop.init.params.params.dsa.sign_hash = NCR_ALG_SHA1;
nop.init.op = NCR_OP_VERIFY;
nop.op.data.verify.text = datad;
diff --git a/examples/speed.c b/examples/speed.c
index f4119c8..1c76eb6 100644
--- a/examples/speed.c
+++ b/examples/speed.c
@@ -187,7 +187,7 @@ int encrypt_data_ncr(int cfd, int algo, int chunksize)
memset(&nop, 0, sizeof(nop));
nop.init.algorithm = algo;
- nop.init.params.key = key;
+ nop.init.key = key;
nop.init.op = NCR_OP_ENCRYPT;
nop.op.data.cipher.plaintext = dd;
nop.op.data.cipher.ciphertext = dd;