mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[CRYPTO] api: Add support for multiple template parameters
This patch adds support for having multiple parameters to a template, separated by a comma. It also adds support for integer parameters in addition to the current algorithm parameter type. This will be used by the authenc template which will have four parameters: the authentication algorithm, the encryption algorithm, the authentication size and the encryption key length. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
1ae978208e
commit
39e1ee011f
3 changed files with 83 additions and 26 deletions
|
@ -439,13 +439,15 @@ EXPORT_SYMBOL_GPL(crypto_unregister_notifier);
|
|||
|
||||
struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb)
|
||||
{
|
||||
struct rtattr *rta = tb[CRYPTOA_TYPE - 1];
|
||||
struct rtattr *rta = tb[0];
|
||||
struct crypto_attr_type *algt;
|
||||
|
||||
if (!rta)
|
||||
return ERR_PTR(-ENOENT);
|
||||
if (RTA_PAYLOAD(rta) < sizeof(*algt))
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (rta->rta_type != CRYPTOA_TYPE)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
algt = RTA_DATA(rta);
|
||||
|
||||
|
@ -470,13 +472,15 @@ EXPORT_SYMBOL_GPL(crypto_check_attr_type);
|
|||
|
||||
struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, u32 type, u32 mask)
|
||||
{
|
||||
struct rtattr *rta = tb[CRYPTOA_ALG - 1];
|
||||
struct rtattr *rta = tb[1];
|
||||
struct crypto_attr_alg *alga;
|
||||
|
||||
if (!rta)
|
||||
return ERR_PTR(-ENOENT);
|
||||
if (RTA_PAYLOAD(rta) < sizeof(*alga))
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (rta->rta_type != CRYPTOA_ALG)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
alga = RTA_DATA(rta);
|
||||
alga->name[CRYPTO_MAX_ALG_NAME - 1] = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue