reenc_testing.html 9.57 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./reenc_testing_files/filelist.xml">
<title>Recrypt Test Plan</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>pramila</o:Author>
  <o:Template>Normal</o:Template>
  <o:LastAuthor>pramila</o:LastAuthor>
  <o:Revision>8</o:Revision>
  <o:TotalTime>36</o:TotalTime>
  <o:Created>2003-08-28T22:38:00Z</o:Created>
  <o:LastSaved>2003-08-28T22:51:00Z</o:LastSaved>
  <o:Pages>3</o:Pages>
  <o:Words>613</o:Words>
  <o:Characters>3498</o:Characters>
  <o:Company>RouteFree</o:Company>
  <o:Lines>29</o:Lines>
  <o:Paragraphs>6</o:Paragraphs>
  <o:CharactersWithSpaces>4295</o:CharactersWithSpaces>
  <o:Version>9.2720</o:Version>
 </o:DocumentProperties>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
@list l0
	{mso-list-id:667556550;
	mso-list-type:hybrid;
	mso-list-template-ids:-1778322718 67698703 67698689 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>
</head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<h1>Reencryption Testing</h1>

<h2>API Calls</h2>

<p class=MsoNormal><i>int skRecryptListValid(void *pList)</i>,<br>
<i><br>
int skRecryptBegin(BbTicketBundle *ticketBundle, BbAppLaunchCrls *crls, void
*pList)</i>, <br>
<br>
<i>int skRecryptData(u8 *data, u32 size)</i>, <br>
<br>
<i>int skRecryptComputeState(u8 *data, u32 size)</i>,<br>
<br>
<i>int skRecryptEnd(void *pList)</i>, <br>
<br>
All calls return SK_API_SUCCESS or SK_API_FAIL</p>

<h2>Correct Sequence of Calls</h2>

<p class=MsoNormal>For a new piece of content:<br>
<br>
skRecryptBegin()<br>
while (!done) <br>
&nbsp;&nbsp;&nbsp; skRecryptData();<br>
skRecryptEnd();<br>
<br>
For case where reencryption was tried and failed for some reason<br>
<br>
skRecryptBegin()<br>
while (!atStart)<br>
&nbsp;&nbsp;&nbsp; skRecryptComputeState();<br>
while (!done)<br>
&nbsp;&nbsp;&nbsp; skRecryptData();</p>

<h2>Functional Test Coverage</h2>

<h3>General negative tests</h3>

<p class=MsoNormal>1. All cases of invalid addresses for each entry point. Use
full range of KSEG1.<br>
<br>
2. All case of invalid key list, size &gt; 16k, signature invalid for each
entry point taking the Key list.</p>

<h3>skRecryptListValid()</h3>

<h4>Code Paths</h4>

<p class=MsoNormal>Invalid list covered by general negative tests<br>
Valid list</p>

<h3>skRecryptBegin()</h3>

<h4>Internal state used</h4>

<p class=MsoNormal>gCmdh set (in ticket processing)<br>
gRecryptState, set to RECRYPT_RECOVERY, or RECRYPT_DATA<br>
gRecryptKey set<br>
gSha reset<br>
gBytesProcessed set to 0<br>
gRecryptHwAesChain set to -<br>
gTikh set<br>
<br>
Assume ticket and revocation list testing is done in Launch, so not necessary
to test fully here, since call sequence is identical.</p>

<h4>Code Paths</h4>

<p class=MsoNormal>Ticket with no re-encryption required - should fail.<br>
Invalid key list - should start a new list of length 0 and add an entry<br>
Valid key list with no entry.<br>
<br>
Key list with entry that has SK_API_RECRYPT_INCOMPLETE<br>
this is treated as recovery case<br>
<br>
Key list with entry that is not SK_API_RECRYPT_INCOMPLETE <br>
this is treated as the case of starting from scratch</p>

<h3>skRecryptData()</h3>

<h4>Internal state used</h4>

<p class=MsoNormal>gRecryptState read and set<br>
gRecryptCipher read<br>
gRecryptHwAesChain, read and set<br>
gSha set<br>
gCmdh read<br>
gBytesProcessed set</p>

<h4>Code paths</h4>

<p class=MsoNormal style='margin-bottom:12.0pt'>If gRecryptState is
RECRYPT_RECOVERY or not.<br>
Input buffer size not a multiple of PI_BUFFER_DATA_SIZE/2, and greater than
buffer long.</p>

<h3>skRecryptComputeState()</h3>

<h4>Internal state use</h4>

<p class=MsoNormal>gRecryptCipher read<br>
gRecryptRecoverIv set<br>
gRRecryptKey read<br>
gRecryptHwAesChain, read and set<br>
gSha set<br>
gCmdh read<br>
gBytesProcessed set</p>

<h4>Code paths</h4>

<p class=MsoNormal>Input buffer size not a multiple of PI_BUFFER_DATA_SIZE/2,
and greater than buffer long.</p>

<h3>skRecryptEnd()</h3>

<h4>Internal state used</h4>

<p class=MsoNormal>gSha read<br>
gCmdh read</p>

<h4>Code paths</h4>

<p class=MsoNormal style='margin-bottom:12.0pt'>Hash miscompare<br>
Fail to update reencryption list entry <br>
Invalid list covered by general negative tests<br>
No entry on the list which matches<br>
Matching hash, valid list.</p>

<h2>Tests</h2>

<h3>Functional Tests for Complete Code Path Coverage</h3>

<h3>Method:</h3>

<p class=MsoNormal>Test using the library calls, using the following entry
points repeatedly with different files:</p>

<p class=MsoNormal>osBbSaGamePreLaunch to call skRecryptBegin and skRecryptData</p>

<p class=MsoNormal>osBbSaGamePersonalize to call skRecryptComputeState and skRecryptData</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>The following tests will exercise the code paths listed
above:</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<ol style='margin-top:0in' start=1 type=1>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Exercise
     all null pointer tests at API level.</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Exercise
     skRecryptListValid(?) at API level, positive and negative test for
     signature.</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Ticket
     says no reencryption required, check return code FAIL.</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>No key
     list, new content piece, invalid ticket (alter signature), check return
     code FAIL</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>No key
     list, new content piece, good ticket bundle, let reenc proceed and check
     SUCCESS. Save key list.</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Start
     reenc with above key list, stop randomly before completion, restart and
     proceed to completion. Try a few random points of stopping before
     completion. In each case check return code.</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Start
     reenc, stop randomly before completion with different CIDs to populate the
     key list.</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Search
     for each cid on the list and ensure the number of entries on list did not
     change. (if seach failed, it wipes out the list).</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Corrupt
     sign on key list, start reenc and proceed to completion, check that only
     one item on key list. Check CID. (it has been wiped out and new one
     created in its place).</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Check
     various content sizes, to exercise integer and non-integer multiples of
     PI_BUFFER_DATA_SIZE</li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'>Start
     with good key list, stop reenc, replace with another sometime before
     skRecryptEnd is called: all negative cases:</li>
 <ul style='margin-top:0in' type=disc>
  <li class=MsoNormal style='mso-list:l0 level2 lfo1;tab-stops:list 1.0in'>Good
      key list but that cid is not there</li>
  <li class=MsoNormal style='mso-list:l0 level2 lfo1;tab-stops:list 1.0in'>Bad
      signature on key list</li>
  <li class=MsoNormal style='mso-list:l0 level2 lfo1;tab-stops:list 1.0in'>Status
      not incomplete.</li>
  <li class=MsoNormal style='mso-list:l0 level2 lfo1;tab-stops:list 1.0in'>Ticket
      is otherwise good, but hash is incorrect.</li>
 </ul>
</ol>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>Additional tests to cover corner cases on the library:</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h3>Random API testing</h3>

<p class=MsoNormal style='margin-bottom:12.0pt'>To ensure that there is no
possibility of internal issues, make random API calls using random input data,
then run a correct functional test.<br>
This should probably extend to all API's, since some internal state may be used
by other SK functions?<br style='mso-special-character:line-break'>
<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
<![endif]></p>

</div>

</body>

</html>