1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Asynchronous Block Cipher API</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="API.html" title="Chapter 5. Programming Interface"><link rel="prev" href="API-struct-rng-alg.html" title="struct rng_alg"><link rel="next" href="API-crypto-alloc-ablkcipher.html" title="crypto_alloc_ablkcipher"></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">Asynchronous Block Cipher API</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-rng-alg.html">Prev</a> </td><th width="60%" align="center">Chapter 5. Programming Interface</th><td width="20%" align="right"> <a accesskey="n" href="API-crypto-alloc-ablkcipher.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1097487220"></a>Asynchronous Block Cipher API</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="refentrytitle"><a href="API-crypto-alloc-ablkcipher.html"><span class="phrase">crypto_alloc_ablkcipher</span></a></span><span class="refpurpose"> — 2 allocate asynchronous block cipher handle 3 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-free-ablkcipher.html"><span class="phrase">crypto_free_ablkcipher</span></a></span><span class="refpurpose"> — 4 zeroize and free cipher handle 5 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-has-ablkcipher.html"><span class="phrase">crypto_has_ablkcipher</span></a></span><span class="refpurpose"> — 6 Search for the availability of an ablkcipher. 7 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-ablkcipher-ivsize.html"><span class="phrase">crypto_ablkcipher_ivsize</span></a></span><span class="refpurpose"> — 8 obtain IV size 9 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-ablkcipher-blocksize.html"><span class="phrase">crypto_ablkcipher_blocksize</span></a></span><span class="refpurpose"> — 10 obtain block size of cipher 11 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-ablkcipher-setkey.html"><span class="phrase">crypto_ablkcipher_setkey</span></a></span><span class="refpurpose"> — 12 set key for cipher 13 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-ablkcipher-reqtfm.html"><span class="phrase">crypto_ablkcipher_reqtfm</span></a></span><span class="refpurpose"> — 14 obtain cipher handle from request 15 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-ablkcipher-encrypt.html"><span class="phrase">crypto_ablkcipher_encrypt</span></a></span><span class="refpurpose"> — 16 encrypt plaintext 17 </span></dt><dt><span class="refentrytitle"><a href="API-crypto-ablkcipher-decrypt.html"><span class="phrase">crypto_ablkcipher_decrypt</span></a></span><span class="refpurpose"> — 18 decrypt ciphertext 19 </span></dt></dl></div><p> 20 </p><p> 21 Asynchronous block cipher API is used with the ciphers of type 22 CRYPTO_ALG_TYPE_ABLKCIPHER (listed as type <span class="quote">“<span class="quote">ablkcipher</span>”</span> in /proc/crypto). 23 </p><p> 24 Asynchronous cipher operations imply that the function invocation for a 25 cipher request returns immediately before the completion of the operation. 26 The cipher request is scheduled as a separate kernel thread and therefore 27 load-balanced on the different CPUs via the process scheduler. To allow 28 the kernel crypto API to inform the caller about the completion of a cipher 29 request, the caller must provide a callback function. That function is 30 invoked with the cipher handle when the request completes. 31 </p><p> 32 To support the asynchronous operation, additional information than just the 33 cipher handle must be supplied to the kernel crypto API. That additional 34 information is given by filling in the ablkcipher_request data structure. 35 </p><p> 36 For the asynchronous block cipher API, the state is maintained with the tfm 37 cipher handle. A single tfm can be used across multiple calls and in 38 parallel. For asynchronous block cipher calls, context data supplied and 39 only used by the caller can be referenced the request data structure in 40 addition to the IV used for the cipher request. The maintenance of such 41 state information would be important for a crypto driver implementer to 42 have, because when calling the callback function upon completion of the 43 cipher operation, that callback function may need some information about 44 which operation just finished if it invoked multiple in parallel. This 45 state information is unused by the kernel crypto API. 46</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-rng-alg.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="API.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-crypto-alloc-ablkcipher.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct rng_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">crypto_alloc_ablkcipher</span></td></tr></table></div></body></html> 47