summaryrefslogtreecommitdiff
path: root/crypto/hmac.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-08-31 22:21:09 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2008-12-25 11:01:33 +1100
commita152bf973ef158c79f29388facf16857afd71083 (patch)
treed32aaa4a4c3c46b6963f7454e7485cb1e114a078 /crypto/hmac.c
parentbacd8cf0d688bec61b6ae44c11c4a37a952cae02 (diff)
downloadlinux-crypto-a152bf973ef158c79f29388facf16857afd71083.tar.gz
linux-crypto-a152bf973ef158c79f29388facf16857afd71083.zip
crypto: hash - Export shash through hash
This patch allows shash algorithms to be used through the old hash interface. This is a transitional measure so we can convert the underlying algorithms to shash before converting the users across. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/hmac.c')
-rw-r--r--crypto/hmac.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 7ff2d6a8..0ad39c37 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -16,7 +16,7 @@
*
*/
-#include <crypto/algapi.h>
+#include <crypto/internal/hash.h>
#include <crypto/scatterwalk.h>
#include <linux/err.h>
#include <linux/init.h>
@@ -238,9 +238,11 @@ static struct crypto_instance *hmac_alloc(struct rtattr **tb)
return ERR_CAST(alg);
inst = ERR_PTR(-EINVAL);
- ds = (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
- CRYPTO_ALG_TYPE_HASH ? alg->cra_hash.digestsize :
- alg->cra_digest.dia_digestsize;
+ ds = alg->cra_type == &crypto_hash_type ?
+ alg->cra_hash.digestsize :
+ alg->cra_type ?
+ __crypto_shash_alg(alg)->digestsize :
+ alg->cra_digest.dia_digestsize;
if (ds > alg->cra_blocksize)
goto out_put_alg;