Skip to content

Commit 7fbe85a

Browse files
committed
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>
1 parent 5f8f273 commit 7fbe85a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/crypto/atmel-tdes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,9 @@ static int atmel_tdes_crypt(struct skcipher_request *req, unsigned long mode)
684684
struct atmel_tdes_reqctx *rctx = skcipher_request_ctx(req);
685685
struct device *dev = ctx->dd->dev;
686686

687+
if (!req->cryptlen)
688+
return 0;
689+
687690
switch (mode & TDES_FLAGS_OPMODE_MASK) {
688691
case TDES_FLAGS_CFB8:
689692
if (!IS_ALIGNED(req->cryptlen, CFB8_BLOCK_SIZE)) {

0 commit comments

Comments
 (0)