David Howells | 973c9f4 | 2011-01-20 16:38:33 +0000 | [diff] [blame] | 1 | /* 32-bit compatibility syscall for 64-bit systems |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
David Howells | 3e30148 | 2005-06-23 22:00:56 -0700 | [diff] [blame] | 3 | * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/syscalls.h> |
| 13 | #include <linux/keyctl.h> |
| 14 | #include <linux/compat.h> |
| 15 | #include "internal.h" |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | /* |
David Howells | 973c9f4 | 2011-01-20 16:38:33 +0000 | [diff] [blame] | 18 | * The key control system call, 32-bit compatibility version for 64-bit archs |
| 19 | * |
| 20 | * This should only be called if the 64-bit arch uses weird pointers in 32-bit |
| 21 | * mode or doesn't guarantee that the top 32-bits of the argument registers on |
| 22 | * taking a 32-bit syscall are zero. If you can, you should call sys_keyctl() |
| 23 | * directly. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | */ |
| 25 | asmlinkage long compat_sys_keyctl(u32 option, |
David Howells | 3e30148 | 2005-06-23 22:00:56 -0700 | [diff] [blame] | 26 | u32 arg2, u32 arg3, u32 arg4, u32 arg5) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | { |
| 28 | switch (option) { |
| 29 | case KEYCTL_GET_KEYRING_ID: |
| 30 | return keyctl_get_keyring_ID(arg2, arg3); |
| 31 | |
| 32 | case KEYCTL_JOIN_SESSION_KEYRING: |
| 33 | return keyctl_join_session_keyring(compat_ptr(arg2)); |
| 34 | |
| 35 | case KEYCTL_UPDATE: |
| 36 | return keyctl_update_key(arg2, compat_ptr(arg3), arg4); |
| 37 | |
| 38 | case KEYCTL_REVOKE: |
| 39 | return keyctl_revoke_key(arg2); |
| 40 | |
| 41 | case KEYCTL_DESCRIBE: |
| 42 | return keyctl_describe_key(arg2, compat_ptr(arg3), arg4); |
| 43 | |
| 44 | case KEYCTL_CLEAR: |
| 45 | return keyctl_keyring_clear(arg2); |
| 46 | |
| 47 | case KEYCTL_LINK: |
| 48 | return keyctl_keyring_link(arg2, arg3); |
| 49 | |
| 50 | case KEYCTL_UNLINK: |
| 51 | return keyctl_keyring_unlink(arg2, arg3); |
| 52 | |
| 53 | case KEYCTL_SEARCH: |
| 54 | return keyctl_keyring_search(arg2, compat_ptr(arg3), |
| 55 | compat_ptr(arg4), arg5); |
| 56 | |
| 57 | case KEYCTL_READ: |
| 58 | return keyctl_read_key(arg2, compat_ptr(arg3), arg4); |
| 59 | |
| 60 | case KEYCTL_CHOWN: |
| 61 | return keyctl_chown_key(arg2, arg3, arg4); |
| 62 | |
| 63 | case KEYCTL_SETPERM: |
| 64 | return keyctl_setperm_key(arg2, arg3); |
| 65 | |
| 66 | case KEYCTL_INSTANTIATE: |
| 67 | return keyctl_instantiate_key(arg2, compat_ptr(arg3), arg4, |
| 68 | arg5); |
| 69 | |
| 70 | case KEYCTL_NEGATE: |
| 71 | return keyctl_negate_key(arg2, arg3, arg4); |
| 72 | |
David Howells | 3e30148 | 2005-06-23 22:00:56 -0700 | [diff] [blame] | 73 | case KEYCTL_SET_REQKEY_KEYRING: |
| 74 | return keyctl_set_reqkey_keyring(arg2); |
| 75 | |
David Howells | 017679c | 2006-01-08 01:02:43 -0800 | [diff] [blame] | 76 | case KEYCTL_SET_TIMEOUT: |
| 77 | return keyctl_set_timeout(arg2, arg3); |
| 78 | |
David Howells | b5f545c | 2006-01-08 01:02:47 -0800 | [diff] [blame] | 79 | case KEYCTL_ASSUME_AUTHORITY: |
| 80 | return keyctl_assume_authority(arg2); |
| 81 | |
David Howells | 70a5bb7 | 2008-04-29 01:01:26 -0700 | [diff] [blame] | 82 | case KEYCTL_GET_SECURITY: |
| 83 | return keyctl_get_security(arg2, compat_ptr(arg3), arg4); |
| 84 | |
David Howells | ee18d64 | 2009-09-02 09:14:21 +0100 | [diff] [blame] | 85 | case KEYCTL_SESSION_TO_PARENT: |
| 86 | return keyctl_session_to_parent(); |
| 87 | |
David Howells | fdd1b94 | 2011-03-07 15:06:09 +0000 | [diff] [blame^] | 88 | case KEYCTL_REJECT: |
| 89 | return keyctl_reject_key(arg2, arg3, arg4, arg5); |
| 90 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | default: |
| 92 | return -EOPNOTSUPP; |
| 93 | } |
David Howells | a8b17ed | 2011-01-20 16:38:27 +0000 | [diff] [blame] | 94 | } |