1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

sm: Fix parsing encrypted data.

* sm/minip12.c (cram_octet_string): Finish when N==0.
(parse_bag_encrypted_data): Support constructed data with multiple
octet strings.

--

Backport master commit of:
	6c50834c0905b55ee2da18728194dd4c93c377bf

GnuPG-bug-id: 5793
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-03-09 10:48:20 +09:00
parent 847d618454
commit 0c7dffe99d

View File

@ -304,7 +304,7 @@ cram_octet_string (const unsigned char *input, size_t *length,
if (!output)
goto bailout;
for (;;)
while (n)
{
if (parse_tag (&s, &n, &ti))
goto bailout;
@ -874,6 +874,19 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length,
r_consumed = NULL; /* Ugly hack to not update that value any further. */
ti.length = n;
}
else if (ti.class == ASNCONTEXT && ti.tag == 0 && ti.is_constructed)
{
where = "octets-rc2or3des-ciphertext";
n = ti.length;
cram_buffer = cram_octet_string ( p, &n, &consumed);
if (!cram_buffer)
goto bailout;
p = p_start = cram_buffer;
if (r_consumed)
*r_consumed = consumed;
r_consumed = NULL; /* Ugly hack to not update that value any further. */
ti.length = n;
}
else if (ti.class == ASNCONTEXT && ti.tag == 0 && ti.length )
;
else