crypto: stm32/hash: Fix bug in hmac mode
Subsystems (2)
cover crypto: stm32/hash: Fix bug in hmac mode
This series fixes issues discovered while using libkcapi library. Some more tests show wrong key management in hmac mode. It is fixes by these patches and prevent a potential issue in case of interrupt while processing in dma mode.
Lionel Debieve (2):
crypto: stm32/hash: Fix hmac issue more than 256 bytes
crypto: stm32/hash: remove interruptible condition for dma
drivers/crypto/stm32/stm32-hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
PATCH 2/2 crypto: stm32/hash: remove interruptible condition for dma
When DMA is used, waiting for completion must not be interruptible as it can generate an error that is not handle by the driver. There is no need to put the completion interruptible in this driver.
--- drivers/crypto/stm32/stm32-hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/stm32/stm32-hash.c +2 -2
@@ -447,8 +447,8 @@ static int stm32_hash_xmit_dma(struct stm32_hash_dev *hdev,dma_async_issue_pending (hdev->dma_lch); -if (!wait_for_completion_interruptible_timeout (&hdev->dma_completion, -msecs_to_jiffies (100 ))) +if (!wait_for_completion_timeout (&hdev->dma_completion, +msecs_to_jiffies (100 ))) err = -ETIMEDOUT ; if (dma_async_is_tx_complete(hdev->dma_lch, cookie,
Signature · 1 line
2.17.1
PATCH 1/2 crypto: stm32/hash: Fix hmac issue more than 256 bytes
In reply to Lionel DebieveCorrect condition for the second hmac loop. Key must be only set in the first loop. Initial condition was wrong, HMAC_KEY flag was not properly checked.
--- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/stm32/stm32-hash.c +1 -1
@@ -349,7 +349,7 @@ static int stm32_hash_xmit_cpu(struct stm32_hash_dev *hdev,return -ETIMEDOUT ;if ((hdev->flags &HASH_FLAGS_HMAC ) && - (hdev->flags & ~HASH_FLAGS_HMAC_KEY )) { + (!(hdev->flags &HASH_FLAGS_HMAC_KEY ))) { hdev->flags |=HASH_FLAGS_HMAC_KEY ;stm32_hash_write_key (hdev);if (stm32_hash_wait_busy (hdev))
Signature · 1 line
2.17.1
Herbert Xu
maintainerQuoted 11 lines · Lionel Debieve
This series fixes issues discovered while using libkcapi library. Some more tests show wrong key management in hmac mode. It is fixes by these patches and prevent a potential issue in case of interrupt while processing in dma mode.
Lionel Debieve (2):
crypto: stm32/hash: Fix hmac issue more than 256 bytes
crypto: stm32/hash: remove interruptible condition for dmadrivers/crypto/stm32/stm32-hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt