[CRYPTO] skcipher: Add crypto_grab_skcipher interface
[deliverable/linux.git] / include / crypto / internal / skcipher.h
1 /*
2 * Symmetric key ciphers.
3 *
4 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.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
13 #ifndef _CRYPTO_INTERNAL_SKCIPHER_H
14 #define _CRYPTO_INTERNAL_SKCIPHER_H
15
16 #include <crypto/algapi.h>
17
18 struct crypto_skcipher_spawn {
19 struct crypto_spawn base;
20 };
21
22 static inline void crypto_set_skcipher_spawn(
23 struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst)
24 {
25 crypto_set_spawn(&spawn->base, inst);
26 }
27
28 int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name,
29 u32 type, u32 mask);
30
31 static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn)
32 {
33 crypto_drop_spawn(&spawn->base);
34 }
35
36 static inline struct crypto_alg *crypto_skcipher_spawn_alg(
37 struct crypto_skcipher_spawn *spawn)
38 {
39 return spawn->base.alg;
40 }
41
42 static inline struct crypto_ablkcipher *crypto_spawn_skcipher(
43 struct crypto_skcipher_spawn *spawn)
44 {
45 return __crypto_ablkcipher_cast(
46 crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0),
47 crypto_skcipher_mask(0)));
48 }
49
50 #endif /* _CRYPTO_INTERNAL_SKCIPHER_H */
51
This page took 0.036625 seconds and 5 git commands to generate.