summaryrefslogtreecommitdiff
path: root/crypto/shash.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2017-12-29 17:49:13 +0100
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2017-12-29 17:49:13 +0100
commit59d9ddb192bc424cc53e52180478001af4fb99a4 (patch)
tree0abd8646ad5a39bf4993faf67e0200c6be6a5e13 /crypto/shash.c
parent1ca96e9695b6c448befcd0abacaf473458f22d1c (diff)
parentd5abe860ac298ebe723b37a6f63a5b2d404fca60 (diff)
downloadlinux-crypto-59d9ddb192bc424cc53e52180478001af4fb99a4.tar.gz
linux-crypto-59d9ddb192bc424cc53e52180478001af4fb99a4.zip
Merge tag 'v4.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into fbdev-for-next
Linux 4.15-rc5
Diffstat (limited to 'crypto/shash.c')
-rw-r--r--crypto/shash.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/crypto/shash.c b/crypto/shash.c
index 5e31c8d7..e849d3ee 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -25,11 +25,12 @@
static const struct crypto_type crypto_shash_type;
-static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
- unsigned int keylen)
+int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
+ unsigned int keylen)
{
return -ENOSYS;
}
+EXPORT_SYMBOL_GPL(shash_no_setkey);
static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
unsigned int keylen)
@@ -41,7 +42,7 @@ static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
int err;
absize = keylen + (alignmask & ~(crypto_tfm_ctx_alignment() - 1));
- buffer = kmalloc(absize, GFP_KERNEL);
+ buffer = kmalloc(absize, GFP_ATOMIC);
if (!buffer)
return -ENOMEM;
@@ -275,12 +276,14 @@ static int shash_async_finup(struct ahash_request *req)
int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
{
- struct scatterlist *sg = req->src;
- unsigned int offset = sg->offset;
unsigned int nbytes = req->nbytes;
+ struct scatterlist *sg;
+ unsigned int offset;
int err;
- if (nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset)) {
+ if (nbytes &&
+ (sg = req->src, offset = sg->offset,
+ nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset))) {
void *data;
data = kmap_atomic(sg_page(sg));