xform_auth.h revision 213068
1104476Ssam/* $FreeBSD: head/sys/opencrypto/xform.h 213068 2010-09-23 11:52:32Z pjd $ */ 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 12104476Ssam * 13104476Ssam * Permission to use, copy, and modify this software without fee 14104476Ssam * is hereby granted, provided that this entire notice is included in 15104476Ssam * all source code copies of any software which is or includes a copy or 16104476Ssam * modification of this software. 17104476Ssam * 18104476Ssam * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 19104476Ssam * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 20104476Ssam * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 21104476Ssam * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 22104476Ssam * PURPOSE. 23104476Ssam */ 24104476Ssam 25104476Ssam#ifndef _CRYPTO_XFORM_H_ 26104476Ssam#define _CRYPTO_XFORM_H_ 27104476Ssam 28104476Ssam#include <sys/md5.h> 29104476Ssam#include <crypto/sha1.h> 30104476Ssam#include <crypto/sha2/sha2.h> 31104476Ssam#include <opencrypto/rmd160.h> 32104476Ssam 33104476Ssam/* Declarations */ 34104476Ssamstruct auth_hash { 35104476Ssam int type; 36104476Ssam char *name; 37104476Ssam u_int16_t keysize; 38104476Ssam u_int16_t hashsize; 39158703Spjd u_int16_t blocksize; 40104476Ssam u_int16_t ctxsize; 41104476Ssam void (*Init) (void *); 42104476Ssam int (*Update) (void *, u_int8_t *, u_int16_t); 43104476Ssam void (*Final) (u_int8_t *, void *); 44104476Ssam}; 45104476Ssam 46104476Ssam#define AH_ALEN_MAX 20 /* max authenticator hash length */ 47104476Ssam 48104476Ssamstruct enc_xform { 49104476Ssam int type; 50104476Ssam char *name; 51104476Ssam u_int16_t blocksize; 52104476Ssam u_int16_t minkey, maxkey; 53104476Ssam void (*encrypt) (caddr_t, u_int8_t *); 54104476Ssam void (*decrypt) (caddr_t, u_int8_t *); 55104476Ssam int (*setkey) (u_int8_t **, u_int8_t *, int len); 56104476Ssam void (*zerokey) (u_int8_t **); 57213068Spjd void (*reinit) (caddr_t, u_int8_t *); 58104476Ssam}; 59104476Ssam 60104476Ssamstruct comp_algo { 61104476Ssam int type; 62104476Ssam char *name; 63104476Ssam size_t minlen; 64104476Ssam u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **); 65104476Ssam u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **); 66104476Ssam}; 67104476Ssam 68104476Ssamunion authctx { 69104476Ssam MD5_CTX md5ctx; 70104476Ssam SHA1_CTX sha1ctx; 71104476Ssam RMD160_CTX rmd160ctx; 72104476Ssam SHA256_CTX sha256ctx; 73104476Ssam SHA384_CTX sha384ctx; 74104476Ssam SHA512_CTX sha512ctx; 75104476Ssam}; 76104476Ssam 77104476Ssamextern struct enc_xform enc_xform_null; 78104476Ssamextern struct enc_xform enc_xform_des; 79104476Ssamextern struct enc_xform enc_xform_3des; 80104476Ssamextern struct enc_xform enc_xform_blf; 81104476Ssamextern struct enc_xform enc_xform_cast5; 82104476Ssamextern struct enc_xform enc_xform_skipjack; 83104476Ssamextern struct enc_xform enc_xform_rijndael128; 84213068Spjdextern struct enc_xform enc_xform_aes_xts; 85104476Ssamextern struct enc_xform enc_xform_arc4; 86169425Sgnnextern struct enc_xform enc_xform_camellia; 87104476Ssam 88104476Ssamextern struct auth_hash auth_hash_null; 89104476Ssamextern struct auth_hash auth_hash_key_md5; 90104476Ssamextern struct auth_hash auth_hash_key_sha1; 91158703Spjdextern struct auth_hash auth_hash_hmac_md5; 92158703Spjdextern struct auth_hash auth_hash_hmac_sha1; 93158703Spjdextern struct auth_hash auth_hash_hmac_ripemd_160; 94104476Ssamextern struct auth_hash auth_hash_hmac_sha2_256; 95104476Ssamextern struct auth_hash auth_hash_hmac_sha2_384; 96104476Ssamextern struct auth_hash auth_hash_hmac_sha2_512; 97104476Ssam 98104476Ssamextern struct comp_algo comp_algo_deflate; 99104476Ssam 100104476Ssam#ifdef _KERNEL 101104476Ssam#include <sys/malloc.h> 102104476SsamMALLOC_DECLARE(M_XDATA); 103104476Ssam#endif 104104476Ssam#endif /* _CRYPTO_XFORM_H_ */ 105