summaryrefslogtreecommitdiffstats
path: root/libtomcrypt
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-07-24 03:07:56 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-07-24 04:25:24 +0200
commit94ad20f2978e7234579593ac284f9c6cd1426785 (patch)
treeb048aa7b4b0cd246b481eeddc6403250eddb73fe /libtomcrypt
parent32e0115f32c75f0bffdea599734774376cdf097b (diff)
downloadcryptodev-linux-94ad20f2978e7234579593ac284f9c6cd1426785.tar.gz
cryptodev-linux-94ad20f2978e7234579593ac284f9c6cd1426785.tar.xz
cryptodev-linux-94ad20f2978e7234579593ac284f9c6cd1426785.zip
Replace _ncr_algo_digest_size by direct accesses
Diffstat (limited to 'libtomcrypt')
-rw-r--r--libtomcrypt/hashes/hash_memory.c8
-rw-r--r--libtomcrypt/hashes/hash_memory_multi.c8
-rw-r--r--libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c2
-rw-r--r--libtomcrypt/pk/pkcs1/pkcs_1_oaep_decode.c2
-rw-r--r--libtomcrypt/pk/pkcs1/pkcs_1_oaep_encode.c2
-rw-r--r--libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c2
-rw-r--r--libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c2
7 files changed, 11 insertions, 15 deletions
diff --git a/libtomcrypt/hashes/hash_memory.c b/libtomcrypt/hashes/hash_memory.c
index 267957a..a452525 100644
--- a/libtomcrypt/hashes/hash_memory.c
+++ b/libtomcrypt/hashes/hash_memory.c
@@ -30,7 +30,6 @@ int hash_memory(const struct algo_properties_st *hash, const unsigned char *in,
{
int err;
struct hash_data hdata;
- int digest_size;
LTC_ARGCHK(in != NULL);
LTC_ARGCHK(out != NULL);
@@ -40,9 +39,8 @@ int hash_memory(const struct algo_properties_st *hash, const unsigned char *in,
return err;
}
- digest_size = _ncr_algo_digest_size(hash->algo);
- if (*outlen < digest_size) {
- *outlen = digest_size;
+ if (*outlen < hash->digest_size) {
+ *outlen = hash->digest_size;
return CRYPT_BUFFER_OVERFLOW;
}
@@ -59,7 +57,7 @@ int hash_memory(const struct algo_properties_st *hash, const unsigned char *in,
err = cryptodev_hash_final(&hdata, out);
- *outlen = digest_size;
+ *outlen = hash->digest_size;
LBL_ERR:
cryptodev_hash_deinit(&hdata);
diff --git a/libtomcrypt/hashes/hash_memory_multi.c b/libtomcrypt/hashes/hash_memory_multi.c
index 79cfd2b..a10e14c 100644
--- a/libtomcrypt/hashes/hash_memory_multi.c
+++ b/libtomcrypt/hashes/hash_memory_multi.c
@@ -32,7 +32,6 @@ int hash_memory_multi(const struct algo_properties_st *hash, unsigned char *out,
const unsigned char *in, unsigned long inlen, ...)
{
struct hash_data hdata;
- int digest_size;
int err;
va_list args;
const unsigned char *curptr;
@@ -46,9 +45,8 @@ int hash_memory_multi(const struct algo_properties_st *hash, unsigned char *out,
return err;
}
- digest_size = _ncr_algo_digest_size(hash->algo);
- if (*outlen < digest_size) {
- *outlen = digest_size;
+ if (*outlen < hash->digest_size) {
+ *outlen = hash->digest_size;
return CRYPT_BUFFER_OVERFLOW;
}
@@ -77,7 +75,7 @@ int hash_memory_multi(const struct algo_properties_st *hash, unsigned char *out,
err = cryptodev_hash_final(&hdata, out);
- *outlen = digest_size;
+ *outlen = hash->digest_size;
LBL_ERR:
cryptodev_hash_deinit(&hdata);
va_end(args);
diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c b/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c
index e7971f7..b09dd11 100644
--- a/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c
+++ b/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c
@@ -45,7 +45,7 @@ int pkcs_1_mgf1(const struct algo_properties_st *hash,
}
/* get hash output size */
- hLen = _ncr_algo_digest_size(hash->algo);
+ hLen = hash->digest_size;
/* allocate memory */
buf = XMALLOC(hLen);
diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_oaep_decode.c b/libtomcrypt/pk/pkcs1/pkcs_1_oaep_decode.c
index b44a1ed..60f76a0 100644
--- a/libtomcrypt/pk/pkcs1/pkcs_1_oaep_decode.c
+++ b/libtomcrypt/pk/pkcs1/pkcs_1_oaep_decode.c
@@ -54,7 +54,7 @@ int pkcs_1_oaep_decode(const unsigned char *msg, unsigned long msglen,
return err;
}
- hLen = _ncr_algo_digest_size(hash->algo);
+ hLen = hash->digest_size;
modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
/* test hash/message size */
diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_oaep_encode.c b/libtomcrypt/pk/pkcs1/pkcs_1_oaep_encode.c
index 43bd22e..c56e3b1 100644
--- a/libtomcrypt/pk/pkcs1/pkcs_1_oaep_encode.c
+++ b/libtomcrypt/pk/pkcs1/pkcs_1_oaep_encode.c
@@ -48,7 +48,7 @@ int pkcs_1_oaep_encode(const unsigned char *msg, unsigned long msglen,
return err;
}
- hLen = _ncr_algo_digest_size(hash->algo);
+ hLen = hash->digest_size;
modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
/* test message size */
diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c b/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c
index b8e126a..293d84f 100644
--- a/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c
+++ b/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c
@@ -50,7 +50,7 @@ int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen,
return err;
}
- hLen = _ncr_algo_digest_size(hash_algo->algo);
+ hLen = hash_algo->digest_size;
modulus_len = (modulus_bitlen>>3) + (modulus_bitlen & 7 ? 1 : 0);
/* check sizes */
diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c b/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c
index 88963de..d747b49 100644
--- a/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c
+++ b/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c
@@ -47,7 +47,7 @@ int pkcs_1_pss_encode(const unsigned char *msghash, unsigned long msghashlen,
return err;
}
- hLen = _ncr_algo_digest_size(hash_algo->algo);
+ hLen = hash_algo->digest_size;
modulus_len = (modulus_bitlen>>3) + (modulus_bitlen & 7 ? 1 : 0);
/* check sizes */