diff options
-rw-r--r-- | crypto/tcrypt.c | 8 | ||||
-rw-r--r-- | drivers/crypto/padlock.c | 6 | ||||
-rw-r--r-- | drivers/net/ppp_mppe.c | 4 | ||||
-rw-r--r-- | include/linux/crypto.h | 5 | ||||
-rw-r--r-- | include/net/ipcomp.h | 5 | ||||
-rw-r--r-- | net/ipv4/ipcomp.c | 25 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 25 | ||||
-rw-r--r-- | net/xfrm/xfrm_algo.c | 27 |
8 files changed, 60 insertions, 45 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 840ab8be0b96..83307420d31c 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -749,7 +749,7 @@ static void test_deflate(void) | |||
749 | { | 749 | { |
750 | unsigned int i; | 750 | unsigned int i; |
751 | char result[COMP_BUF_SIZE]; | 751 | char result[COMP_BUF_SIZE]; |
752 | struct crypto_tfm *tfm; | 752 | struct crypto_comp *tfm; |
753 | struct comp_testvec *tv; | 753 | struct comp_testvec *tv; |
754 | unsigned int tsize; | 754 | unsigned int tsize; |
755 | 755 | ||
@@ -821,7 +821,7 @@ static void test_deflate(void) | |||
821 | ilen, dlen); | 821 | ilen, dlen); |
822 | } | 822 | } |
823 | out: | 823 | out: |
824 | crypto_free_tfm(tfm); | 824 | crypto_free_comp(tfm); |
825 | } | 825 | } |
826 | 826 | ||
827 | static void test_available(void) | 827 | static void test_available(void) |
@@ -830,8 +830,8 @@ static void test_available(void) | |||
830 | 830 | ||
831 | while (*name) { | 831 | while (*name) { |
832 | printk("alg %s ", *name); | 832 | printk("alg %s ", *name); |
833 | printk((crypto_alg_available(*name, 0)) ? | 833 | printk(crypto_has_alg(*name, 0, CRYPTO_ALG_ASYNC) ? |
834 | "found\n" : "not found\n"); | 834 | "found\n" : "not found\n"); |
835 | name++; | 835 | name++; |
836 | } | 836 | } |
837 | } | 837 | } |
diff --git a/drivers/crypto/padlock.c b/drivers/crypto/padlock.c index ce581684f4b4..d6d7dd5bb98c 100644 --- a/drivers/crypto/padlock.c +++ b/drivers/crypto/padlock.c | |||
@@ -26,13 +26,13 @@ static int __init padlock_init(void) | |||
26 | { | 26 | { |
27 | int success = 0; | 27 | int success = 0; |
28 | 28 | ||
29 | if (crypto_alg_available("aes-padlock", 0)) | 29 | if (crypto_has_cipher("aes-padlock", 0, 0)) |
30 | success++; | 30 | success++; |
31 | 31 | ||
32 | if (crypto_alg_available("sha1-padlock", 0)) | 32 | if (crypto_has_hash("sha1-padlock", 0, 0)) |
33 | success++; | 33 | success++; |
34 | 34 | ||
35 | if (crypto_alg_available("sha256-padlock", 0)) | 35 | if (crypto_has_hash("sha256-padlock", 0, 0)) |
36 | success++; | 36 | success++; |
37 | 37 | ||
38 | if (!success) { | 38 | if (!success) { |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c index e7a0eb4fca60..f3655fd772f5 100644 --- a/drivers/net/ppp_mppe.c +++ b/drivers/net/ppp_mppe.c | |||
@@ -710,8 +710,8 @@ static struct compressor ppp_mppe = { | |||
710 | static int __init ppp_mppe_init(void) | 710 | static int __init ppp_mppe_init(void) |
711 | { | 711 | { |
712 | int answer; | 712 | int answer; |
713 | if (!(crypto_alg_available("ecb(arc4)", 0) && | 713 | if (!(crypto_has_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC) && |
714 | crypto_alg_available("sha1", 0))) | 714 | crypto_has_hash("sha1", 0, CRYPTO_ALG_ASYNC))) |
715 | return -ENODEV; | 715 | return -ENODEV; |
716 | 716 | ||
717 | sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); | 717 | sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index cf91c4c0638b..d4f9948b64b1 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -928,6 +928,11 @@ static inline int crypto_has_comp(const char *alg_name, u32 type, u32 mask) | |||
928 | return crypto_has_alg(alg_name, type, mask); | 928 | return crypto_has_alg(alg_name, type, mask); |
929 | } | 929 | } |
930 | 930 | ||
931 | static inline const char *crypto_comp_name(struct crypto_comp *tfm) | ||
932 | { | ||
933 | return crypto_tfm_alg_name(crypto_comp_tfm(tfm)); | ||
934 | } | ||
935 | |||
931 | static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm) | 936 | static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm) |
932 | { | 937 | { |
933 | return &crypto_comp_tfm(tfm)->crt_compress; | 938 | return &crypto_comp_tfm(tfm)->crt_compress; |
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index b94e3047b4d9..87c1af3e5e82 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h | |||
@@ -1,15 +1,14 @@ | |||
1 | #ifndef _NET_IPCOMP_H | 1 | #ifndef _NET_IPCOMP_H |
2 | #define _NET_IPCOMP_H | 2 | #define _NET_IPCOMP_H |
3 | 3 | ||
4 | #include <linux/crypto.h> | ||
4 | #include <linux/types.h> | 5 | #include <linux/types.h> |
5 | 6 | ||
6 | #define IPCOMP_SCRATCH_SIZE 65400 | 7 | #define IPCOMP_SCRATCH_SIZE 65400 |
7 | 8 | ||
8 | struct crypto_tfm; | ||
9 | |||
10 | struct ipcomp_data { | 9 | struct ipcomp_data { |
11 | u16 threshold; | 10 | u16 threshold; |
12 | struct crypto_tfm **tfms; | 11 | struct crypto_comp **tfms; |
13 | }; | 12 | }; |
14 | 13 | ||
15 | #endif | 14 | #endif |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index a0c28b2b756e..5bb9c9f03fb6 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | struct ipcomp_tfms { | 33 | struct ipcomp_tfms { |
34 | struct list_head list; | 34 | struct list_head list; |
35 | struct crypto_tfm **tfms; | 35 | struct crypto_comp **tfms; |
36 | int users; | 36 | int users; |
37 | }; | 37 | }; |
38 | 38 | ||
@@ -46,7 +46,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) | |||
46 | int err, plen, dlen; | 46 | int err, plen, dlen; |
47 | struct ipcomp_data *ipcd = x->data; | 47 | struct ipcomp_data *ipcd = x->data; |
48 | u8 *start, *scratch; | 48 | u8 *start, *scratch; |
49 | struct crypto_tfm *tfm; | 49 | struct crypto_comp *tfm; |
50 | int cpu; | 50 | int cpu; |
51 | 51 | ||
52 | plen = skb->len; | 52 | plen = skb->len; |
@@ -107,7 +107,7 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) | |||
107 | struct iphdr *iph = skb->nh.iph; | 107 | struct iphdr *iph = skb->nh.iph; |
108 | struct ipcomp_data *ipcd = x->data; | 108 | struct ipcomp_data *ipcd = x->data; |
109 | u8 *start, *scratch; | 109 | u8 *start, *scratch; |
110 | struct crypto_tfm *tfm; | 110 | struct crypto_comp *tfm; |
111 | int cpu; | 111 | int cpu; |
112 | 112 | ||
113 | ihlen = iph->ihl * 4; | 113 | ihlen = iph->ihl * 4; |
@@ -302,7 +302,7 @@ static void **ipcomp_alloc_scratches(void) | |||
302 | return scratches; | 302 | return scratches; |
303 | } | 303 | } |
304 | 304 | ||
305 | static void ipcomp_free_tfms(struct crypto_tfm **tfms) | 305 | static void ipcomp_free_tfms(struct crypto_comp **tfms) |
306 | { | 306 | { |
307 | struct ipcomp_tfms *pos; | 307 | struct ipcomp_tfms *pos; |
308 | int cpu; | 308 | int cpu; |
@@ -324,28 +324,28 @@ static void ipcomp_free_tfms(struct crypto_tfm **tfms) | |||
324 | return; | 324 | return; |
325 | 325 | ||
326 | for_each_possible_cpu(cpu) { | 326 | for_each_possible_cpu(cpu) { |
327 | struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu); | 327 | struct crypto_comp *tfm = *per_cpu_ptr(tfms, cpu); |
328 | crypto_free_tfm(tfm); | 328 | crypto_free_comp(tfm); |
329 | } | 329 | } |
330 | free_percpu(tfms); | 330 | free_percpu(tfms); |
331 | } | 331 | } |
332 | 332 | ||
333 | static struct crypto_tfm **ipcomp_alloc_tfms(const char *alg_name) | 333 | static struct crypto_comp **ipcomp_alloc_tfms(const char *alg_name) |
334 | { | 334 | { |
335 | struct ipcomp_tfms *pos; | 335 | struct ipcomp_tfms *pos; |
336 | struct crypto_tfm **tfms; | 336 | struct crypto_comp **tfms; |
337 | int cpu; | 337 | int cpu; |
338 | 338 | ||
339 | /* This can be any valid CPU ID so we don't need locking. */ | 339 | /* This can be any valid CPU ID so we don't need locking. */ |
340 | cpu = raw_smp_processor_id(); | 340 | cpu = raw_smp_processor_id(); |
341 | 341 | ||
342 | list_for_each_entry(pos, &ipcomp_tfms_list, list) { | 342 | list_for_each_entry(pos, &ipcomp_tfms_list, list) { |
343 | struct crypto_tfm *tfm; | 343 | struct crypto_comp *tfm; |
344 | 344 | ||
345 | tfms = pos->tfms; | 345 | tfms = pos->tfms; |
346 | tfm = *per_cpu_ptr(tfms, cpu); | 346 | tfm = *per_cpu_ptr(tfms, cpu); |
347 | 347 | ||
348 | if (!strcmp(crypto_tfm_alg_name(tfm), alg_name)) { | 348 | if (!strcmp(crypto_comp_name(tfm), alg_name)) { |
349 | pos->users++; | 349 | pos->users++; |
350 | return tfms; | 350 | return tfms; |
351 | } | 351 | } |
@@ -359,12 +359,13 @@ static struct crypto_tfm **ipcomp_alloc_tfms(const char *alg_name) | |||
359 | INIT_LIST_HEAD(&pos->list); | 359 | INIT_LIST_HEAD(&pos->list); |
360 | list_add(&pos->list, &ipcomp_tfms_list); | 360 | list_add(&pos->list, &ipcomp_tfms_list); |
361 | 361 | ||
362 | pos->tfms = tfms = alloc_percpu(struct crypto_tfm *); | 362 | pos->tfms = tfms = alloc_percpu(struct crypto_comp *); |
363 | if (!tfms) | 363 | if (!tfms) |
364 | goto error; | 364 | goto error; |
365 | 365 | ||
366 | for_each_possible_cpu(cpu) { | 366 | for_each_possible_cpu(cpu) { |
367 | struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0); | 367 | struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, |
368 | CRYPTO_ALG_ASYNC); | ||
368 | if (!tfm) | 369 | if (!tfm) |
369 | goto error; | 370 | goto error; |
370 | *per_cpu_ptr(tfms, cpu) = tfm; | 371 | *per_cpu_ptr(tfms, cpu) = tfm; |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 7e4d1c17bfbc..a81e9e9d93bd 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | struct ipcomp6_tfms { | 54 | struct ipcomp6_tfms { |
55 | struct list_head list; | 55 | struct list_head list; |
56 | struct crypto_tfm **tfms; | 56 | struct crypto_comp **tfms; |
57 | int users; | 57 | int users; |
58 | }; | 58 | }; |
59 | 59 | ||
@@ -70,7 +70,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
70 | int plen, dlen; | 70 | int plen, dlen; |
71 | struct ipcomp_data *ipcd = x->data; | 71 | struct ipcomp_data *ipcd = x->data; |
72 | u8 *start, *scratch; | 72 | u8 *start, *scratch; |
73 | struct crypto_tfm *tfm; | 73 | struct crypto_comp *tfm; |
74 | int cpu; | 74 | int cpu; |
75 | 75 | ||
76 | if (skb_linearize_cow(skb)) | 76 | if (skb_linearize_cow(skb)) |
@@ -129,7 +129,7 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
129 | struct ipcomp_data *ipcd = x->data; | 129 | struct ipcomp_data *ipcd = x->data; |
130 | int plen, dlen; | 130 | int plen, dlen; |
131 | u8 *start, *scratch; | 131 | u8 *start, *scratch; |
132 | struct crypto_tfm *tfm; | 132 | struct crypto_comp *tfm; |
133 | int cpu; | 133 | int cpu; |
134 | 134 | ||
135 | hdr_len = skb->h.raw - skb->data; | 135 | hdr_len = skb->h.raw - skb->data; |
@@ -301,7 +301,7 @@ static void **ipcomp6_alloc_scratches(void) | |||
301 | return scratches; | 301 | return scratches; |
302 | } | 302 | } |
303 | 303 | ||
304 | static void ipcomp6_free_tfms(struct crypto_tfm **tfms) | 304 | static void ipcomp6_free_tfms(struct crypto_comp **tfms) |
305 | { | 305 | { |
306 | struct ipcomp6_tfms *pos; | 306 | struct ipcomp6_tfms *pos; |
307 | int cpu; | 307 | int cpu; |
@@ -323,28 +323,28 @@ static void ipcomp6_free_tfms(struct crypto_tfm **tfms) | |||
323 | return; | 323 | return; |
324 | 324 | ||
325 | for_each_possible_cpu(cpu) { | 325 | for_each_possible_cpu(cpu) { |
326 | struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu); | 326 | struct crypto_comp *tfm = *per_cpu_ptr(tfms, cpu); |
327 | crypto_free_tfm(tfm); | 327 | crypto_free_comp(tfm); |
328 | } | 328 | } |
329 | free_percpu(tfms); | 329 | free_percpu(tfms); |
330 | } | 330 | } |
331 | 331 | ||
332 | static struct crypto_tfm **ipcomp6_alloc_tfms(const char *alg_name) | 332 | static struct crypto_comp **ipcomp6_alloc_tfms(const char *alg_name) |
333 | { | 333 | { |
334 | struct ipcomp6_tfms *pos; | 334 | struct ipcomp6_tfms *pos; |
335 | struct crypto_tfm **tfms; | 335 | struct crypto_comp **tfms; |
336 | int cpu; | 336 | int cpu; |
337 | 337 | ||
338 | /* This can be any valid CPU ID so we don't need locking. */ | 338 | /* This can be any valid CPU ID so we don't need locking. */ |
339 | cpu = raw_smp_processor_id(); | 339 | cpu = raw_smp_processor_id(); |
340 | 340 | ||
341 | list_for_each_entry(pos, &ipcomp6_tfms_list, list) { | 341 | list_for_each_entry(pos, &ipcomp6_tfms_list, list) { |
342 | struct crypto_tfm *tfm; | 342 | struct crypto_comp *tfm; |
343 | 343 | ||
344 | tfms = pos->tfms; | 344 | tfms = pos->tfms; |
345 | tfm = *per_cpu_ptr(tfms, cpu); | 345 | tfm = *per_cpu_ptr(tfms, cpu); |
346 | 346 | ||
347 | if (!strcmp(crypto_tfm_alg_name(tfm), alg_name)) { | 347 | if (!strcmp(crypto_comp_name(tfm), alg_name)) { |
348 | pos->users++; | 348 | pos->users++; |
349 | return tfms; | 349 | return tfms; |
350 | } | 350 | } |
@@ -358,12 +358,13 @@ static struct crypto_tfm **ipcomp6_alloc_tfms(const char *alg_name) | |||
358 | INIT_LIST_HEAD(&pos->list); | 358 | INIT_LIST_HEAD(&pos->list); |
359 | list_add(&pos->list, &ipcomp6_tfms_list); | 359 | list_add(&pos->list, &ipcomp6_tfms_list); |
360 | 360 | ||
361 | pos->tfms = tfms = alloc_percpu(struct crypto_tfm *); | 361 | pos->tfms = tfms = alloc_percpu(struct crypto_comp *); |
362 | if (!tfms) | 362 | if (!tfms) |
363 | goto error; | 363 | goto error; |
364 | 364 | ||
365 | for_each_possible_cpu(cpu) { | 365 | for_each_possible_cpu(cpu) { |
366 | struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0); | 366 | struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, |
367 | CRYPTO_ALG_ASYNC); | ||
367 | if (!tfm) | 368 | if (!tfm) |
368 | goto error; | 369 | goto error; |
369 | *per_cpu_ptr(tfms, cpu) = tfm; | 370 | *per_cpu_ptr(tfms, cpu) = tfm; |
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index 87918f281bb4..5a0dbeb6bbe8 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c | |||
@@ -363,8 +363,8 @@ struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id) | |||
363 | EXPORT_SYMBOL_GPL(xfrm_calg_get_byid); | 363 | EXPORT_SYMBOL_GPL(xfrm_calg_get_byid); |
364 | 364 | ||
365 | static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, | 365 | static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, |
366 | int entries, char *name, | 366 | int entries, u32 type, u32 mask, |
367 | int probe) | 367 | char *name, int probe) |
368 | { | 368 | { |
369 | int i, status; | 369 | int i, status; |
370 | 370 | ||
@@ -382,7 +382,7 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, | |||
382 | if (!probe) | 382 | if (!probe) |
383 | break; | 383 | break; |
384 | 384 | ||
385 | status = crypto_alg_available(name, 0); | 385 | status = crypto_has_alg(name, type, mask | CRYPTO_ALG_ASYNC); |
386 | if (!status) | 386 | if (!status) |
387 | break; | 387 | break; |
388 | 388 | ||
@@ -394,19 +394,25 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, | |||
394 | 394 | ||
395 | struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe) | 395 | struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe) |
396 | { | 396 | { |
397 | return xfrm_get_byname(aalg_list, aalg_entries(), name, probe); | 397 | return xfrm_get_byname(aalg_list, aalg_entries(), |
398 | CRYPTO_ALG_TYPE_HASH, CRYPTO_ALG_TYPE_HASH_MASK, | ||
399 | name, probe); | ||
398 | } | 400 | } |
399 | EXPORT_SYMBOL_GPL(xfrm_aalg_get_byname); | 401 | EXPORT_SYMBOL_GPL(xfrm_aalg_get_byname); |
400 | 402 | ||
401 | struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe) | 403 | struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe) |
402 | { | 404 | { |
403 | return xfrm_get_byname(ealg_list, ealg_entries(), name, probe); | 405 | return xfrm_get_byname(ealg_list, ealg_entries(), |
406 | CRYPTO_ALG_TYPE_BLKCIPHER, CRYPTO_ALG_TYPE_MASK, | ||
407 | name, probe); | ||
404 | } | 408 | } |
405 | EXPORT_SYMBOL_GPL(xfrm_ealg_get_byname); | 409 | EXPORT_SYMBOL_GPL(xfrm_ealg_get_byname); |
406 | 410 | ||
407 | struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe) | 411 | struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe) |
408 | { | 412 | { |
409 | return xfrm_get_byname(calg_list, calg_entries(), name, probe); | 413 | return xfrm_get_byname(calg_list, calg_entries(), |
414 | CRYPTO_ALG_TYPE_COMPRESS, CRYPTO_ALG_TYPE_MASK, | ||
415 | name, probe); | ||
410 | } | 416 | } |
411 | EXPORT_SYMBOL_GPL(xfrm_calg_get_byname); | 417 | EXPORT_SYMBOL_GPL(xfrm_calg_get_byname); |
412 | 418 | ||
@@ -441,19 +447,22 @@ void xfrm_probe_algs(void) | |||
441 | BUG_ON(in_softirq()); | 447 | BUG_ON(in_softirq()); |
442 | 448 | ||
443 | for (i = 0; i < aalg_entries(); i++) { | 449 | for (i = 0; i < aalg_entries(); i++) { |
444 | status = crypto_alg_available(aalg_list[i].name, 0); | 450 | status = crypto_has_hash(aalg_list[i].name, 0, |
451 | CRYPTO_ALG_ASYNC); | ||
445 | if (aalg_list[i].available != status) | 452 | if (aalg_list[i].available != status) |
446 | aalg_list[i].available = status; | 453 | aalg_list[i].available = status; |
447 | } | 454 | } |
448 | 455 | ||
449 | for (i = 0; i < ealg_entries(); i++) { | 456 | for (i = 0; i < ealg_entries(); i++) { |
450 | status = crypto_alg_available(ealg_list[i].name, 0); | 457 | status = crypto_has_blkcipher(ealg_list[i].name, 0, |
458 | CRYPTO_ALG_ASYNC); | ||
451 | if (ealg_list[i].available != status) | 459 | if (ealg_list[i].available != status) |
452 | ealg_list[i].available = status; | 460 | ealg_list[i].available = status; |
453 | } | 461 | } |
454 | 462 | ||
455 | for (i = 0; i < calg_entries(); i++) { | 463 | for (i = 0; i < calg_entries(); i++) { |
456 | status = crypto_alg_available(calg_list[i].name, 0); | 464 | status = crypto_has_comp(calg_list[i].name, 0, |
465 | CRYPTO_ALG_ASYNC); | ||
457 | if (calg_list[i].available != status) | 466 | if (calg_list[i].available != status) |
458 | calg_list[i].available = status; | 467 | calg_list[i].available = status; |
459 | } | 468 | } |