aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/sunxi-ss/sun4i-ss-hash.c')
-rw-r--r--drivers/crypto/sunxi-ss/sun4i-ss-hash.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index a4b5ff2b72f8..d2b6d89aad28 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* sun4i-ss-hash.c - hardware cryptographic accelerator for Allwinner A20 SoC
*
@@ -6,11 +7,6 @@
* This file add support for MD5 and SHA1.
*
* You could find the datasheet in Documentation/arm/sunxi/README
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
*/
#include "sun4i-ss.h"
#include <linux/scatterlist.h>
@@ -240,7 +236,10 @@ static int sun4i_hash(struct ahash_request *areq)
}
} else {
/* Since we have the flag final, we can go up to modulo 4 */
- end = ((areq->nbytes + op->len) / 4) * 4 - op->len;
+ if (areq->nbytes < 4)
+ end = 0;
+ else
+ end = ((areq->nbytes + op->len) / 4) * 4 - op->len;
}
/* TODO if SGlen % 4 and !op->len then DMA */