1KCAPI_KPP_SETKEY(3) Programming Interface KCAPI_KPP_SETKEY(3)
2
3
4
6 kcapi_kpp_setkey - set the private key of the DH / ECDH operation
7
9 int kcapi_kpp_setkey(struct kcapi_handle * handle, const uint8_t * key,
10 uint32_t keylen);
11
13 handle
14 [in] cipher handle
15
16 key
17 [in] key buffer
18
19 keylen
20 [in] length of key buffer
21
23 With this function, the caller sets the key for subsequent DH / ECDH
24 public key generation or shared secret generation operations.
25
26 If the key / keylen is zero, the kernel tries to generate the private
27 key itself and retains it internally. This is useful if the DH / ECDH
28 operation shall be performed on ephemeral keys where the caller is only
29 interested in eventually obtain the shared secret.
30
31 After the caller provided the key, the caller may securely destroy the
32 key as it is now maintained by the kernel.
33
34 Note, the key can only be set after the DH parameters or the ECC curve
35 has been set.
36
37 return in case of success a positive integer is returned that
38 denominates the maximum output size of the cryptographic operation --
39 this value must be used as the size of the output buffer for one
40 cryptographic operation); a negative errno-style error code if an error
41 occurred -- the error -EOPNOTSUPP is returned in case a
42 kernel-triggered private key generation is requested, but the
43 underlying cipher implementation does not support this operation.
44
46 Stephan Mueller <smueller@chronox.de>
47 Author.
48
50libkcapi Manual 1.3.1 July 2021 KCAPI_KPP_SETKEY(3)