aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /crypto/internal.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
new file mode 100644
index 000000000000..e68e43886d3c
--- /dev/null
+++ b/crypto/internal.h
@@ -0,0 +1,92 @@
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>
19#include <linux/kmod.h>
20#include <asm/kmap_types.h>
21
22extern enum km_type crypto_km_types[];
23
24static inline enum km_type crypto_kmap_type(int out)
25{
26 return crypto_km_types[(in_softirq() ? 2 : 0) + out];
27}
28
29static inline void *crypto_kmap(struct page *page, int out)
30{
31 return kmap_atomic(page, crypto_kmap_type(out));
32}
33
34static inline void crypto_kunmap(void *vaddr, int out)
35{
36 kunmap_atomic(vaddr, crypto_kmap_type(out));
37}
38
39static inline void crypto_yield(struct crypto_tfm *tfm)
40{
41 if (!in_softirq())
42 cond_resched();
43}
44
45static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
46{
47 return (void *)&tfm[1];
48}
49
50struct crypto_alg *crypto_alg_lookup(const char *name);
51
52/* A far more intelligent version of this is planned. For now, just
53 * try an exact match on the name of the algorithm. */
54static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name)
55{
56 return try_then_request_module(crypto_alg_lookup(name), name);
57}
58
59#ifdef CONFIG_CRYPTO_HMAC
60int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
61void crypto_free_hmac_block(struct crypto_tfm *tfm);
62#else
63static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
64{
65 return 0;
66}
67
68static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
69{ }
70#endif
71
72#ifdef CONFIG_PROC_FS
73void __init crypto_init_proc(void);
74#else
75static inline void crypto_init_proc(void)
76{ }
77#endif
78
79int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
80int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
81int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
82
83int crypto_init_digest_ops(struct crypto_tfm *tfm);
84int crypto_init_cipher_ops(struct crypto_tfm *tfm);
85int crypto_init_compress_ops(struct crypto_tfm *tfm);
86
87void crypto_exit_digest_ops(struct crypto_tfm *tfm);
88void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
89void crypto_exit_compress_ops(struct crypto_tfm *tfm);
90
91#endif /* _CRYPTO_INTERNAL_H */
92