Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /* 32-bit compatibility syscall for 64-bit systems for DH operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 2016 Stephan Mueller <smueller@chronox.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include "internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * Perform the DH computation or DH based key derivation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * If successful, 0 will be returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) long compat_keyctl_dh_compute(struct keyctl_dh_params __user *params,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 			      char __user *buffer, size_t buflen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 			      struct compat_keyctl_kdf_params __user *kdf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct keyctl_kdf_params kdfcopy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	struct compat_keyctl_kdf_params compat_kdfcopy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	if (!kdf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		return __keyctl_dh_compute(params, buffer, buflen, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	if (copy_from_user(&compat_kdfcopy, kdf, sizeof(compat_kdfcopy)) != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	kdfcopy.hashname = compat_ptr(compat_kdfcopy.hashname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	kdfcopy.otherinfo = compat_ptr(compat_kdfcopy.otherinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	kdfcopy.otherinfolen = compat_kdfcopy.otherinfolen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	memcpy(kdfcopy.__spare, compat_kdfcopy.__spare,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	       sizeof(kdfcopy.__spare));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	return __keyctl_dh_compute(params, buffer, buflen, &kdfcopy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }