• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/rtl8192u/ieee80211/
1/*
2 * Header file to maintain compatibility among different kernel versions.
3 *
4 * Copyright (c) 2004-2006  <lawrence_wang@realsil.com.cn>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. See README and COPYING for
9 * more details.
10 */
11
12#include <linux/crypto.h>
13
14static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
15					struct scatterlist *dst,
16					struct scatterlist *src,
17					unsigned int nbytes)
18{
19	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
20	return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
21}
22
23
24static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
25					struct scatterlist *dst,
26					struct scatterlist *src,
27					unsigned int nbytes)
28{
29	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
30	return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
31}
32
33 struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
34{
35	struct crypto_tfm *tfm = NULL;
36	int err;
37	printk("call crypto_alloc_tfm!!!\n");
38	do {
39		struct crypto_alg *alg;
40
41		alg = crypto_alg_mod_lookup(name, 0, CRYPTO_ALG_ASYNC);
42		err = PTR_ERR(alg);
43		if (IS_ERR(alg))
44			continue;
45
46		tfm = __crypto_alloc_tfm(alg, flags);
47		err = 0;
48		if (IS_ERR(tfm)) {
49			crypto_mod_put(alg);
50			err = PTR_ERR(tfm);
51			tfm = NULL;
52		}
53	} while (err == -EAGAIN && !signal_pending(current));
54
55	return tfm;
56}
57//EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
58//EXPORT_SYMBOL_GPL(crypto_free_tfm);
59