repo init
[linux-rt-nao.git] / drivers / staging / rtl8187se / ieee80211 / internal.h
blobddc22350d0064e4a19ed3167e7ab40fabf078707
1 /*
2 * Cryptographic API.
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
12 #ifndef _CRYPTO_INTERNAL_H
13 #define _CRYPTO_INTERNAL_H
16 //#include <linux/crypto.h>
17 #include "rtl_crypto.h"
18 #include <linux/mm.h>
19 #include <linux/highmem.h>
20 #include <linux/init.h>
21 #include <asm/hardirq.h>
22 #include <asm/softirq.h>
23 #include <asm/kmap_types.h>
25 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
26 #define list_for_each_entry(pos, head, member) \
27 for (pos = list_entry((head)->next, typeof(*pos), member), \
28 prefetch(pos->member.next); \
29 &pos->member != (head); \
30 pos = list_entry(pos->member.next, typeof(*pos), member), \
31 prefetch(pos->member.next))
33 static inline void cond_resched(void)
35 if (need_resched()) {
36 set_current_state(TASK_RUNNING);
37 schedule();
40 #endif
42 extern enum km_type crypto_km_types[];
44 static inline enum km_type crypto_kmap_type(int out)
46 return crypto_km_types[(in_softirq() ? 2 : 0) + out];
49 static inline void *crypto_kmap(struct page *page, int out)
51 return kmap_atomic(page, crypto_kmap_type(out));
54 static inline void crypto_kunmap(void *vaddr, int out)
56 kunmap_atomic(vaddr, crypto_kmap_type(out));
59 static inline void crypto_yield(struct crypto_tfm *tfm)
61 if (!in_softirq())
62 cond_resched();
65 static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
67 return (void *)&tfm[1];
70 struct crypto_alg *crypto_alg_lookup(const char *name);
72 #ifdef CONFIG_KMOD
73 void crypto_alg_autoload(const char *name);
74 struct crypto_alg *crypto_alg_mod_lookup(const char *name);
75 #else
76 static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name)
78 return crypto_alg_lookup(name);
80 #endif
82 #ifdef CONFIG_CRYPTO_HMAC
83 int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
84 void crypto_free_hmac_block(struct crypto_tfm *tfm);
85 #else
86 static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
88 return 0;
91 static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
92 { }
93 #endif
95 #ifdef CONFIG_PROC_FS
96 void __init crypto_init_proc(void);
97 #else
98 static inline void crypto_init_proc(void)
99 { }
100 #endif
102 int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
103 int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
104 int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
106 int crypto_init_digest_ops(struct crypto_tfm *tfm);
107 int crypto_init_cipher_ops(struct crypto_tfm *tfm);
108 int crypto_init_compress_ops(struct crypto_tfm *tfm);
110 void crypto_exit_digest_ops(struct crypto_tfm *tfm);
111 void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
112 void crypto_exit_compress_ops(struct crypto_tfm *tfm);
114 #endif /* _CRYPTO_INTERNAL_H */