Skip to content

Commit

Permalink
crypto: Add userspace report for larval type algorithms
Browse files Browse the repository at this point in the history
Signed-off-by: Steffen Klassert <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
klassert authored and herbertx committed Oct 21, 2011
1 parent b6aa63c commit 6c5a86f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crypto/crypto_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,23 @@ static int crypto_report_one(struct crypto_alg *alg,

NLA_PUT_U32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority);

if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
struct crypto_report_larval rl;

snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval");

NLA_PUT(skb, CRYPTOCFGA_REPORT_LARVAL,
sizeof(struct crypto_report_larval), &rl);

goto out;
}

if (alg->cra_type && alg->cra_type->report) {
if (alg->cra_type->report(skb, alg))
goto nla_put_failure;
}

out:
return 0;

nla_put_failure:
Expand Down
5 changes: 5 additions & 0 deletions include/linux/cryptouser.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum {
enum crypto_attr_type_t {
CRYPTOCFGA_UNSPEC,
CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
__CRYPTOCFGA_MAX

#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
Expand All @@ -50,3 +51,7 @@ struct crypto_user_alg {
__u32 cru_refcnt;
__u32 cru_flags;
};

struct crypto_report_larval {
char type[CRYPTO_MAX_NAME];
};

0 comments on commit 6c5a86f

Please sign in to comment.