1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* 32-bit compatibility syscall for 64-bit systems
4 * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #include <linux/syscalls.h>
9 #include <linux/keyctl.h>
10 #include <linux/compat.h>
11 #include <linux/slab.h>
15 * The key control system call, 32-bit compatibility version for 64-bit archs
17 COMPAT_SYSCALL_DEFINE5(keyctl, u32, option,
18 u32, arg2, u32, arg3, u32, arg4, u32, arg5)
21 case KEYCTL_GET_KEYRING_ID:
22 return keyctl_get_keyring_ID(arg2, arg3);
24 case KEYCTL_JOIN_SESSION_KEYRING:
25 return keyctl_join_session_keyring(compat_ptr(arg2));
28 return keyctl_update_key(arg2, compat_ptr(arg3), arg4);
31 return keyctl_revoke_key(arg2);
34 return keyctl_describe_key(arg2, compat_ptr(arg3), arg4);
37 return keyctl_keyring_clear(arg2);
40 return keyctl_keyring_link(arg2, arg3);
43 return keyctl_keyring_unlink(arg2, arg3);
46 return keyctl_keyring_search(arg2, compat_ptr(arg3),
47 compat_ptr(arg4), arg5);
50 return keyctl_read_key(arg2, compat_ptr(arg3), arg4);
53 return keyctl_chown_key(arg2, arg3, arg4);
56 return keyctl_setperm_key(arg2, arg3);
58 case KEYCTL_INSTANTIATE:
59 return keyctl_instantiate_key(arg2, compat_ptr(arg3), arg4,
63 return keyctl_negate_key(arg2, arg3, arg4);
65 case KEYCTL_SET_REQKEY_KEYRING:
66 return keyctl_set_reqkey_keyring(arg2);
68 case KEYCTL_SET_TIMEOUT:
69 return keyctl_set_timeout(arg2, arg3);
71 case KEYCTL_ASSUME_AUTHORITY:
72 return keyctl_assume_authority(arg2);
74 case KEYCTL_GET_SECURITY:
75 return keyctl_get_security(arg2, compat_ptr(arg3), arg4);
77 case KEYCTL_SESSION_TO_PARENT:
78 return keyctl_session_to_parent();
81 return keyctl_reject_key(arg2, arg3, arg4, arg5);
83 case KEYCTL_INSTANTIATE_IOV:
84 return keyctl_instantiate_key_iov(arg2, compat_ptr(arg3), arg4,
87 case KEYCTL_INVALIDATE:
88 return keyctl_invalidate_key(arg2);
90 case KEYCTL_GET_PERSISTENT:
91 return keyctl_get_persistent(arg2, arg3);
93 case KEYCTL_DH_COMPUTE:
94 return compat_keyctl_dh_compute(compat_ptr(arg2),
96 arg4, compat_ptr(arg5));
98 case KEYCTL_RESTRICT_KEYRING:
99 return keyctl_restrict_keyring(arg2, compat_ptr(arg3),
102 case KEYCTL_PKEY_QUERY:
105 return keyctl_pkey_query(arg2,
109 case KEYCTL_PKEY_ENCRYPT:
110 case KEYCTL_PKEY_DECRYPT:
111 case KEYCTL_PKEY_SIGN:
112 return keyctl_pkey_e_d_s(option,
113 compat_ptr(arg2), compat_ptr(arg3),
114 compat_ptr(arg4), compat_ptr(arg5));
116 case KEYCTL_PKEY_VERIFY:
117 return keyctl_pkey_verify(compat_ptr(arg2), compat_ptr(arg3),
118 compat_ptr(arg4), compat_ptr(arg5));
121 return keyctl_keyring_move(arg2, arg3, arg4, arg5);
123 case KEYCTL_CAPABILITIES:
124 return keyctl_capabilities(compat_ptr(arg2), arg3);
126 case KEYCTL_WATCH_KEY:
127 return keyctl_watch_key(arg2, arg3, arg4);