VIA CPU support: Detect and enable CPU features (RNG, ACE etc.).
[dragonfly.git] / sys / opencrypto / xform.h
CommitLineData
984263bc 1/* $FreeBSD: src/sys/opencrypto/xform.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
1de703da 2/* $DragonFly: src/sys/opencrypto/xform.h,v 1.2 2003/06/17 04:28:54 dillon Exp $ */
984263bc
MD
3/* $OpenBSD: xform.h,v 1.8 2001/08/28 12:20:43 ben Exp $ */
4
5/*
6 * The author of this code is Angelos D. Keromytis (angelos@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 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/md5.h>
30#include <crypto/sha1.h>
31#include <crypto/sha2/sha2.h>
32#include <opencrypto/rmd160.h>
33
34/* Declarations */
35struct auth_hash {
36 int type;
37 char *name;
38 u_int16_t keysize;
39 u_int16_t hashsize;
40 u_int16_t authsize;
41 u_int16_t ctxsize;
42 void (*Init) (void *);
43 int (*Update) (void *, u_int8_t *, u_int16_t);
44 void (*Final) (u_int8_t *, void *);
45};
46
47#define AH_ALEN_MAX 20 /* max authenticator hash length */
48
49struct enc_xform {
50 int type;
51 char *name;
52 u_int16_t blocksize;
53 u_int16_t minkey, maxkey;
54 void (*encrypt) (caddr_t, u_int8_t *);
55 void (*decrypt) (caddr_t, u_int8_t *);
56 int (*setkey) (u_int8_t **, u_int8_t *, int len);
57 void (*zerokey) (u_int8_t **);
58};
59
60struct comp_algo {
61 int type;
62 char *name;
63 size_t minlen;
64 u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **);
65 u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **);
66};
67
68union authctx {
69 MD5_CTX md5ctx;
70 SHA1_CTX sha1ctx;
71 RMD160_CTX rmd160ctx;
72 SHA256_CTX sha256ctx;
73 SHA384_CTX sha384ctx;
74 SHA512_CTX sha512ctx;
75};
76
77extern struct enc_xform enc_xform_null;
78extern struct enc_xform enc_xform_des;
79extern struct enc_xform enc_xform_3des;
80extern struct enc_xform enc_xform_blf;
81extern struct enc_xform enc_xform_cast5;
82extern struct enc_xform enc_xform_skipjack;
83extern struct enc_xform enc_xform_rijndael128;
84extern struct enc_xform enc_xform_arc4;
85
86extern struct auth_hash auth_hash_null;
87extern struct auth_hash auth_hash_key_md5;
88extern struct auth_hash auth_hash_key_sha1;
89extern struct auth_hash auth_hash_hmac_md5_96;
90extern struct auth_hash auth_hash_hmac_sha1_96;
91extern struct auth_hash auth_hash_hmac_ripemd_160_96;
92extern struct auth_hash auth_hash_hmac_sha2_256;
93extern struct auth_hash auth_hash_hmac_sha2_384;
94extern struct auth_hash auth_hash_hmac_sha2_512;
95
96extern struct comp_algo comp_algo_deflate;
97
98#ifdef _KERNEL
99#include <sys/malloc.h>
100MALLOC_DECLARE(M_XDATA);
101#endif
102#endif /* _CRYPTO_XFORM_H_ */