summaryrefslogtreecommitdiffstats
path: root/crypto/sha2.c
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 /crypto/sha2.c
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 'crypto/sha2.c')
-rw-r--r--crypto/sha2.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/crypto/sha2.c b/crypto/sha2.c
index 375a40e1f6..42c40da757 100644
--- a/crypto/sha2.c
+++ b/crypto/sha2.c
@@ -20,8 +20,7 @@
#include <init.h>
#include <linux/string.h>
#include <asm/byteorder.h>
-
-#include "internal.h"
+#include <crypto/internal.h>
#define SHA224_SUM_LEN 28
#define SHA256_SUM_LEN 32
@@ -300,7 +299,12 @@ static int digest_sha224_init(struct digest *d)
}
static struct digest_algo m224 = {
- .name = "sha224",
+ .base = {
+ .name = "sha224",
+ .driver_name = "sha224-generic",
+ .priority = 0,
+ },
+
.init = digest_sha224_init,
.update = digest_sha2_update,
.final = digest_sha2_final,
@@ -332,7 +336,12 @@ static int digest_sha256_init(struct digest *d)
}
static struct digest_algo m256 = {
- .name = "sha256",
+ .base = {
+ .name = "sha256",
+ .driver_name = "sha256-generic",
+ .priority = 0,
+ },
+
.init = digest_sha256_init,
.update = digest_sha2_update,
.final = digest_sha2_final,