summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-07-24 02:17:27 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-07-24 04:25:24 +0200
commit5a0f78d7300975afc64f51ad217e69f71aa0aa55 (patch)
treedf9d2651cca1cc8c31b13a1a945a5b110ddd3f81
parent52e90afd006bec2a072c00cae8945e606f43da66 (diff)
downloadkernel-crypto-5a0f78d7300975afc64f51ad217e69f71aa0aa55.tar.gz
kernel-crypto-5a0f78d7300975afc64f51ad217e69f71aa0aa55.tar.xz
kernel-crypto-5a0f78d7300975afc64f51ad217e69f71aa0aa55.zip
Use algo_properties_st in rsa_decrypt_key_ex
-rw-r--r--libtomcrypt/headers/tomcrypt_pk.h6
-rw-r--r--libtomcrypt/pk/rsa/rsa_decrypt_key.c9
-rw-r--r--ncr-pk.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/libtomcrypt/headers/tomcrypt_pk.h b/libtomcrypt/headers/tomcrypt_pk.h
index 3d2de505c47..cc5e6c2d5b1 100644
--- a/libtomcrypt/headers/tomcrypt_pk.h
+++ b/libtomcrypt/headers/tomcrypt_pk.h
@@ -62,8 +62,8 @@ void rsa_free(rsa_key *key);
#define rsa_encrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash, _key) \
rsa_encrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash, LTC_LTC_PKCS_1_OAEP, _key)
-#define rsa_decrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, _stat, _key) \
- rsa_decrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, LTC_LTC_PKCS_1_OAEP, _stat, _key)
+#define rsa_decrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash, _stat, _key) \
+ rsa_decrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash, LTC_LTC_PKCS_1_OAEP, _stat, _key)
#define rsa_sign_hash(_in, _inlen, _out, _outlen, _hash_idx, _saltlen, _key) \
rsa_sign_hash_ex(_in, _inlen, _out, _outlen, LTC_LTC_PKCS_1_PSS, _hash_idx, _saltlen, _key)
@@ -80,7 +80,7 @@ int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen,
int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
const unsigned char *lparam, unsigned long lparamlen,
- int hash_idx, int padding,
+ const struct algo_properties_st *hash, int padding,
int *stat, rsa_key *key);
int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen,
diff --git a/libtomcrypt/pk/rsa/rsa_decrypt_key.c b/libtomcrypt/pk/rsa/rsa_decrypt_key.c
index 52885e82654..b674e5641c2 100644
--- a/libtomcrypt/pk/rsa/rsa_decrypt_key.c
+++ b/libtomcrypt/pk/rsa/rsa_decrypt_key.c
@@ -9,6 +9,7 @@
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
+#include "ncr_int.h"
/**
@file rsa_decrypt_key.c
@@ -25,7 +26,7 @@
@param outlen [in/out] The max size and resulting size of the plaintext (octets)
@param lparam The system "lparam" value
@param lparamlen The length of the lparam value (octets)
- @param hash_idx The index of the hash desired
+ @param hash The desired hash
@param padding Type of padding (LTC_LTC_PKCS_1_OAEP or LTC_LTC_PKCS_1_V1_5)
@param stat [out] Result of the decryption, 1==valid, 0==invalid
@param key The corresponding private RSA key
@@ -34,7 +35,7 @@
int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
const unsigned char *lparam, unsigned long lparamlen,
- int hash_idx, int padding,
+ const struct algo_properties_st *hash, int padding,
int *stat, rsa_key *key)
{
unsigned long modulus_bitlen, modulus_bytelen, x;
@@ -58,7 +59,7 @@ int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen,
if (padding == LTC_LTC_PKCS_1_OAEP) {
/* valid hash ? */
- if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) {
+ if ((err = hash_is_valid(hash->algo)) != CRYPT_OK) {
return err;
}
}
@@ -87,7 +88,7 @@ int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen,
if (padding == LTC_LTC_PKCS_1_OAEP) {
/* now OAEP decode the packet */
- err = pkcs_1_oaep_decode(tmp, x, lparam, lparamlen, modulus_bitlen, hash_idx,
+ err = pkcs_1_oaep_decode(tmp, x, lparam, lparamlen, modulus_bitlen, hash->algo,
out, outlen, stat);
} else {
/* now LTC_PKCS #1 v1.5 depad the packet */
diff --git a/ncr-pk.c b/ncr-pk.c
index bd041b17d08..9a9e98a9860 100644
--- a/ncr-pk.c
+++ b/ncr-pk.c
@@ -420,7 +420,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->algo, ctx->type, &stat, &ctx->key->key.pk.rsa);
+ NULL, 0, ctx->oaep_hash, ctx->type, &stat, &ctx->key->key.pk.rsa);
if (cret != CRYPT_OK) {
err();