[CRYPTO] skcipher: Add crypto_grab_skcipher interface
[linux-2.6/verdex.git] / include / crypto / internal / skcipher.h
blob87879e64ff4c1e7129a5989347e4438474f56972
1 /*
2 * Symmetric key ciphers.
3 *
4 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
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.
13 #ifndef _CRYPTO_INTERNAL_SKCIPHER_H
14 #define _CRYPTO_INTERNAL_SKCIPHER_H
16 #include <crypto/algapi.h>
18 struct crypto_skcipher_spawn {
19 struct crypto_spawn base;
22 static inline void crypto_set_skcipher_spawn(
23 struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst)
25 crypto_set_spawn(&spawn->base, inst);
28 int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name,
29 u32 type, u32 mask);
31 static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn)
33 crypto_drop_spawn(&spawn->base);
36 static inline struct crypto_alg *crypto_skcipher_spawn_alg(
37 struct crypto_skcipher_spawn *spawn)
39 return spawn->base.alg;
42 static inline struct crypto_ablkcipher *crypto_spawn_skcipher(
43 struct crypto_skcipher_spawn *spawn)
45 return __crypto_ablkcipher_cast(
46 crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0),
47 crypto_skcipher_mask(0)));
50 #endif /* _CRYPTO_INTERNAL_SKCIPHER_H */