On Thu, Apr 28, 2016 at 6:18 PM, Jonas Eymann <[email protected]> wrote:
> Hi Alexandru, > > > > > Crypto hash algorithms must provide the statesize for > > kernel 4.2+ > > > > Referencing commit in the kernel: > > > > commit 8996eafdcbad149ac0f772fb1649fbb75c482a6a > > Author: Russell King <[email protected]> > > Date: Fri Oct 9 20:43:33 2015 +0100 > > > > crypto: ahash - ensure statesize is non-zero > > > > Unlike shash algorithms, ahash drivers must implement export > > and import as their descriptors may contain hardware state and > > cannot be exported as is. Unfortunately some ahash drivers did > > not provide them and end up causing crashes with algif_hash. > > > > This patch adds a check to prevent these drivers from registering > > ahash algorithms until they are fixed. > > > > Cc: [email protected] > > Signed-off-by: Russell King <[email protected]> > > Signed-off-by: Herbert Xu <[email protected]> > > > > Signed-off-by: Alexandru Ardelean <[email protected]> > > --- > > .../302-add-statesize-to-talitos-crypto-driver.sh | 100 > +++++++++++++++++++++ > > 1 file changed, 100 insertions(+) > > create mode 100644 > target/linux/mpc85xx/patches-4.4/302-add-statesize-to-talitos-crypto-driver.sh > > > > diff --git > a/target/linux/mpc85xx/patches-4.4/302-add-statesize-to-talitos-crypto-driver.sh > b/target/linux/mpc85xx/patches-4.4/302-add-statesize-to-talitos-crypto-driver.sh > > new file mode 100644 > > index 0000000..4d77c19 > > --- /dev/null > > +++ > b/target/linux/mpc85xx/patches-4.4/302-add-statesize-to-talitos-crypto-driver.sh > > @@ -0,0 +1,100 @@ > > +diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c > > +index b6f9f42..b786b21 100644 > > +--- a/drivers/crypto/talitos.c > > ++++ b/drivers/crypto/talitos.c > > +@@ -2334,6 +2334,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = MD5_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "md5", > > + .cra_driver_name = "md5-talitos", > > +@@ -2349,6 +2350,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA1_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "sha1", > > + .cra_driver_name = "sha1-talitos", > > +@@ -2364,6 +2366,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA224_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "sha224", > > + .cra_driver_name = "sha224-talitos", > > +@@ -2379,6 +2382,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA256_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "sha256", > > + .cra_driver_name = "sha256-talitos", > > +@@ -2394,6 +2398,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA384_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "sha384", > > + .cra_driver_name = "sha384-talitos", > > +@@ -2409,6 +2414,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA512_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "sha512", > > + .cra_driver_name = "sha512-talitos", > > +@@ -2424,6 +2430,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = MD5_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "hmac(md5)", > > + .cra_driver_name = "hmac-md5-talitos", > > +@@ -2439,6 +2446,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA1_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "hmac(sha1)", > > + .cra_driver_name = "hmac-sha1-talitos", > > +@@ -2454,6 +2462,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA224_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "hmac(sha224)", > > + .cra_driver_name = "hmac-sha224-talitos", > > +@@ -2469,6 +2478,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA256_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "hmac(sha256)", > > + .cra_driver_name = "hmac-sha256-talitos", > > +@@ -2484,6 +2494,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA384_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "hmac(sha384)", > > + .cra_driver_name = "hmac-sha384-talitos", > > +@@ -2499,6 +2510,7 @@ static struct talitos_alg_template driver_algs[] > = { > > + { .type = CRYPTO_ALG_TYPE_AHASH, > > + .alg.hash = { > > + .halg.digestsize = SHA512_DIGEST_SIZE, > > ++ .halg.statesize = sizeof(struct > talitos_ahash_req_ctx), > > + .halg.base = { > > + .cra_name = "hmac(sha512)", > > + .cra_driver_name = "hmac-sha512-talitos", > > -- > > 2.8.1 > > _______________________________________________ > > openwrt-devel mailing list > > [email protected] > > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel > > > > AFAIK just setting the statesize is not sufficient as the driver also > needs to implement the state import/export functions. However, this was > implemented recently by Horia Geanta and already applied to cryptodev-2.6 > as commit id > 3639ca840df953f9af6f15fc8a6bf77f19075ab1. It assume it will be merged to > the mainline kernel in the next merge window. > > Jonas > Thanks for the heads-up Jonas. Seems I was a bit naive ; I just modified the driver this and it built fine. I'll take a look there and try to backport the patch. I'll submit it to the OpenWrt list. At the moment I'm in the midst of sync-ing our tree with OpenWrt trunk and plenty of stuff needs re-sync-ing.
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
