summaryrefslogtreecommitdiffstats
path: root/include/digest.h
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-25 12:56:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-27 07:49:45 +0100
commitab5b2c35e143a87483700ca92d7fd50292a891d0 (patch)
treef2aaba38fb2ff847ab1e19d0d611fb3aa0be0a01 /include/digest.h
parente10cc0b3330d4dd72fef076a7f1b2b67cb271a12 (diff)
downloadbarebox-ab5b2c35e143a87483700ca92d7fd50292a891d0.tar.gz
barebox-ab5b2c35e143a87483700ca92d7fd50292a891d0.tar.xz
crypto: prepare to allow multiple digest driver
This will allow to have hw driver or asm optimised driver. Use a priority level to determine which one to use at runtime. The generic one will be 0. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/digest.h')
-rw-r--r--include/digest.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/digest.h b/include/digest.h
index c574b4d568..00aeee5237 100644
--- a/include/digest.h
+++ b/include/digest.h
@@ -23,10 +23,16 @@
struct digest;
-struct digest_algo {
+struct crypto_alg {
char *name;
+ char *driver_name;
+ int priority;
#define DIGEST_ALGO_NEED_KEY (1 << 0)
unsigned int flags;
+};
+
+struct digest_algo {
+ struct crypto_alg base;
int (*alloc)(struct digest *d);
void (*free)(struct digest *d);
@@ -113,12 +119,12 @@ static inline int digest_set_key(struct digest *d, const unsigned char *key,
static inline int digest_is_flags(struct digest *d, unsigned int flags)
{
- return d->algo->flags & flags;
+ return d->algo->base.flags & flags;
}
static inline const char *digest_name(struct digest *d)
{
- return d->algo->name;
+ return d->algo->base.name;
}
#endif /* __SH_ST_DEVICES_H__ */