Skip to content

Commit a55465d

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

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

crypto/pcompress.c

+18
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <linux/module.h>
2525
#include <linux/seq_file.h>
2626
#include <linux/string.h>
27+
#include <linux/cryptouser.h>
28+
#include <net/netlink.h>
2729

2830
#include <crypto/compress.h>
2931
#include <crypto/internal/compress.h>
@@ -46,6 +48,21 @@ static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm)
4648
return 0;
4749
}
4850

51+
static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg)
52+
{
53+
struct crypto_report_comp rpcomp;
54+
55+
snprintf(rpcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "pcomp");
56+
57+
NLA_PUT(skb, CRYPTOCFGA_REPORT_COMPRESS,
58+
sizeof(struct crypto_report_comp), &rpcomp);
59+
60+
return 0;
61+
62+
nla_put_failure:
63+
return -EMSGSIZE;
64+
}
65+
4966
static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg)
5067
__attribute__ ((unused));
5168
static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg)
@@ -60,6 +77,7 @@ static const struct crypto_type crypto_pcomp_type = {
6077
#ifdef CONFIG_PROC_FS
6178
.show = crypto_pcomp_show,
6279
#endif
80+
.report = crypto_pcomp_report,
6381
.maskclear = ~CRYPTO_ALG_TYPE_MASK,
6482
.maskset = CRYPTO_ALG_TYPE_MASK,
6583
.type = CRYPTO_ALG_TYPE_PCOMPRESS,

include/linux/cryptouser.h

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum crypto_attr_type_t {
4040
CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
4141
CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
4242
CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
43+
CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
4344
__CRYPTOCFGA_MAX
4445

4546
#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
@@ -81,3 +82,7 @@ struct crypto_report_aead {
8182
unsigned int maxauthsize;
8283
unsigned int ivsize;
8384
};
85+
86+
struct crypto_report_comp {
87+
char type[CRYPTO_MAX_NAME];
88+
};

0 commit comments

Comments
 (0)