linux-old/crypto/internal.h
<<
>>
Prefs
   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/init.h>
  18#include <asm/hardirq.h>
  19#include <asm/softirq.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#ifdef CONFIG_KMOD
  53void crypto_alg_autoload(const char *name);
  54struct crypto_alg *crypto_alg_mod_lookup(const char *name);
  55#else
  56static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name)
  57{
  58        return crypto_alg_lookup(name);
  59}
  60#endif
  61
  62#ifdef CONFIG_CRYPTO_HMAC
  63int crypto_alloc_hmac_block(struct crypto_tfm *tfm);
  64void crypto_free_hmac_block(struct crypto_tfm *tfm);
  65#else
  66static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm)
  67{
  68        return 0;
  69}
  70
  71static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
  72{ }
  73#endif
  74
  75#ifdef CONFIG_PROC_FS
  76void __init crypto_init_proc(void);
  77#else
  78static inline void crypto_init_proc(void)
  79{ }
  80#endif
  81
  82int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
  83int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
  84int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
  85
  86int crypto_init_digest_ops(struct crypto_tfm *tfm);
  87int crypto_init_cipher_ops(struct crypto_tfm *tfm);
  88int crypto_init_compress_ops(struct crypto_tfm *tfm);
  89
  90void crypto_exit_digest_ops(struct crypto_tfm *tfm);
  91void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
  92void crypto_exit_compress_ops(struct crypto_tfm *tfm);
  93
  94#endif  /* _CRYPTO_INTERNAL_H */
  95
  96
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.