KEYCTL_INSTANTIATE


Instantiates the payload of an uninstantiated key from the data specified.

If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call to supply data for the key before the invoked process returns, or else the key will be marked negative automatically.

Arguments

ecx Key serial number.
edx Pointer to a buffer containing the data for new payload. It may be zero if the key type permits it. The key type may reject the data if it's in the wrong format or in some other way invalid.
esi Size of the data pointed by edx. It may be zero if the key type permits it.
edi Keyring serial number. If it's specified (non-zero), the key will also be linked into this keyring, however all the constraints applying in KEYCTL_LINK apply in this case too.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-ENOKEY No matching key was found.
-EKEYEXPIRED The keyring specified has expired.
-EKEYREVOKED The keyring specified had been revoked.
-EACCES The key exists, but is not writable by the requester.
-ENOMEM Insufficient memory to store the new payload or to expand the destination keyring.
-EDQUOT The key quota for the key's user would be exceeded by increasing the size of the key to accommodate the new payload or the key quota for the keyring's user would be exceeded by expanding the destination keyring.
-EINVAL The payload data was invalid.

Remarks

The process must have write access on the key to be able to instantiate it, and the key must be uninstantiated.