[CRYPTO] Make crypto_alg_lookup static
[linux-2.6-block.git] / crypto / internal.h
CommitLineData
1da177e4
LT
1/*
2 * Cryptographic API.
3 *
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
5 *
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.
10 *
11 */
12#ifndef _CRYPTO_INTERNAL_H
13#define _CRYPTO_INTERNAL_H
14#include <linux/crypto.h>
15#include <linux/mm.h>
16#include <linux/highmem.h>
17#include <linux/interrupt.h>
18#include <linux/init.h>
1da177e4
LT
19#include <asm/kmap_types.h>
20
21extern enum km_type crypto_km_types[];
22
23static inline enum km_type crypto_kmap_type(int out)
24{
25 return crypto_km_types[(in_softirq() ? 2 : 0) + out];
26}
27
28static inline void *crypto_kmap(struct page *page, int out)
29{
30 return kmap_atomic(page, crypto_kmap_type(out));
31}
32
33static inline void crypto_kunmap(void *vaddr, int out)
34{
35 kunmap_atomic(vaddr, crypto_kmap_type(out));
36}
37
38static inline void crypto_yield(struct crypto_tfm *tfm)
39{
15333038 40 if (!in_atomic())
1da177e4
LT
41 cond_resched();
42}
43
1da177e4
LT
44#ifdef CONFIG_CRYPTO_HMAC
45int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
46void crypto_free_hmac_block(struct crypto_tfm *tfm);
47#else
48static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
49{
50 return 0;
51}
52
53static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
54{ }
55#endif
56
57#ifdef CONFIG_PROC_FS
58void __init crypto_init_proc(void);
59#else
60static inline void crypto_init_proc(void)
61{ }
62#endif
63
64int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
65int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
66int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
67
68int crypto_init_digest_ops(struct crypto_tfm *tfm);
69int crypto_init_cipher_ops(struct crypto_tfm *tfm);
70int crypto_init_compress_ops(struct crypto_tfm *tfm);
71
72void crypto_exit_digest_ops(struct crypto_tfm *tfm);
73void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
74void crypto_exit_compress_ops(struct crypto_tfm *tfm);
75
76#endif /* _CRYPTO_INTERNAL_H */
77