summaryrefslogtreecommitdiffstats
path: root/ncr-pk.c
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-07-24 01:41:00 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-07-24 02:06:22 +0200
commit785cc374c65b2e206db4e38d686dfede50fdb9f5 (patch)
treeba98676f8b2b51638854d5d4dda0cdaf38882eaa /ncr-pk.c
parent9ea8ffaa934b50ced391817ce2e11527f5426f22 (diff)
downloadcryptodev-linux-785cc374c65b2e206db4e38d686dfede50fdb9f5.tar.gz
cryptodev-linux-785cc374c65b2e206db4e38d686dfede50fdb9f5.tar.xz
cryptodev-linux-785cc374c65b2e206db4e38d686dfede50fdb9f5.zip
Use algo_properties_st in ncr_pk_ctx.algorithm
Diffstat (limited to 'ncr-pk.c')
-rw-r--r--ncr-pk.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ncr-pk.c b/ncr-pk.c
index e911c23..0f9ca53 100644
--- a/ncr-pk.c
+++ b/ncr-pk.c
@@ -329,7 +329,7 @@ void ncr_pk_cipher_deinit(struct ncr_pk_ctx* ctx)
}
}
-int ncr_pk_cipher_init(ncr_algorithm_t algo,
+int ncr_pk_cipher_init(const struct algo_properties_st *algo,
struct ncr_pk_ctx* ctx, struct ncr_key_params_st* params,
struct key_item_st *key)
{
@@ -337,21 +337,21 @@ int ret;
memset(ctx, 0, sizeof(*ctx));
- if (key->algorithm->algo != algo) {
+ if (key->algorithm != algo) {
err();
return -EINVAL;
}
ctx->algorithm = algo;
ctx->key = key;
- ret = ncr_key_params_get_sign_hash(algo, params);
+ ret = ncr_key_params_get_sign_hash(algo->algo, params);
if (ret < 0) {
err();
return ret;
}
ctx->sign_hash = ret;
- switch(algo) {
+ switch(algo->algo) {
case NCR_ALG_RSA:
if (params->params.rsa.type == RSA_PKCS1_V1_5)
ctx->type = LTC_LTC_PKCS_1_V1_5;
@@ -382,7 +382,7 @@ int ncr_pk_cipher_encrypt(const struct ncr_pk_ctx* ctx,
int cret;
unsigned long osize = *output_size;
- switch(ctx->algorithm) {
+ switch(ctx->algorithm->algo) {
case NCR_ALG_RSA:
cret = rsa_encrypt_key_ex( input, input_size, output, &osize,
NULL, 0, ctx->oaep_hash, ctx->type, &ctx->key->key.pk.rsa);
@@ -412,7 +412,7 @@ int cret;
unsigned long osize = *output_size;
int stat;
- switch(ctx->algorithm) {
+ switch(ctx->algorithm->algo) {
case NCR_ALG_RSA:
cret = rsa_decrypt_key_ex( input, input_size, output, &osize,
NULL, 0, ctx->oaep_hash, ctx->type, &stat, &ctx->key->key.pk.rsa);
@@ -446,7 +446,7 @@ int ncr_pk_cipher_sign(const struct ncr_pk_ctx* ctx,
int cret;
unsigned long osize = *output_size;
- switch(ctx->algorithm) {
+ switch(ctx->algorithm->algo) {
case NCR_ALG_RSA:
cret = rsa_sign_hash_ex( input, input_size, output, &osize,
ctx->type, ctx->sign_hash, ctx->salt_len, &ctx->key->key.pk.rsa);
@@ -482,7 +482,7 @@ int ncr_pk_cipher_verify(const struct ncr_pk_ctx* ctx,
int cret;
int stat;
- switch(ctx->algorithm) {
+ switch(ctx->algorithm->algo) {
case NCR_ALG_RSA:
cret = rsa_verify_hash_ex( signature, signature_size,
hash, hash_size, ctx->type, ctx->sign_hash,