diff options
author | Shane Wang <shane.wang@intel.com> | 2009-09-02 06:05:22 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-09-02 06:05:22 -0400 |
commit | f1939f7c56456d22a559d2c75156e91912a2e97e (patch) | |
tree | 49b16096a65ccb318777b50e15e3ed2c66db0500 /include/crypto | |
parent | 2bf2901669a564b402cd0e40eb3f941c391e64c4 (diff) |
crypto: vmac - New hash algorithm for intel_txt support
This patch adds VMAC (a fast MAC) support into crypto framework.
Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r-- | include/crypto/vmac.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/crypto/vmac.h b/include/crypto/vmac.h new file mode 100644 index 00000000000..c4467c55df1 --- /dev/null +++ b/include/crypto/vmac.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Modified to interface to the Linux kernel | ||
3 | * Copyright (c) 2009, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
16 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __CRYPTO_VMAC_H | ||
20 | #define __CRYPTO_VMAC_H | ||
21 | |||
22 | /* -------------------------------------------------------------------------- | ||
23 | * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai. | ||
24 | * This implementation is herby placed in the public domain. | ||
25 | * The authors offers no warranty. Use at your own risk. | ||
26 | * Please send bug reports to the authors. | ||
27 | * Last modified: 17 APR 08, 1700 PDT | ||
28 | * ----------------------------------------------------------------------- */ | ||
29 | |||
30 | /* | ||
31 | * User definable settings. | ||
32 | */ | ||
33 | #define VMAC_TAG_LEN 64 | ||
34 | #define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */ | ||
35 | #define VMAC_KEY_LEN (VMAC_KEY_SIZE/8) | ||
36 | #define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/ | ||
37 | |||
38 | /* | ||
39 | * This implementation uses u32 and u64 as names for unsigned 32- | ||
40 | * and 64-bit integer types. These are defined in C99 stdint.h. The | ||
41 | * following may need adaptation if you are not running a C99 or | ||
42 | * Microsoft C environment. | ||
43 | */ | ||
44 | struct vmac_ctx { | ||
45 | u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)]; | ||
46 | u64 polykey[2*VMAC_TAG_LEN/64]; | ||
47 | u64 l3key[2*VMAC_TAG_LEN/64]; | ||
48 | u64 polytmp[2*VMAC_TAG_LEN/64]; | ||
49 | u64 cached_nonce[2]; | ||
50 | u64 cached_aes[2]; | ||
51 | int first_block_processed; | ||
52 | }; | ||
53 | |||
54 | typedef u64 vmac_t; | ||
55 | |||
56 | struct vmac_ctx_t { | ||
57 | struct crypto_cipher *child; | ||
58 | struct vmac_ctx __vmac_ctx; | ||
59 | }; | ||
60 | |||
61 | #endif /* __CRYPTO_VMAC_H */ | ||