blob: c9402dd12d0388f5596a2ee5b61bd2c0cef483ad [file] [log] [blame]
Herbert Xu378f4f52007-12-17 20:07:31 +08001/*
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>
Herbert Xu61da88e2007-12-17 21:51:27 +080017#include <crypto/skcipher.h>
Herbert Xu378f4f52007-12-17 20:07:31 +080018
19struct crypto_skcipher_spawn {
20 struct crypto_spawn base;
21};
22
Herbert Xu61da88e2007-12-17 21:51:27 +080023extern const struct crypto_type crypto_givcipher_type;
24
Herbert Xu378f4f52007-12-17 20:07:31 +080025static inline void crypto_set_skcipher_spawn(
26 struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst)
27{
28 crypto_set_spawn(&spawn->base, inst);
29}
30
31int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name,
32 u32 type, u32 mask);
33
34static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn)
35{
36 crypto_drop_spawn(&spawn->base);
37}
38
39static inline struct crypto_alg *crypto_skcipher_spawn_alg(
40 struct crypto_skcipher_spawn *spawn)
41{
42 return spawn->base.alg;
43}
44
45static inline struct crypto_ablkcipher *crypto_spawn_skcipher(
46 struct crypto_skcipher_spawn *spawn)
47{
48 return __crypto_ablkcipher_cast(
49 crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0),
50 crypto_skcipher_mask(0)));
51}
52
Herbert Xu61da88e2007-12-17 21:51:27 +080053static inline void *skcipher_givcrypt_reqctx(
54 struct skcipher_givcrypt_request *req)
55{
56 return ablkcipher_request_ctx(&req->creq);
57}
58
Herbert Xu378f4f52007-12-17 20:07:31 +080059#endif /* _CRYPTO_INTERNAL_SKCIPHER_H */
60