Skip to content

Commit 4aaefb6

Browse files
Gilad Ben-Yossefherbertx
authored andcommitted
crypto: ccree - fix some reported cipher block sizes
OFB and CTR modes block sizes were wrongfully reported as the underlying block sizes. Fix it to 1 bytes as they turn the block ciphers into stream ciphers. Also document why our XTS differes from the generic implementation. Signed-off-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 504e84a commit 4aaefb6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/crypto/ccree/cc_cipher.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,10 @@ static const struct cc_alg_template skcipher_algs[] = {
12281228
.sec_func = true,
12291229
},
12301230
{
1231+
/* See https://www.mail-archive.com/[email protected]/msg40576.html
1232+
* for the reason why this differs from the generic
1233+
* implementation.
1234+
*/
12311235
.name = "xts(aes)",
12321236
.driver_name = "xts-aes-ccree",
12331237
.blocksize = 1,
@@ -1423,7 +1427,7 @@ static const struct cc_alg_template skcipher_algs[] = {
14231427
{
14241428
.name = "ofb(aes)",
14251429
.driver_name = "ofb-aes-ccree",
1426-
.blocksize = AES_BLOCK_SIZE,
1430+
.blocksize = 1,
14271431
.template_skcipher = {
14281432
.setkey = cc_cipher_setkey,
14291433
.encrypt = cc_cipher_encrypt,
@@ -1576,7 +1580,7 @@ static const struct cc_alg_template skcipher_algs[] = {
15761580
{
15771581
.name = "ctr(sm4)",
15781582
.driver_name = "ctr-sm4-ccree",
1579-
.blocksize = SM4_BLOCK_SIZE,
1583+
.blocksize = 1,
15801584
.template_skcipher = {
15811585
.setkey = cc_cipher_setkey,
15821586
.encrypt = cc_cipher_encrypt,

0 commit comments

Comments
 (0)