xform_auth.h revision 275732
155682Smarkm/* $FreeBSD: head/sys/opencrypto/xform.h 275732 2014-12-12 19:56:36Z jmg $ */ 2233294Sstas/* $OpenBSD: xform.h,v 1.8 2001/08/28 12:20:43 ben Exp $ */ 355682Smarkm 455682Smarkm/*- 5233294Sstas * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) 655682Smarkm * 755682Smarkm * This code was written by Angelos D. Keromytis in Athens, Greece, in 855682Smarkm * February 2000. Network Security Technologies Inc. (NSTI) kindly 9233294Sstas * supported the development of this code. 1055682Smarkm * 1155682Smarkm * Copyright (c) 2000 Angelos D. Keromytis 12233294Sstas * Copyright (c) 2014 The FreeBSD Foundation 1355682Smarkm * All rights reserved. 1455682Smarkm * 1555682Smarkm * Portions of this software were developed by John-Mark Gurney 16233294Sstas * under sponsorship of the FreeBSD Foundation and 1755682Smarkm * Rubicon Communications, LLC (Netgate). 1855682Smarkm * 1955682Smarkm * Permission to use, copy, and modify this software without fee 20233294Sstas * is hereby granted, provided that this entire notice is included in 2155682Smarkm * all source code copies of any software which is or includes a copy or 2255682Smarkm * modification of this software. 2355682Smarkm * 2455682Smarkm * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 2555682Smarkm * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 2655682Smarkm * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 2755682Smarkm * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 2855682Smarkm * PURPOSE. 2955682Smarkm */ 3055682Smarkm 3155682Smarkm#ifndef _CRYPTO_XFORM_H_ 3255682Smarkm#define _CRYPTO_XFORM_H_ 3355682Smarkm 3455682Smarkm#include <sys/md5.h> 3555682Smarkm#include <crypto/sha1.h> 3655682Smarkm#include <crypto/sha2/sha2.h> 3755682Smarkm#include <opencrypto/rmd160.h> 3855682Smarkm#include <opencrypto/gmac.h> 39178825Sdfr 4055682Smarkm/* Declarations */ 4155682Smarkmstruct auth_hash { 4255682Smarkm int type; 4355682Smarkm char *name; 4455682Smarkm u_int16_t keysize; 45233294Sstas u_int16_t hashsize; 4655682Smarkm u_int16_t ctxsize; 4755682Smarkm u_int16_t blocksize; 4855682Smarkm void (*Init) (void *); 4955682Smarkm void (*Setkey) (void *, const u_int8_t *, u_int16_t); 5055682Smarkm void (*Reinit) (void *, const u_int8_t *, u_int16_t); 5190926Snectar int (*Update) (void *, const u_int8_t *, u_int16_t); 5255682Smarkm void (*Final) (u_int8_t *, void *); 5355682Smarkm}; 54 55/* XXX use a define common with other hash stuff ! */ 56#define AH_ALEN_MAX 64 /* max authenticator hash length */ 57 58struct enc_xform { 59 int type; 60 char *name; 61 u_int16_t blocksize; 62 u_int16_t ivsize; 63 u_int16_t minkey, maxkey; 64 void (*encrypt) (caddr_t, u_int8_t *); 65 void (*decrypt) (caddr_t, u_int8_t *); 66 int (*setkey) (u_int8_t **, u_int8_t *, int len); 67 void (*zerokey) (u_int8_t **); 68 void (*reinit) (caddr_t, u_int8_t *); 69}; 70 71struct comp_algo { 72 int type; 73 char *name; 74 size_t minlen; 75 u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **); 76 u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **); 77}; 78 79union authctx { 80 MD5_CTX md5ctx; 81 SHA1_CTX sha1ctx; 82 RMD160_CTX rmd160ctx; 83 SHA256_CTX sha256ctx; 84 SHA384_CTX sha384ctx; 85 SHA512_CTX sha512ctx; 86 struct aes_gmac_ctx aes_gmac_ctx; 87}; 88 89extern struct enc_xform enc_xform_null; 90extern struct enc_xform enc_xform_des; 91extern struct enc_xform enc_xform_3des; 92extern struct enc_xform enc_xform_blf; 93extern struct enc_xform enc_xform_cast5; 94extern struct enc_xform enc_xform_skipjack; 95extern struct enc_xform enc_xform_rijndael128; 96extern struct enc_xform enc_xform_aes_icm; 97extern struct enc_xform enc_xform_aes_nist_gcm; 98extern struct enc_xform enc_xform_aes_nist_gmac; 99extern struct enc_xform enc_xform_aes_xts; 100extern struct enc_xform enc_xform_arc4; 101extern struct enc_xform enc_xform_camellia; 102 103extern struct auth_hash auth_hash_null; 104extern struct auth_hash auth_hash_key_md5; 105extern struct auth_hash auth_hash_key_sha1; 106extern struct auth_hash auth_hash_hmac_md5; 107extern struct auth_hash auth_hash_hmac_sha1; 108extern struct auth_hash auth_hash_hmac_ripemd_160; 109extern struct auth_hash auth_hash_hmac_sha2_256; 110extern struct auth_hash auth_hash_hmac_sha2_384; 111extern struct auth_hash auth_hash_hmac_sha2_512; 112extern struct auth_hash auth_hash_nist_gmac_aes_128; 113extern struct auth_hash auth_hash_nist_gmac_aes_192; 114extern struct auth_hash auth_hash_nist_gmac_aes_256; 115 116extern struct comp_algo comp_algo_deflate; 117 118#ifdef _KERNEL 119#include <sys/malloc.h> 120MALLOC_DECLARE(M_XDATA); 121#endif 122#endif /* _CRYPTO_XFORM_H_ */ 123