1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00
arduinolibs/classAcorn128.html
Rhys Weatherley 6fadd58f39 Update docs
2018-04-27 12:01:49 +10:00

644 lines
40 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Arduino Cryptography Library: Acorn128 Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Arduino Cryptography Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classAcorn128-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Acorn128 Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>ACORN-128 authenticated cipher.
<a href="classAcorn128.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="Acorn128_8h_source.html">Acorn128.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Acorn128:</div>
<div class="dyncontent">
<div class="center">
<img src="classAcorn128.png" usemap="#Acorn128_map" alt=""/>
<map id="Acorn128_map" name="Acorn128_map">
<area href="classAuthenticatedCipher.html" title="Abstract base class for authenticated ciphers. " alt="AuthenticatedCipher" shape="rect" coords="0,56,127,80"/>
<area href="classCipher.html" title="Abstract base class for stream ciphers. " alt="Cipher" shape="rect" coords="0,0,127,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af42823fb01dcbdeb8a93fa4103edebf2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af42823fb01dcbdeb8a93fa4103edebf2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#af42823fb01dcbdeb8a93fa4103edebf2">Acorn128</a> ()</td></tr>
<tr class="memdesc:af42823fb01dcbdeb8a93fa4103edebf2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> authenticated cipher. <br/></td></tr>
<tr class="separator:af42823fb01dcbdeb8a93fa4103edebf2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a170c189599a1cf332db5496dd6bc1df4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a170c189599a1cf332db5496dd6bc1df4"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a170c189599a1cf332db5496dd6bc1df4">~Acorn128</a> ()</td></tr>
<tr class="memdesc:a170c189599a1cf332db5496dd6bc1df4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys this <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> authenticated cipher. <br/></td></tr>
<tr class="separator:a170c189599a1cf332db5496dd6bc1df4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af13cffd088e6ec25f9f781bea22fba12"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#af13cffd088e6ec25f9f781bea22fba12">keySize</a> () const </td></tr>
<tr class="memdesc:af13cffd088e6ec25f9f781bea22fba12"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the size of the <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> key in bytes. <a href="#af13cffd088e6ec25f9f781bea22fba12">More...</a><br/></td></tr>
<tr class="separator:af13cffd088e6ec25f9f781bea22fba12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4141564021e8233727beb5b9f645dc4e"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a4141564021e8233727beb5b9f645dc4e">ivSize</a> () const </td></tr>
<tr class="memdesc:a4141564021e8233727beb5b9f645dc4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the size of the <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> initialization vector in bytes. <a href="#a4141564021e8233727beb5b9f645dc4e">More...</a><br/></td></tr>
<tr class="separator:a4141564021e8233727beb5b9f645dc4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75c8953cea6b9cd59aa5034dfe739889"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a75c8953cea6b9cd59aa5034dfe739889">tagSize</a> () const </td></tr>
<tr class="memdesc:a75c8953cea6b9cd59aa5034dfe739889"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the size of the <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> authentication tag in bytes. <a href="#a75c8953cea6b9cd59aa5034dfe739889">More...</a><br/></td></tr>
<tr class="separator:a75c8953cea6b9cd59aa5034dfe739889"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a2b2285ffc4d0ed57d661d739d22302"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a2a2b2285ffc4d0ed57d661d739d22302">setKey</a> (const uint8_t *key, size_t len)</td></tr>
<tr class="memdesc:a2a2b2285ffc4d0ed57d661d739d22302"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the key to use for future encryption and decryption operations. <a href="#a2a2b2285ffc4d0ed57d661d739d22302">More...</a><br/></td></tr>
<tr class="separator:a2a2b2285ffc4d0ed57d661d739d22302"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4e9ecf2030c4d2e3f32a19f937de845"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#ae4e9ecf2030c4d2e3f32a19f937de845">setIV</a> (const uint8_t *iv, size_t len)</td></tr>
<tr class="memdesc:ae4e9ecf2030c4d2e3f32a19f937de845"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the initialization vector to use for future encryption and decryption operations. <a href="#ae4e9ecf2030c4d2e3f32a19f937de845">More...</a><br/></td></tr>
<tr class="separator:ae4e9ecf2030c4d2e3f32a19f937de845"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4273a0b1eb880d98e34f2f9123fa167b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b">encrypt</a> (uint8_t *output, const uint8_t *input, size_t len)</td></tr>
<tr class="memdesc:a4273a0b1eb880d98e34f2f9123fa167b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encrypts an input buffer and writes the ciphertext to an output buffer. <a href="#a4273a0b1eb880d98e34f2f9123fa167b">More...</a><br/></td></tr>
<tr class="separator:a4273a0b1eb880d98e34f2f9123fa167b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7eacfc496f19b691207f64ba58b4c14a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a">decrypt</a> (uint8_t *output, const uint8_t *input, size_t len)</td></tr>
<tr class="memdesc:a7eacfc496f19b691207f64ba58b4c14a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decrypts an input buffer and writes the plaintext to an output buffer. <a href="#a7eacfc496f19b691207f64ba58b4c14a">More...</a><br/></td></tr>
<tr class="separator:a7eacfc496f19b691207f64ba58b4c14a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a893539010c729c7d93a7acfd76ae67"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a9a893539010c729c7d93a7acfd76ae67">addAuthData</a> (const void *data, size_t len)</td></tr>
<tr class="memdesc:a9a893539010c729c7d93a7acfd76ae67"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds extra data that will be authenticated but not encrypted. <a href="#a9a893539010c729c7d93a7acfd76ae67">More...</a><br/></td></tr>
<tr class="separator:a9a893539010c729c7d93a7acfd76ae67"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a333c98509f0ba55dff684d54781c0242"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a333c98509f0ba55dff684d54781c0242">computeTag</a> (void *tag, size_t len)</td></tr>
<tr class="memdesc:a333c98509f0ba55dff684d54781c0242"><td class="mdescLeft">&#160;</td><td class="mdescRight">Finalizes the encryption process and computes the authentication tag. <a href="#a333c98509f0ba55dff684d54781c0242">More...</a><br/></td></tr>
<tr class="separator:a333c98509f0ba55dff684d54781c0242"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a1c914c76d15af00bbb348f160bbacb"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#a0a1c914c76d15af00bbb348f160bbacb">checkTag</a> (const void *tag, size_t len)</td></tr>
<tr class="memdesc:a0a1c914c76d15af00bbb348f160bbacb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Finalizes the decryption process and checks the authentication tag. <a href="#a0a1c914c76d15af00bbb348f160bbacb">More...</a><br/></td></tr>
<tr class="separator:a0a1c914c76d15af00bbb348f160bbacb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac98fa6f3ad9f12b090d678d94ffff56f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac98fa6f3ad9f12b090d678d94ffff56f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAcorn128.html#ac98fa6f3ad9f12b090d678d94ffff56f">clear</a> ()</td></tr>
<tr class="memdesc:ac98fa6f3ad9f12b090d678d94ffff56f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears all security-sensitive state from this cipher object. <br/></td></tr>
<tr class="separator:ac98fa6f3ad9f12b090d678d94ffff56f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classAuthenticatedCipher"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classAuthenticatedCipher')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classAuthenticatedCipher.html">AuthenticatedCipher</a></td></tr>
<tr class="memitem:a0b1c0210ecb9d374d09b5b62a5140ba2 inherit pub_methods_classAuthenticatedCipher"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0b1c0210ecb9d374d09b5b62a5140ba2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#a0b1c0210ecb9d374d09b5b62a5140ba2">AuthenticatedCipher</a> ()</td></tr>
<tr class="memdesc:a0b1c0210ecb9d374d09b5b62a5140ba2 inherit pub_methods_classAuthenticatedCipher"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new authenticated cipher. <br/></td></tr>
<tr class="separator:a0b1c0210ecb9d374d09b5b62a5140ba2 inherit pub_methods_classAuthenticatedCipher"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae52a07be5b7265ea5898529ec21a79e4 inherit pub_methods_classAuthenticatedCipher"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae52a07be5b7265ea5898529ec21a79e4"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#ae52a07be5b7265ea5898529ec21a79e4">~AuthenticatedCipher</a> ()</td></tr>
<tr class="memdesc:ae52a07be5b7265ea5898529ec21a79e4 inherit pub_methods_classAuthenticatedCipher"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys this authenticated cipher. <br/></td></tr>
<tr class="separator:ae52a07be5b7265ea5898529ec21a79e4 inherit pub_methods_classAuthenticatedCipher"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classCipher"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classCipher')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classCipher.html">Cipher</a></td></tr>
<tr class="memitem:a6a61077eca3ccd5900f92ceac58fb09c inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a61077eca3ccd5900f92ceac58fb09c"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a6a61077eca3ccd5900f92ceac58fb09c">Cipher</a> ()</td></tr>
<tr class="memdesc:a6a61077eca3ccd5900f92ceac58fb09c inherit pub_methods_classCipher"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new cipher object. <br/></td></tr>
<tr class="separator:a6a61077eca3ccd5900f92ceac58fb09c inherit pub_methods_classCipher"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a84bdea765f7e35aa5b5950dd2853a383 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a84bdea765f7e35aa5b5950dd2853a383">~Cipher</a> ()</td></tr>
<tr class="memdesc:a84bdea765f7e35aa5b5950dd2853a383 inherit pub_methods_classCipher"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys this cipher object. <a href="#a84bdea765f7e35aa5b5950dd2853a383">More...</a><br/></td></tr>
<tr class="separator:a84bdea765f7e35aa5b5950dd2853a383 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>ACORN-128 authenticated cipher. </p>
<p><a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> is an authenticated cipher designed for memory-limited environments with a 128-bit key, a 128-bit initialization vector, and a 128-bit authentication tag. It was one of the finalists in the CAESAR AEAD competition.</p>
<p>References: <a href="http://competitions.cr.yp.to/round3/acornv3.pdf,">http://competitions.cr.yp.to/round3/acornv3.pdf,</a> <a href="http://competitions.cr.yp.to/caesar-submissions.html">http://competitions.cr.yp.to/caesar-submissions.html</a></p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAuthenticatedCipher.html" title="Abstract base class for authenticated ciphers. ">AuthenticatedCipher</a> </dd></dl>
<p>Definition at line <a class="el" href="Acorn128_8h_source.html#l00067">67</a> of file <a class="el" href="Acorn128_8h_source.html">Acorn128.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a9a893539010c729c7d93a7acfd76ae67"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void Acorn128::addAuthData </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds extra data that will be authenticated but not encrypted. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>The extra data to be authenticated. </td></tr>
<tr><td class="paramname">len</td><td>The number of bytes of extra data to be authenticated.</td></tr>
</table>
</dd>
</dl>
<p>This function must be called before the first call to <a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> or <a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a>. That is, it is assumed that all extra data for authentication is available before the first payload data block and that it will be prepended to the payload for authentication. If the subclass needs to process the extra data after the payload, then it is responsible for saving <em>data</em> away until it is needed during <a class="el" href="classAcorn128.html#a333c98509f0ba55dff684d54781c0242" title="Finalizes the encryption process and computes the authentication tag. ">computeTag()</a> or <a class="el" href="classAcorn128.html#a0a1c914c76d15af00bbb348f160bbacb" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a>.</p>
<p>This function can be called multiple times with separate extra data blocks for authentication. All such data will be concatenated into a single block for authentication purposes. </p>
<p>Implements <a class="el" href="classAuthenticatedCipher.html#abdb081bdf0d59c138cbcffd23c044b10">AuthenticatedCipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00606">606</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a0a1c914c76d15af00bbb348f160bbacb"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool Acorn128::checkTag </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>tag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Finalizes the decryption process and checks the authentication tag. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">tag</td><td>The tag value from the incoming ciphertext to be checked. </td></tr>
<tr><td class="paramname">len</td><td>The length of the tag value in bytes, which may be less than <a class="el" href="classAcorn128.html#a75c8953cea6b9cd59aa5034dfe739889" title="Gets the size of the Acorn128 authentication tag in bytes. ">tagSize()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns true if the <em>tag</em> is identical to the first <em>len</em> bytes of the authentication tag that was calculated during the decryption process. Returns false otherwise.</dd></dl>
<p>This function must be called after the final block of ciphertext is passed to <a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> to determine if the data could be authenticated.</p>
<dl class="section note"><dt>Note</dt><dd>Authenticated cipher modes usually require that if the tag could not be verified, then all of the data that was previously decrypted <em>must</em> be discarded. It is unwise to use the decrypted data for any purpose before it can be verified. Callers are responsible for ensuring that any data returned via previous calls to <a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> is discarded if <a class="el" href="classAcorn128.html#a0a1c914c76d15af00bbb348f160bbacb" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a> returns false.</dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAcorn128.html#a333c98509f0ba55dff684d54781c0242" title="Finalizes the encryption process and computes the authentication tag. ">computeTag()</a> </dd></dl>
<p>Implements <a class="el" href="classAuthenticatedCipher.html#a4bb33d194e2c7d30c4e5a713e59786ff">AuthenticatedCipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00660">660</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a333c98509f0ba55dff684d54781c0242"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void Acorn128::computeTag </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>tag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Finalizes the encryption process and computes the authentication tag. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">tag</td><td>Points to the buffer to write the tag to. </td></tr>
<tr><td class="paramname">len</td><td>The length of the tag, which may be less than <a class="el" href="classAcorn128.html#a75c8953cea6b9cd59aa5034dfe739889" title="Gets the size of the Acorn128 authentication tag in bytes. ">tagSize()</a> to truncate the tag to the first <em>len</em> bytes.</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAcorn128.html#a0a1c914c76d15af00bbb348f160bbacb" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a> </dd></dl>
<p>Implements <a class="el" href="classAuthenticatedCipher.html#a73fa4306053ed457e5c533b3127391c9">AuthenticatedCipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00631">631</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7eacfc496f19b691207f64ba58b4c14a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void Acorn128::decrypt </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Decrypts an input buffer and writes the plaintext to an output buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">output</td><td>The output buffer to write to, which may be the same buffer as <em>input</em>. The <em>output</em> buffer must have at least as many bytes as the <em>input</em> buffer. </td></tr>
<tr><td class="paramname">input</td><td>The input buffer to read from. </td></tr>
<tr><td class="paramname">len</td><td>The number of bytes to decrypt.</td></tr>
</table>
</dd>
</dl>
<p>The <a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> function can be called multiple times with different regions of the ciphertext data.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> </dd></dl>
<p>Implements <a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08">Cipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00580">580</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a4273a0b1eb880d98e34f2f9123fa167b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void Acorn128::encrypt </td>
<td>(</td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Encrypts an input buffer and writes the ciphertext to an output buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">output</td><td>The output buffer to write to, which may be the same buffer as <em>input</em>. The <em>output</em> buffer must have at least as many bytes as the <em>input</em> buffer. </td></tr>
<tr><td class="paramname">input</td><td>The input buffer to read from. </td></tr>
<tr><td class="paramname">len</td><td>The number of bytes to encrypt.</td></tr>
</table>
</dd>
</dl>
<p>The <a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> function can be called multiple times with different regions of the plaintext data.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> </dd></dl>
<p>Implements <a class="el" href="classCipher.html#ad2832bd61039d61560e34ea3382ca562">Cipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00554">554</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a4141564021e8233727beb5b9f645dc4e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t Acorn128::ivSize </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the size of the <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> initialization vector in bytes. </p>
<dl class="section return"><dt>Returns</dt><dd>Always returns 16, indicating a 128-bit IV.</dd></dl>
<p>Authentication tags may be truncated to 8 bytes, but the algorithm authors recommend using a full 16-byte tag. </p>
<p>Implements <a class="el" href="classCipher.html#ab8b53ddc4ce431f03c2a1903d70ace9c">Cipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00077">77</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="af13cffd088e6ec25f9f781bea22fba12"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t Acorn128::keySize </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the size of the <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> key in bytes. </p>
<dl class="section return"><dt>Returns</dt><dd>Always returns 16, indicating a 128-bit key. </dd></dl>
<p>Implements <a class="el" href="classCipher.html#a4cea432ea0278c865441f17cbb88b1ab">Cipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00064">64</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ae4e9ecf2030c4d2e3f32a19f937de845"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool Acorn128::setIV </td>
<td>(</td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>iv</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the initialization vector to use for future encryption and decryption operations. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">iv</td><td>The initialization vector to use. </td></tr>
<tr><td class="paramname">len</td><td>The length of the initialization vector in bytes. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns false if the length is not supported.</dd></dl>
<p>Initialization vectors should be set before the first call to <a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> or <a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> after a <a class="el" href="classAcorn128.html#a2a2b2285ffc4d0ed57d661d739d22302" title="Sets the key to use for future encryption and decryption operations. ">setKey()</a> call. If the initialization vector is changed after encryption or decryption begins, then the behaviour is undefined.</p>
<dl class="section note"><dt>Note</dt><dd>The IV is not encoded into the output stream by <a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a>. The caller is responsible for communicating the IV to the other party.</dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAcorn128.html#a4141564021e8233727beb5b9f645dc4e" title="Gets the size of the Acorn128 initialization vector in bytes. ">ivSize()</a> </dd></dl>
<p>Implements <a class="el" href="classCipher.html#a3777acd8ff776a4e945bb7c9f2d044d9">Cipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00495">495</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a2a2b2285ffc4d0ed57d661d739d22302"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool Acorn128::setKey </td>
<td>(</td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the key to use for future encryption and decryption operations. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">key</td><td>The key to use. </td></tr>
<tr><td class="paramname">len</td><td>The length of the key in bytes. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns false if the key length is not supported, or the key is somehow "weak" and unusable by this cipher.</dd></dl>
<p>Use <a class="el" href="classAcorn128.html#ac98fa6f3ad9f12b090d678d94ffff56f" title="Clears all security-sensitive state from this cipher object. ">clear()</a> or the destructor to remove the key and any other sensitive data from the object once encryption or decryption is complete.</p>
<p>Calling <a class="el" href="classAcorn128.html#a2a2b2285ffc4d0ed57d661d739d22302" title="Sets the key to use for future encryption and decryption operations. ">setKey()</a> resets the cipher. Any temporary data that was being retained for encrypting partial blocks will be abandoned.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAcorn128.html#af13cffd088e6ec25f9f781bea22fba12" title="Gets the size of the Acorn128 key in bytes. ">keySize()</a>, <a class="el" href="classAcorn128.html#ac98fa6f3ad9f12b090d678d94ffff56f" title="Clears all security-sensitive state from this cipher object. ">clear()</a> </dd></dl>
<p>Implements <a class="el" href="classCipher.html#a0dfe133bda81dfa680b668f5908ccbe5">Cipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00477">477</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a75c8953cea6b9cd59aa5034dfe739889"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">size_t Acorn128::tagSize </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the size of the <a class="el" href="classAcorn128.html" title="ACORN-128 authenticated cipher. ">Acorn128</a> authentication tag in bytes. </p>
<dl class="section return"><dt>Returns</dt><dd>Always returns 16, indicating a 128-bit authentication tag. </dd></dl>
<p>Implements <a class="el" href="classAuthenticatedCipher.html#a50c9de15b1ac1f3079dcfef626238759">AuthenticatedCipher</a>.</p>
<p>Definition at line <a class="el" href="Acorn128_8cpp_source.html#l00087">87</a> of file <a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="Acorn128_8h_source.html">Acorn128.h</a></li>
<li><a class="el" href="Acorn128_8cpp_source.html">Acorn128.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 27 2018 12:01:32 for Arduino Cryptography Library by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>