Skip to content

Commit

Permalink
crypto: aead - Add multiple algorithm registration interface
Browse files Browse the repository at this point in the history
This patch adds the helpers that allow the registration and removal
of multiple algorithms.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jun 3, 2015
1 parent 4361536 commit caab946
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crypto/aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,35 @@ void crypto_unregister_aead(struct aead_alg *alg)
}
EXPORT_SYMBOL_GPL(crypto_unregister_aead);

int crypto_register_aeads(struct aead_alg *algs, int count)
{
int i, ret;

for (i = 0; i < count; i++) {
ret = crypto_register_aead(&algs[i]);
if (ret)
goto err;
}

return 0;

err:
for (--i; i >= 0; --i)
crypto_unregister_aead(&algs[i]);

return ret;
}
EXPORT_SYMBOL_GPL(crypto_register_aeads);

void crypto_unregister_aeads(struct aead_alg *algs, int count)
{
int i;

for (i = count - 1; i >= 0; --i)
crypto_unregister_aead(&algs[i]);
}
EXPORT_SYMBOL_GPL(crypto_unregister_aeads);

int aead_register_instance(struct crypto_template *tmpl,
struct aead_instance *inst)
{
Expand Down
2 changes: 2 additions & 0 deletions include/crypto/internal/aead.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ static inline unsigned int crypto_aead_maxauthsize(struct crypto_aead *aead)

int crypto_register_aead(struct aead_alg *alg);
void crypto_unregister_aead(struct aead_alg *alg);
int crypto_register_aeads(struct aead_alg *algs, int count);
void crypto_unregister_aeads(struct aead_alg *algs, int count);
int aead_register_instance(struct crypto_template *tmpl,
struct aead_instance *inst);

Expand Down

0 comments on commit caab946

Please sign in to comment.