| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 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/hardirq.h> |
|---|
| 21 |
#include <asm/kmap_types.h> |
|---|
| 22 |
|
|---|
| 23 |
extern enum km_type crypto_km_types[]; |
|---|
| 24 |
|
|---|
| 25 |
static inline enum km_type crypto_kmap_type(int out) |
|---|
| 26 |
{ |
|---|
| 27 |
return crypto_km_types[(in_softirq() ? 2 : 0) + out]; |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
static inline void *crypto_kmap(struct page *page, int out) |
|---|
| 31 |
{ |
|---|
| 32 |
return kmap_atomic(page, crypto_kmap_type(out)); |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
static inline void crypto_kunmap(void *vaddr, int out) |
|---|
| 36 |
{ |
|---|
| 37 |
kunmap_atomic(vaddr, crypto_kmap_type(out)); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
static inline void crypto_yield(struct crypto_tfm *tfm) |
|---|
| 41 |
{ |
|---|
| 42 |
if (!in_softirq()) |
|---|
| 43 |
cond_resched(); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) |
|---|
| 47 |
{ |
|---|
| 48 |
return (void *)&tfm[1]; |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
struct crypto_alg *crypto_alg_lookup(const char *name); |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) |
|---|
| 56 |
{ |
|---|
| 57 |
return try_then_request_module(crypto_alg_lookup(name), name); |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
#ifdef CONFIG_CRYPTO_HMAC |
|---|
| 61 |
int crypto_alloc_hmac_block(struct crypto_tfm *tfm); |
|---|
| 62 |
void crypto_free_hmac_block(struct crypto_tfm *tfm); |
|---|
| 63 |
#else |
|---|
| 64 |
static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm) |
|---|
| 65 |
{ |
|---|
| 66 |
return 0; |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
static inline void crypto_free_hmac_block(struct crypto_tfm *tfm) |
|---|
| 70 |
{ } |
|---|
| 71 |
#endif |
|---|
| 72 |
|
|---|
| 73 |
#ifdef CONFIG_PROC_FS |
|---|
| 74 |
void __init crypto_init_proc(void); |
|---|
| 75 |
#else |
|---|
| 76 |
static inline void crypto_init_proc(void) |
|---|
| 77 |
{ } |
|---|
| 78 |
#endif |
|---|
| 79 |
|
|---|
| 80 |
int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); |
|---|
| 81 |
int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); |
|---|
| 82 |
int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); |
|---|
| 83 |
|
|---|
| 84 |
int crypto_init_digest_ops(struct crypto_tfm *tfm); |
|---|
| 85 |
int crypto_init_cipher_ops(struct crypto_tfm *tfm); |
|---|
| 86 |
int crypto_init_compress_ops(struct crypto_tfm *tfm); |
|---|
| 87 |
|
|---|
| 88 |
void crypto_exit_digest_ops(struct crypto_tfm *tfm); |
|---|
| 89 |
void crypto_exit_cipher_ops(struct crypto_tfm *tfm); |
|---|
| 90 |
void crypto_exit_compress_ops(struct crypto_tfm *tfm); |
|---|
| 91 |
|
|---|
| 92 |
#endif |
|---|
| 93 |
|
|---|