aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/hmac.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-08-19 08:24:23 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:46:17 -0400
commit055bcee3102dc35f019b69df9c2618e9d6dd1c09 (patch)
tree3f7c68abbbb5041d570e4cb8588f3943530bc0b7 /crypto/hmac.c
parent7226bc877a22244e8003924031435a4bffd52654 (diff)
[CRYPTO] digest: Added user API for new hash type
The existing digest user interface is inadequate for support asynchronous operations. For one it doesn't return a value to indicate success or failure, nor does it take a per-operation descriptor which is essential for the issuing of requests while other requests are still outstanding. This patch is the first in a series of steps to remodel the interface for asynchronous operations. For the ease of transition the new interface will be known as "hash" while the old one will remain as "digest". This patch also changes sg_next to allow chaining. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/hmac.c')
-rw-r--r--crypto/hmac.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 46120dee5ada..ecf7b0a95b56 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -35,9 +35,9 @@ int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
35 35
36 BUG_ON(!crypto_tfm_alg_blocksize(tfm)); 36 BUG_ON(!crypto_tfm_alg_blocksize(tfm));
37 37
38 tfm->crt_digest.dit_hmac_block = kmalloc(crypto_tfm_alg_blocksize(tfm), 38 tfm->crt_hash.hmac_block = kmalloc(crypto_tfm_alg_blocksize(tfm),
39 GFP_KERNEL); 39 GFP_KERNEL);
40 if (tfm->crt_digest.dit_hmac_block == NULL) 40 if (tfm->crt_hash.hmac_block == NULL)
41 ret = -ENOMEM; 41 ret = -ENOMEM;
42 42
43 return ret; 43 return ret;
@@ -46,14 +46,14 @@ int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
46 46
47void crypto_free_hmac_block(struct crypto_tfm *tfm) 47void crypto_free_hmac_block(struct crypto_tfm *tfm)
48{ 48{
49 kfree(tfm->crt_digest.dit_hmac_block); 49 kfree(tfm->crt_hash.hmac_block);
50} 50}
51 51
52void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen) 52void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen)
53{ 53{
54 unsigned int i; 54 unsigned int i;
55 struct scatterlist tmp; 55 struct scatterlist tmp;
56 char *ipad = tfm->crt_digest.dit_hmac_block; 56 char *ipad = tfm->crt_hash.hmac_block;
57 57
58 if (*keylen > crypto_tfm_alg_blocksize(tfm)) { 58 if (*keylen > crypto_tfm_alg_blocksize(tfm)) {
59 hash_key(tfm, key, *keylen); 59 hash_key(tfm, key, *keylen);
@@ -83,7 +83,7 @@ void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key,
83{ 83{
84 unsigned int i; 84 unsigned int i;
85 struct scatterlist tmp; 85 struct scatterlist tmp;
86 char *opad = tfm->crt_digest.dit_hmac_block; 86 char *opad = tfm->crt_hash.hmac_block;
87 87
88 if (*keylen > crypto_tfm_alg_blocksize(tfm)) { 88 if (*keylen > crypto_tfm_alg_blocksize(tfm)) {
89 hash_key(tfm, key, *keylen); 89 hash_key(tfm, key, *keylen);