1275732Sjmg/*- 2275732Sjmg * Copyright (c) 2014 The FreeBSD Foundation 3275732Sjmg * All rights reserved. 4275732Sjmg * 5275732Sjmg * This software was developed by John-Mark Gurney under 6275732Sjmg * the sponsorship of the FreeBSD Foundation and 7275732Sjmg * Rubicon Communications, LLC (Netgate). 8275732Sjmg * Redistribution and use in source and binary forms, with or without 9275732Sjmg * modification, are permitted provided that the following conditions 10275732Sjmg * are met: 11275732Sjmg * 1. Redistributions of source code must retain the above copyright 12275732Sjmg * notice, this list of conditions and the following disclaimer. 13275732Sjmg * 2. Redistributions in binary form must reproduce the above copyright 14275732Sjmg * notice, this list of conditions and the following disclaimer in the 15275732Sjmg * documentation and/or other materials provided with the distribution. 16275732Sjmg * 17275732Sjmg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18275732Sjmg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19275732Sjmg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20275732Sjmg * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21275732Sjmg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22275732Sjmg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23275732Sjmg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24275732Sjmg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25275732Sjmg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26275732Sjmg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27275732Sjmg * SUCH DAMAGE. 28275732Sjmg * 29275732Sjmg * $FreeBSD: releng/11.0/sys/opencrypto/gmac.h 281196 2015-04-07 09:00:03Z jmg $ 30275732Sjmg * 31275732Sjmg */ 32275732Sjmg 33275732Sjmg#ifndef _GMAC_H_ 34281196Sjmg#define _GMAC_H_ 35275732Sjmg 36275732Sjmg#include "gfmult.h" 37275732Sjmg#include <crypto/rijndael/rijndael.h> 38275732Sjmg 39275732Sjmg#define GMAC_BLOCK_LEN 16 40275732Sjmg#define GMAC_DIGEST_LEN 16 41275732Sjmg 42275732Sjmgstruct aes_gmac_ctx { 43275732Sjmg struct gf128table4 ghashtbl; 44275732Sjmg struct gf128 hash; 45275732Sjmg uint32_t keysched[4*(RIJNDAEL_MAXNR + 1)]; 46275732Sjmg uint8_t counter[GMAC_BLOCK_LEN]; 47275732Sjmg int rounds; 48275732Sjmg}; 49275732Sjmg 50275732Sjmgvoid AES_GMAC_Init(struct aes_gmac_ctx *); 51275732Sjmgvoid AES_GMAC_Setkey(struct aes_gmac_ctx *, const uint8_t *, uint16_t); 52275732Sjmgvoid AES_GMAC_Reinit(struct aes_gmac_ctx *, const uint8_t *, uint16_t); 53275732Sjmgint AES_GMAC_Update(struct aes_gmac_ctx *, const uint8_t *, uint16_t); 54275732Sjmgvoid AES_GMAC_Final(uint8_t [GMAC_DIGEST_LEN], struct aes_gmac_ctx *); 55275732Sjmg 56275732Sjmg#endif /* _GMAC_H_ */ 57