* Re: [PATCH] lib/asn1_encoder: fix encoding of zero OID components
[not found] <tencent_AFE15D698FFD4F18E16A6EF7CDA002D69806@qq.com>
@ 2026-11-24 6:03 ` Andrew Morton
2026-11-24 9:21 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2026-11-24 6:03 UTC (permalink / raw)
To: zzz
Cc: linux-kernel, James.Bottomley, Jarkko Sakkinen, David Howells,
keyrings, linux-integrity
On Fri, 20 Nov 2026 21:00:55 +0800 zzz <abc0eichs@qq.com> wrote:
>
Sorry, "zzz" isn't usable. See
Documentation/process/submitting-patches.rst under "Sign your
work":"using a known identity (sorry, no anonymous contributions.)".
So for now I'll rewrite this as From:me and Reported-by:zzz. Please
send a
Signed-off-by: Your Real Name <email@address>
as a reply-to-all to this message and I shall alter the attributions
appropriately.
> asn1_encode_oid_digit() encodes a zero component as 0x80, setting the
> continuation bit on its only octet. A trailing zero therefore produces
> an unterminated subidentifier, while an interior zero produces an
> overlong encoding of the following component.
>
> For example, 1.2.0 is encoded as 06 02 2a 80 instead of 06 02 2a 00.
> Emit zero without the continuation bit, as required for the final
> octet of a base-128 subidentifier.
Super-slim bug and it appears that nothing in the current tree uses
this code path. But a bug is a bug.
> Validation:
> - A local UML KUnit suite called the actual encoder with six OID
> vectors and short buffers. The original failed the zero-component
> vectors; the fixed kernel passed both subtests.
Feel free to send along a patch which adds a KUint test for the
asn1_decoder code.
> The sole current in-tree caller uses a fixed, nonzero TPM OID whose
> encoding is unchanged. This fixes the exported encoder's handling of
> valid zero components; it does not claim an observed TPM failure.
yup.
> --- a/lib/asn1_encoder.c
> +++ b/lib/asn1_encoder.c
> @@ -97,7 +97,7 @@ static int asn1_encode_oid_digit(unsigned char **_data, int *data_len, u32 oid)
>
> /* quick case */
> if (oid == 0) {
> - *data++ = 0x80;
> + *data++ = 0;
> (*data_len)--;
> goto out;
> }
Thanks, Added to the pile!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/asn1_encoder: fix encoding of zero OID components
2026-11-24 6:03 ` [PATCH] lib/asn1_encoder: fix encoding of zero OID components Andrew Morton
@ 2026-11-24 9:21 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2026-11-24 9:21 UTC (permalink / raw)
To: Andrew Morton
Cc: zzz, linux-kernel, James.Bottomley, David Howells, keyrings,
linux-integrity
On Mon, Nov 23, 2026 at 10:03:11PM -0800, Andrew Morton wrote:
> > For example, 1.2.0 is encoded as 06 02 2a 80 instead of 06 02 2a 00.
> > Emit zero without the continuation bit, as required for the final
> > octet of a base-128 subidentifier.
>
> Super-slim bug and it appears that nothing in the current tree uses
> this code path. But a bug is a bug.
It's a good catch :-)
But yeah, we need a person, this is not anonymous/pseudonym project but
the change itself is apppreciated.
Br, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-24 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <tencent_AFE15D698FFD4F18E16A6EF7CDA002D69806@qq.com>
2026-11-24 6:03 ` [PATCH] lib/asn1_encoder: fix encoding of zero OID components Andrew Morton
2026-11-24 9:21 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox