X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=crypto%2Fdigest.c;h=d3e827a141f11cf458d848e0e54c042895cc169e;hb=e3a4ea4fd2e5f154ae9233f1ce30e7564e5cbcfc;hp=8f4593268ce0bf5c5ef2e9e47d8ab72789adb842;hpb=21b4e736922f546e0f1aa7b9d6c442f309a2444a;p=powerpc.git diff --git a/crypto/digest.c b/crypto/digest.c index 8f4593268c..d3e827a141 100644 --- a/crypto/digest.c +++ b/crypto/digest.c @@ -14,12 +14,13 @@ #include #include +#include #include +#include #include #include #include "internal.h" -#include "scatterwalk.h" static int init(struct hash_desc *desc) { @@ -29,8 +30,8 @@ static int init(struct hash_desc *desc) return 0; } -static int update(struct hash_desc *desc, - struct scatterlist *sg, unsigned int nbytes) +static int update2(struct hash_desc *desc, + struct scatterlist *sg, unsigned int nbytes) { struct crypto_tfm *tfm = crypto_hash_tfm(desc->tfm); unsigned int alignmask = crypto_tfm_alg_alignmask(tfm); @@ -39,7 +40,7 @@ static int update(struct hash_desc *desc, return 0; for (;;) { - struct page *pg = sg->page; + struct page *pg = sg_page(sg); unsigned int offset = sg->offset; unsigned int l = sg->length; @@ -81,6 +82,14 @@ static int update(struct hash_desc *desc, return 0; } +static int update(struct hash_desc *desc, + struct scatterlist *sg, unsigned int nbytes) +{ + if (WARN_ON_ONCE(in_irq())) + return -EDEADLK; + return update2(desc, sg, nbytes); +} + static int final(struct hash_desc *desc, u8 *out) { struct crypto_tfm *tfm = crypto_hash_tfm(desc->tfm); @@ -118,16 +127,14 @@ static int setkey(struct crypto_hash *hash, const u8 *key, unsigned int keylen) static int digest(struct hash_desc *desc, struct scatterlist *sg, unsigned int nbytes, u8 *out) { + if (WARN_ON_ONCE(in_irq())) + return -EDEADLK; + init(desc); - update(desc, sg, nbytes); + update2(desc, sg, nbytes); return final(desc, out); } -int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags) -{ - return flags ? -EINVAL : 0; -} - int crypto_init_digest_ops(struct crypto_tfm *tfm) { struct hash_tfm *ops = &tfm->crt_hash;