All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "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 18:20:33 +0300	[thread overview]
Message-ID: <D1FFABJRCD85.1EA4JBU93JT5Y@kernel.org> (raw)
In-Reply-To: <CANiq72=Kv217NDGf5sXgx+EYez=cs+hO50+YNnZf9oL2zxni9Q@mail.gmail.com>

On Tue May 21, 2024 at 5:52 PM EEST, Miguel Ojeda wrote:
> Hi Jarkko,
>
> On Tue, May 21, 2024 at 8:36 AM Jarkko Sakkinen <jarkko@kernel.org> wrote:
> >
> > So question is how to approach this? How the holding data structure for
> > holding the deserialized data should represented so that is is also
> > directly accessible from C?
>
> Daniel (Cc'd) is working on in-kernel Rust codecs and is experimenting
> with `cbindgen` support to easily provide an API for C code (of
> course, you can do it manually too), so you may want to talk :) He
> recently wrote this article on it: https://lwn.net/Articles/970565/
>
> The main issue with a parallel implementation is whether the relevant
> maintainers will be OK with keeping both versions alive in the kernel.
> As usual, some ideas that may help offsetting the maintenance cost may
> be showcasing a security benefit, or a performance improvement, or a
> complexity reduction, or an avoidance of unsafe code, etc.

For me the main use case would be loading of keys (I co-maintain
keyring).

For keyring the ASN.1 C-API is actually quite good in the sense that
callbacks in parsing and sequential encoding are great at not conserving
memory (actually zero consumption almost). In that sense I'm happy with
it.

It is just hard to modify in the sense that it is very prone to
off-by-one errors and such.

Here's an example of a patch set that I wrote over the weekend for
asymmetric keys:

https://lore.kernel.org/linux-integrity/20240521031645.17008-1-jarkko@kernel.org/

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 ;-)

> Cheers,
> Miguel

BR, Jarkko

  reply	other threads:[~2024-05-21 15:20 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   ` Jarkko Sakkinen [this message]
2024-05-21 18:01     ` ASN.1 Jarkko Sakkinen
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=D1FFABJRCD85.1EA4JBU93JT5Y@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.