diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 01:47:46 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 04:21:44 +0200 |
commit | 25b214ce62127133c2bca50df073475d754a81cd (patch) | |
tree | 987b8c01f9629969eba009aa956d9e0f2a9d22a8 | |
parent | 10d1f115ffc8ea9cb03c4685a0a1b18850ae4feb (diff) | |
download | cryptodev-linux-25b214ce62127133c2bca50df073475d754a81cd.tar.gz cryptodev-linux-25b214ce62127133c2bca50df073475d754a81cd.tar.xz cryptodev-linux-25b214ce62127133c2bca50df073475d754a81cd.zip |
Use algo_properties_st in ncr_pk_ctx.oaep_hash
-rw-r--r-- | ncr-pk.c | 14 | ||||
-rw-r--r-- | ncr-pk.h | 2 |
2 files changed, 10 insertions, 6 deletions
@@ -355,12 +355,16 @@ int ret; case NCR_ALG_RSA: if (params->params.rsa.type == RSA_PKCS1_V1_5) ctx->type = LTC_LTC_PKCS_1_V1_5; - else if (params->params.rsa.type == RSA_PKCS1_OAEP) + else if (params->params.rsa.type == RSA_PKCS1_OAEP) { ctx->type = LTC_LTC_PKCS_1_OAEP; - else if (params->params.rsa.type == RSA_PKCS1_PSS) + ctx->oaep_hash = _ncr_algo_to_properties(params->params.rsa.oaep_hash); + if (ctx->oaep_hash == NULL) { + err(); + return -EINVAL; + } + } else if (params->params.rsa.type == RSA_PKCS1_PSS) ctx->type = LTC_LTC_PKCS_1_PSS; - ctx->oaep_hash = params->params.rsa.oaep_hash; ctx->salt_len = params->params.rsa.pss_salt; break; case NCR_ALG_DSA: @@ -385,7 +389,7 @@ unsigned long osize = *output_size; 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); + NULL, 0, ctx->oaep_hash->algo, ctx->type, &ctx->key->key.pk.rsa); if (cret != CRYPT_OK) { printk("cret: %d type: %d\n", cret, ctx->type); @@ -415,7 +419,7 @@ int stat; 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); + NULL, 0, ctx->oaep_hash->algo, ctx->type, &stat, &ctx->key->key.pk.rsa); if (cret != CRYPT_OK) { err(); @@ -8,7 +8,7 @@ struct ncr_pk_ctx { const struct algo_properties_st *sign_hash; /* for verification */ - ncr_algorithm_t oaep_hash; + const struct algo_properties_st *oaep_hash; int salt_len; /* for RSA-PSS signatures */ int type; /* libtomcrypt type */ |