Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 23e07fd43e778a61ff4b78161a3e2389 > files > 2436

cryptopp-doc-5.6.1-5.fc14.noarch.rpm

<!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"/>
<title>Crypto++: vmac.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Crypto++</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">vmac.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_VMAC_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_VMAC_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;iterhash.h&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;seckey.h&quot;</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 NAMESPACE_BEGIN(CryptoPP)
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="comment">/// .</span>
<a name="l00010"></a><a class="code" href="class_v_m_a_c___base.html">00010</a> <span class="comment"></span>class <a class="code" href="class_v_m_a_c___base.html" title=".">VMAC_Base</a> : public <a class="code" href="class_iterated_hash_base.html" title="_">IteratedHashBase</a>&lt;word64, <a class="code" href="class_message_authentication_code.html" title="interface for message authentication codes">MessageAuthenticationCode</a>&gt;
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012 <span class="keyword">public</span>:
<a name="l00013"></a><a class="code" href="class_v_m_a_c___base.html#ae5f95bf7adf621616472f842d085a53b">00013</a>         std::string <a class="code" href="class_v_m_a_c___base.html#ae5f95bf7adf621616472f842d085a53b" title="returns name of this algorithm, not universally implemented yet">AlgorithmName</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> std::string(<span class="stringliteral">&quot;VMAC(&quot;</span>) + GetCipher().AlgorithmName() + <span class="stringliteral">&quot;)-&quot;</span> + IntToString(DigestSize()*8);}
<a name="l00014"></a>00014         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> IVSize()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetCipher().BlockSize();}
<a name="l00015"></a><a class="code" href="class_v_m_a_c___base.html#ad5e08e1936eb6ac04474903f1f6e923d">00015</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_v_m_a_c___base.html#ad5e08e1936eb6ac04474903f1f6e923d" title="returns minimal length of IVs accepted by this object">MinIVLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 1;}
<a name="l00016"></a>00016         <span class="keywordtype">void</span> Resynchronize(<span class="keyword">const</span> byte *nonce, <span class="keywordtype">int</span> length=-1);
<a name="l00017"></a>00017         <span class="keywordtype">void</span> GetNextIV(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, byte *IV);
<a name="l00018"></a><a class="code" href="class_v_m_a_c___base.html#ae18ab64d0a5f84768ac3d9d4fba57a12">00018</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_v_m_a_c___base.html#ae18ab64d0a5f84768ac3d9d4fba57a12" title="size of the hash/digest/MAC returned by Final()">DigestSize</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_is128 ? 16 : 8;};
<a name="l00019"></a>00019         <span class="keywordtype">void</span> UncheckedSetKey(<span class="keyword">const</span> byte *userKey, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> keylength, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;params);
<a name="l00020"></a>00020         <span class="keywordtype">void</span> TruncatedFinal(byte *mac, <span class="keywordtype">size_t</span> size);
<a name="l00021"></a><a class="code" href="class_v_m_a_c___base.html#a4c0a250cf0eeccb351ac20f3adfec0c8">00021</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_v_m_a_c___base.html#a4c0a250cf0eeccb351ac20f3adfec0c8" title="block size of underlying compression function, or 0 if not block based">BlockSize</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_L1KeyLength;}
<a name="l00022"></a>00022         ByteOrder GetByteOrder()<span class="keyword"> const </span>{<span class="keywordflow">return</span> LITTLE_ENDIAN_ORDER;}
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="keyword">protected</span>:
<a name="l00025"></a>00025         <span class="keyword">virtual</span> <a class="code" href="class_block_cipher.html" title="interface for one direction (encryption or decryption) of a block cipher">BlockCipher</a> &amp; AccessCipher() =0;
<a name="l00026"></a>00026         <span class="keyword">virtual</span> <span class="keywordtype">int</span> DefaultDigestSize() <span class="keyword">const</span> =0;
<a name="l00027"></a>00027         <span class="keyword">const</span> <a class="code" href="class_block_cipher.html" title="interface for one direction (encryption or decryption) of a block cipher">BlockCipher</a> &amp; GetCipher()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">const_cast&lt;</span><a class="code" href="class_v_m_a_c___base.html" title=".">VMAC_Base</a> *<span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;AccessCipher();}
<a name="l00028"></a>00028         <span class="keywordtype">void</span> HashEndianCorrectedBlock(<span class="keyword">const</span> word64 *data);
<a name="l00029"></a>00029         <span class="keywordtype">size_t</span> HashMultipleBlocks(<span class="keyword">const</span> word64 *input, <span class="keywordtype">size_t</span> length);
<a name="l00030"></a>00030         <span class="keywordtype">void</span> Init() {}
<a name="l00031"></a>00031         word64* StateBuf() {<span class="keywordflow">return</span> NULL;}
<a name="l00032"></a>00032         word64* DataBuf() {<span class="keywordflow">return</span> (word64 *)m_data();}
<a name="l00033"></a>00033 
<a name="l00034"></a>00034         <span class="keywordtype">void</span> VHASH_Update_SSE2(<span class="keyword">const</span> word64 *data, <span class="keywordtype">size_t</span> blocksRemainingInWord64, <span class="keywordtype">int</span> tagPart);
<a name="l00035"></a>00035 <span class="preprocessor">#if !(defined(_MSC_VER) &amp;&amp; _MSC_VER &lt; 1300)             // can&#39;t use function template here with VC6</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>        <span class="keyword">template</span> &lt;<span class="keywordtype">bool</span> T_128BitTag&gt;
<a name="l00037"></a>00037 <span class="preprocessor">#endif</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>        <span class="keywordtype">void</span> VHASH_Update_Template(<span class="keyword">const</span> word64 *data, <span class="keywordtype">size_t</span> blockRemainingInWord128);
<a name="l00039"></a>00039         <span class="keywordtype">void</span> VHASH_Update(<span class="keyword">const</span> word64 *data, <span class="keywordtype">size_t</span> blocksRemainingInWord128);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041         CRYPTOPP_BLOCK_1(polyState, word64, 4*(m_is128+1))
<a name="l00042"></a>00042         CRYPTOPP_BLOCK_2(nhKey, word64, m_L1KeyLength/sizeof(word64) + 2*m_is128)
<a name="l00043"></a>00043         CRYPTOPP_BLOCK_3(data, byte, m_L1KeyLength)
<a name="l00044"></a>00044         CRYPTOPP_BLOCK_4(l3Key, word64, 2*(m_is128+1))
<a name="l00045"></a>00045         CRYPTOPP_BLOCK_5(nonce, byte, IVSize())
<a name="l00046"></a>00046         CRYPTOPP_BLOCK_6(pad, byte, IVSize())
<a name="l00047"></a>00047         CRYPTOPP_BLOCKS_END(6)
<a name="l00048"></a>00048 
<a name="l00049"></a>00049         <span class="keywordtype">bool</span> m_is128, m_padCached, m_isFirstBlock;
<a name="l00050"></a>00050         <span class="keywordtype">int</span> m_L1KeyLength;
<a name="l00051"></a>00051 };
<a name="l00052"></a>00052 <span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">/// &lt;a href=&quot;http://www.cryptolounge.org/wiki/VMAC&quot;&gt;VMAC&lt;/a&gt;</span>
<a name="l00054"></a>00054 <span class="comment"></span>template &lt;class T_BlockCipher, <span class="keywordtype">int</span> T_DigestBitSize = 128&gt;
<a name="l00055"></a><a class="code" href="class_v_m_a_c.html">00055</a> class <a class="code" href="class_v_m_a_c.html" title="VMAC">VMAC</a> : public <a class="code" href="class_simple_keying_interface_impl.html" title="_">SimpleKeyingInterfaceImpl</a>&lt;<a class="code" href="class_v_m_a_c___base.html" title=".">VMAC_Base</a>, <a class="code" href="class_same_key_length_as.html" title="support query of key length that&#39;s the same as another class">SameKeyLengthAs</a>&lt;T_BlockCipher, <a class="code" href="class_simple_keying_interface.html" title="keying interface for crypto algorithms that take byte strings as keys">SimpleKeyingInterface</a>::UNIQUE_IV, T_BlockCipher::BLOCKSIZE&gt; &gt;
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057 <span class="keyword">public</span>:
<a name="l00058"></a>00058         <span class="keyword">static</span> std::string StaticAlgorithmName() {<span class="keywordflow">return</span> std::string(<span class="stringliteral">&quot;VMAC(&quot;</span>) + T_BlockCipher::StaticAlgorithmName() + <span class="stringliteral">&quot;)-&quot;</span> + IntToString(T_DigestBitSize);}
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="keyword">private</span>:
<a name="l00061"></a>00061         <a class="code" href="class_block_cipher.html" title="interface for one direction (encryption or decryption) of a block cipher">BlockCipher</a> &amp; AccessCipher() {<span class="keywordflow">return</span> m_cipher;}
<a name="l00062"></a>00062         <span class="keywordtype">int</span> DefaultDigestSize()<span class="keyword"> const </span>{<span class="keywordflow">return</span> T_DigestBitSize/8;}
<a name="l00063"></a>00063         <span class="keyword">typename</span> T_BlockCipher::Encryption m_cipher;
<a name="l00064"></a>00064 };
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 NAMESPACE_END
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Oct 16 2011 for Crypto++ by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>