2 * Kernel runtime algorithm handling interface definitions
3 * Author: JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
5 * kernel_alg.h,v 1.1.2.1 2003/11/21 18:12:23 jjo Exp
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 #include "openswan/pfkeyv2.h"
22 struct sadb_msg; /* forward definition */
24 /* Registration messages from pluto */
25 extern void kernel_alg_register_pfkey(const struct sadb_msg *msg, int buflen);
32 extern struct sadb_alg *kernel_alg_esp_sadb_alg(int alg_id);
33 extern int kernel_alg_esp_ivlen(int alg_id);
34 /* returns bool success if esp encrypt alg is present */
35 extern err_t kernel_alg_esp_enc_ok(int alg_id, unsigned int key_len, struct alg_info_esp *nfo);
36 extern bool kernel_alg_esp_ok_final(int ealg, unsigned int key_len, int aalg, struct alg_info_esp *alg_info);
37 /* returns encrypt keylen in BYTES for esp enc alg passed */
38 extern int kernel_alg_esp_enc_keylen(int alg_id);
39 /* returns bool success if esp auth alg is present */
40 extern err_t kernel_alg_esp_auth_ok(int auth, struct alg_info_esp *nfo);
42 extern int kernel_alg_ah_auth_keylen(int auth);
43 extern err_t kernel_alg_ah_auth_ok(int auth,struct alg_info_esp *alg_info);
46 /* returns auth keylen in BYTES for esp auth alg passed */
47 extern int kernel_alg_esp_auth_keylen(int auth);
48 /* returns 0 if read ok from /proc/net/pf_key_supported */
49 extern int kernel_alg_proc_read(void);
51 /* get sadb_alg for passed args */
52 extern const struct sadb_alg * kernel_alg_sadb_alg_get(int satype, int exttype, int alg_id);
55 extern struct db_context * kernel_alg_db_new(struct alg_info_esp *ai
59 /* returns pointer to static buffer, no reentrant */
60 extern struct esp_info *kernel_alg_esp_info(u_int8_t transid
64 extern struct sadb_alg esp_aalg[];
65 extern struct sadb_alg esp_ealg[];
66 extern int esp_ealg_num;
67 extern int esp_aalg_num;
69 #define ESP_EALG_PRESENT(algo) (((algo)<=K_SADB_EALG_MAX)&&(esp_ealg[(algo)].sadb_alg_id==(algo)))
70 #define ESP_EALG_FOR_EACH(algo) \
71 for (algo=1; algo <= K_SADB_EALG_MAX; algo++) \
72 if (ESP_EALG_PRESENT(algo))
73 #define ESP_EALG_FOR_EACH_UPDOWN(algo) \
74 for (algo=K_SADB_EALG_MAX; algo >0 ; algo--) \
75 if (ESP_EALG_PRESENT(algo))
76 #define ESP_AALG_PRESENT(algo) ((algo<=SADB_AALG_MAX)&&(esp_aalg[(algo)].sadb_alg_id==(algo)))
77 #define ESP_AALG_FOR_EACH(algo) \
78 for (algo=1; algo <= SADB_AALG_MAX; algo++) \
79 if (ESP_AALG_PRESENT(algo))
80 #define ESP_AALG_FOR_EACH_UPDOWN(algo) \
81 for (algo=SADB_AALG_MAX; algo >0 ; algo--) \
82 if (ESP_AALG_PRESENT(algo))
84 /* used by test skaffold */
85 extern int kernel_alg_add(int satype, int exttype
86 , const struct sadb_alg *sadb_alg);
89 #endif /* _KERNEL_ALG_H */