Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 07dfcfe50d66c9a48a3c5e6c1693f12a > files > 43

cryptopp-doc-5.6.1-0.1.svn479.fc13.i686.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++: cbcmac.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.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;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 class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>cbcmac.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_CBCMAC_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_CBCMAC_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;seckey.h&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;secblock.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_c_b_c___m_a_c___base.html">00010</a> <span class="comment"></span>class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_c_b_c___m_a_c___base.html" title="_">CBC_MAC_Base</a> : public <a class="code" href="class_message_authentication_code.html" title="interface for message authentication codes">MessageAuthenticationCode</a>
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012 <span class="keyword">public</span>:
<a name="l00013"></a>00013         <a class="code" href="class_c_b_c___m_a_c___base.html" title="_">CBC_MAC_Base</a>() {}
<a name="l00014"></a>00014 
<a name="l00015"></a>00015         <span class="keywordtype">void</span> UncheckedSetKey(<span class="keyword">const</span> byte *key, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <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="l00016"></a>00016         <span class="keywordtype">void</span> Update(<span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> length);
<a name="l00017"></a>00017         <span class="keywordtype">void</span> TruncatedFinal(byte *mac, <span class="keywordtype">size_t</span> size);
<a name="l00018"></a><a class="code" href="class_c_b_c___m_a_c___base.html#abc27c4dd1b795319a6a30c70f038f614">00018</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_c_b_c___m_a_c___base.html#abc27c4dd1b795319a6a30c70f038f614" title="size of the hash/digest/MAC returned by Final()">DigestSize</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">const_cast&lt;</span><a class="code" href="class_c_b_c___m_a_c___base.html" title="_">CBC_MAC_Base</a>*<span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;AccessCipher().BlockSize();}
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="keyword">protected</span>:
<a name="l00021"></a>00021         <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="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">private</span>:
<a name="l00024"></a>00024         <span class="keywordtype">void</span> ProcessBuf();
<a name="l00025"></a>00025         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> m_reg;
<a name="l00026"></a>00026         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_counter;
<a name="l00027"></a>00027 };
<a name="l00028"></a>00028 <span class="comment"></span>
<a name="l00029"></a>00029 <span class="comment">//! &lt;a href=&quot;http://www.weidai.com/scan-mirror/mac.html#CBC-MAC&quot;&gt;CBC-MAC&lt;/a&gt;</span>
<a name="l00030"></a>00030 <span class="comment"></span><span class="comment">/*! Compatible with FIPS 113. T should be a class derived from BlockCipherDocumentation.</span>
<a name="l00031"></a>00031 <span class="comment">        Secure only for fixed length messages. For variable length messages use CMAC or DMAC.</span>
<a name="l00032"></a>00032 <span class="comment">*/</span>
<a name="l00033"></a>00033 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00034"></a><a class="code" href="class_c_b_c___m_a_c.html">00034</a> <span class="keyword">class </span><a class="code" href="class_c_b_c___m_a_c.html" title="CBC-MAC">CBC_MAC</a> : <span class="keyword">public</span> <a class="code" href="class_message_authentication_code_impl.html" title="_">MessageAuthenticationCodeImpl</a>&lt;CBC_MAC_Base, CBC_MAC&lt;T&gt; &gt;, <span class="keyword">public</span> <a class="code" href="class_same_key_length_as.html" title="support query of key length that&amp;#39;s the same as another class">SameKeyLengthAs</a>&lt;T&gt;
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">public</span>:
<a name="l00037"></a>00037         <a class="code" href="class_c_b_c___m_a_c.html" title="CBC-MAC">CBC_MAC</a>() {}
<a name="l00038"></a>00038         <a class="code" href="class_c_b_c___m_a_c.html" title="CBC-MAC">CBC_MAC</a>(<span class="keyword">const</span> byte *key, <span class="keywordtype">size_t</span> length=<a class="code" href="class_same_key_length_as.html" title="support query of key length that&amp;#39;s the same as another class">SameKeyLengthAs&lt;T&gt;::DEFAULT_KEYLENGTH</a>)
<a name="l00039"></a>00039                 {this-&gt;<a class="code" href="class_simple_keying_interface.html#adf3c29b3ef3af74788a58c7c49887fd7" title="set or reset the key of this object">SetKey</a>(key, length);}
<a name="l00040"></a>00040 
<a name="l00041"></a>00041         <span class="keyword">static</span> std::string StaticAlgorithmName() {<span class="keywordflow">return</span> std::string(<span class="stringliteral">&quot;CBC-MAC(&quot;</span>) + T::StaticAlgorithmName() + <span class="stringliteral">&quot;)&quot;</span>;}
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">private</span>:
<a name="l00044"></a>00044         <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="l00045"></a>00045         <span class="keyword">typename</span> T::Encryption m_cipher;
<a name="l00046"></a>00046 };
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 NAMESPACE_END
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 9 Dec 2009 for Crypto++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>