1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct ablkcipher_alg</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="ch05s02.html" title="Block Cipher Algorithm Definitions"><link rel="prev" href="API-struct-crypto-alg.html" title="struct crypto_alg"><link rel="next" href="API-struct-aead-alg.html" title="struct aead_alg"></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"><span class="phrase">struct ablkcipher_alg</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-crypto-alg.html">Prev</a> </td><th width="60%" align="center">Block Cipher Algorithm Definitions</th><td width="20%" align="right"> <a accesskey="n" href="API-struct-aead-alg.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-ablkcipher-alg"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct ablkcipher_alg — 2 asynchronous block cipher definition 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct ablkcipher_alg { 5 int (* setkey) (struct crypto_ablkcipher *tfm, const u8 *key,unsigned int keylen); 6 int (* encrypt) (struct ablkcipher_request *req); 7 int (* decrypt) (struct ablkcipher_request *req); 8 int (* givencrypt) (struct skcipher_givcrypt_request *req); 9 int (* givdecrypt) (struct skcipher_givcrypt_request *req); 10 const char * geniv; 11 unsigned int min_keysize; 12 unsigned int max_keysize; 13 unsigned int ivsize; 14}; </pre></div><div class="refsect1"><a name="idp1097429764"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">setkey</span></dt><dd><p> 15Set key for the transformation. This function is used to either 16program a supplied key into the hardware or store the key in the 17transformation context for programming it later. Note that this 18function does modify the transformation context. This function can 19be called multiple times during the existence of the transformation 20object, so one must make sure the key is properly reprogrammed into 21the hardware. This function is also responsible for checking the key 22length for validity. In case a software fallback was put in place in 23the <em class="parameter"><code>cra_init</code></em> call, this function might need to use the fallback if 24the algorithm doesn't support all of the key sizes. 25 </p></dd><dt><span class="term">encrypt</span></dt><dd><p> 26Encrypt a scatterlist of blocks. This function is used to encrypt 27the supplied scatterlist containing the blocks of data. The crypto 28API consumer is responsible for aligning the entries of the 29scatterlist properly and making sure the chunks are correctly 30sized. In case a software fallback was put in place in the 31<em class="parameter"><code>cra_init</code></em> call, this function might need to use the fallback if 32the algorithm doesn't support all of the key sizes. In case the 33key was stored in transformation context, the key might need to be 34re-programmed into the hardware in this function. This function 35shall not modify the transformation context, as this function may 36be called in parallel with the same transformation object. 37 </p></dd><dt><span class="term">decrypt</span></dt><dd><p> 38Decrypt a single block. This is a reverse counterpart to <em class="parameter"><code>encrypt</code></em> 39and the conditions are exactly the same. 40 </p></dd><dt><span class="term">givencrypt</span></dt><dd><p> 41Update the IV for encryption. With this function, a cipher 42implementation may provide the function on how to update the IV 43for encryption. 44 </p></dd><dt><span class="term">givdecrypt</span></dt><dd><p> 45Update the IV for decryption. This is the reverse of 46<em class="parameter"><code>givencrypt</code></em> . 47 </p></dd><dt><span class="term">geniv</span></dt><dd><p> 48The transformation implementation may use an <span class="quote">“<span class="quote">IV generator</span>”</span> provided 49by the kernel crypto API. Several use cases have a predefined 50approach how IVs are to be updated. For such use cases, the kernel 51crypto API provides ready-to-use implementations that can be 52referenced with this variable. 53 </p></dd><dt><span class="term">min_keysize</span></dt><dd><p> 54Minimum key size supported by the transformation. This is the 55smallest key length supported by this transformation algorithm. 56This must be set to one of the pre-defined values as this is 57not hardware specific. Possible values for this field can be 58found via git grep <span class="quote">“<span class="quote">_MIN_KEY_SIZE</span>”</span> include/crypto/ 59 </p></dd><dt><span class="term">max_keysize</span></dt><dd><p> 60Maximum key size supported by the transformation. This is the 61largest key length supported by this transformation algorithm. 62This must be set to one of the pre-defined values as this is 63not hardware specific. Possible values for this field can be 64found via git grep <span class="quote">“<span class="quote">_MAX_KEY_SIZE</span>”</span> include/crypto/ 65 </p></dd><dt><span class="term">ivsize</span></dt><dd><p> 66IV size applicable for transformation. The consumer must provide an 67IV of exactly that size to perform the encrypt or decrypt operation. 68 </p></dd></dl></div></div><div class="refsect1"><a name="idp1097441188"></a><h2>Description</h2><p> 69 All fields except <em class="parameter"><code>givencrypt</code></em> , <em class="parameter"><code>givdecrypt</code></em> , <em class="parameter"><code>geniv</code></em> and <em class="parameter"><code>ivsize</code></em> are 70 mandatory and must be filled. 71</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-crypto-alg.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch05s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-struct-aead-alg.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct crypto_alg</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">struct aead_alg</span></td></tr></table></div></body></html> 72