More meth updates.
[linux-2.6/linux-mips.git] / crypto / internal.h
blob10880d149afedb1609bc486a353ea460d3a40042
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
14 #include <linux/mm.h>
15 #include <linux/highmem.h>
16 #include <linux/interrupt.h>
17 #include <linux/init.h>
18 #include <asm/hardirq.h>
19 #include <asm/kmap_types.h>
21 extern enum km_type crypto_km_types[];
23 static inline enum km_type crypto_kmap_type(int out)
25 return crypto_km_types[(in_softirq() ? 2 : 0) + out];
28 static inline void *crypto_kmap(struct page *page, int out)
30 return kmap_atomic(page, crypto_kmap_type(out));
33 static inline void crypto_kunmap(void *vaddr, int out)
35 kunmap_atomic(vaddr, crypto_kmap_type(out));
38 static inline void crypto_yield(struct crypto_tfm *tfm)
40 if (!in_softirq())
41 cond_resched();
44 static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
46 return (void *)&tfm[1];
49 struct crypto_alg *crypto_alg_lookup(const char *name);
51 #ifdef CONFIG_KMOD
52 void crypto_alg_autoload(const char *name);
53 struct crypto_alg *crypto_alg_mod_lookup(const char *name);
54 #else
55 static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name)
57 return crypto_alg_lookup(name);
59 #endif
61 #ifdef CONFIG_CRYPTO_HMAC
62 int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
63 void crypto_free_hmac_block(struct crypto_tfm *tfm);
64 #else
65 static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
67 return 0;
70 static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
71 { }
72 #endif
74 #ifdef CONFIG_PROC_FS
75 void __init crypto_init_proc(void);
76 #else
77 static inline void crypto_init_proc(void)
78 { }
79 #endif
81 int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
82 int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
83 int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
85 int crypto_init_digest_ops(struct crypto_tfm *tfm);
86 int crypto_init_cipher_ops(struct crypto_tfm *tfm);
87 int crypto_init_compress_ops(struct crypto_tfm *tfm);
89 void crypto_exit_digest_ops(struct crypto_tfm *tfm);
90 void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
91 void crypto_exit_compress_ops(struct crypto_tfm *tfm);
93 #endif /* _CRYPTO_INTERNAL_H */