mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 17:01:14 +00:00
13b8404b1e
This backports commits from master that fix AES ciphers when using the qce driver: - A couple of simple fixes for CTR and XTS modes used with AES: * 041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch * 042-crypto-qce-fix-xts-aes-qce-key-sizes.patch - A fix for a bug that affected cases when there were more entries in the input sg list than necessary to actually encrypt, resulting in failure in gcm, where the authentication tag is present after the encryption data: * 043-crypto-qce-save-a-sg-table-slot-for-result-buf.patch - A fix to update the IV buffer passed to the driver from the kernel: * 044-crypto-qce-update-the-skcipher-IV.patch - A patch that reduces memory footprint and driver initialization by only initializing the fallback mechanism where it is actually used: * 046-crypto-qce-initialize-fallback-only-for-AES.patch - Three patches that make gcm and xts modes work with the qce driver, and improve performance with small blocks: * 047-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch * 048-crypto-qce-use-AES-fallback-for-small-requests.patch * 049-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch - A patch that allows the hashes/ciphers to be built individually. * 051-crypto-qce-allow-building-only-hashes-ciphers.patch Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com> [renumbered patches, added patches from dropped commit, refreshed, 5.4] Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
From 3f5598286445f695bb63a22239dd3603c69a6eaf Mon Sep 17 00:00:00 2001
|
|
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
|
Date: Mon, 28 Oct 2019 09:03:07 -0300
|
|
Subject: [PATCH] crypto: qce - fix ctr-aes-qce block, chunk sizes
|
|
|
|
Set blocksize of ctr-aes-qce to 1, so it can operate as a stream cipher,
|
|
adding the definition for chucksize instead, where the underlying block
|
|
size belongs.
|
|
|
|
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
|
|
|
--- a/drivers/crypto/qce/skcipher.c
|
|
+++ b/drivers/crypto/qce/skcipher.c
|
|
@@ -261,6 +261,7 @@ struct qce_skcipher_def {
|
|
const char *name;
|
|
const char *drv_name;
|
|
unsigned int blocksize;
|
|
+ unsigned int chunksize;
|
|
unsigned int ivsize;
|
|
unsigned int min_keysize;
|
|
unsigned int max_keysize;
|
|
@@ -289,7 +290,8 @@ static const struct qce_skcipher_def skc
|
|
.flags = QCE_ALG_AES | QCE_MODE_CTR,
|
|
.name = "ctr(aes)",
|
|
.drv_name = "ctr-aes-qce",
|
|
- .blocksize = AES_BLOCK_SIZE,
|
|
+ .blocksize = 1,
|
|
+ .chunksize = AES_BLOCK_SIZE,
|
|
.ivsize = AES_BLOCK_SIZE,
|
|
.min_keysize = AES_MIN_KEY_SIZE,
|
|
.max_keysize = AES_MAX_KEY_SIZE,
|
|
@@ -359,6 +361,7 @@ static int qce_skcipher_register_one(con
|
|
def->drv_name);
|
|
|
|
alg->base.cra_blocksize = def->blocksize;
|
|
+ alg->chunksize = def->chunksize;
|
|
alg->ivsize = def->ivsize;
|
|
alg->min_keysize = def->min_keysize;
|
|
alg->max_keysize = def->max_keysize;
|