From 6d3166316b032b68a6ce2346d260f46edd028a13 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Sat, 23 Dec 2017 14:39:59 -0700 Subject: [PATCH] set input size constraints for AES-ECB mode with driver --- wolfcrypt/src/port/caam/caam_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/port/caam/caam_driver.c b/wolfcrypt/src/port/caam/caam_driver.c index 6126601f4..e3ce796be 100644 --- a/wolfcrypt/src/port/caam/caam_driver.c +++ b/wolfcrypt/src/port/caam/caam_driver.c @@ -847,7 +847,7 @@ static Error caamAes(struct DescStruct* desc) } /* set alignment constraints */ - if (desc->type == CAAM_AESCBC) { + if (desc->type == CAAM_AESCBC || desc->type == CAAM_AESECB) { align = 16; } @@ -1403,6 +1403,10 @@ static Error caamTransferStart(IODeviceVector ioCaam, switch (type) { case CAAM_AESECB: case CAAM_AESCBC: + if (desc->inputSz % 16 != 0) { + return ArgumentError; + } + /* fall through to break */ case CAAM_AESCTR: break;