1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Multi-Block Ciphers [BLKCIPHER] [ABLKCIPHER]</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="Development.html" title="Chapter 3. Developing Cipher Algorithms"><link rel="prev" href="ch03s02.html" title="Single-Block Symmetric Ciphers [CIPHER]"><link rel="next" href="ch03s04.html" title="Hashing [HASH]"></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">Multi-Block Ciphers [BLKCIPHER] [ABLKCIPHER]</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Developing Cipher Algorithms</th><td width="20%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1094352132"></a>Multi-Block Ciphers [BLKCIPHER] [ABLKCIPHER]</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="ch03s03.html#idp1094352900">Registration Specifics</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#idp1097333636">Cipher Definition With struct blkcipher_alg and ablkcipher_alg</a></span></dt><dt><span class="sect2"><a href="ch03s03.html#idp1097334796">Specifics Of Asynchronous Multi-Block Cipher</a></span></dt></dl></div><p> 2 Example of transformations: cbc(aes), ecb(arc4), ... 3 </p><p> 4 This section describes the multi-block cipher transformation 5 implementations for both synchronous [BLKCIPHER] and 6 asynchronous [ABLKCIPHER] case. The multi-block ciphers are 7 used for transformations which operate on scatterlists of 8 data supplied to the transformation functions. They output 9 the result into a scatterlist of data as well. 10 </p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idp1094352900"></a>Registration Specifics</h3></div></div></div><p> 11 The registration of [BLKCIPHER] or [ABLKCIPHER] algorithms 12 is one of the most standard procedures throughout the crypto API. 13 </p><p> 14 Note, if a cipher implementation requires a proper alignment 15 of data, the caller should use the functions of 16 crypto_blkcipher_alignmask() or crypto_ablkcipher_alignmask() 17 respectively to identify a memory alignment mask. The kernel 18 crypto API is able to process requests that are unaligned. 19 This implies, however, additional overhead as the kernel 20 crypto API needs to perform the realignment of the data which 21 may imply moving of data. 22 </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idp1097333636"></a>Cipher Definition With struct blkcipher_alg and ablkcipher_alg</h3></div></div></div><p> 23 Struct blkcipher_alg defines a synchronous block cipher whereas 24 struct ablkcipher_alg defines an asynchronous block cipher. 25 </p><p> 26 Please refer to the single block cipher description for schematics 27 of the block cipher usage. The usage patterns are exactly the same 28 for [ABLKCIPHER] and [BLKCIPHER] as they are for plain [CIPHER]. 29 </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="idp1097334796"></a>Specifics Of Asynchronous Multi-Block Cipher</h3></div></div></div><p> 30 There are a couple of specifics to the [ABLKCIPHER] interface. 31 </p><p> 32 First of all, some of the drivers will want to use the 33 Generic ScatterWalk in case the hardware needs to be fed 34 separate chunks of the scatterlist which contains the 35 plaintext and will contain the ciphertext. Please refer 36 to the ScatterWalk interface offered by the Linux kernel 37 scatter / gather list implementation. 38 </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="Development.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Single-Block Symmetric Ciphers [CIPHER] </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Hashing [HASH]</td></tr></table></div></body></html> 39