diff mbox series

[v5,04/16] core: don't check for writen output to terminate

Message ID 20250904115704.58413-5-Michael.Glembotzki@iris-sensing.com
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series Add support for asymmetric decryption | expand

Commit Message

Michael Glembotzki Sept. 4, 2025, 11:49 a.m. UTC
From: Stefano Babic <stefano.babic@swupdate.org>

commit 9e0bcaad2 and 744def043e are thought to fix the decryption of a
short artifact of one AES block. However, check is done on both input
and output data, but just checking if there are still data in the
incoming buffer is enough. This allows a crypto module to postpone the
decryption and to collect data - some algorithms are not able to work on
stream of data, and they need to have the full crypto message in memory.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 core/cpio_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/core/cpio_utils.c b/core/cpio_utils.c
index 30259e27..10a39914 100644
--- a/core/cpio_utils.c
+++ b/core/cpio_utils.c
@@ -312,7 +312,7 @@  static int decrypt_step(void *state, void *buffer, size_t size)
 			ret = swupdate_DECRYPT_update(s->dcrypt,
 				s->output, &s->outlen, s->input, inlen);
 		}
-		if (inlen == 0 || s->outlen == 0) {
+		if (inlen == 0) {
 			/*
 			 * Finalise the decryption. Further plaintext bytes may
 			 * be written at this stage.