Skip to content

Commit 67caef0

Browse files
urishirherbertx
authored andcommitted
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: Uri Shir <[email protected]> Acked-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 465527b commit 67caef0

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

drivers/crypto/ccree/cc_cipher.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ static int validate_data_size(struct cc_cipher_ctx *ctx_p,
116116
case S_DIN_to_AES:
117117
switch (ctx_p->cipher_mode) {
118118
case DRV_CIPHER_XTS:
119-
if (size >= AES_BLOCK_SIZE &&
120-
IS_ALIGNED(size, AES_BLOCK_SIZE))
121-
return 0;
122-
break;
123119
case DRV_CIPHER_CBC_CTS:
124120
if (size >= AES_BLOCK_SIZE)
125121
return 0;
@@ -938,7 +934,7 @@ static const struct cc_alg_template skcipher_algs[] = {
938934
{
939935
.name = "xts(paes)",
940936
.driver_name = "xts-paes-ccree",
941-
.blocksize = AES_BLOCK_SIZE,
937+
.blocksize = 1,
942938
.template_skcipher = {
943939
.setkey = cc_cipher_sethkey,
944940
.encrypt = cc_cipher_encrypt,
@@ -956,7 +952,7 @@ static const struct cc_alg_template skcipher_algs[] = {
956952
{
957953
.name = "xts512(paes)",
958954
.driver_name = "xts-paes-du512-ccree",
959-
.blocksize = AES_BLOCK_SIZE,
955+
.blocksize = 1,
960956
.template_skcipher = {
961957
.setkey = cc_cipher_sethkey,
962958
.encrypt = cc_cipher_encrypt,
@@ -975,7 +971,7 @@ static const struct cc_alg_template skcipher_algs[] = {
975971
{
976972
.name = "xts4096(paes)",
977973
.driver_name = "xts-paes-du4096-ccree",
978-
.blocksize = AES_BLOCK_SIZE,
974+
.blocksize = 1,
979975
.template_skcipher = {
980976
.setkey = cc_cipher_sethkey,
981977
.encrypt = cc_cipher_encrypt,
@@ -1196,7 +1192,7 @@ static const struct cc_alg_template skcipher_algs[] = {
11961192
{
11971193
.name = "xts(aes)",
11981194
.driver_name = "xts-aes-ccree",
1199-
.blocksize = AES_BLOCK_SIZE,
1195+
.blocksize = 1,
12001196
.template_skcipher = {
12011197
.setkey = cc_cipher_setkey,
12021198
.encrypt = cc_cipher_encrypt,
@@ -1213,7 +1209,7 @@ static const struct cc_alg_template skcipher_algs[] = {
12131209
{
12141210
.name = "xts512(aes)",
12151211
.driver_name = "xts-aes-du512-ccree",
1216-
.blocksize = AES_BLOCK_SIZE,
1212+
.blocksize = 1,
12171213
.template_skcipher = {
12181214
.setkey = cc_cipher_setkey,
12191215
.encrypt = cc_cipher_encrypt,
@@ -1231,7 +1227,7 @@ static const struct cc_alg_template skcipher_algs[] = {
12311227
{
12321228
.name = "xts4096(aes)",
12331229
.driver_name = "xts-aes-du4096-ccree",
1234-
.blocksize = AES_BLOCK_SIZE,
1230+
.blocksize = 1,
12351231
.template_skcipher = {
12361232
.setkey = cc_cipher_setkey,
12371233
.encrypt = cc_cipher_encrypt,

0 commit comments

Comments
 (0)