All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
To: ext Herbert Xu <herbert@gondor.hengli.com.au>
Cc: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: RSA signature verification
Date: Mon, 21 Mar 2011 16:04:41 +0200	[thread overview]
Message-ID: <4D875AF9.4060302@nokia.com> (raw)

Hi Herbert,

I work on kernel RSA verification for IMA/EVM.

Currently I have a patch which provides "direct" API like ksign_verify()
to get signature verified.
I was thinking about doing it via crypto interface as usual but for now
I have done it directly.
I have found some very old (5y) patches where someone tried to have it
as kind of hash API.
update(), update(), final...

As RSA, in contrast to hash, has like sign/verify operations.
For the kernel there is only verify.

Snippet from the code:

-----------------------------------------------------------------------
    desc = kzalloc(sizeof(*desc) + crypto_shash_descsize(shash),
               GFP_KERNEL);
    if (!desc)
        goto err;

    desc->tfm = shash;
    desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;

    crypto_shash_init(desc);
    crypto_shash_update(desc, digest, digestlen);
    crypto_shash_update(desc, sig, sizeof(*sh));
    crypto_shash_final(desc, h);

    kfree(desc);

    /* pass signature mpis address */
    err = ksign_verify_rsa(key, sig + sizeof(*sh), siglen - sizeof(*sh),
                 h, sizeof(h));

-----------------------------------------------------------------------

So hash is calculated which is then verified against
signature.

Do you think it make sense to have it as a crypto "algo"
What kind of API you would have in mind?

Thanks,
Dmitry

             reply	other threads:[~2011-03-21 14:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21 14:04 Dmitry Kasatkin [this message]
2011-03-21 14:06 ` RSA signature verification Herbert Xu
2011-03-22  6:59   ` Dmitry Kasatkin
2011-03-22  7:26     ` Dmitry Kasatkin
2011-03-22  7:34     ` Herbert Xu
2011-03-22  8:57       ` Dmitry Kasatkin
2011-03-22  8:58         ` Herbert Xu

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=4D875AF9.4060302@nokia.com \
    --to=dmitry.kasatkin@nokia.com \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-crypto@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.