Linux 4.16.11
[linux/fpc-iii.git] / include / crypto / vmac.h
blob6b700c7b2fe1cba3cd054a200eac450ac4bde7be
1 /*
2 * Modified to interface to the Linux kernel
3 * Copyright (c) 2009, Intel Corporation.
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.
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.
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.
19 #ifndef __CRYPTO_VMAC_H
20 #define __CRYPTO_VMAC_H
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 * ----------------------------------------------------------------------- */
31 * User definable settings.
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*/
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.
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;
54 typedef u64 vmac_t;
56 struct vmac_ctx_t {
57 struct crypto_cipher *child;
58 struct vmac_ctx __vmac_ctx;
59 u8 partial[VMAC_NHBYTES]; /* partial block */
60 int partial_size; /* size of the partial block */
63 #endif /* __CRYPTO_VMAC_H */