diff options
Diffstat (limited to 'crypto/internal.h')
-rw-r--r-- | crypto/internal.h | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/crypto/internal.h b/crypto/internal.h index 964b9a60ca24..68612874b5fd 100644 --- a/crypto/internal.h +++ b/crypto/internal.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/highmem.h> | 16 | #include <linux/highmem.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/kmod.h> | 19 | #include <linux/kernel.h> |
20 | #include <asm/kmap_types.h> | 20 | #include <asm/kmap_types.h> |
21 | 21 | ||
22 | extern enum km_type crypto_km_types[]; | 22 | extern enum km_type crypto_km_types[]; |
@@ -42,20 +42,6 @@ static inline void crypto_yield(struct crypto_tfm *tfm) | |||
42 | cond_resched(); | 42 | cond_resched(); |
43 | } | 43 | } |
44 | 44 | ||
45 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) | ||
46 | { | ||
47 | return (void *)&tfm[1]; | ||
48 | } | ||
49 | |||
50 | struct 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. */ | ||
54 | static 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 | 45 | #ifdef CONFIG_CRYPTO_HMAC |
60 | int crypto_alloc_hmac_block(struct crypto_tfm *tfm); | 46 | int crypto_alloc_hmac_block(struct crypto_tfm *tfm); |
61 | void crypto_free_hmac_block(struct crypto_tfm *tfm); | 47 | void crypto_free_hmac_block(struct crypto_tfm *tfm); |
@@ -76,6 +62,33 @@ static inline void crypto_init_proc(void) | |||
76 | { } | 62 | { } |
77 | #endif | 63 | #endif |
78 | 64 | ||
65 | static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg, | ||
66 | int flags) | ||
67 | { | ||
68 | return alg->cra_ctxsize; | ||
69 | } | ||
70 | |||
71 | static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg, | ||
72 | int flags) | ||
73 | { | ||
74 | unsigned int len = alg->cra_ctxsize; | ||
75 | |||
76 | switch (flags & CRYPTO_TFM_MODE_MASK) { | ||
77 | case CRYPTO_TFM_MODE_CBC: | ||
78 | len = ALIGN(len, alg->cra_alignmask + 1); | ||
79 | len += alg->cra_blocksize; | ||
80 | break; | ||
81 | } | ||
82 | |||
83 | return len; | ||
84 | } | ||
85 | |||
86 | static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg, | ||
87 | int flags) | ||
88 | { | ||
89 | return alg->cra_ctxsize; | ||
90 | } | ||
91 | |||
79 | int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); | 92 | int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); |
80 | int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); | 93 | int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); |
81 | int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); | 94 | int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); |