aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/crypto.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-12-12 06:23:36 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2008-01-10 16:16:51 -0500
commit5b6d2d7fdf806f2b5a9352416f9e670911fc4748 (patch)
treed2eda87839e1b5de18c691ecff6e6074a35c09f0 /include/linux/crypto.h
parentaedb30dc49eeecd48558b601c47e0b3f9e42c602 (diff)
[CRYPTO] aead: Add aead_geniv_alloc/aead_geniv_free
This patch creates the infrastructure to help the construction of IV generator templates that wrap around AEAD algorithms by adding an IV generator to them. This is useful for AEAD algorithms with no built-in IV generator or to replace their built-in generator. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r--include/linux/crypto.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 7524928bff93..639385a9672d 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -206,6 +206,8 @@ struct aead_alg {
206 int (*givencrypt)(struct aead_givcrypt_request *req); 206 int (*givencrypt)(struct aead_givcrypt_request *req);
207 int (*givdecrypt)(struct aead_givcrypt_request *req); 207 int (*givdecrypt)(struct aead_givcrypt_request *req);
208 208
209 const char *geniv;
210
209 unsigned int ivsize; 211 unsigned int ivsize;
210 unsigned int maxauthsize; 212 unsigned int maxauthsize;
211}; 213};
@@ -353,6 +355,9 @@ struct aead_tfm {
353 int (*decrypt)(struct aead_request *req); 355 int (*decrypt)(struct aead_request *req);
354 int (*givencrypt)(struct aead_givcrypt_request *req); 356 int (*givencrypt)(struct aead_givcrypt_request *req);
355 int (*givdecrypt)(struct aead_givcrypt_request *req); 357 int (*givdecrypt)(struct aead_givcrypt_request *req);
358
359 struct crypto_aead *base;
360
356 unsigned int ivsize; 361 unsigned int ivsize;
357 unsigned int authsize; 362 unsigned int authsize;
358 unsigned int reqsize; 363 unsigned int reqsize;
@@ -781,7 +786,9 @@ static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
781static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key, 786static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
782 unsigned int keylen) 787 unsigned int keylen)
783{ 788{
784 return crypto_aead_crt(tfm)->setkey(tfm, key, keylen); 789 struct aead_tfm *crt = crypto_aead_crt(tfm);
790
791 return crt->setkey(crt->base, key, keylen);
785} 792}
786 793
787int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize); 794int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
@@ -809,7 +816,7 @@ static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
809static inline void aead_request_set_tfm(struct aead_request *req, 816static inline void aead_request_set_tfm(struct aead_request *req,
810 struct crypto_aead *tfm) 817 struct crypto_aead *tfm)
811{ 818{
812 req->base.tfm = crypto_aead_tfm(tfm); 819 req->base.tfm = crypto_aead_tfm(crypto_aead_crt(tfm)->base);
813} 820}
814 821
815static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, 822static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,