xref: /freebsd/sys/opencrypto/xform_gmac.c (revision 9b6b2f8608e24fc824404e2b47e2cecc669b189b)
12155bb23SAllan Jude /*	$OpenBSD: xform.c,v 1.16 2001/08/28 12:20:43 ben Exp $	*/
22155bb23SAllan Jude /*-
32155bb23SAllan Jude  * The authors of this code are John Ioannidis (ji@tla.org),
42155bb23SAllan Jude  * Angelos D. Keromytis (kermit@csd.uch.gr),
52155bb23SAllan Jude  * Niels Provos (provos@physnet.uni-hamburg.de) and
62155bb23SAllan Jude  * Damien Miller (djm@mindrot.org).
72155bb23SAllan Jude  *
82155bb23SAllan Jude  * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
92155bb23SAllan Jude  * in November 1995.
102155bb23SAllan Jude  *
112155bb23SAllan Jude  * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
122155bb23SAllan Jude  * by Angelos D. Keromytis.
132155bb23SAllan Jude  *
142155bb23SAllan Jude  * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
152155bb23SAllan Jude  * and Niels Provos.
162155bb23SAllan Jude  *
172155bb23SAllan Jude  * Additional features in 1999 by Angelos D. Keromytis.
182155bb23SAllan Jude  *
192155bb23SAllan Jude  * AES XTS implementation in 2008 by Damien Miller
202155bb23SAllan Jude  *
212155bb23SAllan Jude  * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
222155bb23SAllan Jude  * Angelos D. Keromytis and Niels Provos.
232155bb23SAllan Jude  *
242155bb23SAllan Jude  * Copyright (C) 2001, Angelos D. Keromytis.
252155bb23SAllan Jude  *
262155bb23SAllan Jude  * Copyright (C) 2008, Damien Miller
272155bb23SAllan Jude  * Copyright (c) 2014 The FreeBSD Foundation
282155bb23SAllan Jude  * All rights reserved.
292155bb23SAllan Jude  *
302155bb23SAllan Jude  * Portions of this software were developed by John-Mark Gurney
312155bb23SAllan Jude  * under sponsorship of the FreeBSD Foundation and
322155bb23SAllan Jude  * Rubicon Communications, LLC (Netgate).
332155bb23SAllan Jude  *
342155bb23SAllan Jude  * Permission to use, copy, and modify this software with or without fee
352155bb23SAllan Jude  * is hereby granted, provided that this entire notice is included in
362155bb23SAllan Jude  * all copies of any software which is or includes a copy or
372155bb23SAllan Jude  * modification of this software.
382155bb23SAllan Jude  * You may use this code under the GNU public license if you so wish. Please
392155bb23SAllan Jude  * contribute changes back to the authors under this freer than GPL license
402155bb23SAllan Jude  * so that we may further the use of strong encryption without limitations to
412155bb23SAllan Jude  * all.
422155bb23SAllan Jude  *
432155bb23SAllan Jude  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
442155bb23SAllan Jude  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
452155bb23SAllan Jude  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
462155bb23SAllan Jude  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
472155bb23SAllan Jude  * PURPOSE.
482155bb23SAllan Jude  */
492155bb23SAllan Jude 
502155bb23SAllan Jude #include <sys/cdefs.h>
512155bb23SAllan Jude __FBSDID("$FreeBSD$");
522155bb23SAllan Jude 
532155bb23SAllan Jude #include <opencrypto/gmac.h>
542155bb23SAllan Jude #include <opencrypto/xform_auth.h>
552155bb23SAllan Jude 
562155bb23SAllan Jude /* Encryption instances */
572155bb23SAllan Jude struct enc_xform enc_xform_aes_nist_gmac = {
583e947048SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
593e947048SJohn Baldwin 	.name = "AES-GMAC",
603e947048SJohn Baldwin 	.blocksize = AES_ICM_BLOCK_LEN,
613e947048SJohn Baldwin 	.ivsize = AES_GCM_IV_LEN,
623e947048SJohn Baldwin 	.minkey = AES_MIN_KEY,
633e947048SJohn Baldwin 	.maxkey = AES_MAX_KEY,
642155bb23SAllan Jude };
652155bb23SAllan Jude 
662155bb23SAllan Jude /* Authentication instances */
672155bb23SAllan Jude struct auth_hash auth_hash_nist_gmac_aes_128 = {
68*9b6b2f86SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
69*9b6b2f86SJohn Baldwin 	.name = "GMAC-AES-128",
70*9b6b2f86SJohn Baldwin 	.keysize = AES_128_GMAC_KEY_LEN,
71*9b6b2f86SJohn Baldwin 	.hashsize = AES_GMAC_HASH_LEN,
72*9b6b2f86SJohn Baldwin 	.ctxsize = sizeof(struct aes_gmac_ctx),
73*9b6b2f86SJohn Baldwin 	.blocksize = GMAC_BLOCK_LEN,
74*9b6b2f86SJohn Baldwin 	.Init = AES_GMAC_Init,
75*9b6b2f86SJohn Baldwin 	.Setkey = AES_GMAC_Setkey,
76*9b6b2f86SJohn Baldwin 	.Reinit = AES_GMAC_Reinit,
77*9b6b2f86SJohn Baldwin 	.Update = AES_GMAC_Update,
78*9b6b2f86SJohn Baldwin 	.Final = AES_GMAC_Final,
792155bb23SAllan Jude };
802155bb23SAllan Jude 
812155bb23SAllan Jude struct auth_hash auth_hash_nist_gmac_aes_192 = {
82*9b6b2f86SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
83*9b6b2f86SJohn Baldwin 	.name = "GMAC-AES-192",
84*9b6b2f86SJohn Baldwin 	.keysize = AES_192_GMAC_KEY_LEN,
85*9b6b2f86SJohn Baldwin 	.hashsize = AES_GMAC_HASH_LEN,
86*9b6b2f86SJohn Baldwin 	.ctxsize = sizeof(struct aes_gmac_ctx),
87*9b6b2f86SJohn Baldwin 	.blocksize = GMAC_BLOCK_LEN,
88*9b6b2f86SJohn Baldwin 	.Init = AES_GMAC_Init,
89*9b6b2f86SJohn Baldwin 	.Setkey = AES_GMAC_Setkey,
90*9b6b2f86SJohn Baldwin 	.Reinit = AES_GMAC_Reinit,
91*9b6b2f86SJohn Baldwin 	.Update = AES_GMAC_Update,
92*9b6b2f86SJohn Baldwin 	.Final = AES_GMAC_Final,
932155bb23SAllan Jude };
942155bb23SAllan Jude 
952155bb23SAllan Jude struct auth_hash auth_hash_nist_gmac_aes_256 = {
96*9b6b2f86SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
97*9b6b2f86SJohn Baldwin 	.name = "GMAC-AES-256",
98*9b6b2f86SJohn Baldwin 	.keysize = AES_256_GMAC_KEY_LEN,
99*9b6b2f86SJohn Baldwin 	.hashsize = AES_GMAC_HASH_LEN,
100*9b6b2f86SJohn Baldwin 	.ctxsize = sizeof(struct aes_gmac_ctx),
101*9b6b2f86SJohn Baldwin 	.blocksize = GMAC_BLOCK_LEN,
102*9b6b2f86SJohn Baldwin 	.Init = AES_GMAC_Init,
103*9b6b2f86SJohn Baldwin 	.Setkey = AES_GMAC_Setkey,
104*9b6b2f86SJohn Baldwin 	.Reinit = AES_GMAC_Reinit,
105*9b6b2f86SJohn Baldwin 	.Update = AES_GMAC_Update,
106*9b6b2f86SJohn Baldwin 	.Final = AES_GMAC_Final,
1072155bb23SAllan Jude };
108