diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 02:04:11 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 04:25:17 +0200 |
commit | d11063f50e61ba5880324908ea6cccb0314f0d46 (patch) | |
tree | 4f000394fa0e798a8a4206996ce51ec4919cd909 /ncr-pk.c | |
parent | 442669bac9acde432d01d423a3fd1dd2c7a27fd7 (diff) | |
download | cryptodev-linux-d11063f50e61ba5880324908ea6cccb0314f0d46.tar.gz cryptodev-linux-d11063f50e61ba5880324908ea6cccb0314f0d46.tar.xz cryptodev-linux-d11063f50e61ba5880324908ea6cccb0314f0d46.zip |
Use algo_properties_st in ncr_key_params_get_sign_hash
Diffstat (limited to 'ncr-pk.c')
-rw-r--r-- | ncr-pk.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -305,16 +305,21 @@ void ncr_pk_queue_deinit(void) destroy_workqueue(pk_wq); } -int ncr_key_params_get_sign_hash(ncr_algorithm_t algo, struct ncr_key_params_st * params) +const struct algo_properties_st *ncr_key_params_get_sign_hash(const struct algo_properties_st *algo, struct ncr_key_params_st * params) { - switch(algo) { + ncr_algorithm_t id; + + switch(algo->algo) { case NCR_ALG_RSA: - return params->params.rsa.sign_hash; + id = params->params.rsa.sign_hash; + break; case NCR_ALG_DSA: - return params->params.dsa.sign_hash; + id = params->params.dsa.sign_hash; + break; default: - return -EINVAL; + return ERR_PTR(-EINVAL); } + return _ncr_algo_to_properties(id); } /* Encryption/Decryption @@ -332,8 +337,6 @@ 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) { -int ret; - memset(ctx, 0, sizeof(*ctx)); if (key->algorithm != algo) { @@ -343,12 +346,11 @@ int ret; ctx->algorithm = algo; ctx->key = key; - ret = ncr_key_params_get_sign_hash(algo->algo, params); - if (ret < 0) { + ctx->sign_hash = ncr_key_params_get_sign_hash(algo, params); + if (IS_ERR(ctx->sign_hash)) { err(); - return ret; + return PTR_ERR(ctx->sign_hash); } - ctx->sign_hash = _ncr_algo_to_properties(ret); switch(algo->algo) { case NCR_ALG_RSA: |