ia64/linux-2.6.18-xen.hg

annotate crypto/internal.h @ 749:2892ca2b9c17

linux/x86: cleanup IO-APIC code

- get 32-bit code in sync with 64-bit wrt ExtINT pin detection being
unnecessary
- eliminate build warnings resulting from c/s 725

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 28 13:31:21 2008 +0000 (2008-11-28)
parents 831230e53067
children
rev   line source
ian@0 1 /*
ian@0 2 * Cryptographic API.
ian@0 3 *
ian@0 4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
ian@0 5 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
ian@0 6 *
ian@0 7 * This program is free software; you can redistribute it and/or modify it
ian@0 8 * under the terms of the GNU General Public License as published by the Free
ian@0 9 * Software Foundation; either version 2 of the License, or (at your option)
ian@0 10 * any later version.
ian@0 11 *
ian@0 12 */
ian@0 13 #ifndef _CRYPTO_INTERNAL_H
ian@0 14 #define _CRYPTO_INTERNAL_H
ian@0 15 #include <linux/crypto.h>
ian@0 16 #include <linux/mm.h>
ian@0 17 #include <linux/highmem.h>
ian@0 18 #include <linux/interrupt.h>
ian@0 19 #include <linux/init.h>
ian@0 20 #include <linux/list.h>
ian@0 21 #include <linux/kernel.h>
ian@0 22 #include <linux/rwsem.h>
ian@0 23 #include <linux/slab.h>
ian@0 24 #include <asm/kmap_types.h>
ian@0 25
ian@0 26 extern struct list_head crypto_alg_list;
ian@0 27 extern struct rw_semaphore crypto_alg_sem;
ian@0 28
ian@0 29 extern enum km_type crypto_km_types[];
ian@0 30
ian@0 31 static inline enum km_type crypto_kmap_type(int out)
ian@0 32 {
ian@0 33 return crypto_km_types[(in_softirq() ? 2 : 0) + out];
ian@0 34 }
ian@0 35
ian@0 36 static inline void *crypto_kmap(struct page *page, int out)
ian@0 37 {
ian@0 38 return kmap_atomic(page, crypto_kmap_type(out));
ian@0 39 }
ian@0 40
ian@0 41 static inline void crypto_kunmap(void *vaddr, int out)
ian@0 42 {
ian@0 43 kunmap_atomic(vaddr, crypto_kmap_type(out));
ian@0 44 }
ian@0 45
ian@0 46 static inline void crypto_yield(struct crypto_tfm *tfm)
ian@0 47 {
ian@0 48 if (tfm->crt_flags & CRYPTO_TFM_REQ_MAY_SLEEP)
ian@0 49 cond_resched();
ian@0 50 }
ian@0 51
ian@0 52 #ifdef CONFIG_CRYPTO_HMAC
ian@0 53 int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
ian@0 54 void crypto_free_hmac_block(struct crypto_tfm *tfm);
ian@0 55 #else
ian@0 56 static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
ian@0 57 {
ian@0 58 return 0;
ian@0 59 }
ian@0 60
ian@0 61 static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
ian@0 62 { }
ian@0 63 #endif
ian@0 64
ian@0 65 #ifdef CONFIG_PROC_FS
ian@0 66 void __init crypto_init_proc(void);
ian@0 67 #else
ian@0 68 static inline void crypto_init_proc(void)
ian@0 69 { }
ian@0 70 #endif
ian@0 71
ian@0 72 static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg,
ian@0 73 int flags)
ian@0 74 {
ian@0 75 return alg->cra_ctxsize;
ian@0 76 }
ian@0 77
ian@0 78 static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg,
ian@0 79 int flags)
ian@0 80 {
ian@0 81 unsigned int len = alg->cra_ctxsize;
ian@0 82
ian@0 83 switch (flags & CRYPTO_TFM_MODE_MASK) {
ian@0 84 case CRYPTO_TFM_MODE_CBC:
ian@0 85 len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1);
ian@0 86 len += alg->cra_blocksize;
ian@0 87 break;
ian@0 88 }
ian@0 89
ian@0 90 return len;
ian@0 91 }
ian@0 92
ian@0 93 static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg,
ian@0 94 int flags)
ian@0 95 {
ian@0 96 return alg->cra_ctxsize;
ian@0 97 }
ian@0 98
ian@0 99 int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
ian@0 100 int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
ian@0 101 int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
ian@0 102
ian@0 103 int crypto_init_digest_ops(struct crypto_tfm *tfm);
ian@0 104 int crypto_init_cipher_ops(struct crypto_tfm *tfm);
ian@0 105 int crypto_init_compress_ops(struct crypto_tfm *tfm);
ian@0 106
ian@0 107 void crypto_exit_digest_ops(struct crypto_tfm *tfm);
ian@0 108 void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
ian@0 109 void crypto_exit_compress_ops(struct crypto_tfm *tfm);
ian@0 110
ian@0 111 #endif /* _CRYPTO_INTERNAL_H */
ian@0 112