diff mbox

arm/arm64/crypto: assure that ECB modes don't require an IV

Message ID 1455292072-5236-1-git-send-email-jeremy.linton@arm.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show

Commit Message

Jeremy Linton Feb. 12, 2016, 3:47 p.m. UTC
ECB modes don't use an initialization vector. The kernel
/proc/crypto interface doesn't reflect this properly.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 arch/arm/crypto/aes-ce-glue.c | 4 ++--
 arch/arm64/crypto/aes-glue.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Ard Biesheuvel Feb. 12, 2016, 5 p.m. UTC | #1
On 12 February 2016 at 16:47, Jeremy Linton <jeremy.linton@arm.com> wrote:
> ECB modes don't use an initialization vector. The kernel
> /proc/crypto interface doesn't reflect this properly.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>

Thanks for spotting that!

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  arch/arm/crypto/aes-ce-glue.c | 4 ++--
>  arch/arm64/crypto/aes-glue.c  | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c
> index b445a5d..89a3a3e 100644
> --- a/arch/arm/crypto/aes-ce-glue.c
> +++ b/arch/arm/crypto/aes-ce-glue.c
> @@ -364,7 +364,7 @@ static struct crypto_alg aes_algs[] = { {
>         .cra_blkcipher = {
>                 .min_keysize    = AES_MIN_KEY_SIZE,
>                 .max_keysize    = AES_MAX_KEY_SIZE,
> -               .ivsize         = AES_BLOCK_SIZE,
> +               .ivsize         = 0,
>                 .setkey         = ce_aes_setkey,
>                 .encrypt        = ecb_encrypt,
>                 .decrypt        = ecb_decrypt,
> @@ -441,7 +441,7 @@ static struct crypto_alg aes_algs[] = { {
>         .cra_ablkcipher = {
>                 .min_keysize    = AES_MIN_KEY_SIZE,
>                 .max_keysize    = AES_MAX_KEY_SIZE,
> -               .ivsize         = AES_BLOCK_SIZE,
> +               .ivsize         = 0,
>                 .setkey         = ablk_set_key,
>                 .encrypt        = ablk_encrypt,
>                 .decrypt        = ablk_decrypt,
> diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c
> index 05d9e16..7a3d22a 100644
> --- a/arch/arm64/crypto/aes-glue.c
> +++ b/arch/arm64/crypto/aes-glue.c
> @@ -294,7 +294,7 @@ static struct crypto_alg aes_algs[] = { {
>         .cra_blkcipher = {
>                 .min_keysize    = AES_MIN_KEY_SIZE,
>                 .max_keysize    = AES_MAX_KEY_SIZE,
> -               .ivsize         = AES_BLOCK_SIZE,
> +               .ivsize         = 0,
>                 .setkey         = aes_setkey,
>                 .encrypt        = ecb_encrypt,
>                 .decrypt        = ecb_decrypt,
> @@ -371,7 +371,7 @@ static struct crypto_alg aes_algs[] = { {
>         .cra_ablkcipher = {
>                 .min_keysize    = AES_MIN_KEY_SIZE,
>                 .max_keysize    = AES_MAX_KEY_SIZE,
> -               .ivsize         = AES_BLOCK_SIZE,
> +               .ivsize         = 0,
>                 .setkey         = ablk_set_key,
>                 .encrypt        = ablk_encrypt,
>                 .decrypt        = ablk_decrypt,
> --
> 2.4.3
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Will Deacon Feb. 15, 2016, 3:51 p.m. UTC | #2
On Fri, Feb 12, 2016 at 06:00:01PM +0100, Ard Biesheuvel wrote:
> On 12 February 2016 at 16:47, Jeremy Linton <jeremy.linton@arm.com> wrote:
> > ECB modes don't use an initialization vector. The kernel
> > /proc/crypto interface doesn't reflect this properly.
> >
> > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> 
> Thanks for spotting that!
> 
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Thanks, I'll queue this for -rc5.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c
index b445a5d..89a3a3e 100644
--- a/arch/arm/crypto/aes-ce-glue.c
+++ b/arch/arm/crypto/aes-ce-glue.c
@@ -364,7 +364,7 @@  static struct crypto_alg aes_algs[] = { {
 	.cra_blkcipher = {
 		.min_keysize	= AES_MIN_KEY_SIZE,
 		.max_keysize	= AES_MAX_KEY_SIZE,
-		.ivsize		= AES_BLOCK_SIZE,
+		.ivsize		= 0,
 		.setkey		= ce_aes_setkey,
 		.encrypt	= ecb_encrypt,
 		.decrypt	= ecb_decrypt,
@@ -441,7 +441,7 @@  static struct crypto_alg aes_algs[] = { {
 	.cra_ablkcipher = {
 		.min_keysize	= AES_MIN_KEY_SIZE,
 		.max_keysize	= AES_MAX_KEY_SIZE,
-		.ivsize		= AES_BLOCK_SIZE,
+		.ivsize		= 0,
 		.setkey		= ablk_set_key,
 		.encrypt	= ablk_encrypt,
 		.decrypt	= ablk_decrypt,
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c
index 05d9e16..7a3d22a 100644
--- a/arch/arm64/crypto/aes-glue.c
+++ b/arch/arm64/crypto/aes-glue.c
@@ -294,7 +294,7 @@  static struct crypto_alg aes_algs[] = { {
 	.cra_blkcipher = {
 		.min_keysize	= AES_MIN_KEY_SIZE,
 		.max_keysize	= AES_MAX_KEY_SIZE,
-		.ivsize		= AES_BLOCK_SIZE,
+		.ivsize		= 0,
 		.setkey		= aes_setkey,
 		.encrypt	= ecb_encrypt,
 		.decrypt	= ecb_decrypt,
@@ -371,7 +371,7 @@  static struct crypto_alg aes_algs[] = { {
 	.cra_ablkcipher = {
 		.min_keysize	= AES_MIN_KEY_SIZE,
 		.max_keysize	= AES_MAX_KEY_SIZE,
-		.ivsize		= AES_BLOCK_SIZE,
+		.ivsize		= 0,
 		.setkey		= ablk_set_key,
 		.encrypt	= ablk_encrypt,
 		.decrypt	= ablk_decrypt,