Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 17f48c047155a7d4c992d6a672acd57f > files > 2518

libcryptopp-devel-7.0.0-1.1.mga7.armv7hl.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crypto++: randpool.cpp Source File</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="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 id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Crypto++
   &#160;<span id="projectnumber">7.0</span>
   </div>
   <div id="projectbrief">Free&nbsp;C&#43;&#43;&nbsp;class&nbsp;library&nbsp;of&nbsp;cryptographic&nbsp;schemes</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">randpool.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// randpool.cpp - originally written and placed in the public domain by Wei Dai</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">// RandomPool used to follow the design of randpool in PGP 2.6.x,</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// but as of version 5.5 it has been redesigned to reduce the risk</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">// of reusing random numbers after state rollback (which may occur</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// when running in a virtual machine like VMware).</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="pch_8h.html">pch.h</a>&quot;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#ifndef CRYPTOPP_IMPORTS</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="randpool_8h.html">randpool.h</a>&quot;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="aes_8h.html">aes.h</a>&quot;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="sha_8h.html">sha.h</a>&quot;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;hrtimer.h&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="trap_8h.html">trap.h</a>&quot;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// OldRandomPool</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="mdc_8h.html">mdc.h</a>&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="modes_8h.html">modes.h</a>&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;time.h&gt;</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;NAMESPACE_BEGIN(<a class="code" href="namespace_crypto_p_p.html">CryptoPP</a>)</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="class_random_pool.html#a1197329c8cf4ffd9097a2675431c0da1">   25</a></span>&#160;<a class="code" href="class_random_pool.html">RandomPool</a>::<a class="code" href="class_random_pool.html">RandomPool</a>()</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    : m_pCipher(new <a class="code" href="class_a_e_s.html">AES</a>::Encryption), m_keySet(false)</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;{</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    ::memset(m_key, 0, m_key.SizeInBytes());</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    ::memset(m_seed, 0, m_seed.SizeInBytes());</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;}</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="class_random_pool.html#a4339d77cb309a5ee47d7a5f1751481f3">   32</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_random_pool.html#a4339d77cb309a5ee47d7a5f1751481f3">RandomPool::IncorporateEntropy</a>(<span class="keyword">const</span> <span class="keywordtype">byte</span> *input, <span class="keywordtype">size_t</span> length)</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;{</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <a class="code" href="class_s_h_a256.html">SHA256</a> hash;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    hash.<a class="code" href="class_iterated_hash_base.html#a3202914349a18f79facb605d75f0d10c">Update</a>(m_key, 32);</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    hash.<a class="code" href="class_iterated_hash_base.html#a3202914349a18f79facb605d75f0d10c">Update</a>(input, length);</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    hash.<a class="code" href="class_hash_transformation.html#aa0b8c7a110d8968268fd02ec32b9a8e8">Final</a>(m_key);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    m_keySet = <span class="keyword">false</span>;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;}</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="class_random_pool.html#aa8f69e71e3f43bc78b73084b81567a7e">   41</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_random_pool.html#aa8f69e71e3f43bc78b73084b81567a7e">RandomPool::GenerateIntoBufferedTransformation</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &amp;target, <span class="keyword">const</span> std::string &amp;channel, lword size)</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;{</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keywordflow">if</span> (size &gt; 0)</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    {</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        <span class="keywordflow">if</span> (!m_keySet)</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;            m_pCipher-&gt;<a class="code" href="class_simple_keying_interface.html#adf3c29b3ef3af74788a58c7c49887fd7">SetKey</a>(m_key, 32);</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        <a class="code" href="misc_8h.html#a6b378b1b9b2d4654cc852c088742ba70">CRYPTOPP_COMPILE_ASSERT</a>(<span class="keyword">sizeof</span>(TimerWord) &lt;= 16);</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <a class="code" href="misc_8h.html#a6b378b1b9b2d4654cc852c088742ba70">CRYPTOPP_COMPILE_ASSERT</a>(<span class="keyword">sizeof</span>(time_t) &lt;= 8);</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        <a class="code" href="class_timer.html">Timer</a> timer;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        TimerWord tw = timer.GetCurrentTimerValue();</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        *(TimerWord *)(<span class="keywordtype">void</span>*)m_seed.<a class="code" href="class_sec_block.html#a42ad7c28810297ca50b2411284876845">data</a>() += tw;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        time_t t = time(NULLPTR);</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;        <span class="comment">// UBsan finding: signed integer overflow: 1876017710 + 1446085457 cannot be represented in type &#39;long int&#39;</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        <span class="comment">// *(time_t *)(m_seed.data()+8) += t;</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        word64 tt1 = 0, tt2 = (word64)t;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        ::memcpy(&amp;tt1, m_seed.<a class="code" href="class_sec_block.html#a42ad7c28810297ca50b2411284876845">data</a>()+8, 8);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        ::memcpy(m_seed.<a class="code" href="class_sec_block.html#a42ad7c28810297ca50b2411284876845">data</a>()+8, &amp;(tt2 += tt1), 8);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="comment">// Wipe the intermediates</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        *((<span class="keyword">volatile</span> TimerWord*)&amp;tw) = 0;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        *((<span class="keyword">volatile</span> word64*)&amp;tt1) = 0;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        *((<span class="keyword">volatile</span> word64*)&amp;tt2) = 0;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        <span class="keywordflow">do</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        {</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;            m_pCipher-&gt;<a class="code" href="class_block_transformation.html#a93b18a5b11cd6f61bf19624192575d1d">ProcessBlock</a>(m_seed);</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;            <span class="keywordtype">size_t</span> len = <a class="code" href="misc_8h.html#ac8391e7d9d613a6c401787d2cdab1f51">UnsignedMin</a>(16, size);</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            target.<a class="code" href="class_buffered_transformation.html#a97a60b54fafdb3df59e1457ef629fc5f">ChannelPut</a>(channel, m_seed, len);</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            size -= len;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        } <span class="keywordflow">while</span> (size &gt; 0);</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    }</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;}</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment">// OldRandomPool is provided for backwards compatibility for a migration path</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="keyword">typedef</span> <a class="code" href="class_m_d_c.html">MDC&lt;SHA1&gt;</a> <a class="code" href="class_m_d_c.html">OldRandomPoolCipher</a>;</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="class_old_random_pool.html#af7a6eecc735c01c3fad5ac38e3977993">   81</a></span>&#160;<a class="code" href="class_old_random_pool.html#af7a6eecc735c01c3fad5ac38e3977993">OldRandomPool::OldRandomPool</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> poolSize)</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        : pool(poolSize), key(<a class="code" href="class_m_d_c.html">OldRandomPoolCipher</a>::DEFAULT_KEYLENGTH), addPos(0), getPos(poolSize)</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;{</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <a class="code" href="trap_8h.html#adf3b392588bc94cbeae9f415a78c7b95">CRYPTOPP_ASSERT</a>(poolSize &gt; key.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>());</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    ::memset(pool, 0, poolSize);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    ::memset(key, 0, key.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>());</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;}</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="class_old_random_pool.html#ae90928d3e986a8d370aa4b4e37419109">   89</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_old_random_pool.html#ae90928d3e986a8d370aa4b4e37419109">OldRandomPool::IncorporateEntropy</a>(<span class="keyword">const</span> <span class="keywordtype">byte</span> *input, <span class="keywordtype">size_t</span> length)</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;{</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordtype">size_t</span> t;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordflow">while</span> (length &gt; (t = pool.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>() - addPos))</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    {</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        <a class="code" href="misc_8h.html#a6aaae7768600b9d735a5e1b8192035f8">xorbuf</a>(pool+addPos, input, t);</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        input += t;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        length -= t;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        Stir();</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    }</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordflow">if</span> (length)</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    {</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <a class="code" href="misc_8h.html#a6aaae7768600b9d735a5e1b8192035f8">xorbuf</a>(pool+addPos, input, length);</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        addPos += length;</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        getPos = pool.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>(); <span class="comment">// Force stir on get</span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    }</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;}</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="keywordtype">void</span> OldRandomPool::Stir()</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;{</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <a class="code" href="class_cipher_mode_final_template___cipher_holder.html">CFB_Mode&lt;OldRandomPoolCipher&gt;::Encryption</a> cipher;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;2; i++)</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    {</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        cipher.SetKeyWithIV(key, key.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>(), pool.<a class="code" href="class_sec_block.html#a26d88ba73b5da0f5dd4ab87ce6345d8f">end</a>()-cipher.IVSize());</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        cipher.ProcessString(pool, pool.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>());</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        ::memcpy(key, pool, key.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>());</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    }</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    addPos = 0;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    getPos = key.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>();</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;}</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="class_old_random_pool.html#a1c3818de9345ff693dfa0c2357fae56f">  123</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_old_random_pool.html#a1c3818de9345ff693dfa0c2357fae56f">OldRandomPool::GenerateIntoBufferedTransformation</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &amp;target, <span class="keyword">const</span> std::string &amp;channel, lword size)</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;{</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordflow">while</span> (size &gt; 0)</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    {</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <span class="keywordflow">if</span> (getPos == pool.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>())</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;                Stir();</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="keywordtype">size_t</span> t = <a class="code" href="misc_8h.html#ac8391e7d9d613a6c401787d2cdab1f51">UnsignedMin</a>(pool.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>() - getPos, size);</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        target.<a class="code" href="class_buffered_transformation.html#a97a60b54fafdb3df59e1457ef629fc5f">ChannelPut</a>(channel, pool+getPos, t);</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        size -= t;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        getPos += t;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    }}</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div><div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="class_old_random_pool.html#a77849891efe3d7c6e7691aaf88ec99d7">  135</a></span>&#160;<span class="keywordtype">byte</span> <a class="code" href="class_old_random_pool.html#a77849891efe3d7c6e7691aaf88ec99d7">OldRandomPool::GenerateByte</a>()</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;{</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="keywordflow">if</span> (getPos == pool.<a class="code" href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">size</a>())</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        Stir();</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keywordflow">return</span> pool[getPos++];</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;}</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="class_old_random_pool.html#aefeb6fddd031ea1c44337c41170a73df">  143</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_old_random_pool.html#aefeb6fddd031ea1c44337c41170a73df">OldRandomPool::GenerateBlock</a>(<span class="keywordtype">byte</span> *outString, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;{</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <a class="code" href="class_array_sink.html">ArraySink</a> sink(outString, size);</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <a class="code" href="class_old_random_pool.html#a1c3818de9345ff693dfa0c2357fae56f">GenerateIntoBufferedTransformation</a>(sink, <a class="code" href="cryptlib_8h.html#a9a69ab5a5e0f58279c43f4f51809c84a">DEFAULT_CHANNEL</a>, size);</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;}</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;NAMESPACE_END</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="class_random_pool_html_a4339d77cb309a5ee47d7a5f1751481f3"><div class="ttname"><a href="class_random_pool.html#a4339d77cb309a5ee47d7a5f1751481f3">RandomPool::IncorporateEntropy</a></div><div class="ttdeci">void IncorporateEntropy(const byte *input, size_t length)</div><div class="ttdoc">Update RNG state with additional unpredictable values.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00032">randpool.cpp:32</a></div></div>
<div class="ttc" id="class_sec_block_html_a26d88ba73b5da0f5dd4ab87ce6345d8f"><div class="ttname"><a href="class_sec_block.html#a26d88ba73b5da0f5dd4ab87ce6345d8f">SecBlock::end</a></div><div class="ttdeci">iterator end()</div><div class="ttdoc">Provides an iterator pointing beyond the last element in the memory block.</div><div class="ttdef"><b>Definition:</b> <a href="secblock_8h_source.html#l00544">secblock.h:544</a></div></div>
<div class="ttc" id="class_random_pool_html"><div class="ttname"><a href="class_random_pool.html">RandomPool</a></div><div class="ttdoc">Randomness Pool based on AES-256.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8h_source.html#l00041">randpool.h:41</a></div></div>
<div class="ttc" id="class_timer_html"><div class="ttname"><a href="class_timer.html">Timer</a></div><div class="ttdoc">high resolution timer</div><div class="ttdef"><b>Definition:</b> <a href="hrtimer_8h_source.html#l00055">hrtimer.h:55</a></div></div>
<div class="ttc" id="class_simple_keying_interface_html_adf3c29b3ef3af74788a58c7c49887fd7"><div class="ttname"><a href="class_simple_keying_interface.html#adf3c29b3ef3af74788a58c7c49887fd7">SimpleKeyingInterface::SetKey</a></div><div class="ttdeci">virtual void SetKey(const byte *key, size_t length, const NameValuePairs &amp;params=g_nullNameValuePairs)</div><div class="ttdoc">Sets or reset the key of this object.</div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8cpp_source.html#l00064">cryptlib.cpp:64</a></div></div>
<div class="ttc" id="class_s_h_a256_html"><div class="ttname"><a href="class_s_h_a256.html">SHA256</a></div><div class="ttdoc">SHA-256 message digest.</div><div class="ttdef"><b>Definition:</b> <a href="sha_8h_source.html#l00062">sha.h:62</a></div></div>
<div class="ttc" id="randpool_8h_html"><div class="ttname"><a href="randpool_8h.html">randpool.h</a></div><div class="ttdoc">Class file for Randomness Pool.</div></div>
<div class="ttc" id="modes_8h_html"><div class="ttname"><a href="modes_8h.html">modes.h</a></div><div class="ttdoc">Classes for block cipher modes of operation.</div></div>
<div class="ttc" id="class_buffered_transformation_html_a97a60b54fafdb3df59e1457ef629fc5f"><div class="ttname"><a href="class_buffered_transformation.html#a97a60b54fafdb3df59e1457ef629fc5f">BufferedTransformation::ChannelPut</a></div><div class="ttdeci">size_t ChannelPut(const std::string &amp;channel, byte inByte, bool blocking=true)</div><div class="ttdoc">Input a byte for processing on a channel.</div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l02053">cryptlib.h:2053</a></div></div>
<div class="ttc" id="class_m_d_c_html"><div class="ttname"><a href="class_m_d_c.html">MDC</a></div><div class="ttdoc">MDC cipher.</div><div class="ttdef"><b>Definition:</b> <a href="mdc_8h_source.html#l00032">mdc.h:32</a></div></div>
<div class="ttc" id="class_old_random_pool_html_a1c3818de9345ff693dfa0c2357fae56f"><div class="ttname"><a href="class_old_random_pool.html#a1c3818de9345ff693dfa0c2357fae56f">OldRandomPool::GenerateIntoBufferedTransformation</a></div><div class="ttdeci">void GenerateIntoBufferedTransformation(BufferedTransformation &amp;target, const std::string &amp;channel, lword size)</div><div class="ttdoc">Generate random bytes into a BufferedTransformation.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00123">randpool.cpp:123</a></div></div>
<div class="ttc" id="class_random_pool_html_aa8f69e71e3f43bc78b73084b81567a7e"><div class="ttname"><a href="class_random_pool.html#aa8f69e71e3f43bc78b73084b81567a7e">RandomPool::GenerateIntoBufferedTransformation</a></div><div class="ttdeci">void GenerateIntoBufferedTransformation(BufferedTransformation &amp;target, const std::string &amp;channel, lword size)</div><div class="ttdoc">Generate random bytes into a BufferedTransformation.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00041">randpool.cpp:41</a></div></div>
<div class="ttc" id="class_iterated_hash_base_html_a3202914349a18f79facb605d75f0d10c"><div class="ttname"><a href="class_iterated_hash_base.html#a3202914349a18f79facb605d75f0d10c">IteratedHashBase::Update</a></div><div class="ttdeci">void Update(const byte *input, size_t length)</div><div class="ttdoc">Updates a hash with additional input.</div><div class="ttdef"><b>Definition:</b> <a href="iterhash_8cpp_source.html#l00013">iterhash.cpp:13</a></div></div>
<div class="ttc" id="class_buffered_transformation_html"><div class="ttname"><a href="class_buffered_transformation.html">BufferedTransformation</a></div><div class="ttdoc">Interface for buffered transformations.</div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l01545">cryptlib.h:1545</a></div></div>
<div class="ttc" id="class_array_sink_html"><div class="ttname"><a href="class_array_sink.html">ArraySink</a></div><div class="ttdoc">Copy input to a memory buffer.</div><div class="ttdef"><b>Definition:</b> <a href="filters_8h_source.html#l01132">filters.h:1132</a></div></div>
<div class="ttc" id="cryptlib_8h_html_a9a69ab5a5e0f58279c43f4f51809c84a"><div class="ttname"><a href="cryptlib_8h.html#a9a69ab5a5e0f58279c43f4f51809c84a">DEFAULT_CHANNEL</a></div><div class="ttdeci">const std::string DEFAULT_CHANNEL</div><div class="ttdoc">Default channel for BufferedTransformation.</div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l00481">cryptlib.h:481</a></div></div>
<div class="ttc" id="class_cipher_mode_final_template___cipher_holder_html"><div class="ttname"><a href="class_cipher_mode_final_template___cipher_holder.html">CipherModeFinalTemplate_CipherHolder</a></div><div class="ttdoc">Block cipher mode of operation aggregate.</div><div class="ttdef"><b>Definition:</b> <a href="modes_8h_source.html#l00284">modes.h:284</a></div></div>
<div class="ttc" id="misc_8h_html_a6b378b1b9b2d4654cc852c088742ba70"><div class="ttname"><a href="misc_8h.html#a6b378b1b9b2d4654cc852c088742ba70">CRYPTOPP_COMPILE_ASSERT</a></div><div class="ttdeci">#define CRYPTOPP_COMPILE_ASSERT(expr)</div><div class="ttdoc">Compile time assertion.</div><div class="ttdef"><b>Definition:</b> <a href="misc_8h_source.html#l00144">misc.h:144</a></div></div>
<div class="ttc" id="class_sec_block_html_a42ad7c28810297ca50b2411284876845"><div class="ttname"><a href="class_sec_block.html#a42ad7c28810297ca50b2411284876845">SecBlock::data</a></div><div class="ttdeci">A::pointer data()</div><div class="ttdoc">Provides a pointer to the first element in the memory block.</div><div class="ttdef"><b>Definition:</b> <a href="secblock_8h_source.html#l00553">secblock.h:553</a></div></div>
<div class="ttc" id="aes_8h_html"><div class="ttname"><a href="aes_8h.html">aes.h</a></div><div class="ttdoc">Class file for the AES cipher (Rijndael)</div></div>
<div class="ttc" id="pch_8h_html"><div class="ttname"><a href="pch_8h.html">pch.h</a></div><div class="ttdoc">Precompiled header file.</div></div>
<div class="ttc" id="class_block_transformation_html_a93b18a5b11cd6f61bf19624192575d1d"><div class="ttname"><a href="class_block_transformation.html#a93b18a5b11cd6f61bf19624192575d1d">BlockTransformation::ProcessBlock</a></div><div class="ttdeci">void ProcessBlock(const byte *inBlock, byte *outBlock) const</div><div class="ttdoc">Encrypt or decrypt a block.</div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l00832">cryptlib.h:832</a></div></div>
<div class="ttc" id="misc_8h_html_ac8391e7d9d613a6c401787d2cdab1f51"><div class="ttname"><a href="misc_8h.html#ac8391e7d9d613a6c401787d2cdab1f51">UnsignedMin</a></div><div class="ttdeci">const T1 UnsignedMin(const T1 &amp;a, const T2 &amp;b)</div><div class="ttdoc">Safe comparison of values that could be neagtive and incorrectly promoted.</div><div class="ttdef"><b>Definition:</b> <a href="misc_8h_source.html#l00546">misc.h:546</a></div></div>
<div class="ttc" id="class_old_random_pool_html_ae90928d3e986a8d370aa4b4e37419109"><div class="ttname"><a href="class_old_random_pool.html#ae90928d3e986a8d370aa4b4e37419109">OldRandomPool::IncorporateEntropy</a></div><div class="ttdeci">void IncorporateEntropy(const byte *input, size_t length)</div><div class="ttdoc">Update RNG state with additional unpredictable values.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00089">randpool.cpp:89</a></div></div>
<div class="ttc" id="class_a_e_s_html"><div class="ttname"><a href="class_a_e_s.html">AES</a></div><div class="ttdoc">AES block cipher (Rijndael)</div><div class="ttdef"><b>Definition:</b> <a href="aes_8h_source.html#l00023">aes.h:23</a></div></div>
<div class="ttc" id="trap_8h_html_adf3b392588bc94cbeae9f415a78c7b95"><div class="ttname"><a href="trap_8h.html#adf3b392588bc94cbeae9f415a78c7b95">CRYPTOPP_ASSERT</a></div><div class="ttdeci">#define CRYPTOPP_ASSERT(exp)</div><div class="ttdoc">Debugging and diagnostic assertion.</div><div class="ttdef"><b>Definition:</b> <a href="trap_8h_source.html#l00060">trap.h:60</a></div></div>
<div class="ttc" id="class_old_random_pool_html_af7a6eecc735c01c3fad5ac38e3977993"><div class="ttname"><a href="class_old_random_pool.html#af7a6eecc735c01c3fad5ac38e3977993">OldRandomPool::OldRandomPool</a></div><div class="ttdeci">OldRandomPool(unsigned int poolSize=384)</div><div class="ttdoc">Construct an OldRandomPool.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00081">randpool.cpp:81</a></div></div>
<div class="ttc" id="sha_8h_html"><div class="ttname"><a href="sha_8h.html">sha.h</a></div><div class="ttdoc">Classes for SHA-1 and SHA-2 family of message digests.</div></div>
<div class="ttc" id="class_old_random_pool_html_a77849891efe3d7c6e7691aaf88ec99d7"><div class="ttname"><a href="class_old_random_pool.html#a77849891efe3d7c6e7691aaf88ec99d7">OldRandomPool::GenerateByte</a></div><div class="ttdeci">byte GenerateByte()</div><div class="ttdoc">Generate new random byte and return it.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00135">randpool.cpp:135</a></div></div>
<div class="ttc" id="mdc_8h_html"><div class="ttname"><a href="mdc_8h.html">mdc.h</a></div><div class="ttdoc">Classes for the MDC message digest.</div></div>
<div class="ttc" id="misc_8h_html_a6aaae7768600b9d735a5e1b8192035f8"><div class="ttname"><a href="misc_8h.html#a6aaae7768600b9d735a5e1b8192035f8">xorbuf</a></div><div class="ttdeci">void xorbuf(byte *buf, const byte *mask, size_t count)</div><div class="ttdoc">Performs an XOR of a buffer with a mask.</div><div class="ttdef"><b>Definition:</b> <a href="misc_8cpp_source.html#l00032">misc.cpp:32</a></div></div>
<div class="ttc" id="trap_8h_html"><div class="ttname"><a href="trap_8h.html">trap.h</a></div><div class="ttdoc">Debugging and diagnostic assertions.</div></div>
<div class="ttc" id="class_old_random_pool_html_aefeb6fddd031ea1c44337c41170a73df"><div class="ttname"><a href="class_old_random_pool.html#aefeb6fddd031ea1c44337c41170a73df">OldRandomPool::GenerateBlock</a></div><div class="ttdeci">void GenerateBlock(byte *output, size_t size)</div><div class="ttdoc">Generate random array of bytes.</div><div class="ttdef"><b>Definition:</b> <a href="randpool_8cpp_source.html#l00143">randpool.cpp:143</a></div></div>
<div class="ttc" id="namespace_crypto_p_p_html"><div class="ttname"><a href="namespace_crypto_p_p.html">CryptoPP</a></div><div class="ttdoc">Crypto++ library namespace.</div></div>
<div class="ttc" id="class_hash_transformation_html_aa0b8c7a110d8968268fd02ec32b9a8e8"><div class="ttname"><a href="class_hash_transformation.html#aa0b8c7a110d8968268fd02ec32b9a8e8">HashTransformation::Final</a></div><div class="ttdeci">virtual void Final(byte *digest)</div><div class="ttdoc">Computes the hash of the current message.</div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l01095">cryptlib.h:1095</a></div></div>
<div class="ttc" id="class_sec_block_html_af5999bffe3193e62719cc0792b0282a7"><div class="ttname"><a href="class_sec_block.html#af5999bffe3193e62719cc0792b0282a7">SecBlock::size</a></div><div class="ttdeci">size_type size() const</div><div class="ttdoc">Provides the count of elements in the SecBlock.</div><div class="ttdef"><b>Definition:</b> <a href="secblock_8h_source.html#l00561">secblock.h:561</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 27 2019 15:03:41 for Crypto++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>