mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
370 lines
25 KiB
HTML
370 lines
25 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: NewHope 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 Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related 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 List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class 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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </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-types">Public Types</a> |
|
|
<a href="#pub-static-methods">Static Public Member Functions</a> |
|
|
<a href="classNewHope-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">NewHope Class Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p><a class="el" href="classNewHope.html" title="NewHope post-quantum key exchange algorithm. ">NewHope</a> post-quantum key exchange algorithm.
|
|
<a href="classNewHope.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="NewHope_8h_source.html">NewHope.h</a>></code></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
|
|
Public Types</h2></td></tr>
|
|
<tr class="memitem:a679601da301134f037c3a5786bd7085f"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085f">Variant</a> { <a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085fa2326f3fd76345d5900834593a74f6596">Ref</a>,
|
|
<a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085fae270e706968a8e01e5c1cb40422b22c6">Torref</a>
|
|
}</td></tr>
|
|
<tr class="memdesc:a679601da301134f037c3a5786bd7085f"><td class="mdescLeft"> </td><td class="mdescRight">Describes the variant of the New Hope algorithm to implement. <a href="classNewHope.html#a679601da301134f037c3a5786bd7085f">More...</a><br/></td></tr>
|
|
<tr class="separator:a679601da301134f037c3a5786bd7085f"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><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:a335b17b40949f66aa579d1035384662c"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classNewHope.html#a335b17b40949f66aa579d1035384662c">keygen</a> (uint8_t send[NEWHOPE_SENDABYTES], <a class="el" href="structNewHopePrivateKey.html">NewHopePrivateKey</a> &sk, <a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085f">Variant</a> variant=<a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085fa2326f3fd76345d5900834593a74f6596">Ref</a>, const uint8_t *random_seed=0)</td></tr>
|
|
<tr class="memdesc:a335b17b40949f66aa579d1035384662c"><td class="mdescLeft"> </td><td class="mdescRight">Generates the key pair for Alice in a New Hope key exchange. <a href="#a335b17b40949f66aa579d1035384662c">More...</a><br/></td></tr>
|
|
<tr class="separator:a335b17b40949f66aa579d1035384662c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a2f09529f5f73cf9763c28b58b13bbd14"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14">sharedb</a> (uint8_t shared_key[NEWHOPE_SHAREDBYTES], uint8_t send[NEWHOPE_SENDBBYTES], uint8_t received[NEWHOPE_SENDABYTES], <a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085f">Variant</a> variant=<a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085fa2326f3fd76345d5900834593a74f6596">Ref</a>, const uint8_t *random_seed=0)</td></tr>
|
|
<tr class="memdesc:a2f09529f5f73cf9763c28b58b13bbd14"><td class="mdescLeft"> </td><td class="mdescRight">Generates the public key and shared secret for Bob. <a href="#a2f09529f5f73cf9763c28b58b13bbd14">More...</a><br/></td></tr>
|
|
<tr class="separator:a2f09529f5f73cf9763c28b58b13bbd14"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac8128e0799fe74a6c69c541e0d6bd66e"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classNewHope.html#ac8128e0799fe74a6c69c541e0d6bd66e">shareda</a> (uint8_t shared_key[NEWHOPE_SHAREDBYTES], const <a class="el" href="structNewHopePrivateKey.html">NewHopePrivateKey</a> &sk, uint8_t received[NEWHOPE_SENDBBYTES])</td></tr>
|
|
<tr class="memdesc:ac8128e0799fe74a6c69c541e0d6bd66e"><td class="mdescLeft"> </td><td class="mdescRight">Generates the shared secret for Alice. <a href="#ac8128e0799fe74a6c69c541e0d6bd66e">More...</a><br/></td></tr>
|
|
<tr class="separator:ac8128e0799fe74a6c69c541e0d6bd66e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p><a class="el" href="classNewHope.html" title="NewHope post-quantum key exchange algorithm. ">NewHope</a> post-quantum key exchange algorithm. </p>
|
|
<p>New Hope is an ephemeral key exchange algorithm, similar to Diffie-Hellman, which is believed to be resistant to quantum computers.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>The functions in this class need a substantial amount of memory for function parameters and stack space. On an 8-bit AVR system it is possible to operate with around 2K of parameter space and 4.5K of stack space if the parameters are in shared buffers. More information on the memory requirements and how they were reduced are on <a class="el" href="newhope_small.html">this page</a>.</dd></dl>
|
|
<p>Key exchange occurs between two parties, Alice and Bob, and results in a 32-byte (256-bit) shared secret. Alice's public key is 1824 bytes in size and Bob's public key is 2048 bytes in size.</p>
|
|
<p>Alice, either the client or the server depending upon the application, generates a key pair as follows:</p>
|
|
<div class="fragment"><div class="line">uint8_t alice_public[NEWHOPE_SENDABYTES];</div>
|
|
<div class="line"><a class="code" href="structNewHopePrivateKey.html">NewHopePrivateKey</a> alice_private;</div>
|
|
<div class="line"><a class="code" href="classNewHope.html#a335b17b40949f66aa579d1035384662c">NewHope::keygen</a>(alice_public, alice_private);</div>
|
|
</div><!-- fragment --><p>Alice's application sends the contents of <code>alice_public</code> to Bob, who then performs the following operations:</p>
|
|
<div class="fragment"><div class="line">uint8_t bob_public[NEWHOPE_SENDABYTES];</div>
|
|
<div class="line">uint8_t shared_secret[NEWHOPE_SHAREDBYTES];</div>
|
|
<div class="line"><a class="code" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14">NewHope::sharedb</a>(shared_secret, bob_public, alice_public);</div>
|
|
</div><!-- fragment --><p>Bob's application sends the contents of <code>bob_public</code> to Alice, and can then begin encrypting session traffic with <code>shared_secret</code> or some transformed version of it.</p>
|
|
<p>To reduce the memory requirements, the second and third parameters to <a class="el" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14" title="Generates the public key and shared secret for Bob. ">sharedb()</a> can point to the same 2048-byte buffer. On entry, the first 1824 bytes of the buffer are filled with Alice's public key. On exit, the buffer is filled with the 2048 bytes of Bob's public key:</p>
|
|
<div class="fragment"><div class="line">uint8_t shared_secret[NEWHOPE_SHAREDBYTES];</div>
|
|
<div class="line"><a class="code" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14">NewHope::sharedb</a>(shared_secret, public_key, public_key);</div>
|
|
</div><!-- fragment --><p>When Alice's application receives <code>bob_public</code>, the application performs the folllowing final steps to generate her version of the shared secret:</p>
|
|
<div class="fragment"><div class="line">uint8_t shared_secret[NEWHOPE_SHAREDBYTES];</div>
|
|
<div class="line"><a class="code" href="classNewHope.html#ac8128e0799fe74a6c69c541e0d6bd66e">NewHope::shareda</a>(shared_secret, alice_private, bob_public);</div>
|
|
</div><!-- fragment --><p>In the New Hope paper there are two versions of the algorithm described, referred to as "ref" and "torref" in author's reference C code. This class implements "ref" by default, but it is possible to enable the "torref" variant with an extra parameter on the <a class="el" href="classNewHope.html#a335b17b40949f66aa579d1035384662c" title="Generates the key pair for Alice in a New Hope key exchange. ">keygen()</a> and <a class="el" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14" title="Generates the public key and shared secret for Bob. ">sharedb()</a> function calls:</p>
|
|
<div class="fragment"><div class="line"><a class="code" href="classNewHope.html#a335b17b40949f66aa579d1035384662c">NewHope::keygen</a>(alice_public, alice_private, <a class="code" href="classNewHope.html#a679601da301134f037c3a5786bd7085fae270e706968a8e01e5c1cb40422b22c6">NewHope::Torref</a>);</div>
|
|
<div class="line"><a class="code" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14">NewHope::sharedb</a>(shared_secret, bob_public, alice_public, <a class="code" href="classNewHope.html#a679601da301134f037c3a5786bd7085fae270e706968a8e01e5c1cb40422b22c6">NewHope::Torref</a>);</div>
|
|
</div><!-- fragment --><p>The <a class="el" href="classNewHope.html#ac8128e0799fe74a6c69c541e0d6bd66e" title="Generates the shared secret for Alice. ">shareda()</a> function is the same for both "ref" and "torref".</p>
|
|
<p>The "ref" and "torref" variants are not binary-compatible. Public keys generated with one variant will not work with the other variant. The application author must make a decision as to which variant they need and then use it universally. The paper contains more information on why an application may want to use "torref" instead of "ref".</p>
|
|
<p>Reference: <a href="https://cryptojedi.org/crypto/#newhope">https://cryptojedi.org/crypto/#newhope</a> </p>
|
|
|
|
<p>Definition at line <a class="el" href="NewHope_8h_source.html#l00050">50</a> of file <a class="el" href="NewHope_8h_source.html">NewHope.h</a>.</p>
|
|
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
|
|
<a class="anchor" id="a679601da301134f037c3a5786bd7085f"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">enum <a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085f">NewHope::Variant</a></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Describes the variant of the New Hope algorithm to implement. </p>
|
|
<table class="fieldtable">
|
|
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="a679601da301134f037c3a5786bd7085fa2326f3fd76345d5900834593a74f6596"></a>Ref</em> </td><td class="fielddoc">
|
|
<p>The standard "reference" version of the New Hope algorithm. </p>
|
|
</td></tr>
|
|
<tr><td class="fieldname"><em><a class="anchor" id="a679601da301134f037c3a5786bd7085fae270e706968a8e01e5c1cb40422b22c6"></a>Torref</em> </td><td class="fielddoc">
|
|
<p>The alternative "torref" version of the New Hope algorithm. </p>
|
|
<dl class="section note"><dt>Note</dt><dd>The <a class="el" href="classNewHope.html" title="NewHope post-quantum key exchange algorithm. ">NewHope</a> class can be compiled without support for "torref" to save memory. In that case, Torref is identical to Ref. </dd></dl>
|
|
</td></tr>
|
|
</table>
|
|
|
|
<p>Definition at line <a class="el" href="NewHope_8h_source.html#l00057">57</a> of file <a class="el" href="NewHope_8h_source.html">NewHope.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="a335b17b40949f66aa579d1035384662c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void NewHope::keygen </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>send</em>[NEWHOPE_SENDABYTES], </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="structNewHopePrivateKey.html">NewHopePrivateKey</a> & </td>
|
|
<td class="paramname"><em>sk</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085f">Variant</a> </td>
|
|
<td class="paramname"><em>variant</em> = <code><a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085fa2326f3fd76345d5900834593a74f6596">Ref</a></code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>random_seed</em> = <code>0</code> </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>Generates the key pair for Alice in a New Hope key exchange. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">send</td><td>The public key value for Alice to be sent to Bob. </td></tr>
|
|
<tr><td class="paramname">sk</td><td>The private key value for Alice to be passed to <a class="el" href="classNewHope.html#ac8128e0799fe74a6c69c541e0d6bd66e" title="Generates the shared secret for Alice. ">shareda()</a> later. </td></tr>
|
|
<tr><td class="paramname">variant</td><td>The variant of the New Hope algorithm to use, usually Ref. </td></tr>
|
|
<tr><td class="paramname">random_seed</td><td>Points to 64 bytes of random data to use to generate the key pair. This is intended for test vectors only and should be set to NULL in real applications.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>The <em>send</em> value should be sent to Bob over the communications link and then it can be discarded. The <em>sk</em> value must be retained until the later call to <a class="el" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14" title="Generates the public key and shared secret for Bob. ">sharedb()</a>.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14" title="Generates the public key and shared secret for Bob. ">sharedb()</a>, <a class="el" href="classNewHope.html#ac8128e0799fe74a6c69c541e0d6bd66e" title="Generates the shared secret for Alice. ">shareda()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="NewHope_8cpp_source.html#l01025">1025</a> of file <a class="el" href="NewHope_8cpp_source.html">NewHope.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ac8128e0799fe74a6c69c541e0d6bd66e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void NewHope::shareda </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>shared_key</em>[NEWHOPE_SHAREDBYTES], </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="structNewHopePrivateKey.html">NewHopePrivateKey</a> & </td>
|
|
<td class="paramname"><em>sk</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>received</em>[NEWHOPE_SENDBBYTES] </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>Generates the shared secret for Alice. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">shared_key</td><td>The shared secret key. </td></tr>
|
|
<tr><td class="paramname">sk</td><td>Alice's secret private key which was generated by <a class="el" href="classNewHope.html#a335b17b40949f66aa579d1035384662c" title="Generates the key pair for Alice in a New Hope key exchange. ">keygen()</a>. </td></tr>
|
|
<tr><td class="paramname">received</td><td>The public key value that was received from Bob.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classNewHope.html#a2f09529f5f73cf9763c28b58b13bbd14" title="Generates the public key and shared secret for Bob. ">sharedb()</a>, <a class="el" href="classNewHope.html#a335b17b40949f66aa579d1035384662c" title="Generates the key pair for Alice in a New Hope key exchange. ">keygen()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="NewHope_8cpp_source.html#l01319">1319</a> of file <a class="el" href="NewHope_8cpp_source.html">NewHope.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a2f09529f5f73cf9763c28b58b13bbd14"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void NewHope::sharedb </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>shared_key</em>[NEWHOPE_SHAREDBYTES], </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>send</em>[NEWHOPE_SENDBBYTES], </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>received</em>[NEWHOPE_SENDABYTES], </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085f">Variant</a> </td>
|
|
<td class="paramname"><em>variant</em> = <code><a class="el" href="classNewHope.html#a679601da301134f037c3a5786bd7085fa2326f3fd76345d5900834593a74f6596">Ref</a></code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>random_seed</em> = <code>0</code> </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>Generates the public key and shared secret for Bob. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">shared_key</td><td>The shared secret key. </td></tr>
|
|
<tr><td class="paramname">send</td><td>The public key value for Bob to be sent to Alice. This is allowed to be the same pointer as <em>received</em> to replace the received value from Alice with the new value to send for Bob. </td></tr>
|
|
<tr><td class="paramname">received</td><td>The public key value that was received from Alice. </td></tr>
|
|
<tr><td class="paramname">variant</td><td>The variant of the New Hope algorithm to use, usually Ref. </td></tr>
|
|
<tr><td class="paramname">random_seed</td><td>Points to 32 bytes of random data to use to generate the temporary private key for Bob. This is intended for test vectors only and should be set to NULL in real applications.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>The <em>send</em> value should be sent to Alice over the communications link and then it can be discarded. Bob can immediately start encrypting session traffic with <em>shared_key</em> or some transformed version of it.</p>
|
|
<p>It is assumed that if <em>send</em> and <em>received</em> overlap, then they are the same pointer. The bytes at the end of <em>send</em> may be used for temporary storage while the leading bytes of <em>send</em> / <em>received</em> are being processed.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classNewHope.html#ac8128e0799fe74a6c69c541e0d6bd66e" title="Generates the shared secret for Alice. ">shareda()</a>, <a class="el" href="classNewHope.html#a335b17b40949f66aa579d1035384662c" title="Generates the key pair for Alice in a New Hope key exchange. ">keygen()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="NewHope_8cpp_source.html#l01137">1137</a> of file <a class="el" href="NewHope_8cpp_source.html">NewHope.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="NewHope_8h_source.html">NewHope.h</a></li>
|
|
<li><a class="el" href="NewHope_8cpp_source.html">NewHope.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  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.6
|
|
</small></address>
|
|
</body>
|
|
</html>
|