All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: Check for l_cipher_decrypt error
@ 2021-02-10 14:24 Andrew Zaborowski
  2021-02-10 17:58 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Zaborowski @ 2021-02-10 14:24 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

---
 src/crypto.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/crypto.c b/src/crypto.c
index 563f17ce..6c70eb9a 100644
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -167,12 +167,18 @@ bool aes_unwrap(const uint8_t *kek, size_t kek_len, const uint8_t *in, size_t le
 		for (i = n; i >= 1; i--, t--) {
 			b[0] ^= L_CPU_TO_BE64(t);
 			b[1] = L_GET_UNALIGNED(r);
-			l_cipher_decrypt(cipher, b, b, 16);
+
+			if (!l_cipher_decrypt(cipher, b, b, 16)) {
+				b[0] = 0;
+				goto done;
+			}
+
 			L_PUT_UNALIGNED(b[1], r);
 			r -= 1;
 		}
 	}
 
+done:
 	l_cipher_free(cipher);
 	explicit_bzero(&b[1], 8);
 
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: Check for l_cipher_decrypt error
  2021-02-10 14:24 [PATCH] crypto: Check for l_cipher_decrypt error Andrew Zaborowski
@ 2021-02-10 17:58 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-02-10 17:58 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

Hi Andrew,

On 2/10/21 8:24 AM, Andrew Zaborowski wrote:
> ---
>   src/crypto.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-10 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 14:24 [PATCH] crypto: Check for l_cipher_decrypt error Andrew Zaborowski
2021-02-10 17:58 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.