⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ida_8cpp-source.html

📁 著名的密码库Crypto++的文档 C++语言的杰作。程序员必备。
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<a name="l00204"></a>00204                 vector&lt;MessageQueue&gt; inputQueues;<a name="l00205"></a>00205                 vector&lt;word32&gt; inputChannelIds;<a name="l00206"></a>00206 <a name="l00207"></a>00207                 inputQueues.swap(<a class="code" href="class_raw_i_d_a.html#584a7b425d16b083cce42f5af573dc52">m_inputQueues</a>);<a name="l00208"></a>00208                 inputChannelIds.swap(<a class="code" href="class_raw_i_d_a.html#a282d4933e80efe030fb96361e1ff419">m_inputChannelIds</a>);<a name="l00209"></a>00209                 <a class="code" href="class_raw_i_d_a.html#0515815d1f31024c7ac45760303bd680">m_inputChannelMap</a>.clear();<a name="l00210"></a>00210                 <a class="code" href="class_raw_i_d_a.html#2a6879cff90946155d76dbe5ed7d3dcb">m_lastMapPosition</a> = <a class="code" href="class_raw_i_d_a.html#0515815d1f31024c7ac45760303bd680">m_inputChannelMap</a>.end();<a name="l00211"></a>00211 <a name="l00212"></a>00212                 <span class="keywordflow">for</span> (i=0; i&lt;m_threshold; i++)<a name="l00213"></a>00213                 {<a name="l00214"></a>00214                         inputQueues[i].<a class="code" href="class_buffered_transformation.html#8dc8562950fd563f7c62d1f1e5ec6b1e" title="start retrieving the next message">GetNextMessage</a>();<a name="l00215"></a>00215                         inputQueues[i].TransferAllTo(*<a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>(), WordToString(inputChannelIds[i]));<a name="l00216"></a>00216                 }<a name="l00217"></a>00217         }<a name="l00218"></a>00218 }<a name="l00219"></a>00219 <a name="l00220"></a>00220 <span class="keywordtype">void</span> RawIDA::FlushOutputQueues()<a name="l00221"></a>00221 {<a name="l00222"></a>00222         <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="class_raw_i_d_a.html#376de5858283ae6ec368ee49d53febad">m_outputChannelIds</a>.size(); i++)<a name="l00223"></a>00223                 <a class="code" href="class_raw_i_d_a.html#ae55af87cd9751e8b37923bde5aacd82">m_outputQueues</a>[i].<a class="code" href="class_buffered_transformation.html#80b60bff9f62976c15effdbc45cbc5f1">TransferAllTo</a>(*<a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>(), <a class="code" href="class_raw_i_d_a.html#a2a11404f7b82de338821b549dd7b851">m_outputChannelIdStrings</a>[i]);<a name="l00224"></a>00224 }<a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="keywordtype">void</span> RawIDA::OutputMessageEnds()<a name="l00227"></a>00227 {<a name="l00228"></a>00228         <span class="keywordflow">if</span> (<a class="code" href="class_auto_signaling.html#011dc89743a4790bdd2ddefd9f176766">GetAutoSignalPropagation</a>() != 0)<a name="l00229"></a>00229         {<a name="l00230"></a>00230                 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="class_raw_i_d_a.html#376de5858283ae6ec368ee49d53febad">m_outputChannelIds</a>.size(); i++)<a name="l00231"></a>00231                         <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-&gt;<a class="code" href="class_buffered_transformation.html#e0b37b299c5835083e58b205f9cc25cc">ChannelMessageEnd</a>(<a class="code" href="class_raw_i_d_a.html#a2a11404f7b82de338821b549dd7b851">m_outputChannelIdStrings</a>[i], <a class="code" href="class_auto_signaling.html#011dc89743a4790bdd2ddefd9f176766">GetAutoSignalPropagation</a>()-1);<a name="l00232"></a>00232         }<a name="l00233"></a>00233 }<a name="l00234"></a>00234 <a name="l00235"></a>00235 <span class="comment">// ****************************************************************</span><a name="l00236"></a>00236 <a name="l00237"></a>00237 <span class="keywordtype">void</span> SecretSharing::IsolatedInitialize(<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;parameters)<a name="l00238"></a>00238 {<a name="l00239"></a>00239         <a class="code" href="class_secret_sharing.html#f2c48230d5e71fcf78c6ba5f3d34de0a">m_pad</a> = parameters.<a class="code" href="class_name_value_pairs.html#943b2009297783f1c35bae46efc3b5f7" title="get a named value, returns the default if the name doesn't exist">GetValueWithDefault</a>(<span class="stringliteral">"AddPadding"</span>, <span class="keyword">true</span>);<a name="l00240"></a>00240         <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#80b961ed9d9ba16267e3a2db70649736">IsolatedInitialize</a>(parameters);<a name="l00241"></a>00241 }<a name="l00242"></a>00242 <a name="l00243"></a>00243 <span class="keywordtype">size_t</span> <a class="code" href="class_secret_sharing.html#26acaced75c630173f17ab29f615d409" title="input multiple bytes for blocking or non-blocking processing">SecretSharing::Put2</a>(<span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking)<a name="l00244"></a>00244 {<a name="l00245"></a>00245         <span class="keywordflow">if</span> (!blocking)<a name="l00246"></a>00246                 <span class="keywordflow">throw</span> BlockingInputOnly(<span class="stringliteral">"SecretSharing"</span>);<a name="l00247"></a>00247 <a name="l00248"></a>00248         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> buf(UnsignedMin(256, length));<a name="l00249"></a>00249         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> threshold = <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#cbdf3bfeabd7a7c64b03b61fa8929d4c">GetThreshold</a>();<a name="l00250"></a>00250         <span class="keywordflow">while</span> (length &gt; 0)<a name="l00251"></a>00251         {<a name="l00252"></a>00252                 <span class="keywordtype">size_t</span> len = STDMIN(length, buf.size());<a name="l00253"></a>00253                 <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#3fa15d51e46a8eaee252a0a7034aac47">ChannelData</a>(0xffffffff, begin, len, <span class="keyword">false</span>);<a name="l00254"></a>00254                 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;threshold-1; i++)<a name="l00255"></a>00255                 {<a name="l00256"></a>00256                         <a class="code" href="class_secret_sharing.html#8eca29688fdebc5ef5d9677f3075248a">m_rng</a>.<a class="code" href="class_random_number_generator.html#497145546d24e6d4abaf10b7e0f1ba17" title="generate random array of bytes">GenerateBlock</a>(buf, len);<a name="l00257"></a>00257                         <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#3fa15d51e46a8eaee252a0a7034aac47">ChannelData</a>(i, buf, len, <span class="keyword">false</span>);<a name="l00258"></a>00258                 }<a name="l00259"></a>00259                 length -= len;<a name="l00260"></a>00260                 begin += len;<a name="l00261"></a>00261         }<a name="l00262"></a>00262 <a name="l00263"></a>00263         <span class="keywordflow">if</span> (messageEnd)<a name="l00264"></a>00264         {<a name="l00265"></a>00265                 <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_auto_signaling.html#e63c0428295aeec8ffd9557ef1d86db9">SetAutoSignalPropagation</a>(messageEnd-1);<a name="l00266"></a>00266                 <span class="keywordflow">if</span> (<a class="code" href="class_secret_sharing.html#f2c48230d5e71fcf78c6ba5f3d34de0a">m_pad</a>)<a name="l00267"></a>00267                 {<a name="l00268"></a>00268                         <a class="code" href="class_buffered_transformation.html#e70658b0d271f8e114ac6c3cc9774ede" title="input a byte for processing">SecretSharing::Put</a>(1);<a name="l00269"></a>00269                         <span class="keywordflow">while</span> (<a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#38c2477ac1e8be7ff63206991bb99c0b">InputBuffered</a>(0xffffffff) &gt; 0)<a name="l00270"></a>00270                                 <a class="code" href="class_buffered_transformation.html#e70658b0d271f8e114ac6c3cc9774ede" title="input a byte for processing">SecretSharing::Put</a>(0);<a name="l00271"></a>00271                 }<a name="l00272"></a>00272                 <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#3fa15d51e46a8eaee252a0a7034aac47">ChannelData</a>(0xffffffff, NULL, 0, <span class="keyword">true</span>);<a name="l00273"></a>00273                 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#cbdf3bfeabd7a7c64b03b61fa8929d4c">GetThreshold</a>()-1; i++)<a name="l00274"></a>00274                         <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#3fa15d51e46a8eaee252a0a7034aac47">ChannelData</a>(i, NULL, 0, <span class="keyword">true</span>);<a name="l00275"></a>00275         }<a name="l00276"></a>00276 <a name="l00277"></a>00277         <span class="keywordflow">return</span> 0;<a name="l00278"></a>00278 }<a name="l00279"></a>00279 <a name="l00280"></a>00280 <span class="keywordtype">void</span> SecretRecovery::IsolatedInitialize(<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;parameters)<a name="l00281"></a>00281 {<a name="l00282"></a>00282         <a class="code" href="class_secret_recovery.html#9f329e510c867744d20f82906c490eeb">m_pad</a> = parameters.<a class="code" href="class_name_value_pairs.html#943b2009297783f1c35bae46efc3b5f7" title="get a named value, returns the default if the name doesn't exist">GetValueWithDefault</a>(<span class="stringliteral">"RemovePadding"</span>, <span class="keyword">true</span>);<a name="l00283"></a>00283         RawIDA::IsolatedInitialize(<a class="code" href="class_combined_name_value_pairs.html">CombinedNameValuePairs</a>(parameters, MakeParameters(<span class="stringliteral">"OutputChannelID"</span>, (word32)0xffffffff)));<a name="l00284"></a>00284 }<a name="l00285"></a>00285 <a name="l00286"></a>00286 <span class="keywordtype">void</span> SecretRecovery::FlushOutputQueues()<a name="l00287"></a>00287 {<a name="l00288"></a>00288         <span class="keywordflow">if</span> (<a class="code" href="class_secret_recovery.html#9f329e510c867744d20f82906c490eeb">m_pad</a>)<a name="l00289"></a>00289                 <a class="code" href="class_raw_i_d_a.html#ae55af87cd9751e8b37923bde5aacd82">m_outputQueues</a>[0].TransferTo(*<a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>(), <a class="code" href="class_raw_i_d_a.html#ae55af87cd9751e8b37923bde5aacd82">m_outputQueues</a>[0].<a class="code" href="class_buffered_transformation.html#30b2076bce5fb29e992b6457485c67c2" title="returns number of bytes that is currently ready for retrieval">MaxRetrievable</a>()-4);<a name="l00290"></a>00290         <span class="keywordflow">else</span><a name="l00291"></a>00291                 <a class="code" href="class_raw_i_d_a.html#ae55af87cd9751e8b37923bde5aacd82">m_outputQueues</a>[0].TransferTo(*<a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>());<a name="l00292"></a>00292 }<a name="l00293"></a>00293 <a name="l00294"></a>00294 <span class="keywordtype">void</span> SecretRecovery::OutputMessageEnds()<a name="l00295"></a>00295 {<a name="l00296"></a>00296         <span class="keywordflow">if</span> (<a class="code" href="class_secret_recovery.html#9f329e510c867744d20f82906c490eeb">m_pad</a>)<a name="l00297"></a>00297         {<a name="l00298"></a>00298                 <a class="code" href="class_padding_remover.html">PaddingRemover</a> paddingRemover(<span class="keyword">new</span> <a class="code" href="class_redirector.html" title="Redirect input to another BufferedTransformation without owning it.">Redirector</a>(*<a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()));<a name="l00299"></a>00299                 <a class="code" href="class_raw_i_d_a.html#ae55af87cd9751e8b37923bde5aacd82">m_outputQueues</a>[0].TransferAllTo(paddingRemover);<a name="l00300"></a>00300         }<a name="l00301"></a>00301 <a name="l00302"></a>00302         <span class="keywordflow">if</span> (<a class="code" href="class_auto_signaling.html#011dc89743a4790bdd2ddefd9f176766">GetAutoSignalPropagation</a>() != 0)<a name="l00303"></a>00303                 <a class="code" href="class_filter.html#c8fc888888b2dad88bf64fc703044a93" title="returns the object immediately attached to this object or NULL for no attachment">AttachedTransformation</a>()-&gt;<a class="code" href="class_buffered_transformation.html#20ae0ef2e4ff338b43849e541e9b940f">MessageEnd</a>(<a class="code" href="class_auto_signaling.html#011dc89743a4790bdd2ddefd9f176766">GetAutoSignalPropagation</a>()-1);<a name="l00304"></a>00304 }<a name="l00305"></a>00305 <a name="l00306"></a>00306 <span class="comment">// ****************************************************************</span><a name="l00307"></a>00307 <a name="l00308"></a>00308 <span class="keywordtype">void</span> InformationDispersal::IsolatedInitialize(<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;parameters)<a name="l00309"></a>00309 {<a name="l00310"></a>00310         <a class="code" href="class_information_dispersal.html#4bd5ab80c6221a3274033470cbc83620">m_nextChannel</a> = 0;<a name="l00311"></a>00311         <a class="code" href="class_information_dispersal.html#fc464de54c9d574c9bff3d674907fd42">m_pad</a> = parameters.<a class="code" href="class_name_value_pairs.html#943b2009297783f1c35bae46efc3b5f7" title="get a named value, returns the default if the name doesn't exist">GetValueWithDefault</a>(<span class="stringliteral">"AddPadding"</span>, <span class="keyword">true</span>);<a name="l00312"></a>00312         <a class="code" href="class_information_dispersal.html#fd962aac086ce5c3fbf16157d59e4e63">m_ida</a>.<a class="code" href="class_raw_i_d_a.html#80b961ed9d9ba16267e3a2db70649736">IsolatedInitialize</a>(parameters);<a name="l00313"></a>00313 }<a name="l00314"></a>00314 <a name="l00315"></a>00315 <span class="keywordtype">size_t</span> <a class="code" href="class_information_dispersal.html#0dd51a1bdc83cea84cd72218730f4744" title="input multiple bytes for blocking or non-blocking processing">InformationDispersal::Put2</a>(<span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -