crypto: inside-secure - authenc(hmac(sha256), cbc(aes)) support
This patch adds support for the first AEAD algorithm in the Inside Secure SafeXcel driver, authenc(hmac(sha256),cbc(aes)). As this is the first AEAD algorithm added to this driver, common AEAD functions are added as well. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:

committed by
Herbert Xu

parent
bdfd190956
commit
f6beaea304
@@ -20,6 +20,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <crypto/internal/aead.h>
|
||||
#include <crypto/internal/hash.h>
|
||||
#include <crypto/internal/skcipher.h>
|
||||
|
||||
@@ -352,6 +353,7 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
|
||||
/* H/W capabilities selection */
|
||||
val = EIP197_FUNCTION_RSVD;
|
||||
val |= EIP197_PROTOCOL_ENCRYPT_ONLY | EIP197_PROTOCOL_HASH_ONLY;
|
||||
val |= EIP197_PROTOCOL_ENCRYPT_HASH | EIP197_PROTOCOL_HASH_DECRYPT;
|
||||
val |= EIP197_ALG_AES_ECB | EIP197_ALG_AES_CBC;
|
||||
val |= EIP197_ALG_SHA1 | EIP197_ALG_HMAC_SHA1;
|
||||
val |= EIP197_ALG_SHA2 | EIP197_ALG_HMAC_SHA2;
|
||||
@@ -791,6 +793,7 @@ static struct safexcel_alg_template *safexcel_algs[] = {
|
||||
&safexcel_alg_hmac_sha1,
|
||||
&safexcel_alg_hmac_sha224,
|
||||
&safexcel_alg_hmac_sha256,
|
||||
&safexcel_alg_authenc_hmac_sha256_cbc_aes,
|
||||
};
|
||||
|
||||
static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv)
|
||||
@@ -802,6 +805,8 @@ static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv)
|
||||
|
||||
if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER)
|
||||
ret = crypto_register_skcipher(&safexcel_algs[i]->alg.skcipher);
|
||||
else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD)
|
||||
ret = crypto_register_aead(&safexcel_algs[i]->alg.aead);
|
||||
else
|
||||
ret = crypto_register_ahash(&safexcel_algs[i]->alg.ahash);
|
||||
|
||||
@@ -815,6 +820,8 @@ fail:
|
||||
for (j = 0; j < i; j++) {
|
||||
if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_SKCIPHER)
|
||||
crypto_unregister_skcipher(&safexcel_algs[j]->alg.skcipher);
|
||||
else if (safexcel_algs[j]->type == SAFEXCEL_ALG_TYPE_AEAD)
|
||||
crypto_unregister_aead(&safexcel_algs[j]->alg.aead);
|
||||
else
|
||||
crypto_unregister_ahash(&safexcel_algs[j]->alg.ahash);
|
||||
}
|
||||
@@ -829,6 +836,8 @@ static void safexcel_unregister_algorithms(struct safexcel_crypto_priv *priv)
|
||||
for (i = 0; i < ARRAY_SIZE(safexcel_algs); i++) {
|
||||
if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_SKCIPHER)
|
||||
crypto_unregister_skcipher(&safexcel_algs[i]->alg.skcipher);
|
||||
else if (safexcel_algs[i]->type == SAFEXCEL_ALG_TYPE_AEAD)
|
||||
crypto_unregister_aead(&safexcel_algs[i]->alg.aead);
|
||||
else
|
||||
crypto_unregister_ahash(&safexcel_algs[i]->alg.ahash);
|
||||
}
|
||||
|
Reference in New Issue
Block a user