Annotation of embedaddon/ipsec-tools/src/racoon/algorithm.h, revision 1.1.1.1

1.1       misho       1: /*     $NetBSD: algorithm.h,v 1.5 2006/10/06 12:02:27 manu Exp $       */
                      2: 
                      3: /* Id: algorithm.h,v 1.10 2005/04/09 16:25:23 manubsd Exp */
                      4: 
                      5: /*
                      6:  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
                      7:  * All rights reserved.
                      8:  * 
                      9:  * Redistribution and use in source and binary forms, with or without
                     10:  * modification, are permitted provided that the following conditions
                     11:  * are met:
                     12:  * 1. Redistributions of source code must retain the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer.
                     14:  * 2. Redistributions in binary form must reproduce the above copyright
                     15:  *    notice, this list of conditions and the following disclaimer in the
                     16:  *    documentation and/or other materials provided with the distribution.
                     17:  * 3. Neither the name of the project nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  * 
                     21:  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  */
                     33: 
                     34: #ifndef _ALGORITHM_H
                     35: #define _ALGORITHM_H
                     36: 
                     37: #include <gnuc.h>
                     38: 
                     39: /* algorithm class */
                     40: enum {
                     41:        algclass_ipsec_enc,
                     42:        algclass_ipsec_auth,
                     43:        algclass_ipsec_comp,
                     44:        algclass_isakmp_enc,
                     45:        algclass_isakmp_hash,
                     46:        algclass_isakmp_dh,
                     47:        algclass_isakmp_ameth,  /* authentication method. */
                     48: #define MAXALGCLASS    7
                     49: };
                     50: 
                     51: #define ALG_DEFAULT_KEYLEN     64
                     52: 
                     53: #define ALGTYPE_NOTHING                0
                     54: 
                     55: /* algorithm type */
                     56: enum algtype {
                     57:        algtype_nothing = 0,
                     58: 
                     59:        /* enc */
                     60:        algtype_des_iv64,
                     61:        algtype_des,
                     62:        algtype_3des,
                     63:        algtype_rc5,
                     64:        algtype_idea,
                     65:        algtype_cast128,
                     66:        algtype_blowfish,
                     67:        algtype_3idea,
                     68:        algtype_des_iv32,
                     69:        algtype_rc4,
                     70:        algtype_null_enc,
                     71:        algtype_aes,
                     72:        algtype_twofish,
                     73:        algtype_camellia,
                     74: 
                     75:        /* ipsec auth */
                     76:        algtype_hmac_md5,
                     77:        algtype_hmac_sha1,
                     78:        algtype_des_mac,
                     79:        algtype_kpdk,
                     80:        algtype_non_auth,
                     81:        algtype_hmac_sha2_256,
                     82:        algtype_hmac_sha2_384,
                     83:        algtype_hmac_sha2_512,
                     84: 
                     85:        /* ipcomp */
                     86:        algtype_oui,
                     87:        algtype_deflate,
                     88:        algtype_lzs,
                     89: 
                     90:        /* hash */
                     91:        algtype_md5,
                     92:        algtype_sha1,
                     93:        algtype_tiger,
                     94:        algtype_sha2_256,
                     95:        algtype_sha2_384,
                     96:        algtype_sha2_512,
                     97: 
                     98:        /* dh_group */
                     99:        algtype_modp768,
                    100:        algtype_modp1024,
                    101:        algtype_ec2n155,
                    102:        algtype_ec2n185,
                    103:        algtype_modp1536,
                    104:        algtype_modp2048,
                    105:        algtype_modp3072,
                    106:        algtype_modp4096,
                    107:        algtype_modp6144,
                    108:        algtype_modp8192,
                    109: 
                    110:        /* authentication method. */
                    111:        algtype_psk,
                    112:        algtype_dsssig,
                    113:        algtype_rsasig,
                    114:        algtype_rsaenc,
                    115:        algtype_rsarev,
                    116:        algtype_gssapikrb,
                    117: #ifdef ENABLE_HYBRID
                    118:        algtype_hybrid_rsa_s,
                    119:        algtype_hybrid_dss_s,
                    120:        algtype_hybrid_rsa_c,
                    121:        algtype_hybrid_dss_c,
                    122:        algtype_xauth_psk_s,
                    123:        algtype_xauth_psk_c,
                    124:        algtype_xauth_rsa_s,
                    125:        algtype_xauth_rsa_c,
                    126: #endif
                    127: };
                    128: 
                    129: struct hmac_algorithm {
                    130:        char *name;
                    131:        int type;
                    132:        int doi;
                    133:        caddr_t (*init) __P((vchar_t *));
                    134:        void (*update) __P((caddr_t, vchar_t *));
                    135:        vchar_t *(*final) __P((caddr_t));
                    136:        int (*hashlen) __P((void));
                    137:        vchar_t *(*one) __P((vchar_t *, vchar_t *));
                    138: };
                    139: 
                    140: struct hash_algorithm {
                    141:        char *name;
                    142:        int type;
                    143:        int doi;
                    144:        caddr_t (*init) __P((void));
                    145:        void (*update) __P((caddr_t, vchar_t *));
                    146:        vchar_t *(*final) __P((caddr_t));
                    147:        int (*hashlen) __P((void));
                    148:        vchar_t *(*one) __P((vchar_t *));
                    149: };
                    150: 
                    151: struct enc_algorithm {
                    152:        char *name;
                    153:        int type;
                    154:        int doi;
                    155:        int blocklen;
                    156:        vchar_t *(*encrypt) __P((vchar_t *, vchar_t *, vchar_t *));
                    157:        vchar_t *(*decrypt) __P((vchar_t *, vchar_t *, vchar_t *));
                    158:        int (*weakkey) __P((vchar_t *));
                    159:        int (*keylen) __P((int));
                    160: };
                    161: 
                    162: /* dh group */
                    163: struct dh_algorithm {
                    164:        char *name;
                    165:        int type;
                    166:        int doi;
                    167:        struct dhgroup *dhgroup;
                    168: };
                    169: 
                    170: /* ipcomp, auth meth, dh group */
                    171: struct misc_algorithm {
                    172:        char *name;
                    173:        int type;
                    174:        int doi;
                    175: };
                    176: 
                    177: extern int alg_oakley_hashdef_ok __P((int));
                    178: extern int alg_oakley_hashdef_doi __P((int));
                    179: extern int alg_oakley_hashdef_hashlen __P((int));
                    180: extern vchar_t *alg_oakley_hashdef_one __P((int, vchar_t *));
                    181: 
                    182: extern int alg_oakley_hmacdef_doi __P((int));
                    183: extern vchar_t *alg_oakley_hmacdef_one __P((int, vchar_t *, vchar_t *));
                    184: 
                    185: extern int alg_oakley_encdef_ok __P((int));
                    186: extern int alg_oakley_encdef_doi __P((int));
                    187: extern int alg_oakley_encdef_keylen __P((int, int));
                    188: extern int alg_oakley_encdef_blocklen __P((int));
                    189: extern vchar_t *alg_oakley_encdef_decrypt __P((int, vchar_t *, vchar_t *, vchar_t *));
                    190: extern vchar_t *alg_oakley_encdef_encrypt __P((int, vchar_t *, vchar_t *, vchar_t *));
                    191: 
                    192: extern int alg_ipsec_encdef_doi __P((int));
                    193: extern int alg_ipsec_encdef_keylen __P((int, int));
                    194: 
                    195: extern int alg_ipsec_hmacdef_doi __P((int));
                    196: extern int alg_ipsec_hmacdef_hashlen __P((int));
                    197: 
                    198: extern int alg_ipsec_compdef_doi __P((int));
                    199: 
                    200: extern int alg_oakley_dhdef_doi __P((int));
                    201: extern int alg_oakley_dhdef_ok __P((int));
                    202: extern struct dhgroup *alg_oakley_dhdef_group __P((int));
                    203: 
                    204: extern int alg_oakley_authdef_doi __P((int));
                    205: 
                    206: extern int default_keylen __P((int, int));
                    207: extern int check_keylen __P((int, int, int));
                    208: extern int algtype2doi __P((int, int));
                    209: extern int algclass2doi __P((int));
                    210: 
                    211: extern const char *alg_oakley_encdef_name __P((int));
                    212: extern const char *alg_oakley_hashdef_name __P((int));
                    213: extern const char *alg_oakley_dhdef_name __P((int));
                    214: extern const char *alg_oakley_authdef_name __P((int));
                    215: 
                    216: #endif /* _ALGORITHM_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>