1104476Ssam/* $FreeBSD$ */ 2104476Ssam/* $OpenBSD: xform.h,v 1.8 2001/08/28 12:20:43 ben Exp $ */ 3104476Ssam 4139825Simp/*- 5104476Ssam * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) 6104476Ssam * 7104476Ssam * This code was written by Angelos D. Keromytis in Athens, Greece, in 8104476Ssam * February 2000. Network Security Technologies Inc. (NSTI) kindly 9104476Ssam * supported the development of this code. 10104476Ssam * 11104476Ssam * Copyright (c) 2000 Angelos D. Keromytis 12275732Sjmg * Copyright (c) 2014 The FreeBSD Foundation 13275732Sjmg * All rights reserved. 14104476Ssam * 15275732Sjmg * Portions of this software were developed by John-Mark Gurney 16275732Sjmg * under sponsorship of the FreeBSD Foundation and 17275732Sjmg * Rubicon Communications, LLC (Netgate). 18275732Sjmg * 19104476Ssam * Permission to use, copy, and modify this software without fee 20104476Ssam * is hereby granted, provided that this entire notice is included in 21104476Ssam * all source code copies of any software which is or includes a copy or 22104476Ssam * modification of this software. 23104476Ssam * 24104476Ssam * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 25104476Ssam * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 26104476Ssam * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 27104476Ssam * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 28104476Ssam * PURPOSE. 29104476Ssam */ 30104476Ssam 31292963Sallanjude#ifndef _CRYPTO_XFORM_AUTH_H_ 32292963Sallanjude#define _CRYPTO_XFORM_AUTH_H_ 33104476Ssam 34292963Sallanjude#include <sys/malloc.h> 35292963Sallanjude#include <sys/errno.h> 36292963Sallanjude 37104476Ssam#include <sys/md5.h> 38104476Ssam#include <crypto/sha1.h> 39292782Sallanjude#include <crypto/sha2/sha256.h> 40292782Sallanjude#include <crypto/sha2/sha384.h> 41292782Sallanjude#include <crypto/sha2/sha512.h> 42104476Ssam#include <opencrypto/rmd160.h> 43275732Sjmg#include <opencrypto/gmac.h> 44104476Ssam 45292963Sallanjude#include <opencrypto/cryptodev.h> 46292963Sallanjude#include <opencrypto/xform_userland.h> 47292963Sallanjude 48292963Sallanjude/* XXX use a define common with other hash stuff ! */ 49292963Sallanjude#define AH_ALEN_MAX 64 /* max authenticator hash length */ 50292963Sallanjude 51104476Ssam/* Declarations */ 52104476Ssamstruct auth_hash { 53104476Ssam int type; 54104476Ssam char *name; 55104476Ssam u_int16_t keysize; 56104476Ssam u_int16_t hashsize; 57275732Sjmg u_int16_t ctxsize; 58158703Spjd u_int16_t blocksize; 59104476Ssam void (*Init) (void *); 60275732Sjmg void (*Setkey) (void *, const u_int8_t *, u_int16_t); 61275732Sjmg void (*Reinit) (void *, const u_int8_t *, u_int16_t); 62275732Sjmg int (*Update) (void *, const u_int8_t *, u_int16_t); 63104476Ssam void (*Final) (u_int8_t *, void *); 64104476Ssam}; 65104476Ssam 66104476Ssamextern struct auth_hash auth_hash_null; 67104476Ssamextern struct auth_hash auth_hash_key_md5; 68104476Ssamextern struct auth_hash auth_hash_key_sha1; 69158703Spjdextern struct auth_hash auth_hash_hmac_md5; 70158703Spjdextern struct auth_hash auth_hash_hmac_sha1; 71158703Spjdextern struct auth_hash auth_hash_hmac_ripemd_160; 72104476Ssamextern struct auth_hash auth_hash_hmac_sha2_256; 73104476Ssamextern struct auth_hash auth_hash_hmac_sha2_384; 74104476Ssamextern struct auth_hash auth_hash_hmac_sha2_512; 75275732Sjmgextern struct auth_hash auth_hash_nist_gmac_aes_128; 76275732Sjmgextern struct auth_hash auth_hash_nist_gmac_aes_192; 77275732Sjmgextern struct auth_hash auth_hash_nist_gmac_aes_256; 78104476Ssam 79292963Sallanjudeunion authctx { 80292963Sallanjude MD5_CTX md5ctx; 81292963Sallanjude SHA1_CTX sha1ctx; 82292963Sallanjude RMD160_CTX rmd160ctx; 83292963Sallanjude SHA256_CTX sha256ctx; 84292963Sallanjude SHA384_CTX sha384ctx; 85292963Sallanjude SHA512_CTX sha512ctx; 86292963Sallanjude struct aes_gmac_ctx aes_gmac_ctx; 87292963Sallanjude}; 88104476Ssam 89292963Sallanjude#endif /* _CRYPTO_XFORM_AUTH_H_ */ 90