1 /* IKE modular algorithm handling interface
2 * Author: JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 #include "connections.h"
23 struct ike_alg
*algo_next
;
26 typedef struct enc_testvector enc_testvector_t
;
28 struct enc_testvector
{
29 const size_t key_size
;
32 const size_t data_size
;
40 struct ike_alg
*algo_next
;
47 void (*do_crypt
)(u_int8_t
*dat
, size_t datasize
, u_int8_t
*key
, size_t key_size
, u_int8_t
*iv
, bool enc
);
48 const enc_testvector_t
*enc_testvectors
;
51 typedef struct hash_testvector hash_testvector_t
;
53 struct hash_testvector
{
54 const size_t msg_size
;
56 const u_char
*msg_digest
;
59 typedef struct hmac_testvector hmac_testvector_t
;
61 struct hmac_testvector
{
62 const size_t key_size
;
64 const size_t msg_size
;
71 struct ike_alg
*algo_next
;
72 size_t hash_digest_size
;
73 const hash_testvector_t
*hash_testvectors
;
74 const hmac_testvector_t
*hmac_testvectors
;
77 #define IKE_ALG_ENCRYPT 0
78 #define IKE_ALG_HASH 1
79 #define IKE_ALG_MAX IKE_ALG_HASH
81 extern int ike_alg_add(struct ike_alg
*a
);
82 extern struct hash_desc
*ike_alg_get_hasher(u_int alg
);
83 extern struct encrypt_desc
*ike_alg_get_encrypter(u_int alg
);
84 extern bool ike_alg_enc_present(u_int ealg
);
85 extern bool ike_alg_hash_present(u_int halg
);
86 extern int ike_alg_register_hash(struct hash_desc
*a
);
87 extern int ike_alg_register_enc(struct encrypt_desc
*e
);
88 extern const struct oakley_group_desc
* ike_alg_pfsgroup(struct connection
*c
90 extern struct db_context
* ike_alg_db_new(struct alg_info_ike
*ai
, lset_t policy
);
91 extern void ike_alg_list(void);
92 extern void ike_alg_show_connection(struct connection
*c
, const char *instance
);
93 extern bool ike_alg_test(void);
94 extern bool ike_alg_ok_final(u_int ealg
, u_int key_len
, u_int aalg
, u_int group
95 , struct alg_info_ike
*alg_info_ike
);
96 extern int ike_alg_init(void);
98 #endif /* _IKE_ALG_H */