2 * Cryptographic API for algorithms (i.e., low-level API).
4 * Copyright (c) 2006 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)
12 #ifndef _CRYPTO_ALGAPI_H
13 #define _CRYPTO_ALGAPI_H
15 #include <linux/crypto.h>
19 struct crypto_instance {
20 struct crypto_alg alg;
22 struct crypto_template *tmpl;
23 struct hlist_node list;
25 void *__ctx[] CRYPTO_MINALIGN_ATTR;
28 struct crypto_template {
29 struct list_head list;
30 struct hlist_head instances;
31 struct module *module;
33 struct crypto_instance *(*alloc)(void *param, unsigned int len);
34 void (*free)(struct crypto_instance *inst);
36 char name[CRYPTO_MAX_ALG_NAME];
39 int crypto_register_template(struct crypto_template *tmpl);
40 void crypto_unregister_template(struct crypto_template *tmpl);
41 struct crypto_template *crypto_lookup_template(const char *name);
43 static inline void *crypto_instance_ctx(struct crypto_instance *inst)
48 #endif /* _CRYPTO_ALGAPI_H */