Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/include/crypto/vmac.h
10817 views
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 ([email protected]) 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 */
62
63