2015-12-28 16:11:15 +01:00
|
|
|
# Copyright 2015 syzkaller project authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
|
|
|
|
2017-01-28 18:43:52 +01:00
|
|
|
include <linux/key.h>
|
2016-01-22 21:14:51 +01:00
|
|
|
include <linux/keyctl.h>
|
2016-08-27 18:27:50 +02:00
|
|
|
include <uapi/linux/keyctl.h>
|
|
|
|
|
2017-11-01 10:31:17 -07:00
|
|
|
# key serial number (key_serial_t)
|
|
|
|
resource key[int32]: 0
|
2016-01-22 21:14:51 +01:00
|
|
|
|
2017-11-01 10:31:17 -07:00
|
|
|
# key of type "keyring". Note: for now we include KEY_SPEC_REQKEY_AUTH_KEY here
|
|
|
|
# since it should be listed somewhere, though it's not actually a keyring.
|
|
|
|
resource keyring[key]: KEY_SPEC_THREAD_KEYRING, KEY_SPEC_PROCESS_KEYRING, KEY_SPEC_SESSION_KEYRING, KEY_SPEC_USER_KEYRING, KEY_SPEC_USER_SESSION_KEYRING, KEY_SPEC_GROUP_KEYRING, KEY_SPEC_REQKEY_AUTH_KEY, KEY_SPEC_REQUESTOR_KEYRING
|
|
|
|
|
|
|
|
# key of type "user"
|
|
|
|
resource user_key[key]
|
|
|
|
|
2018-06-18 19:45:47 +02:00
|
|
|
add_key(type ptr[in, string[key_type]], desc ptr[in, key_desc], payload buffer[in, opt], paylen len[payload], keyring keyring[opt]) key
|
|
|
|
add_key$keyring(type ptr[in, string["keyring"]], desc ptr[in, key_desc], payload const[0], paylen const[0], keyring keyring[opt]) keyring
|
|
|
|
add_key$user(type ptr[in, string["user"]], desc ptr[in, key_desc], payload buffer[in], paylen len[payload], keyring keyring[opt]) user_key
|
|
|
|
request_key(type ptr[in, string[key_type]], desc ptr[in, key_desc], callout ptr[in, string], keyring keyring[opt]) key
|
2015-12-28 16:11:15 +01:00
|
|
|
keyctl$get_keyring_id(code const[KEYCTL_GET_KEYRING_ID], key key, create intptr)
|
2017-01-28 18:43:52 +01:00
|
|
|
keyctl$join(code const[KEYCTL_JOIN_SESSION_KEYRING], session ptr[in, key_desc, opt])
|
2015-12-28 16:11:15 +01:00
|
|
|
keyctl$update(code const[KEYCTL_UPDATE], key key, payload buffer[in, opt], paylen len[payload])
|
|
|
|
keyctl$revoke(code const[KEYCTL_REVOKE], key key)
|
|
|
|
keyctl$describe(code const[KEYCTL_DESCRIBE], key key, desc buffer[out], len len[desc])
|
2017-11-01 10:31:17 -07:00
|
|
|
keyctl$clear(code const[KEYCTL_CLEAR], keyring keyring)
|
|
|
|
keyctl$link(code const[KEYCTL_LINK], key key, keyring keyring)
|
|
|
|
keyctl$unlink(code const[KEYCTL_UNLINK], key key, keyring keyring)
|
|
|
|
keyctl$search(code const[KEYCTL_SEARCH], key key, type ptr[in, string[key_type]], desc ptr[in, key_desc], destination keyring)
|
2015-12-28 16:11:15 +01:00
|
|
|
keyctl$read(code const[KEYCTL_READ], key key, payload buffer[out], len len[payload])
|
|
|
|
keyctl$chown(code const[KEYCTL_CHOWN], key key, uid uid, gid gid)
|
|
|
|
# perm is a mask of KEY_POS_VIEW, etc consants, but they cover almost whole int32.
|
2017-01-28 18:43:52 +01:00
|
|
|
keyctl$setperm(code const[KEYCTL_SETPERM], key key, perm flags[key_perm])
|
2018-09-26 15:37:33 +02:00
|
|
|
keyctl$instantiate(code const[KEYCTL_INSTANTIATE], key key, payload ptr[in, key_instantiate_payload, opt], paylen len[payload], keyring keyring[opt])
|
2017-11-01 10:31:17 -07:00
|
|
|
keyctl$negate(code const[KEYCTL_NEGATE], key key, timeout intptr, keyring keyring)
|
2015-12-28 16:11:15 +01:00
|
|
|
keyctl$set_reqkey_keyring(code const[KEYCTL_SET_REQKEY_KEYRING], reqkey flags[reqkey_keyring])
|
|
|
|
keyctl$set_timeout(code const[KEYCTL_SET_TIMEOUT], key key, timeout int32)
|
|
|
|
keyctl$assume_authority(code const[KEYCTL_ASSUME_AUTHORITY], key key)
|
|
|
|
keyctl$get_security(code const[KEYCTL_GET_SECURITY], key key, label buffer[out], len len[label])
|
|
|
|
keyctl$session_to_parent(code const[KEYCTL_SESSION_TO_PARENT])
|
2017-11-01 10:31:17 -07:00
|
|
|
keyctl$reject(code const[KEYCTL_REJECT], key key, timeout intptr, error intptr, keyring keyring)
|
2015-12-28 16:11:15 +01:00
|
|
|
keyctl$instantiate_iov(code const[KEYCTL_INSTANTIATE_IOV], key key, payload ptr[in, array[iovec_in]], len len[payload], ring key)
|
|
|
|
keyctl$invalidate(code const[KEYCTL_INVALIDATE], key key)
|
2017-11-01 10:31:17 -07:00
|
|
|
keyctl$get_persistent(code const[KEYCTL_GET_PERSISTENT], uid uid, keyring keyring)
|
2017-11-01 15:45:35 -07:00
|
|
|
keyctl$dh_compute(code const[KEYCTL_DH_COMPUTE], params ptr[in, keyctl_dh_params], buffer buffer[out], buflen len[buffer], kdf ptr[in, keyctl_kdf_params, opt])
|
2017-11-01 15:46:07 -07:00
|
|
|
keyctl$restrict_keyring(code const[KEYCTL_RESTRICT_KEYRING], keyring keyring, type ptr[in, string[key_type], opt], restriction ptr[in, string, opt])
|
2015-12-28 16:11:15 +01:00
|
|
|
|
|
|
|
reqkey_keyring = KEY_REQKEY_DEFL_NO_CHANGE, KEY_REQKEY_DEFL_DEFAULT, KEY_REQKEY_DEFL_THREAD_KEYRING, KEY_REQKEY_DEFL_PROCESS_KEYRING, KEY_REQKEY_DEFL_SESSION_KEYRING, KEY_REQKEY_DEFL_USER_KEYRING, KEY_REQKEY_DEFL_USER_SESSION_KEYRING, KEY_REQKEY_DEFL_GROUP_KEYRING, KEY_REQKEY_DEFL_REQUESTOR_KEYRING
|
2017-01-28 18:43:52 +01:00
|
|
|
key_perm = KEY_POS_VIEW, KEY_POS_READ, KEY_POS_WRITE, KEY_POS_SEARCH, KEY_POS_LINK, KEY_POS_SETATTR, KEY_USR_VIEW, KEY_USR_READ, KEY_USR_WRITE, KEY_USR_SEARCH, KEY_USR_LINK, KEY_USR_SETATTR, KEY_GRP_VIEW, KEY_GRP_READ, KEY_GRP_WRITE, KEY_GRP_SEARCH, KEY_GRP_LINK, KEY_GRP_SETATTR, KEY_OTH_VIEW, KEY_OTH_READ, KEY_OTH_WRITE, KEY_OTH_SEARCH, KEY_OTH_LINK, KEY_OTH_SETATTR, KEY_PERM_UNDEF
|
|
|
|
|
2017-11-01 10:30:31 -07:00
|
|
|
key_type = "asymmetric", "big_key", "blacklist", "ceph", "cifs.idmap", "cifs.spnego", ".dead", "dns_resolver", "encrypted", "id_legacy", "id_resolver", "keyring", "logon", "pkcs7_test", ".request_key_auth", "rxrpc", "rxrpc_s", "syzkaller", "trusted", "user"
|
2017-01-28 18:43:52 +01:00
|
|
|
|
|
|
|
# "syzP\x00"
|
|
|
|
key_desc {
|
2018-09-26 15:37:33 +02:00
|
|
|
prefix stringnoz["syz"]
|
|
|
|
id proc[' ', 4, int8]
|
|
|
|
z const[0, int8]
|
2017-01-28 18:43:52 +01:00
|
|
|
}
|
2017-11-01 15:45:35 -07:00
|
|
|
|
|
|
|
keyctl_dh_params {
|
|
|
|
private user_key
|
|
|
|
prime user_key
|
|
|
|
base user_key
|
|
|
|
}
|
|
|
|
|
|
|
|
keyctl_kdf_params {
|
2017-11-27 09:09:01 +01:00
|
|
|
hashname ptr[in, alg_hash_name]
|
2017-11-01 15:45:35 -07:00
|
|
|
otherinfo buffer[in, opt]
|
|
|
|
otherinfolen len[otherinfo, int32]
|
|
|
|
__spare array[const[0, int32], 8]
|
|
|
|
}
|
2018-09-26 15:37:33 +02:00
|
|
|
|
|
|
|
key_instantiate_payload [
|
|
|
|
encrypted_new key_encrypted_new
|
|
|
|
encrypted_load key_encrypted_load
|
|
|
|
encrypted_update key_encrypted_update
|
|
|
|
] [varlen]
|
|
|
|
|
|
|
|
key_encrypted_new {
|
|
|
|
cmd stringnoz["new "]
|
|
|
|
format stringnoz[key_encrypted_format]
|
|
|
|
sp0 const[' ', int8]
|
|
|
|
key_type stringnoz[key_encrypted_key_type]
|
|
|
|
key_desc stringnoz
|
|
|
|
sp1 const[' ', int8]
|
|
|
|
datalen fmt[dec, int64]
|
|
|
|
z const[0, int8]
|
|
|
|
} [packed]
|
|
|
|
|
|
|
|
key_encrypted_load {
|
|
|
|
cmd stringnoz["load "]
|
|
|
|
format stringnoz[key_encrypted_format]
|
|
|
|
sp0 const[' ', int8]
|
|
|
|
key_type stringnoz[key_encrypted_key_type]
|
|
|
|
key_desc stringnoz
|
|
|
|
sp1 const[' ', int8]
|
|
|
|
datalen fmt[dec, int64]
|
|
|
|
sp2 const[' ', int8]
|
|
|
|
# TODO: this is something complex: hex-encoded iv of particular length, followed by delim?
|
|
|
|
# followed by something-hex-encoded of some particular length, followed by something more?
|
|
|
|
iv_data array[flags[hex_chars, int8]]
|
|
|
|
z const[0, int8]
|
|
|
|
} [packed]
|
|
|
|
|
|
|
|
key_encrypted_update {
|
|
|
|
cmd stringnoz["update "]
|
|
|
|
format stringnoz[key_encrypted_format]
|
|
|
|
sp0 const[' ', int8]
|
|
|
|
key_type stringnoz[key_encrypted_key_type]
|
|
|
|
key_desc stringnoz
|
|
|
|
z const[0, int8]
|
|
|
|
} [packed]
|
|
|
|
|
|
|
|
key_encrypted_format = "ecryptfs", "default"
|
|
|
|
key_encrypted_key_type = "trusted:", "user:"
|