xref: /freebsd/sys/opencrypto/xform_gmac.c (revision 685dc743)
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 #include <opencrypto/gmac.h>
522155bb23SAllan Jude #include <opencrypto/xform_auth.h>
53faf470ffSJohn Baldwin #include <opencrypto/xform_enc.h>
542155bb23SAllan Jude 
552155bb23SAllan Jude /* Encryption instances */
56d8787d4fSMark Johnston const struct enc_xform enc_xform_aes_nist_gmac = {
573e947048SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
583e947048SJohn Baldwin 	.name = "AES-GMAC",
593e947048SJohn Baldwin 	.blocksize = AES_ICM_BLOCK_LEN,
603e947048SJohn Baldwin 	.ivsize = AES_GCM_IV_LEN,
613e947048SJohn Baldwin 	.minkey = AES_MIN_KEY,
623e947048SJohn Baldwin 	.maxkey = AES_MAX_KEY,
632155bb23SAllan Jude };
642155bb23SAllan Jude 
652155bb23SAllan Jude /* Authentication instances */
66d8787d4fSMark Johnston const struct auth_hash auth_hash_nist_gmac_aes_128 = {
679b6b2f86SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
689b6b2f86SJohn Baldwin 	.name = "GMAC-AES-128",
699b6b2f86SJohn Baldwin 	.keysize = AES_128_GMAC_KEY_LEN,
709b6b2f86SJohn Baldwin 	.hashsize = AES_GMAC_HASH_LEN,
719b6b2f86SJohn Baldwin 	.ctxsize = sizeof(struct aes_gmac_ctx),
729b6b2f86SJohn Baldwin 	.blocksize = GMAC_BLOCK_LEN,
739b6b2f86SJohn Baldwin 	.Init = AES_GMAC_Init,
749b6b2f86SJohn Baldwin 	.Setkey = AES_GMAC_Setkey,
759b6b2f86SJohn Baldwin 	.Reinit = AES_GMAC_Reinit,
769b6b2f86SJohn Baldwin 	.Update = AES_GMAC_Update,
779b6b2f86SJohn Baldwin 	.Final = AES_GMAC_Final,
782155bb23SAllan Jude };
792155bb23SAllan Jude 
80d8787d4fSMark Johnston const struct auth_hash auth_hash_nist_gmac_aes_192 = {
819b6b2f86SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
829b6b2f86SJohn Baldwin 	.name = "GMAC-AES-192",
839b6b2f86SJohn Baldwin 	.keysize = AES_192_GMAC_KEY_LEN,
849b6b2f86SJohn Baldwin 	.hashsize = AES_GMAC_HASH_LEN,
859b6b2f86SJohn Baldwin 	.ctxsize = sizeof(struct aes_gmac_ctx),
869b6b2f86SJohn Baldwin 	.blocksize = GMAC_BLOCK_LEN,
879b6b2f86SJohn Baldwin 	.Init = AES_GMAC_Init,
889b6b2f86SJohn Baldwin 	.Setkey = AES_GMAC_Setkey,
899b6b2f86SJohn Baldwin 	.Reinit = AES_GMAC_Reinit,
909b6b2f86SJohn Baldwin 	.Update = AES_GMAC_Update,
919b6b2f86SJohn Baldwin 	.Final = AES_GMAC_Final,
922155bb23SAllan Jude };
932155bb23SAllan Jude 
94d8787d4fSMark Johnston const struct auth_hash auth_hash_nist_gmac_aes_256 = {
959b6b2f86SJohn Baldwin 	.type = CRYPTO_AES_NIST_GMAC,
969b6b2f86SJohn Baldwin 	.name = "GMAC-AES-256",
979b6b2f86SJohn Baldwin 	.keysize = AES_256_GMAC_KEY_LEN,
989b6b2f86SJohn Baldwin 	.hashsize = AES_GMAC_HASH_LEN,
999b6b2f86SJohn Baldwin 	.ctxsize = sizeof(struct aes_gmac_ctx),
1009b6b2f86SJohn Baldwin 	.blocksize = GMAC_BLOCK_LEN,
1019b6b2f86SJohn Baldwin 	.Init = AES_GMAC_Init,
1029b6b2f86SJohn Baldwin 	.Setkey = AES_GMAC_Setkey,
1039b6b2f86SJohn Baldwin 	.Reinit = AES_GMAC_Reinit,
1049b6b2f86SJohn Baldwin 	.Update = AES_GMAC_Update,
1059b6b2f86SJohn Baldwin 	.Final = AES_GMAC_Final,
1062155bb23SAllan Jude };
107