Re: [PATCH 2/2] arm aes: fix encryption of unaligned data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26 July 2014 01:42, Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
> Fix the same alignment bug as in arm64 - we need to pass residue
> unprocessed bytes as the last argument to blkcipher_walk_done.
>
> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx      # 3.13+
>

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

As for the previous patch, this correctly fixes a thinko on my part
regarding the guarantees offered by the blkcipher API.

@Russell: could you please indicate whether you prefer to take this
yourself or ack it so we can ask Herbert to take both ARM and arm64
patches as a set.

Regards,
Ard.

> Index: linux-3.16.0-0.rc6.git1.1.fc21.aarch64/arch/arm/crypto/aesbs-glue.c
> ===================================================================
> --- linux-3.16.0-0.rc6.git1.1.fc21.aarch64.orig/arch/arm/crypto/aesbs-glue.c
> +++ linux-3.16.0-0.rc6.git1.1.fc21.aarch64/arch/arm/crypto/aesbs-glue.c
> @@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkc
>                                 dst += AES_BLOCK_SIZE;
>                         } while (--blocks);
>                 }
> -               err = blkcipher_walk_done(desc, &walk, 0);
> +               err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
>         }
>         return err;
>  }
> @@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkc
>                 bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
>                                   walk.nbytes, &ctx->dec, walk.iv);
>                 kernel_neon_end();
> -               err = blkcipher_walk_done(desc, &walk, 0);
> +               err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
>         }
>         while (walk.nbytes) {
>                 u32 blocks = walk.nbytes / AES_BLOCK_SIZE;
> @@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkc
>                         dst += AES_BLOCK_SIZE;
>                         src += AES_BLOCK_SIZE;
>                 } while (--blocks);
> -               err = blkcipher_walk_done(desc, &walk, 0);
> +               err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
>         }
>         return err;
>  }
> @@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkc
>                 bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
>                                   walk.nbytes, &ctx->enc, walk.iv);
>                 kernel_neon_end();
> -               err = blkcipher_walk_done(desc, &walk, 0);
> +               err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
>         }
>         return err;
>  }
> @@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkc
>                 bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr,
>                                   walk.nbytes, &ctx->dec, walk.iv);
>                 kernel_neon_end();
> -               err = blkcipher_walk_done(desc, &walk, 0);
> +               err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
>         }
>         return err;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux