[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <799a5022a9d427f6fb47005f7f3259bd14932e88.camel@HansenPartnership.com>
Date: Tue, 25 Nov 2025 17:12:30 -0500
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>, Andrew Morton
<akpm@...ux-foundation.org>, Blaise Boscaccy <bboscaccy@...ux.microsoft.com>
Subject: Re: [PATCH] oid_registry: allow arbitrary size OIDs
On Tue, 2025-11-25 at 20:33 +0000, David Howells wrote:
> James Bottomley <James.Bottomley@...senPartnership.com> wrote:
>
> > This isn't usually a problem
> > except that it prevents us from representing the 2.25. prefix OIDs
> > which are the OID representation of UUIDs and have a 128 bit number
> > following the prefix.
>
> Ewww.
Yes, well, not responsible for standards bodies ...
>
> > Rather than import not often used perl arithmetic modules,
>
> Do they not work? Or are they just not commonly installed?
A bit of both: Math::Int128 looked like it might solve my problem but
SUSE doesn't build it. Math::BigInt is built but has a really horrible
API. bc is actually an improvement: it's just really converting
decimal to binary at arbitrary size then we just do string operations
on long strings of binary numbers ... it's easier than actual maths ...
>
> > + # Base128 encode the number
> > + my $j;
> > + my $b;
> > + for ($j = 0; $j < $tmp; $j++) {
>
> I would do:
>
> for (my $j = 0; $j < $tmp; $j++) {
OK.
> > + $b = oct("0b".substr($c, $j * 7, 7));
>
> I would probably do "my $b = ..." here.
I can't do that: $b is used outside the scope.
> > +
> > + push @octets, $b | 0x80;
> > }
> > - push @octets, $c & 0x7f;
> > + $b = oct("0b".substr($c, $j * 7, 7));
> > + push @octets, $b;
>
> and just combine these two lines:
>
> push @octets, oct("0b".substr($c, $j * 7, 7));
Will do (it was actually that way until I added a debugging printk.
Regards,
James
>
> Using "oct("0b"...)" looks weird, but I guess it should work.
>
> David
>
Powered by blists - more mailing lists