Home | History | Annotate | Line # | Download | only in opencrypto
      1 /*	$NetBSD: xform.h,v 1.23 2026/07/05 15:33:44 riastradh Exp $ */
      2 /*	$FreeBSD: src/sys/opencrypto/xform.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $	*/
      3 /*	$OpenBSD: xform.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $	*/
      4 
      5 /*
      6  * The author of this code is Angelos D. Keromytis (angelos (at) cis.upenn.edu)
      7  *
      8  * This code was written by Angelos D. Keromytis in Athens, Greece, in
      9  * February 2000. Network Security Technologies Inc. (NSTI) kindly
     10  * supported the development of this code.
     11  *
     12  * Copyright (c) 2000 Angelos D. Keromytis
     13  *
     14  * Permission to use, copy, and modify this software with or without fee
     15  * is hereby granted, provided that this entire notice is included in
     16  * all source code copies of any software which is or includes a copy or
     17  * modification of this software.
     18  *
     19  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
     20  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
     21  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
     22  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
     23  * PURPOSE.
     24  */
     25 
     26 #ifndef _CRYPTO_XFORM_H_
     27 #define _CRYPTO_XFORM_H_
     28 
     29 #include <sys/types.h>
     30 
     31 /* Declarations */
     32 struct auth_hash {
     33 	int type;
     34 	const char *name;
     35 	uint16_t keysize;
     36 	uint16_t hashsize;
     37 	uint16_t authsize;
     38 	uint16_t blocksize;
     39 };
     40 
     41 /* Provide array-limit for clients (e.g., netipsec) */
     42 #define	AH_ALEN_MAX	32	/* max authenticator hash length */
     43 
     44 struct enc_xform {
     45 	int type;
     46 	const char *name;
     47 	uint16_t blocksize;
     48 	uint16_t ivsize;
     49 	uint16_t minkey;
     50 	uint16_t maxkey;
     51 };
     52 
     53 struct comp_algo {
     54 	int type;
     55 	const char *name;
     56 	size_t minlen;
     57 };
     58 
     59 extern const uint8_t hmac_ipad_buffer[128];
     60 extern const uint8_t hmac_opad_buffer[128];
     61 
     62 extern const struct enc_xform enc_xform_null;
     63 extern const struct enc_xform enc_xform_des;
     64 extern const struct enc_xform enc_xform_3des;
     65 extern const struct enc_xform enc_xform_blf;
     66 extern const struct enc_xform enc_xform_cast5;
     67 extern const struct enc_xform enc_xform_skipjack;
     68 extern const struct enc_xform enc_xform_aes;
     69 extern const struct enc_xform enc_xform_arc4;
     70 extern const struct enc_xform enc_xform_camellia;
     71 extern const struct enc_xform enc_xform_aes_ctr;
     72 extern const struct enc_xform enc_xform_aes_gcm;
     73 extern const struct enc_xform enc_xform_aes_gmac;
     74 
     75 extern const struct auth_hash auth_hash_null;
     76 extern const struct auth_hash auth_hash_md5;
     77 extern const struct auth_hash auth_hash_sha1;
     78 extern const struct auth_hash auth_hash_key_md5;
     79 extern const struct auth_hash auth_hash_key_sha1;
     80 extern const struct auth_hash auth_hash_hmac_md5;
     81 extern const struct auth_hash auth_hash_hmac_sha1;
     82 extern const struct auth_hash auth_hash_hmac_ripemd_160;
     83 extern const struct auth_hash auth_hash_hmac_md5_96;
     84 extern const struct auth_hash auth_hash_hmac_sha1_96;
     85 extern const struct auth_hash auth_hash_hmac_ripemd_160_96;
     86 extern const struct auth_hash auth_hash_hmac_sha2_256;
     87 extern const struct auth_hash auth_hash_hmac_sha2_384;
     88 extern const struct auth_hash auth_hash_hmac_sha2_512;
     89 extern const struct auth_hash auth_hash_aes_xcbc_mac_96;
     90 extern const struct auth_hash auth_hash_gmac_aes_128;
     91 extern const struct auth_hash auth_hash_gmac_aes_192;
     92 extern const struct auth_hash auth_hash_gmac_aes_256;
     93 
     94 extern const struct comp_algo comp_algo_deflate;
     95 extern const struct comp_algo comp_algo_deflate_nogrow;
     96 extern const struct comp_algo comp_algo_gzip;
     97 
     98 #ifdef _KERNEL
     99 #include <sys/malloc.h>
    100 MALLOC_DECLARE(M_XDATA);
    101 #endif
    102 #endif /* _CRYPTO_XFORM_H_ */
    103