From: James Morris <jmorris@intercode.com.au>
To: linux-kernel@vger.kernel.org
Cc: netdev@oss.sgi.com
Subject: Re: The return of the return of crunch time (2.5 merge candidate list 1.6) (crypto api info)
Date: Sat, 26 Oct 2002 12:35:13 +1000 (EST) [thread overview]
Message-ID: <Mutt.LNX.4.44.0210261225020.22775-100000@blackbird.intercode.com.au> (raw)
In-Reply-To: <200210251557.55202.landley@trommello.org>
On Fri, 25 Oct 2002, Rob Landley wrote:
> 4) New CryptoAPI (James Morris)
This is currently available for review at:
http://samba.org/~jamesm/crypto/
The patch there tracks Dave Miller's tree.
There's not much documentation yet, so here's a brief rundown:
The API takes page vectors (scatterlists) as arguments, and works directly
on pages. This is required to support a clean IPsec implementation (which
is being worked on by Dave Miller and Alexey Kuznetzov), and is also a
requirement from Linus. In some cases (e.g. ECB mode ciphers), this will
allow for pages to be encrypted in place with no copying.
At the lowest level are algorithms, which register dynamically with the
API.
'Transforms' are user-instantiated objects, which maintain state, handle all
of the implementation logic (e.g. manipulating page vectors), provide an
abstraction to the underlying algorithms, and handle common logical
operations (e.g. cipher modes, HMAC for digests). However, at the user
level they are very simple.
Conceptually, the API layering looks like this:
[transform api] (user interface)
[transform ops] (per-type logic glue e.g. cipher.c, digest.c)
[algorithm api] (for registering algorithms)
The idea is to make the user interface and algorithm registration API
very simple, while hiding the core logic from both. Many good ideas
from existing APIs such as Cryptoapi and Nettle have been adapted for this.
The API currently supports three types of transforms: Ciphers, Digests and
Compressors. The compression algorithms especially seem to be performing
very well so far.
An asynchronous scheduling interface is in planning but not yet
implemented, as we need to further analyze the requirements of all of
the possible hardware scenarios (e.g. IPsec NIC offload).
Here's an example of how to use the API:
#include <linux/crypto.h>
struct scatterlist sg[2];
char result[128];
struct crypto_tfm *tfm;
tfm = crypto_alloc_tfm(CRYPTO_ALG_MD5);
if (tfm == NULL)
fail();
/* ... set up the scatterlists ... */
crypto_digest_init(tfm);
crypto_digest_update(tfm, &sg, 2);
crypto_digest_final(tfm, result);
crypto_free_tfm(tfm);
Many real examples are available in the regression test module (tcrypt.c).
- James
--
James Morris
<jmorris@intercode.com.au>
next prev parent reply other threads:[~2002-10-26 2:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-25 20:57 The return of the return of crunch time (2.5 merge candidate list 1.6) Rob Landley
2002-10-26 2:35 ` James Morris [this message]
2002-10-26 2:42 ` Hans Reiser
2002-10-27 15:11 ` Rob Landley
2002-10-28 0:27 ` Hans Reiser
2002-10-26 15:09 ` Eric W. Biederman
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=Mutt.LNX.4.44.0210261225020.22775-100000@blackbird.intercode.com.au \
--to=jmorris@intercode.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®