diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2023-11-29 12:27:04 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-12-08 11:59:46 +0800 |
commit | 99bd99d3e3a7f73c1c01ef510d48730b3bdd2c4a (patch) | |
tree | 98fe2dd24296acfca5fdf37d05d7bf2ab682951c /include/crypto | |
parent | 47309ea1359115125d9cab17a279c8df72b47235 (diff) | |
download | linux-99bd99d3e3a7f73c1c01ef510d48730b3bdd2c4a.tar.gz linux-99bd99d3e3a7f73c1c01ef510d48730b3bdd2c4a.tar.bz2 linux-99bd99d3e3a7f73c1c01ef510d48730b3bdd2c4a.zip |
crypto: algif_skcipher - Fix stream cipher chaining
Unlike algif_aead which is always issued in one go (thus limiting
the maximum size of the request), algif_skcipher has always allowed
unlimited input data by cutting them up as necessary and feeding
the fragments to the underlying algorithm one at a time.
However, because of deficiencies in the API, this has been broken
for most stream ciphers such as arc4 or chacha. This is because
they have an internal state in addition to the IV that must be
preserved in order to continue processing.
Fix this by using the new skcipher state API.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r-- | include/crypto/if_alg.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h index 08b803a4fcde..78ecaf5db04c 100644 --- a/include/crypto/if_alg.h +++ b/include/crypto/if_alg.h @@ -121,6 +121,7 @@ struct af_alg_async_req { * * @tsgl_list: Link to TX SGL * @iv: IV for cipher operation + * @state: Existing state for continuing operation * @aead_assoclen: Length of AAD for AEAD cipher operations * @completion: Work queue for synchronous operation * @used: TX bytes sent to kernel. This variable is used to @@ -142,6 +143,7 @@ struct af_alg_ctx { struct list_head tsgl_list; void *iv; + void *state; size_t aead_assoclen; struct crypto_wait wait; |