mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 09:01:36 -04:00
crypto: atmel-tdes - Add FIPS81's zero length cryptlen constraint
FIPS81 requires for the ECB, CBC, CFB, and OFB modes that the plaintext and ciphertext to have a positive integer length. Add this constraint and just return 0 for a zero length cryptlen. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
0d0433599d
commit
031f5e0015
@@ -682,6 +682,9 @@ static int atmel_tdes_crypt(struct skcipher_request *req, unsigned long mode)
|
||||
struct atmel_tdes_reqctx *rctx = skcipher_request_ctx(req);
|
||||
struct device *dev = ctx->dd->dev;
|
||||
|
||||
if (!req->cryptlen)
|
||||
return 0;
|
||||
|
||||
switch (mode & TDES_FLAGS_OPMODE_MASK) {
|
||||
case TDES_FLAGS_CFB8:
|
||||
if (!IS_ALIGNED(req->cryptlen, CFB8_BLOCK_SIZE)) {
|
||||
|
||||
Reference in New Issue
Block a user