Commit 4aaefb62 authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Herbert Xu

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: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 504e84ab
...@@ -1228,6 +1228,10 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -1228,6 +1228,10 @@ static const struct cc_alg_template skcipher_algs[] = {
.sec_func = true, .sec_func = true,
}, },
{ {
/* See https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg40576.html
* for the reason why this differs from the generic
* implementation.
*/
.name = "xts(aes)", .name = "xts(aes)",
.driver_name = "xts-aes-ccree", .driver_name = "xts-aes-ccree",
.blocksize = 1, .blocksize = 1,
...@@ -1423,7 +1427,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -1423,7 +1427,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "ofb(aes)", .name = "ofb(aes)",
.driver_name = "ofb-aes-ccree", .driver_name = "ofb-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,
...@@ -1576,7 +1580,7 @@ static const struct cc_alg_template skcipher_algs[] = { ...@@ -1576,7 +1580,7 @@ static const struct cc_alg_template skcipher_algs[] = {
{ {
.name = "ctr(sm4)", .name = "ctr(sm4)",
.driver_name = "ctr-sm4-ccree", .driver_name = "ctr-sm4-ccree",
.blocksize = SM4_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