<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Rijndael CTR random access in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861722#M7841</link>
    <description>&lt;P&gt;I found my own answer.&lt;BR /&gt;The crt is actually the Nonce+counter&lt;BR /&gt;The documentation is not very clear about this.&lt;BR /&gt;&lt;BR /&gt;Anyway, I now modify the crt directly to change the counter value and I can achieve partial decryption.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;for&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 0; i &amp;lt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;sizeof&lt;/FONT&gt;&lt;FONT size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;unsigned&lt;/FONT&gt;&lt;FONT size="2"&gt;); ++i)&lt;BR /&gt;{&lt;BR /&gt;crt[aesBlkSize - 2 - i] = ((bufferIndex * 3) &amp;gt;&amp;gt; (8 * i)) &amp;amp; 0xFF;&lt;BR /&gt;}&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;One thing I do not understand yet is why I have multiply the bufferIndex value by 3.&lt;BR /&gt;&lt;BR /&gt;I have monitored the crt counter value while debugging and for each buffer I decrypt the counter is increased by 3.&lt;BR /&gt;As my code above shown I am also increasing by 3, but I would like to understand why.&lt;BR /&gt;&lt;BR /&gt;Another thing, I can not set a counter value higher than 0xFFFFFFFF (4294967295).&lt;BR /&gt;If I try 0xFFFFFFFF01 for example, I end up with a counter value of 1 instead of 1099511627521.&lt;BR /&gt;I guess my code to convert the int to hex is not the best.&lt;BR /&gt;Any idea how to improve it?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jul 2008 19:57:52 GMT</pubDate>
    <dc:creator>mickaelpic</dc:creator>
    <dc:date>2008-07-09T19:57:52Z</dc:date>
    <item>
      <title>Rijndael CTR random access</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861721#M7840</link>
      <description>&lt;P&gt;Hi, I am trying to use the IPPS Rijndael capability.&lt;/P&gt;
&lt;P&gt;So far everything is ok for encrypting and decrypting complete files.&lt;BR /&gt;But now I am trying to partially decrypt a file.&lt;BR /&gt;Given a block number I want to be able to start to decrypt the file from there instead of starting from the beginning.&lt;BR /&gt;&lt;BR /&gt;The AES (Rijndael) CTR algorithm support such functionallity according to &lt;A href="http://en.wikipedia.org/wiki/Cipher_block_chaining"&gt;http://en.wikipedia.org/wiki/Cipher_block_chaining&lt;/A&gt;&lt;BR /&gt;In the algorithm, if I set the counter to the block index, and I provide the correct block, it will decrypt properlyfrom that block directly.&lt;BR /&gt;&lt;BR /&gt;But the IPPs does not provide access to the counter.&lt;BR /&gt;At least no way I could find.&lt;BR /&gt;&lt;BR /&gt;So am I missing something, or this functionnality was not provided in the IPPs?&lt;BR /&gt;I use IPPs5.3 Update 3 build 85.25, [5.3.471.85]&lt;BR /&gt;&lt;BR /&gt;Here is a sample of the code I use to decrypt:&lt;BR /&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;BR /&gt;#define&lt;/FONT&gt;&lt;FONT size="2"&gt; bufferSize 24576 &lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;// 24KB&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;#define&lt;/FONT&gt;&lt;FONT size="2"&gt; aesBlkSize 32 &lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;// size of Rijndael-256 algorithm block is equal to 32&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT size="2"&gt; ctxSize;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;ippsRijndael256GetSize(&amp;amp;ctxSize);&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;// and allocate one&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;IppsRijndael256Spec* pCtx = (IppsRijndael256Spec*)( &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; Ipp8u [ctxSize] );&lt;BR /&gt;&lt;FONT color="#008000" size="2"&gt;// and prepare the context for Rijndael256 usage&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;ippsRijndael256Init(key, IppsRijndaelKey256, pCtx);&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Ipp8u crt[aesBlkSize];&lt;BR /&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT size="2"&gt; ctrNumBitSize = 64;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;// init the counter&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;memcpy_s(crt, aesBlkSize, IV, aesBlkSize);&lt;BR /&gt;IppStatus status = ippStsNoErr;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;len = (&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;unsigned&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;long&lt;/FONT&gt;&lt;FONT size="2"&gt;)fread((&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;char&lt;/FONT&gt;&lt;FONT size="2"&gt;*)inBuffer, 1, bufferSize, fin);&lt;BR /&gt;&lt;/FONT&gt;status = ippsRijndael256DecryptCTR(inBuffer, outBuffer, len, pCtx, crt, ctrNumBitSize);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jul 2008 20:16:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861721#M7840</guid>
      <dc:creator>mickaelpic</dc:creator>
      <dc:date>2008-07-07T20:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rijndael CTR random access</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861722#M7841</link>
      <description>&lt;P&gt;I found my own answer.&lt;BR /&gt;The crt is actually the Nonce+counter&lt;BR /&gt;The documentation is not very clear about this.&lt;BR /&gt;&lt;BR /&gt;Anyway, I now modify the crt directly to change the counter value and I can achieve partial decryption.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;for&lt;/FONT&gt;&lt;FONT size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 0; i &amp;lt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;sizeof&lt;/FONT&gt;&lt;FONT size="2"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;unsigned&lt;/FONT&gt;&lt;FONT size="2"&gt;); ++i)&lt;BR /&gt;{&lt;BR /&gt;crt[aesBlkSize - 2 - i] = ((bufferIndex * 3) &amp;gt;&amp;gt; (8 * i)) &amp;amp; 0xFF;&lt;BR /&gt;}&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;One thing I do not understand yet is why I have multiply the bufferIndex value by 3.&lt;BR /&gt;&lt;BR /&gt;I have monitored the crt counter value while debugging and for each buffer I decrypt the counter is increased by 3.&lt;BR /&gt;As my code above shown I am also increasing by 3, but I would like to understand why.&lt;BR /&gt;&lt;BR /&gt;Another thing, I can not set a counter value higher than 0xFFFFFFFF (4294967295).&lt;BR /&gt;If I try 0xFFFFFFFF01 for example, I end up with a counter value of 1 instead of 1099511627521.&lt;BR /&gt;I guess my code to convert the int to hex is not the best.&lt;BR /&gt;Any idea how to improve it?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jul 2008 19:57:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861722#M7841</guid>
      <dc:creator>mickaelpic</dc:creator>
      <dc:date>2008-07-09T19:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rijndael CTR random access</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861723#M7842</link>
      <description>&lt;P&gt;I answered one of my own question.&lt;/P&gt;
&lt;P&gt;The increment of 3 is actually actually the number of 8K buffers that fits in a 24K buffersize&lt;/P&gt;
&lt;P&gt;For a 64K buffersize you can fit 8,...&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2008 14:27:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861723#M7842</guid>
      <dc:creator>mickaelpic</dc:creator>
      <dc:date>2008-07-11T14:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Rijndael CTR random access</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861724#M7843</link>
      <description>&lt;P&gt;Glad to see you can figure oout how to use IPP functions&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt; Vladimir&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2008 19:29:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Rijndael-CTR-random-access/m-p/861724#M7843</guid>
      <dc:creator>Vladimir_Dudnik</dc:creator>
      <dc:date>2008-07-29T19:29:53Z</dc:date>
    </item>
  </channel>
</rss>

