0001
0002
0003
0004
0005
0006
0007 #include <linux/uaccess.h>
0008
0009 #include "internal.h"
0010
0011
0012
0013
0014
0015
0016 long compat_keyctl_dh_compute(struct keyctl_dh_params __user *params,
0017 char __user *buffer, size_t buflen,
0018 struct compat_keyctl_kdf_params __user *kdf)
0019 {
0020 struct keyctl_kdf_params kdfcopy;
0021 struct compat_keyctl_kdf_params compat_kdfcopy;
0022
0023 if (!kdf)
0024 return __keyctl_dh_compute(params, buffer, buflen, NULL);
0025
0026 if (copy_from_user(&compat_kdfcopy, kdf, sizeof(compat_kdfcopy)) != 0)
0027 return -EFAULT;
0028
0029 kdfcopy.hashname = compat_ptr(compat_kdfcopy.hashname);
0030 kdfcopy.otherinfo = compat_ptr(compat_kdfcopy.otherinfo);
0031 kdfcopy.otherinfolen = compat_kdfcopy.otherinfolen;
0032 memcpy(kdfcopy.__spare, compat_kdfcopy.__spare,
0033 sizeof(kdfcopy.__spare));
0034
0035 return __keyctl_dh_compute(params, buffer, buflen, &kdfcopy);
0036 }