On Sun, 8 Sep 2019 at 09:04, Uri Shir <uri.shir@xxxxxxx> wrote: > > In XTS encryption/decryption the plaintext byte size > can be >= AES_BLOCK_SIZE. This patch enable the AES-XTS ciphertext > stealing implementation in ccree driver. > > Signed-off-by: Uri Shir <uri.shir@xxxxxxx> > --- > drivers/crypto/ccree/cc_cipher.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c > index 5b58226..a95d3bd 100644 > --- a/drivers/crypto/ccree/cc_cipher.c > +++ b/drivers/crypto/ccree/cc_cipher.c > @@ -116,10 +116,6 @@ static int validate_data_size(struct cc_cipher_ctx *ctx_p, > case S_DIN_to_AES: > switch (ctx_p->cipher_mode) { > case DRV_CIPHER_XTS: > - if (size >= AES_BLOCK_SIZE && > - IS_ALIGNED(size, AES_BLOCK_SIZE)) > - return 0; > - break; You should still check for size < block size. > case DRV_CIPHER_CBC_CTS: > if (size >= AES_BLOCK_SIZE) > return 0; > @@ -945,7 +941,7 @@ static const struct cc_alg_template skcipher_algs[] = { > { > .name = "xts(paes)", > .driver_name = "xts-paes-ccree", > - .blocksize = AES_BLOCK_SIZE, > + .blocksize = 1, No need for these blocksize changes - just keep them as they are. > .template_skcipher = { > .setkey = cc_cipher_sethkey, > .encrypt = cc_cipher_encrypt, > @@ -963,7 +959,7 @@ static const struct cc_alg_template skcipher_algs[] = { > { > .name = "xts512(paes)", > .driver_name = "xts-paes-du512-ccree", > - .blocksize = AES_BLOCK_SIZE, > + .blocksize = 1, > .template_skcipher = { > .setkey = cc_cipher_sethkey, > .encrypt = cc_cipher_encrypt, > @@ -982,7 +978,7 @@ static const struct cc_alg_template skcipher_algs[] = { > { > .name = "xts4096(paes)", > .driver_name = "xts-paes-du4096-ccree", > - .blocksize = AES_BLOCK_SIZE, > + .blocksize = 1, > .template_skcipher = { > .setkey = cc_cipher_sethkey, > .encrypt = cc_cipher_encrypt, > @@ -1203,7 +1199,7 @@ static const struct cc_alg_template skcipher_algs[] = { > { > .name = "xts(aes)", > .driver_name = "xts-aes-ccree", > - .blocksize = AES_BLOCK_SIZE, > + .blocksize = 1, > .template_skcipher = { > .setkey = cc_cipher_setkey, > .encrypt = cc_cipher_encrypt, > @@ -1220,7 +1216,7 @@ static const struct cc_alg_template skcipher_algs[] = { > { > .name = "xts512(aes)", > .driver_name = "xts-aes-du512-ccree", > - .blocksize = AES_BLOCK_SIZE, > + .blocksize = 1, > .template_skcipher = { > .setkey = cc_cipher_setkey, > .encrypt = cc_cipher_encrypt, > @@ -1238,7 +1234,7 @@ static const struct cc_alg_template skcipher_algs[] = { > { > .name = "xts4096(aes)", > .driver_name = "xts-aes-du4096-ccree", > - .blocksize = AES_BLOCK_SIZE, > + .blocksize = 1, > .template_skcipher = { > .setkey = cc_cipher_setkey, > .encrypt = cc_cipher_encrypt, > -- > 2.7.4 >