1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Ciphers And Templates</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="Architecture.html" title="Chapter 2. Kernel Crypto API Architecture"><link rel="prev" href="Architecture.html" title="Chapter 2. Kernel Crypto API Architecture"><link rel="next" href="ch02s03.html" title="Synchronous And Asynchronous Operation"></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">Ciphers And Templates</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="Architecture.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Kernel Crypto API Architecture</th><td width="20%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1094535764"></a>Ciphers And Templates</h2></div></div></div><p> 2 The kernel crypto API provides implementations of single block 3 ciphers and message digests. In addition, the kernel crypto API 4 provides numerous "templates" that can be used in conjunction 5 with the single block ciphers and message digests. Templates 6 include all types of block chaining mode, the HMAC mechanism, etc. 7 </p><p> 8 Single block ciphers and message digests can either be directly 9 used by a caller or invoked together with a template to form 10 multi-block ciphers or keyed message digests. 11 </p><p> 12 A single block cipher may even be called with multiple templates. 13 However, templates cannot be used without a single cipher. 14 </p><p> 15 See /proc/crypto and search for "name". For example: 16 17 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>aes</p></li><li class="listitem"><p>ecb(aes)</p></li><li class="listitem"><p>cmac(aes)</p></li><li class="listitem"><p>ccm(aes)</p></li><li class="listitem"><p>rfc4106(gcm(aes))</p></li><li class="listitem"><p>sha1</p></li><li class="listitem"><p>hmac(sha1)</p></li><li class="listitem"><p>authenc(hmac(sha1),cbc(aes))</p></li></ul></div><p> 18 </p><p> 19 In these examples, "aes" and "sha1" are the ciphers and all 20 others are the templates. 21 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="Architecture.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="Architecture.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Kernel Crypto API Architecture </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Synchronous And Asynchronous Operation</td></tr></table></div></body></html> 22