Skip to content

Commit 3e29c10

Browse files
klassertherbertx
authored andcommitted
crypto: Add userspace report for givcipher type algorithms
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 29ffc87 commit 3e29c10

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

crypto/ablkcipher.c

+23
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,28 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
457457
return 0;
458458
}
459459

460+
static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
461+
{
462+
struct crypto_report_blkcipher rblkcipher;
463+
464+
snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "givcipher");
465+
snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s",
466+
alg->cra_ablkcipher.geniv ?: "<built-in>");
467+
468+
rblkcipher.blocksize = alg->cra_blocksize;
469+
rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
470+
rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize;
471+
rblkcipher.ivsize = alg->cra_ablkcipher.ivsize;
472+
473+
NLA_PUT(skb, CRYPTOCFGA_REPORT_BLKCIPHER,
474+
sizeof(struct crypto_report_blkcipher), &rblkcipher);
475+
476+
return 0;
477+
478+
nla_put_failure:
479+
return -EMSGSIZE;
480+
}
481+
460482
static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
461483
__attribute__ ((unused));
462484
static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
@@ -479,6 +501,7 @@ const struct crypto_type crypto_givcipher_type = {
479501
#ifdef CONFIG_PROC_FS
480502
.show = crypto_givcipher_show,
481503
#endif
504+
.report = crypto_givcipher_report,
482505
};
483506
EXPORT_SYMBOL_GPL(crypto_givcipher_type);
484507

0 commit comments

Comments
 (0)