Commit 67caef08 authored by Uri Shir's avatar Uri Shir Committed by Herbert Xu

crypto: ccree - enable CTS support in AES-XTS

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: default avatarUri Shir <uri.shir@arm.com>
Acked-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 465527bc
...@@ -116,10 +116,6 @@ static int validate_data_size(struct cc_cipher_ctx *ctx_p, ...@@ -116,10 +116,6 @@ static int validate_data_size(struct cc_cipher_ctx *ctx_p,
case S_DIN_to_AES: case S_DIN_to_AES:
switch (ctx_p->cipher_mode) { switch (ctx_p->cipher_mode) {
case DRV_CIPHER_XTS: case DRV_CIPHER_XTS:
if (size >= AES_BLOCK_SIZE &&
IS_ALIGNED(size, AES_BLOCK_SIZE))
return 0;
break;
case DRV_CIPHER_CBC_CTS: case DRV_CIPHER_CBC_CTS:
if (size >= AES_BLOCK_SIZE) if (size >= AES_BLOCK_SIZE)
return 0; return 0;
...@@ -938,7 +934,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -938,7 +934,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "xts(paes)", .name = "xts(paes)",
.driver_name = "xts-paes-ccree", .driver_name = "xts-paes-ccree",
.blocksize = AES_BLOCK_SIZE, .blocksize = 1,
.template_skcipher = { .template_skcipher = {
.setkey = cc_cipher_sethkey, .setkey = cc_cipher_sethkey,
.encrypt = cc_cipher_encrypt, .encrypt = cc_cipher_encrypt,
...@@ -956,7 +952,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -956,7 +952,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "xts512(paes)", .name = "xts512(paes)",
.driver_name = "xts-paes-du512-ccree", .driver_name = "xts-paes-du512-ccree",
.blocksize = AES_BLOCK_SIZE, .blocksize = 1,
.template_skcipher = { .template_skcipher = {
.setkey = cc_cipher_sethkey, .setkey = cc_cipher_sethkey,
.encrypt = cc_cipher_encrypt, .encrypt = cc_cipher_encrypt,
...@@ -975,7 +971,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -975,7 +971,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "xts4096(paes)", .name = "xts4096(paes)",
.driver_name = "xts-paes-du4096-ccree", .driver_name = "xts-paes-du4096-ccree",
.blocksize = AES_BLOCK_SIZE, .blocksize = 1,
.template_skcipher = { .template_skcipher = {
.setkey = cc_cipher_sethkey, .setkey = cc_cipher_sethkey,
.encrypt = cc_cipher_encrypt, .encrypt = cc_cipher_encrypt,
...@@ -1196,7 +1192,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -1196,7 +1192,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "xts(aes)", .name = "xts(aes)",
.driver_name = "xts-aes-ccree", .driver_name = "xts-aes-ccree",
.blocksize = AES_BLOCK_SIZE, .blocksize = 1,
.template_skcipher = { .template_skcipher = {
.setkey = cc_cipher_setkey, .setkey = cc_cipher_setkey,
.encrypt = cc_cipher_encrypt, .encrypt = cc_cipher_encrypt,
...@@ -1213,7 +1209,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -1213,7 +1209,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "xts512(aes)", .name = "xts512(aes)",
.driver_name = "xts-aes-du512-ccree", .driver_name = "xts-aes-du512-ccree",
.blocksize = AES_BLOCK_SIZE, .blocksize = 1,
.template_skcipher = { .template_skcipher = {
.setkey = cc_cipher_setkey, .setkey = cc_cipher_setkey,
.encrypt = cc_cipher_encrypt, .encrypt = cc_cipher_encrypt,
...@@ -1231,7 +1227,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -1231,7 +1227,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "xts4096(aes)", .name = "xts4096(aes)",
.driver_name = "xts-aes-du4096-ccree", .driver_name = "xts-aes-du4096-ccree",
.blocksize = AES_BLOCK_SIZE, .blocksize = 1,
.template_skcipher = { .template_skcipher = {
.setkey = cc_cipher_setkey, .setkey = cc_cipher_setkey,
.encrypt = cc_cipher_encrypt, .encrypt = cc_cipher_encrypt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment