On Sat, Jul 22, 2017 at 08:43:36PM +0800, JingPiao Chen wrote:
> * configure.ac (AC_CHECK_TYPES): Add struct crypto_report_larval.
> * netlink_crypto.c (decode_crypto_report_larval): New function.
> (crypto_user_alg_nla_decoders): Add CRYPTOCFGA_REPORT_LARVAL.
> ---
> configure.ac | 4 ++++
> netlink_crypto.c | 25 ++++++++++++++++++++++++-
> 2 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 2c6e254..99d2c6e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -320,6 +320,10 @@ AC_CHECK_TYPES(m4_normalize([
> [#include <sys/types.h>
> #include <linux/fcntl.h>])
>
> +AC_CHECK_TYPES(m4_normalize([
> + struct crypto_report_larval
> +]),,, [#include <linux/cryptouser.h>])
> +
> AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
>
> AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
> diff --git a/netlink_crypto.c b/netlink_crypto.c
> index e39fdfc..9a9635b 100644
> --- a/netlink_crypto.c
> +++ b/netlink_crypto.c
> @@ -37,8 +37,31 @@
>
> # include "xlat/crypto_nl_attrs.h"
>
> +static bool
> +decode_crypto_report_larval(struct tcb *const tcp,
> + const kernel_ulong_t addr,
> + const unsigned int len,
> + const void *const opaque_data)
> +{
> +# ifdef HAVE_STRUCT_CRYPTO_REPORT_LARVAL
> + struct crypto_report_larval rl;
> +
> + if (len < sizeof(rl))
> + printstr_ex(tcp, addr, len, QUOTE_0_TERMINATED);
> + else if (!umove_or_printaddr(tcp, addr, &rl)) {
> + PRINT_FIELD_CSTRING("{", rl, type);
> + tprints("}");
> + }
> +# else
> + printstr_ex(tcp, addr, len, QUOTE_0_TERMINATED);
> +# endif
> +
> + return true;
> +}There are several crypto_report_* structures that are the same as crypto_report_larval and could share the same parser. Let's introduce this parser and use it to decode all these identical structures. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
