Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* compat.c: 32-bit compatibility syscall for 64-bit systems |
2 | * | |
3e30148c | 3 | * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved. |
1da177e4 LT |
4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
1da177e4 LT |
12 | #include <linux/syscalls.h> |
13 | #include <linux/keyctl.h> | |
14 | #include <linux/compat.h> | |
15 | #include "internal.h" | |
16 | ||
1da177e4 LT |
17 | /* |
18 | * the key control system call, 32-bit compatibility version for 64-bit archs | |
19 | * - this should only be called if the 64-bit arch uses weird pointers in | |
20 | * 32-bit mode or doesn't guarantee that the top 32-bits of the argument | |
21 | * registers on taking a 32-bit syscall are zero | |
22 | * - if you can, you should call sys_keyctl directly | |
23 | */ | |
24 | asmlinkage long compat_sys_keyctl(u32 option, | |
3e30148c | 25 | u32 arg2, u32 arg3, u32 arg4, u32 arg5) |
1da177e4 LT |
26 | { |
27 | switch (option) { | |
28 | case KEYCTL_GET_KEYRING_ID: | |
29 | return keyctl_get_keyring_ID(arg2, arg3); | |
30 | ||
31 | case KEYCTL_JOIN_SESSION_KEYRING: | |
32 | return keyctl_join_session_keyring(compat_ptr(arg2)); | |
33 | ||
34 | case KEYCTL_UPDATE: | |
35 | return keyctl_update_key(arg2, compat_ptr(arg3), arg4); | |
36 | ||
37 | case KEYCTL_REVOKE: | |
38 | return keyctl_revoke_key(arg2); | |
39 | ||
40 | case KEYCTL_DESCRIBE: | |
41 | return keyctl_describe_key(arg2, compat_ptr(arg3), arg4); | |
42 | ||
43 | case KEYCTL_CLEAR: | |
44 | return keyctl_keyring_clear(arg2); | |
45 | ||
46 | case KEYCTL_LINK: | |
47 | return keyctl_keyring_link(arg2, arg3); | |
48 | ||
49 | case KEYCTL_UNLINK: | |
50 | return keyctl_keyring_unlink(arg2, arg3); | |
51 | ||
52 | case KEYCTL_SEARCH: | |
53 | return keyctl_keyring_search(arg2, compat_ptr(arg3), | |
54 | compat_ptr(arg4), arg5); | |
55 | ||
56 | case KEYCTL_READ: | |
57 | return keyctl_read_key(arg2, compat_ptr(arg3), arg4); | |
58 | ||
59 | case KEYCTL_CHOWN: | |
60 | return keyctl_chown_key(arg2, arg3, arg4); | |
61 | ||
62 | case KEYCTL_SETPERM: | |
63 | return keyctl_setperm_key(arg2, arg3); | |
64 | ||
65 | case KEYCTL_INSTANTIATE: | |
66 | return keyctl_instantiate_key(arg2, compat_ptr(arg3), arg4, | |
67 | arg5); | |
68 | ||
69 | case KEYCTL_NEGATE: | |
70 | return keyctl_negate_key(arg2, arg3, arg4); | |
71 | ||
3e30148c DH |
72 | case KEYCTL_SET_REQKEY_KEYRING: |
73 | return keyctl_set_reqkey_keyring(arg2); | |
74 | ||
017679c4 DH |
75 | case KEYCTL_SET_TIMEOUT: |
76 | return keyctl_set_timeout(arg2, arg3); | |
77 | ||
b5f545c8 DH |
78 | case KEYCTL_ASSUME_AUTHORITY: |
79 | return keyctl_assume_authority(arg2); | |
80 | ||
70a5bb72 DH |
81 | case KEYCTL_GET_SECURITY: |
82 | return keyctl_get_security(arg2, compat_ptr(arg3), arg4); | |
83 | ||
ee18d64c DH |
84 | case KEYCTL_SESSION_TO_PARENT: |
85 | return keyctl_session_to_parent(); | |
86 | ||
1da177e4 LT |
87 | default: |
88 | return -EOPNOTSUPP; | |
89 | } | |
a8b17ed0 | 90 | } |