[PATCH 25/27] netlink: decode crypto_user_alg attributes of CRYPTOCFGA_REPORT_ACOMP

JingPiao Chen chenjingpiao at gmail.com
Sat Jul 22 13:00:40 UTC 2017


* configure.ac (AC_CHECK_TYPES): Add struct crypto_report_acomp.
* netlink_crypto.c (decode_crypto_report_acomp): New function.
(crypto_user_alg_nla_decoders): Add CRYPTOCFGA_REPORT_ACOMP.
---
 configure.ac     |  1 +
 netlink_crypto.c | 25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 929f248..d21d83f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -321,6 +321,7 @@ AC_CHECK_TYPES(m4_normalize([
 #include <linux/fcntl.h>])
 
 AC_CHECK_TYPES(m4_normalize([
+	struct crypto_report_acomp,
 	struct crypto_report_aead,
 	struct crypto_report_akcipher,
 	struct crypto_report_blkcipher,
diff --git a/netlink_crypto.c b/netlink_crypto.c
index 4cd75bd..9979991 100644
--- a/netlink_crypto.c
+++ b/netlink_crypto.c
@@ -250,6 +250,28 @@ decode_crypto_report_kpp(struct tcb *const tcp,
 	return true;
 }
 
+static bool
+decode_crypto_report_acomp(struct tcb *const tcp,
+			   const kernel_ulong_t addr,
+			   const unsigned int len,
+			   const void *const opaque_data)
+{
+# ifdef HAVE_STRUCT_CRYPTO_REPORT_ACOMP
+	struct crypto_report_acomp racomp;
+
+	if (len < sizeof(racomp))
+		printstr_ex(tcp, addr, len, QUOTE_0_TERMINATED);
+	else if (!umove_or_printaddr(tcp, addr, &racomp)) {
+		PRINT_FIELD_CSTRING("{", racomp, type);
+		tprints("}");
+	}
+# else
+	printstr_ex(tcp, addr, len, QUOTE_0_TERMINATED);
+# endif
+
+	return true;
+}
+
 static const nla_decoder_t crypto_user_alg_nla_decoders[] = {
 	[CRYPTOCFGA_PRIORITY_VAL]	= decode_nla_u32,
 	[CRYPTOCFGA_REPORT_LARVAL]	= decode_crypto_report_larval,
@@ -260,7 +282,8 @@ static const nla_decoder_t crypto_user_alg_nla_decoders[] = {
 	[CRYPTOCFGA_REPORT_RNG]		= decode_crypto_report_rng,
 	[CRYPTOCFGA_REPORT_CIPHER]	= decode_crypto_report_cipher,
 	[CRYPTOCFGA_REPORT_AKCIPHER]	= decode_crypto_report_akcipher,
-	[CRYPTOCFGA_REPORT_KPP]		= decode_crypto_report_kpp
+	[CRYPTOCFGA_REPORT_KPP]		= decode_crypto_report_kpp,
+	[CRYPTOCFGA_REPORT_ACOMP]	= decode_crypto_report_acomp
 };
 
 static void
-- 
2.7.4





More information about the Strace-devel mailing list