mirror of https://gitee.com/openkylin/linux.git
[CRYPTO] doc: Update documentation for hash and me
This patch updates the documentation to reflect the switch from digest to hash. It also replaces notes about emailing James Morris to refer to me instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
1b489e11d4
commit
878b901466
|
@ -19,15 +19,14 @@ At the lowest level are algorithms, which register dynamically with the
|
||||||
API.
|
API.
|
||||||
|
|
||||||
'Transforms' are user-instantiated objects, which maintain state, handle all
|
'Transforms' are user-instantiated objects, which maintain state, handle all
|
||||||
of the implementation logic (e.g. manipulating page vectors), provide an
|
of the implementation logic (e.g. manipulating page vectors) and provide an
|
||||||
abstraction to the underlying algorithms, and handle common logical
|
abstraction to the underlying algorithms. However, at the user
|
||||||
operations (e.g. cipher modes, HMAC for digests). However, at the user
|
|
||||||
level they are very simple.
|
level they are very simple.
|
||||||
|
|
||||||
Conceptually, the API layering looks like this:
|
Conceptually, the API layering looks like this:
|
||||||
|
|
||||||
[transform api] (user interface)
|
[transform api] (user interface)
|
||||||
[transform ops] (per-type logic glue e.g. cipher.c, digest.c)
|
[transform ops] (per-type logic glue e.g. cipher.c, compress.c)
|
||||||
[algorithm api] (for registering algorithms)
|
[algorithm api] (for registering algorithms)
|
||||||
|
|
||||||
The idea is to make the user interface and algorithm registration API
|
The idea is to make the user interface and algorithm registration API
|
||||||
|
@ -44,22 +43,27 @@ under development.
|
||||||
Here's an example of how to use the API:
|
Here's an example of how to use the API:
|
||||||
|
|
||||||
#include <linux/crypto.h>
|
#include <linux/crypto.h>
|
||||||
|
#include <linux/err.h>
|
||||||
|
#include <linux/scatterlist.h>
|
||||||
|
|
||||||
struct scatterlist sg[2];
|
struct scatterlist sg[2];
|
||||||
char result[128];
|
char result[128];
|
||||||
struct crypto_tfm *tfm;
|
struct crypto_hash *tfm;
|
||||||
|
struct hash_desc desc;
|
||||||
|
|
||||||
tfm = crypto_alloc_tfm("md5", 0);
|
tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
|
||||||
if (tfm == NULL)
|
if (IS_ERR(tfm))
|
||||||
fail();
|
fail();
|
||||||
|
|
||||||
/* ... set up the scatterlists ... */
|
/* ... set up the scatterlists ... */
|
||||||
|
|
||||||
|
desc.tfm = tfm;
|
||||||
|
desc.flags = 0;
|
||||||
|
|
||||||
crypto_digest_init(tfm);
|
if (crypto_hash_digest(&desc, &sg, 2, result))
|
||||||
crypto_digest_update(tfm, &sg, 2);
|
fail();
|
||||||
crypto_digest_final(tfm, result);
|
|
||||||
|
|
||||||
crypto_free_tfm(tfm);
|
crypto_free_hash(tfm);
|
||||||
|
|
||||||
|
|
||||||
Many real examples are available in the regression test module (tcrypt.c).
|
Many real examples are available in the regression test module (tcrypt.c).
|
||||||
|
@ -126,7 +130,7 @@ might already be working on.
|
||||||
BUGS
|
BUGS
|
||||||
|
|
||||||
Send bug reports to:
|
Send bug reports to:
|
||||||
James Morris <jmorris@redhat.com>
|
Herbert Xu <herbert@gondor.apana.org.au>
|
||||||
Cc: David S. Miller <davem@redhat.com>
|
Cc: David S. Miller <davem@redhat.com>
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,13 +138,14 @@ FURTHER INFORMATION
|
||||||
|
|
||||||
For further patches and various updates, including the current TODO
|
For further patches and various updates, including the current TODO
|
||||||
list, see:
|
list, see:
|
||||||
http://samba.org/~jamesm/crypto/
|
http://gondor.apana.org.au/~herbert/crypto/
|
||||||
|
|
||||||
|
|
||||||
AUTHORS
|
AUTHORS
|
||||||
|
|
||||||
James Morris
|
James Morris
|
||||||
David S. Miller
|
David S. Miller
|
||||||
|
Herbert Xu
|
||||||
|
|
||||||
|
|
||||||
CREDITS
|
CREDITS
|
||||||
|
@ -238,8 +243,11 @@ Anubis algorithm contributors:
|
||||||
Tiger algorithm contributors:
|
Tiger algorithm contributors:
|
||||||
Aaron Grothe
|
Aaron Grothe
|
||||||
|
|
||||||
|
VIA PadLock contributors:
|
||||||
|
Michal Ludvig
|
||||||
|
|
||||||
Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com>
|
Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com>
|
||||||
|
|
||||||
Please send any credits updates or corrections to:
|
Please send any credits updates or corrections to:
|
||||||
James Morris <jmorris@redhat.com>
|
Herbert Xu <herbert@gondor.apana.org.au>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue