text
stringlengths
0
234
.ee
.in
.ip
should the timeout be reached,
the persistent keyring will be removed and
everything it pins can then be garbage collected.
.ip
persistent keyrings were added to linux in kernel version 3.13.
.ip
the arguments
.ir arg4
and
.ir arg5
are ignored.
.ip
this operation is exposed by
.i libkeyutils
via the function
.br keyctl_get_persistent (3).
.tp
.br keyctl_dh_compute " (since linux 4.7)"
.\" commit ddbb41148724367394d0880c516bfaeed127b52e
compute a diffie-hellman shared secret or public key,
optionally applying key derivation function (kdf) to the result.
.ip
the
.i arg2
argument is a pointer to a set of parameters containing
serial numbers for three
.ir """user"""
keys used in the diffie-hellman calculation,
packaged in a structure of the following form:
.ip
.in +4n
.ex
struct keyctl_dh_params {
int32_t private; /* the local private key */
int32_t prime; /* the prime, known to both parties */
int32_t base; /* the base integer: either a shared
generator or the remote public key */
};
.ee
.in
.ip
each of the three keys specified in this structure must grant the caller
.i read
permission.
the payloads of these keys are used to calculate the diffie-hellman
result as:
.ip
base \(ha private mod prime
.ip
if the base is the shared generator, the result is the local public key.
if the base is the remote public key, the result is the shared secret.
.ip
the
.i arg3
argument (cast to
.ir "char\ *" )
points to a buffer where the result of the calculation is placed.
the size of that buffer is specified in
.i arg4
(cast to
.ir size_t ).
.ip
the buffer must be large enough to accommodate the output data,
otherwise an error is returned.
if
.i arg4
is specified zero,
in which case the buffer is not used and
the operation returns the minimum required buffer size
(i.e., the length of the prime).
.ip
diffie-hellman computations can be performed in user space,
but require a multiple-precision integer (mpi) library.
moving the implementation into the kernel gives access to
the kernel mpi implementation,
and allows access to secure or acceleration hardware.
.ip
adding support for dh computation to the
.br keyctl ()
system call was considered a good fit due to the dh algorithm's use
for deriving shared keys;
it also allows the type of the key to determine
which dh implementation (software or hardware) is appropriate.
.\" commit f1c316a3ab9d24df6022682422fe897492f2c0c8
.ip
if the
.i arg5
argument is
.br null ,
then the dh result itself is returned.
otherwise (since linux 4.12), it is a pointer to a structure which specifies
parameters of the kdf operation to be applied:
.ip
.in +4n
.ex
struct keyctl_kdf_params {
char *hashname; /* hash algorithm name */