History

KEYS: Add KEYCTL_DH_COMPUTE command

This adds userspace access to Diffie-Hellman computations through a new keyctl() syscall command to calculate shared secrets or public keys using input parameters stored in the keyring. Input key ids are provided in a struct due to the current 5-arg limit for the keyctl syscall. Only user keys are supported in order to avoid exposing the content of logon or encrypted keys. The output is written to the provided buffer, based on the assumption that the values are only needed in userspace. Future support for other types of key derivation would involve a new command, like KEYCTL_ECDH_COMPUTE. Once Diffie-Hellman support is included in the crypto API, this code can be converted to use the crypto API to take advantage of possible hardware acceleration and reduce redundant code.

Mat Martineau committed 10 years ago

Commit ddbb4111 parent 13100a78 files · +233 −0Browse files

Showing the changes to include/uapi (1 of 8 files). Show all

Unified · Split

include/uapi/linux/keyctl.h+10−0
@@ -12,6 +12,8 @@ · 11 unmodified lines
1212 #ifndef _LINUX_KEYCTL_H
1313 #define _LINUX_KEYCTL_H
1414
15+#include <linux/types.h>
16+
1517 /* special process keyring shortcut IDs */
1618 #define KEY_SPEC_THREAD_KEYRING -1 /* - key ID for thread-specific keyring */
1719 #define KEY_SPEC_PROCESS_KEYRING -2 /* - key ID for process-specific keyring */
@@ -57,5 +59,13 @@ · 39 unmodified lines
5759 #define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
5860 #define KEYCTL_INVALIDATE 21 /* invalidate a key */
5961 #define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */
62+#define KEYCTL_DH_COMPUTE 23 /* Compute Diffie-Hellman values */
63+
64+/* keyctl structures */
65+struct keyctl_dh_params {
66+ __s32 private;
67+ __s32 prime;
68+ __s32 base;
69+};
6070
6171 #endif /* _LINUX_KEYCTL_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t