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

342 lines
22 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: GF128 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-static-methods">Static Public Member Functions</a> &#124;
<a href="classGF128-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">GF128 Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Operations in the Galois field GF(2^128).
<a href="classGF128.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="GF128_8h_source.html">GF128.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a43adbd72619e4f97ce427a60e7c0a248"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGF128.html#a43adbd72619e4f97ce427a60e7c0a248">mulInit</a> (uint32_t H[4], const void *key)</td></tr>
<tr class="memdesc:a43adbd72619e4f97ce427a60e7c0a248"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize multiplication in the GF(2^128) field. <a href="#a43adbd72619e4f97ce427a60e7c0a248">More...</a><br/></td></tr>
<tr class="separator:a43adbd72619e4f97ce427a60e7c0a248"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d9a341a1715d37d25feba21627bc3ab"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGF128.html#a7d9a341a1715d37d25feba21627bc3ab">mul</a> (uint32_t Y[4], const uint32_t H[4])</td></tr>
<tr class="memdesc:a7d9a341a1715d37d25feba21627bc3ab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform a multiplication in the GF(2^128) field. <a href="#a7d9a341a1715d37d25feba21627bc3ab">More...</a><br/></td></tr>
<tr class="separator:a7d9a341a1715d37d25feba21627bc3ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef22f6b7be5937f60ed2b7bcf831e52d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d">dbl</a> (uint32_t V[4])</td></tr>
<tr class="memdesc:aef22f6b7be5937f60ed2b7bcf831e52d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Doubles a value in the GF(2^128) field. <a href="#aef22f6b7be5937f60ed2b7bcf831e52d">More...</a><br/></td></tr>
<tr class="separator:aef22f6b7be5937f60ed2b7bcf831e52d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56000a4cd7d436de42360e9d43eecde4"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGF128.html#a56000a4cd7d436de42360e9d43eecde4">dblEAX</a> (uint32_t V[4])</td></tr>
<tr class="memdesc:a56000a4cd7d436de42360e9d43eecde4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Doubles a value in the GF(2^128) field using <a class="el" href="classEAX.html" title="Implementation of the EAX authenticated cipher. ">EAX</a> conventions. <a href="#a56000a4cd7d436de42360e9d43eecde4">More...</a><br/></td></tr>
<tr class="separator:a56000a4cd7d436de42360e9d43eecde4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3732c9471771c36ac1b518e974d46b3e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGF128.html#a3732c9471771c36ac1b518e974d46b3e">dblXTS</a> (uint32_t V[4])</td></tr>
<tr class="memdesc:a3732c9471771c36ac1b518e974d46b3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Doubles a value in the GF(2^128) field using <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> conventions. <a href="#a3732c9471771c36ac1b518e974d46b3e">More...</a><br/></td></tr>
<tr class="separator:a3732c9471771c36ac1b518e974d46b3e"><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>Operations in the Galois field GF(2^128). </p>
<p>This class contains helper functions for performing operations in the Galois field GF(2^128) which is used as the basis of <a class="el" href="classGCM.html" title="Implementation of the Galois Counter Mode (GCM). ">GCM</a> and <a class="el" href="classGHASH.html" title="Implementation of the GHASH message authenticator. ">GHASH</a>. These functions are provided for use by other cryptographic protocols that make use of GF(2^128).</p>
<p>Most of the functions in this class use the field, polynomial, and byte ordering conventions described in NIST SP 800-38D (<a class="el" href="classGCM.html" title="Implementation of the Galois Counter Mode (GCM). ">GCM</a>). The one exception is <a class="el" href="classGF128.html#a56000a4cd7d436de42360e9d43eecde4" title="Doubles a value in the GF(2^128) field using EAX conventions. ">dblEAX()</a> which uses the conventions of <a class="el" href="classEAX.html" title="Implementation of the EAX authenticated cipher. ">EAX</a> mode instead.</p>
<p>References: <a href="http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf">NIST SP 800-38D</a></p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classGCM.html" title="Implementation of the Galois Counter Mode (GCM). ">GCM</a>, <a class="el" href="classGHASH.html" title="Implementation of the GHASH message authenticator. ">GHASH</a> </dd></dl>
<p>Definition at line <a class="el" href="GF128_8h_source.html#l00028">28</a> of file <a class="el" href="GF128_8h_source.html">GF128.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aef22f6b7be5937f60ed2b7bcf831e52d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GF128::dbl </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>V</em>[4]</td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Doubles a value in the GF(2^128) field. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">V</td><td>The value to double, and the result. This array is assumed to be in big-endian order on entry and exit.</td></tr>
</table>
</dd>
</dl>
<p>Block cipher modes such as <a href="https://en.wikipedia.org/wiki/Disk_encryption_theory#Xor-encrypt-xor_.28XEX.29">XEX</a> are similar to <a class="el" href="classCTR.html" title="Implementation of the Counter (CTR) mode for 128-bit block ciphers. ">CTR</a> mode but instead of incrementing the nonce every block, the modes multiply the nonce by 2 in the GF(2^128) field every block. This function is provided to help with implementing such modes.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classGF128.html#a56000a4cd7d436de42360e9d43eecde4" title="Doubles a value in the GF(2^128) field using EAX conventions. ">dblEAX()</a>, <a class="el" href="classGF128.html#a3732c9471771c36ac1b518e974d46b3e" title="Doubles a value in the GF(2^128) field using XTS conventions. ">dblXTS()</a>, <a class="el" href="classGF128.html#a7d9a341a1715d37d25feba21627bc3ab" title="Perform a multiplication in the GF(2^128) field. ">mul()</a> </dd></dl>
<p>Definition at line <a class="el" href="GF128_8cpp_source.html#l00314">314</a> of file <a class="el" href="GF128_8cpp_source.html">GF128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a56000a4cd7d436de42360e9d43eecde4"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GF128::dblEAX </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>V</em>[4]</td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Doubles a value in the GF(2^128) field using <a class="el" href="classEAX.html" title="Implementation of the EAX authenticated cipher. ">EAX</a> conventions. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">V</td><td>The value to double, and the result. This array is assumed to be in big-endian order on entry and exit.</td></tr>
</table>
</dd>
</dl>
<p>This function differs from <a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d" title="Doubles a value in the GF(2^128) field. ">dbl()</a> that it uses the conventions of <a class="el" href="classEAX.html" title="Implementation of the EAX authenticated cipher. ">EAX</a> mode instead of those of NIST SP 800-38D (<a class="el" href="classGCM.html" title="Implementation of the Galois Counter Mode (GCM). ">GCM</a>). The two operations have equivalent security but the bits are ordered differently with the value shifted left instead of right.</p>
<p>References: <a href="https://en.wikipedia.org/wiki/EAX_mode,">https://en.wikipedia.org/wiki/EAX_mode,</a> <a href="http://web.cs.ucdavis.edu/~rogaway/papers/eax.html">http://web.cs.ucdavis.edu/~rogaway/papers/eax.html</a></p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d" title="Doubles a value in the GF(2^128) field. ">dbl()</a>, <a class="el" href="classGF128.html#a3732c9471771c36ac1b518e974d46b3e" title="Doubles a value in the GF(2^128) field using XTS conventions. ">dblXTS()</a>, <a class="el" href="classGF128.html#a7d9a341a1715d37d25feba21627bc3ab" title="Perform a multiplication in the GF(2^128) field. ">mul()</a> </dd></dl>
<p>Definition at line <a class="el" href="GF128_8cpp_source.html#l00406">406</a> of file <a class="el" href="GF128_8cpp_source.html">GF128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a3732c9471771c36ac1b518e974d46b3e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GF128::dblXTS </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>V</em>[4]</td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Doubles a value in the GF(2^128) field using <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> conventions. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">V</td><td>The value to double, and the result. This array is assumed to be in littlen-endian order on entry and exit.</td></tr>
</table>
</dd>
</dl>
<p>This function differs from <a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d" title="Doubles a value in the GF(2^128) field. ">dbl()</a> that it uses the conventions of <a class="el" href="classXTS.html" title="Implementation of the XTS mode for 128-bit block ciphers. ">XTS</a> mode instead of those of NIST SP 800-38D (<a class="el" href="classGCM.html" title="Implementation of the Galois Counter Mode (GCM). ">GCM</a>). The two operations have equivalent security but the bits are ordered differently with the value shifted left instead of right.</p>
<p>References: <a href="http://libeccio.di.unisa.it/Crypto14/Lab/p1619.pdf">IEEE Std. 1619-2007, XTS-AES</a></p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d" title="Doubles a value in the GF(2^128) field. ">dbl()</a>, <a class="el" href="classGF128.html#a56000a4cd7d436de42360e9d43eecde4" title="Doubles a value in the GF(2^128) field using EAX conventions. ">dblEAX()</a>, <a class="el" href="classGF128.html#a7d9a341a1715d37d25feba21627bc3ab" title="Perform a multiplication in the GF(2^128) field. ">mul()</a> </dd></dl>
<p>Definition at line <a class="el" href="GF128_8cpp_source.html#l00497">497</a> of file <a class="el" href="GF128_8cpp_source.html">GF128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7d9a341a1715d37d25feba21627bc3ab"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GF128::mul </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>Y</em>[4], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint32_t&#160;</td>
<td class="paramname"><em>H</em>[4]&#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">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Perform a multiplication in the GF(2^128) field. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">Y</td><td>The first value to multiply, and the result. This array is assumed to be in big-endian order on entry and exit. </td></tr>
<tr><td class="paramname">H</td><td>The second value to multiply, which must have been initialized by the <a class="el" href="classGF128.html#a43adbd72619e4f97ce427a60e7c0a248" title="Initialize multiplication in the GF(2^128) field. ">mulInit()</a> function.</td></tr>
</table>
</dd>
</dl>
<p>This function and the companion <a class="el" href="classGF128.html#a43adbd72619e4f97ce427a60e7c0a248" title="Initialize multiplication in the GF(2^128) field. ">mulInit()</a> are intended for use by other classes that need access to the raw GF(2^128) field multiplication of <a class="el" href="classGHASH.html" title="Implementation of the GHASH message authenticator. ">GHASH</a> without the overhead of <a class="el" href="classGHASH.html" title="Implementation of the GHASH message authenticator. ">GHASH</a> itself.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classGF128.html#a43adbd72619e4f97ce427a60e7c0a248" title="Initialize multiplication in the GF(2^128) field. ">mulInit()</a>, <a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d" title="Doubles a value in the GF(2^128) field. ">dbl()</a> </dd></dl>
<p>Definition at line <a class="el" href="GF128_8cpp_source.html#l00090">90</a> of file <a class="el" href="GF128_8cpp_source.html">GF128.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a43adbd72619e4f97ce427a60e7c0a248"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void GF128::mulInit </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>H</em>[4], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>key</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">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialize multiplication in the GF(2^128) field. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">H</td><td>The hash state to be initialized. </td></tr>
<tr><td class="paramname">key</td><td>Points to the 16 byte authentication key which is assumed to be in big-endian byte order.</td></tr>
</table>
</dd>
</dl>
<p>This function and the companion <a class="el" href="classGF128.html#a7d9a341a1715d37d25feba21627bc3ab" title="Perform a multiplication in the GF(2^128) field. ">mul()</a> are intended for use by other classes that need access to the raw GF(2^128) field multiplication of <a class="el" href="classGHASH.html" title="Implementation of the GHASH message authenticator. ">GHASH</a> without the overhead of <a class="el" href="classGHASH.html" title="Implementation of the GHASH message authenticator. ">GHASH</a> itself.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classGF128.html#a7d9a341a1715d37d25feba21627bc3ab" title="Perform a multiplication in the GF(2^128) field. ">mul()</a>, <a class="el" href="classGF128.html#aef22f6b7be5937f60ed2b7bcf831e52d" title="Doubles a value in the GF(2^128) field. ">dbl()</a> </dd></dl>
<p>Definition at line <a class="el" href="GF128_8cpp_source.html#l00058">58</a> of file <a class="el" href="GF128_8cpp_source.html">GF128.cpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="GF128_8h_source.html">GF128.h</a></li>
<li><a class="el" href="GF128_8cpp_source.html">GF128.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>