diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 02:59:33 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-07-24 04:25:24 +0200 |
commit | 06520b6a96ac44d1c4c6e999c5d5ec725d11afa5 (patch) | |
tree | 8b454b1c61e03d4e0927bd7e9446d8f2a58cf523 | |
parent | 51f5a84d2999239d305de3404e804273984d01e0 (diff) | |
download | cryptodev-linux-06520b6a96ac44d1c4c6e999c5d5ec725d11afa5.tar.gz cryptodev-linux-06520b6a96ac44d1c4c6e999c5d5ec725d11afa5.tar.xz cryptodev-linux-06520b6a96ac44d1c4c6e999c5d5ec725d11afa5.zip |
Use algo_properties_st in hash_memory_multi
-rw-r--r-- | libtomcrypt/hashes/hash_memory_multi.c | 10 | ||||
-rw-r--r-- | libtomcrypt/headers/tomcrypt_hash.h | 2 | ||||
-rw-r--r-- | libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c | 2 | ||||
-rw-r--r-- | libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c | 2 | ||||
-rw-r--r-- | libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/libtomcrypt/hashes/hash_memory_multi.c b/libtomcrypt/hashes/hash_memory_multi.c index 6a85f65..dd3b524 100644 --- a/libtomcrypt/hashes/hash_memory_multi.c +++ b/libtomcrypt/hashes/hash_memory_multi.c @@ -20,7 +20,7 @@ /** Hash multiple (non-adjacent) blocks of memory at once. - @param hash The index of the hash you wish to use + @param hash The hash you wish to use @param out [out] Where to store the digest @param outlen [in/out] Max size and resulting size of the digest @param in The data you wish to hash @@ -28,7 +28,7 @@ @param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care) @return CRYPT_OK if successful */ -int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, +int hash_memory_multi(const struct algo_properties_st *hash, unsigned char *out, unsigned long *outlen, const unsigned char *in, unsigned long inlen, ...) { struct hash_data hdata; @@ -42,17 +42,17 @@ int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); - if ((err = hash_is_valid(hash)) != CRYPT_OK) { + if ((err = hash_is_valid(hash->algo)) != CRYPT_OK) { return err; } - digest_size = _ncr_algo_digest_size(hash); + digest_size = _ncr_algo_digest_size(hash->algo); if (*outlen < digest_size) { *outlen = digest_size; return CRYPT_BUFFER_OVERFLOW; } - err = cryptodev_hash_init( &hdata, _ncr_algo_to_str(hash), 0, NULL, 0); + err = cryptodev_hash_init( &hdata, _ncr_algo_to_str(hash->algo), 0, NULL, 0); if (err < 0) { err = CRYPT_INVALID_HASH; goto LBL_ERR; diff --git a/libtomcrypt/headers/tomcrypt_hash.h b/libtomcrypt/headers/tomcrypt_hash.h index 93cc6c7..380bf7d 100644 --- a/libtomcrypt/headers/tomcrypt_hash.h +++ b/libtomcrypt/headers/tomcrypt_hash.h @@ -7,7 +7,7 @@ int hash_is_valid(int idx); int hash_memory(const struct algo_properties_st *hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); -int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, +int hash_memory_multi(const struct algo_properties_st *hash, unsigned char *out, unsigned long *outlen, const unsigned char *in, unsigned long inlen, ...); int hash_get_oid(const struct algo_properties_st *hash, oid_st* st); diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c b/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c index 9ea2d8c..983022d 100644 --- a/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c +++ b/libtomcrypt/pk/pkcs1/pkcs_1_mgf1.c @@ -61,7 +61,7 @@ int pkcs_1_mgf1(const struct algo_properties_st *hash, STORE32H(counter, buf); ++counter; - err = hash_memory_multi(hash->algo, buf, &hLen, seed, seedlen, buf, (unsigned long) 4, NULL, 0); + err = hash_memory_multi(hash, buf, &hLen, seed, seedlen, buf, (unsigned long) 4, NULL, 0); if (err != CRYPT_OK) { goto LBL_ERR; } diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c b/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c index 8e3ffa8..7bcffe2 100644 --- a/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c +++ b/libtomcrypt/pk/pkcs1/pkcs_1_pss_decode.c @@ -131,7 +131,7 @@ int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen, } /* M = (eight) 0x00 || msghash || salt, mask = H(M) */ - err = hash_memory_multi(hash_algo->algo, mask, &hLen, mask, 8, msghash, (unsigned long)msghashlen, DB+x, (unsigned long)saltlen, NULL, 0); + err = hash_memory_multi(hash_algo, mask, &hLen, mask, 8, msghash, (unsigned long)msghashlen, DB+x, (unsigned long)saltlen, NULL, 0); if (err != CRYPT_OK) { goto LBL_ERR; } diff --git a/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c b/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c index 38879af..261709f 100644 --- a/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c +++ b/libtomcrypt/pk/pkcs1/pkcs_1_pss_encode.c @@ -83,7 +83,7 @@ int pkcs_1_pss_encode(const unsigned char *msghash, unsigned long msghashlen, } /* M = (eight) 0x00 || msghash || salt, hash = H(M) */ - err = hash_memory_multi(hash_algo->algo, hash, &hLen, DB, 8, msghash, (unsigned long)msghashlen, salt, (unsigned long)saltlen, NULL, 0); + err = hash_memory_multi(hash_algo, hash, &hLen, DB, 8, msghash, (unsigned long)msghashlen, salt, (unsigned long)saltlen, NULL, 0); if (err != CRYPT_OK) { goto LBL_ERR; } |