summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/vmx/aes_xts.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/vmx/aes_xts.c')
-rw-r--r--drivers/crypto/vmx/aes_xts.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/vmx/aes_xts.c b/drivers/crypto/vmx/aes_xts.c
index 49f7258045fa..9fee1b1532a4 100644
--- a/drivers/crypto/vmx/aes_xts.c
+++ b/drivers/crypto/vmx/aes_xts.c
@@ -84,7 +84,10 @@ static int p8_aes_xts_crypt(struct skcipher_request *req, int enc)
u8 tweak[AES_BLOCK_SIZE];
int ret;
- if (!crypto_simd_usable()) {
+ if (req->cryptlen < AES_BLOCK_SIZE)
+ return -EINVAL;
+
+ if (!crypto_simd_usable() || (req->cryptlen % XTS_BLOCK_SIZE) != 0) {
struct skcipher_request *subreq = skcipher_request_ctx(req);
*subreq = *req;
OpenPOWER on IntegriCloud