All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Jarkko Sakkinen" <jarkko@kernel.org>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Cc: <rust-for-linux@vger.kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>
Subject: Re: ASN.1
Date: Tue, 21 May 2024 21:01:08 +0300	[thread overview]
Message-ID: <D1FIPA4YAU84.M7Z9VMR4P739@kernel.org> (raw)
In-Reply-To: <D1FFABJRCD85.1EA4JBU93JT5Y@kernel.org>

On Tue May 21, 2024 at 6:20 PM EEST, Jarkko Sakkinen wrote:
> On Tue May 21, 2024 at 5:52 PM EEST, Miguel Ojeda wrote:
> In this case I could imagine loading ASN.1 blob by calling Rust
> functions. But yeah more like "immediate mode" API rather than "retained
> mode" style ;-)

Hey, sorry I was mixing things a bit so let me clear this up!

The decoder works as follows. There is a compiler, which generates
bytecode object linked to vmlinux and a header with symbol declaration.
Then there is a asn1_ber_decoder(), which runs the bytecode through a
trivial interpreter with e.g. a key blob as parameter.

And this part is great and it does not really get in the way. All of
kernel uses it to parse ber/der/cer blobs in, and it is somewhat stable,
and super well tested. For decoder the value of Rust is not that great.

Encoder (asn1_encoder.c) is just a set of basic functions, like one
function per tagged type to serialize that type. Most valuable asset
would be to replicate this set in Rust with better defined contraints
etc.

Sorry for longish explanation, just wanted to clear up this story :-)
I.e encoder is higher value asset than the decoder as far as I'm
concerned, despite being much more trivial to implement.

BR, Jarkko

  reply	other threads:[~2024-05-21 18:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21  6:36 ASN.1 Jarkko Sakkinen
2024-05-21 14:52 ` ASN.1 Miguel Ojeda
2024-05-21 15:20   ` ASN.1 Jarkko Sakkinen
2024-05-21 18:01     ` Jarkko Sakkinen [this message]
2024-05-21 18:55       ` ASN.1 Jarkko Sakkinen
2024-05-22 12:04         ` ASN.1 Alex Gaynor
2024-05-22 12:56           ` ASN.1 Jarkko Sakkinen
2024-05-22 13:49             ` ASN.1 Jarkko Sakkinen
2024-05-23  7:00               ` ASN.1 Jarkko Sakkinen
2024-05-23  7:03                 ` ASN.1 Jarkko Sakkinen
2024-05-23 15:44                 ` ASN.1 Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D1FIPA4YAU84.M7Z9VMR4P739@kernel.org \
    --to=jarkko@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.