4 #define IKE_ALG_COMMON \
7 struct ike_alg *algo_next
18 void (*do_crypt)(u_int8_t *dat, size_t datasize, u_int8_t *key, size_t key_size, u_int8_t *iv, bool enc);
23 size_t hash_digest_size;
24 void (*hash_init)(void *ctx);
25 void (*hash_update)(void *ctx, const u_int8_t *in, size_t datasize);
26 void (*hash_final)(u_int8_t *out, void *ctx);
28 struct db_context * ike_alg_db_new(struct alg_info_ike *ai, lset_t policy);
29 void ike_alg_show_status(void);
30 void ike_alg_show_connection(struct connection *c, const char *instance);
32 #define IKE_EALG_FOR_EACH(a) \
33 for(a=ike_alg_base[IKE_ALG_ENCRYPT];a;a=a->algo_next)
34 #define IKE_HALG_FOR_EACH(a) \
35 for(a=ike_alg_base[IKE_ALG_HASH];a;a=a->algo_next)
36 bool ike_alg_enc_present(int ealg);
37 bool ike_alg_hash_present(int halg);
38 bool ike_alg_enc_ok(int ealg, unsigned key_len, struct alg_info_ike *alg_info_ike, const char **);
40 int ike_alg_init(void);
43 * This could be just OAKLEY_XXXXXX_ALGORITHM, but it's
44 * here with other name as a way to assure that the
45 * algorithm hook type is supported (detected at compile time)
47 #define IKE_ALG_ENCRYPT 0
48 #define IKE_ALG_HASH 1
50 extern struct ike_alg *ike_alg_base[IKE_ALG_MAX+1];
51 int ike_alg_add(struct ike_alg *);
52 int ike_alg_register_enc(struct encrypt_desc *e);
53 int ike_alg_register_hash(struct hash_desc *a);
54 struct ike_alg *ike_alg_find(unsigned algo_type, unsigned algo_id, unsigned keysize);
55 static __inline__ struct hash_desc *ike_alg_get_hasher(int alg)
57 return (struct hash_desc *) ike_alg_find(IKE_ALG_HASH, alg, 0);
59 static __inline__ struct encrypt_desc *ike_alg_get_encrypter(int alg)
61 return (struct encrypt_desc *) ike_alg_find(IKE_ALG_ENCRYPT, alg, 0);
63 #endif /* _IKE_ALG_H */