'\" t .\" Title: kcapi_kpp_setkey .\" Author: .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: April 2024 .\" Manual: Programming Interface .\" Source: libkcapi Manual 1.4.0 .\" Language: English .\" .TH "KCAPI_KPP_SETKEY" "3" "April 2024" "libkcapi Manual 1\&.4\&.0" "Programming Interface" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" kcapi_kpp_setkey \- set the private key of the DH / ECDH operation .SH "SYNOPSIS" .HP \w'int\ kcapi_kpp_setkey('u .BI "int kcapi_kpp_setkey(struct\ kcapi_handle\ *\ " "handle" ", const\ uint8_t\ *\ " "key" ", uint32_t\ " "keylen" ");" .SH "ARGUMENTS" .PP \fIhandle\fR .RS 4 [in] cipher handle .RE .PP \fIkey\fR .RS 4 [in] key buffer .RE .PP \fIkeylen\fR .RS 4 [in] length of key buffer .RE .SH "DESCRIPTION" .PP With this function, the caller sets the key for subsequent DH / ECDH public key generation or shared secret generation operations\&. .PP If the key / keylen is zero, the kernel tries to generate the private key itself and retains it internally\&. This is useful if the DH / ECDH operation shall be performed on ephemeral keys where the caller is only interested in eventually obtain the shared secret\&. .PP After the caller provided the key, the caller may securely destroy the key as it is now maintained by the kernel\&. .PP Note, the key can only be set after the DH parameters or the ECC curve has been set\&. .PP \fIreturn\fR in case of success a positive integer is returned that denominates the maximum output size of the cryptographic operation \-\- this value must be used as the size of the output buffer for one cryptographic operation); a negative errno\-style error code if an error occurred \-\- the error \-EOPNOTSUPP is returned in case a kernel\-triggered private key generation is requested, but the underlying cipher implementation does not support this operation\&. .SH "AUTHOR" .PP \fBStephan Mueller\fR <\&smueller@chronox.de\&> .RS 4 Author. .RE .SH "COPYRIGHT" .br