12 #include <linux/module.h>
13 #include <linux/kernel.h>
18 #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
30 .name =
"rfc4106(gcm(aes))",
41 .sadb_alg_minbits = 128,
42 .sadb_alg_maxbits = 256
46 .name =
"rfc4106(gcm(aes))",
57 .sadb_alg_minbits = 128,
58 .sadb_alg_maxbits = 256
62 .name =
"rfc4106(gcm(aes))",
73 .sadb_alg_minbits = 128,
74 .sadb_alg_maxbits = 256
78 .name =
"rfc4309(ccm(aes))",
89 .sadb_alg_minbits = 128,
90 .sadb_alg_maxbits = 256
94 .name =
"rfc4309(ccm(aes))",
105 .sadb_alg_minbits = 128,
106 .sadb_alg_maxbits = 256
110 .name =
"rfc4309(ccm(aes))",
114 .icv_truncbits = 128,
121 .sadb_alg_minbits = 128,
122 .sadb_alg_maxbits = 256
126 .name =
"rfc4543(gcm(aes))",
130 .icv_truncbits = 128,
137 .sadb_alg_minbits = 128,
138 .sadb_alg_maxbits = 256
145 .name =
"digest_null",
157 .sadb_alg_minbits = 0,
158 .sadb_alg_maxbits = 0
175 .sadb_alg_minbits = 128,
176 .sadb_alg_maxbits = 128
180 .name =
"hmac(sha1)",
193 .sadb_alg_minbits = 160,
194 .sadb_alg_maxbits = 160
198 .name =
"hmac(sha256)",
211 .sadb_alg_minbits = 256,
212 .sadb_alg_maxbits = 256
216 .name =
"hmac(sha384)",
220 .icv_truncbits = 192,
228 .sadb_alg_minbits = 384,
229 .sadb_alg_maxbits = 384
233 .name =
"hmac(sha512)",
237 .icv_truncbits = 256,
245 .sadb_alg_minbits = 512,
246 .sadb_alg_maxbits = 512
250 .name =
"hmac(rmd160)",
263 .sadb_alg_minbits = 160,
264 .sadb_alg_maxbits = 160
280 .sadb_alg_minbits = 128,
281 .sadb_alg_maxbits = 128
288 .name =
"ecb(cipher_null)",
289 .compat =
"cipher_null",
301 .sadb_alg_minbits = 0,
302 .sadb_alg_maxbits = 0
319 .sadb_alg_minbits = 64,
320 .sadb_alg_maxbits = 64
324 .name =
"cbc(des3_ede)",
325 .compat =
"des3_ede",
337 .sadb_alg_minbits = 192,
338 .sadb_alg_maxbits = 192
342 .name =
"cbc(cast5)",
355 .sadb_alg_minbits = 40,
356 .sadb_alg_maxbits = 128
360 .name =
"cbc(blowfish)",
361 .compat =
"blowfish",
373 .sadb_alg_minbits = 40,
374 .sadb_alg_maxbits = 448
391 .sadb_alg_minbits = 128,
392 .sadb_alg_maxbits = 256
396 .name =
"cbc(serpent)",
409 .sadb_alg_minbits = 128,
410 .sadb_alg_maxbits = 256,
414 .name =
"cbc(camellia)",
415 .compat =
"camellia",
427 .sadb_alg_minbits = 128,
428 .sadb_alg_maxbits = 256
432 .name =
"cbc(twofish)",
445 .sadb_alg_minbits = 128,
446 .sadb_alg_maxbits = 256
450 .name =
"rfc3686(ctr(aes))",
462 .sadb_alg_minbits = 160,
463 .sadb_alg_maxbits = 288
498 static inline int aead_entries(
void)
503 static inline int aalg_entries(
void)
508 static inline int ealg_entries(
void)
513 static inline int calg_entries(
void)
556 const void *data,
int probe)
561 for (i = 0; i < algo_list->
entries; i++) {
562 if (!
match(list + i, data))
585 return entry->
desc.sadb_alg_id == (
unsigned long)data;
590 return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_id_match,
591 (
void *)(
unsigned long)alg_id, 1);
597 return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_id_match,
598 (
void *)(
unsigned long)alg_id, 1);
604 return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_id_match,
605 (
void *)(
unsigned long)alg_id, 1);
609 static int xfrm_alg_name_match(
const struct xfrm_algo_desc *entry,
620 return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_name_match, name,
627 return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_name_match, name,
634 return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_name_match, name,
644 static int xfrm_aead_name_match(
const struct xfrm_algo_desc *entry,
661 return xfrm_find_algo(&xfrm_aead_list, xfrm_aead_name_match, &data,
668 if (idx >= aalg_entries())
671 return &aalg_list[
idx];
677 if (idx >= ealg_entries())
680 return &ealg_list[
idx];
695 for (i = 0; i < aalg_entries(); i++) {
696 status = crypto_has_hash(aalg_list[i].
name, 0,
702 for (i = 0; i < ealg_entries(); i++) {
703 status = crypto_has_blkcipher(ealg_list[i].
name, 0,
709 for (i = 0; i < calg_entries(); i++) {
710 status = crypto_has_comp(calg_list[i].
name, 0,
722 for (i = 0, n = 0; i < aalg_entries(); i++)
733 for (i = 0, n = 0; i < ealg_entries(); i++)
740 #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)