diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-07-26 21:07:19 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-07-26 21:07:19 +0200 |
commit | 7cc28b8bafe112037edae18ea0e590e7c9d074fa (patch) | |
tree | 5836f1f9cdd22d731e986ea4f8ed73649bf7b6e4 /crypto/userspace/libtomcrypt/hashes/hash_memory.c | |
parent | da3eeeff5744e8ea4bcdb819db3afad6437f5231 (diff) | |
parent | a04fd1aa4f807e2f97632a46070306e1389264ed (diff) | |
download | kernel-crypto-7cc28b8bafe112037edae18ea0e590e7c9d074fa.tar.gz kernel-crypto-7cc28b8bafe112037edae18ea0e590e7c9d074fa.tar.xz kernel-crypto-7cc28b8bafe112037edae18ea0e590e7c9d074fa.zip |
Merge branch 'standalone-rename' into userspace-crypto
Conflicts:
crypto/userspace/Makefile
crypto/userspace/ncr-data.c
crypto/userspace/ncr-key-storage.c
crypto/userspace/ncr-key-wrap.c
crypto/userspace/ncr-key.c
crypto/userspace/ncr-limits.c
crypto/userspace/ncr-pk.c
crypto/userspace/ncr-sessions.c
crypto/userspace/ncr.c
Diffstat (limited to 'crypto/userspace/libtomcrypt/hashes/hash_memory.c')
-rw-r--r-- | crypto/userspace/libtomcrypt/hashes/hash_memory.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/crypto/userspace/libtomcrypt/hashes/hash_memory.c b/crypto/userspace/libtomcrypt/hashes/hash_memory.c index 274c208d4f9..a416de9624e 100644 --- a/crypto/userspace/libtomcrypt/hashes/hash_memory.c +++ b/crypto/userspace/libtomcrypt/hashes/hash_memory.c @@ -9,7 +9,7 @@ * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" -#include <ncr_int.h> +#include <ncr-int.h> #include <cryptodev_int.h> /** @@ -19,18 +19,17 @@ /** Hash a block of memory and store the digest. - @param hash The index of the hash you wish to use + @param hash The hash you wish to use @param in The data you wish to hash @param inlen The length of the data to hash (octets) @param out [out] Where to store the digest @param outlen [in/out] Max size and resulting size of the digest @return CRYPT_OK if successful */ -int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) +int hash_memory(const struct algo_properties_st *hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) { int err; struct hash_data hdata; - int digest_size; LTC_ARGCHK(in != NULL); LTC_ARGCHK(out != NULL); @@ -40,13 +39,12 @@ int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned return err; } - digest_size = _ncr_algo_digest_size(hash); - if (*outlen < digest_size) { - *outlen = digest_size; + if (*outlen < hash->digest_size) { + *outlen = hash->digest_size; return CRYPT_BUFFER_OVERFLOW; } - err = cryptodev_hash_init( &hdata, _ncr_algo_to_str(hash), 0, NULL, 0); + err = cryptodev_hash_init( &hdata, hash->kstr, 0, NULL, 0); if (err < 0) { err = CRYPT_INVALID_HASH; goto LBL_ERR; @@ -59,7 +57,7 @@ int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned err = cryptodev_hash_final(&hdata, out); - *outlen = digest_size; + *outlen = hash->digest_size; LBL_ERR: cryptodev_hash_deinit(&hdata); |