diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-10 03:18:01 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:49 -0500 |
commit | 743edf57272fd420348e148bf94f9e48ed6abb70 (patch) | |
tree | be4a96ae7f7f8a6b42bf01cc7a61cb4b5938ab50 /include/crypto/aead.h | |
parent | 03bf712fb4defc7831c727d1e32d0269f7f96de0 (diff) |
[CRYPTO] aead: Add givcrypt operations
This patch adds the underlying givcrypt operations for aead and associated
support elements. The rationale is identical to that of the skcipher
givcrypt operations, i.e., sometimes only the algorithm knows how the
IV should be generated.
A new request type aead_givcrypt_request is added which contains an
embedded aead_request structure with two new elements to support this
operation. The new elements are seq and giv. The seq field should
contain a strictly increasing 64-bit integer which may be used by
certain IV generators as an input value. The giv field will be used
to store the generated IV. It does not need to obey the alignment
requirements of the algorithm because it's not used during the operation.
The existing iv field must still be available as it will be used to store
intermediate IVs and the output IV if chaining is desired.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/aead.h')
-rw-r--r-- | include/crypto/aead.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/crypto/aead.h b/include/crypto/aead.h new file mode 100644 index 000000000000..083920312da0 --- /dev/null +++ b/include/crypto/aead.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * AEAD: Authenticated Encryption with Associated Data | ||
3 | * | ||
4 | * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation; either version 2 of the License, or (at your option) | ||
9 | * any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _CRYPTO_AEAD_H | ||
14 | #define _CRYPTO_AEAD_H | ||
15 | |||
16 | #include <linux/crypto.h> | ||
17 | #include <linux/kernel.h> | ||
18 | |||
19 | /** | ||
20 | * struct aead_givcrypt_request - AEAD request with IV generation | ||
21 | * @seq: Sequence number for IV generation | ||
22 | * @giv: Space for generated IV | ||
23 | * @areq: The AEAD request itself | ||
24 | */ | ||
25 | struct aead_givcrypt_request { | ||
26 | u64 seq; | ||
27 | u8 *giv; | ||
28 | |||
29 | struct aead_request areq; | ||
30 | }; | ||
31 | |||
32 | static inline struct crypto_aead *aead_givcrypt_reqtfm( | ||
33 | struct aead_givcrypt_request *req) | ||
34 | { | ||
35 | return crypto_aead_reqtfm(&req->areq); | ||
36 | } | ||
37 | |||
38 | #endif /* _CRYPTO_AEAD_H */ | ||