summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
diff options
context:
space:
mode:
authorCorentin Labbe <clabbe@baylibre.com>2020-12-14 20:02:25 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2021-01-03 08:41:35 +1100
commit583513510a7acd2306787865bcd19ebb2f629d42 (patch)
treea2d00f1214acbb3f0520d796570b537fac99fb6b /drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
parent7334a4be50764500d5cae4d9a655f7755dbedd5d (diff)
downloadlinux-583513510a7acd2306787865bcd19ebb2f629d42.tar.gz
linux-583513510a7acd2306787865bcd19ebb2f629d42.tar.bz2
linux-583513510a7acd2306787865bcd19ebb2f629d42.zip
crypto: sun4i-ss - linearize buffers content must be kept
When running the non-optimized cipher function, SS produce partial random output. This is due to linearize buffers being reseted after each loop. For preserving stack, instead of moving them back to start of function, I move them in sun4i_ss_ctx. Fixes: 8d3bcb9900ca ("crypto: sun4i-ss - reduce stack usage") Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h')
-rw-r--r--drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
index 5c291e4a6857..c242fccb2ab6 100644
--- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
+++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
@@ -148,6 +148,8 @@ struct sun4i_ss_ctx {
struct reset_control *reset;
struct device *dev;
struct resource *res;
+ char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */
+ char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */
spinlock_t slock; /* control the use of the device */
#ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG
u32 seed[SS_SEED_LEN / BITS_PER_LONG];