strace/fetch_struct_keyctl_kdf_params.c
Eugene Syromyatnikov 46a4dcf4c3 keyctl: add support for KDF parameters decoding in KEYCTL_DH_COMPUTE
* fetch_struct_keyctl_kdf_params.c: New file.
* keyctl_kdf_params.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* configure.ac: Add check for struct keyctl_kdf_params presence in
<linux/keyctl.h>.
* defs.h (struct strace_keyctl_kdf_params): Add forward declaration.
* keyctl.c (keyctl_dh_compute): Add new parameter kdf_addr, print it
on exiting.
(SYS_FUNC(keyctl)) <case KEYCTL_DH_COMPUTE>: Pass arg5 to
keyctl_dh_compute.
* tests/keyctl.c: Include assert.h.
(struct keyctl_kdf_params) [!HAVE_STRUCT_KEYCTL_KDF_PARAMS]: New
definition.
(STR32): New definition, copied from ioctl_dm.c.
(append_str, kckdfp_to_str): New functions.
(main): Update expected output, add checks for struct keyctl_kdf_params
decoding.
2017-09-02 21:48:14 +00:00

35 lines
693 B
C

#include "defs.h"
#include DEF_MPERS_TYPE(struct_keyctl_kdf_params)
#include "keyctl_kdf_params.h"
typedef struct keyctl_kdf_params struct_keyctl_kdf_params;
#include MPERS_DEFS
MPERS_PRINTER_DECL(int, fetch_keyctl_kdf_params, struct tcb *const tcp,
kernel_ulong_t addr, struct strace_keyctl_kdf_params *p)
{
struct_keyctl_kdf_params kdf;
int ret;
if ((ret = umove(tcp, addr, &kdf)))
return ret;
p->hashname = (kernel_ulong_t)
#ifndef IN_MPERS
(uintptr_t)
#endif
kdf.hashname;
p->otherinfo = (kernel_ulong_t)
#ifndef IN_MPERS
(uintptr_t)
#endif
kdf.otherinfo;
p->otherinfolen = kdf.otherinfolen;
memcpy(p->__spare, kdf.__spare, sizeof(kdf.__spare));
return 0;
}