aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-08-29 07:27:26 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:40 -0400
commit39e1ee011f42dbbcb0210c73ea728ae54cf63b06 (patch)
tree0689571972f9678f93cec8bd7f3dac2934c5bc59 /crypto/algapi.c
parent1ae978208e2ee9ba1b01d309164bc5e590cd242d (diff)
[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>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 38aa9e994703..d9559609b525 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -439,13 +439,15 @@ EXPORT_SYMBOL_GPL(crypto_unregister_notifier);
439 439
440struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb) 440struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb)
441{ 441{
442 struct rtattr *rta = tb[CRYPTOA_TYPE - 1]; 442 struct rtattr *rta = tb[0];
443 struct crypto_attr_type *algt; 443 struct crypto_attr_type *algt;
444 444
445 if (!rta) 445 if (!rta)
446 return ERR_PTR(-ENOENT); 446 return ERR_PTR(-ENOENT);
447 if (RTA_PAYLOAD(rta) < sizeof(*algt)) 447 if (RTA_PAYLOAD(rta) < sizeof(*algt))
448 return ERR_PTR(-EINVAL); 448 return ERR_PTR(-EINVAL);
449 if (rta->rta_type != CRYPTOA_TYPE)
450 return ERR_PTR(-EINVAL);
449 451
450 algt = RTA_DATA(rta); 452 algt = RTA_DATA(rta);
451 453
@@ -470,13 +472,15 @@ EXPORT_SYMBOL_GPL(crypto_check_attr_type);
470 472
471struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, u32 type, u32 mask) 473struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, u32 type, u32 mask)
472{ 474{
473 struct rtattr *rta = tb[CRYPTOA_ALG - 1]; 475 struct rtattr *rta = tb[1];
474 struct crypto_attr_alg *alga; 476 struct crypto_attr_alg *alga;
475 477
476 if (!rta) 478 if (!rta)
477 return ERR_PTR(-ENOENT); 479 return ERR_PTR(-ENOENT);
478 if (RTA_PAYLOAD(rta) < sizeof(*alga)) 480 if (RTA_PAYLOAD(rta) < sizeof(*alga))
479 return ERR_PTR(-EINVAL); 481 return ERR_PTR(-EINVAL);
482 if (rta->rta_type != CRYPTOA_ALG)
483 return ERR_PTR(-EINVAL);
480 484
481 alga = RTA_DATA(rta); 485 alga = RTA_DATA(rta);
482 alga->name[CRYPTO_MAX_ALG_NAME - 1] = 0; 486 alga->name[CRYPTO_MAX_ALG_NAME - 1] = 0;