1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Setsockopt Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Kernel Crypto API"><link rel="up" href="User.html" title="Chapter&#160;4.&#160;User Space Interface"><link rel="prev" href="ch04s08.html" title="Zero-Copy Interface"><link rel="next" href="ch04s10.html" title="User space API example"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Setsockopt Interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s08.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;4.&#160;User Space Interface</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch04s10.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1097385508"></a>Setsockopt Interface</h2></div></div></div><p>
2     In addition to the read/recv and send/write system call handling
3     to send and retrieve data subject to the cipher operation, a consumer
4     also needs to set the additional information for the cipher operation.
5     This additional information is set using the setsockopt system call
6     that must be invoked with the file descriptor of the open cipher
7     (i.e. the file descriptor returned by the accept system call).
8    </p><p>
9     Each setsockopt invocation must use the level SOL_ALG.
10    </p><p>
11     The setsockopt interface allows setting the following data using
12     the mentioned optname:
13    </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
14       ALG_SET_KEY -- Setting the key. Key setting is applicable to:
15      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>the skcipher cipher type (symmetric ciphers)</p></li><li class="listitem"><p>the hash cipher type (keyed message digests)</p></li><li class="listitem"><p>the AEAD cipher type</p></li><li class="listitem"><p>the RNG cipher type to provide the seed</p></li></ul></div></li><li class="listitem"><p>
16       ALG_SET_AEAD_AUTHSIZE -- Setting the authentication tag size
17       for AEAD ciphers. For a encryption operation, the authentication
18       tag of the given size will be generated. For a decryption operation,
19       the provided ciphertext is assumed to contain an authentication tag
20       of the given size (see section about AEAD memory layout below).
21      </p></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s08.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="User.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch04s10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Zero-Copy Interface&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;User space API example</td></tr></table></div></body></html>
22