rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_HMAC_SHA1.cpp
changeset 15 8248b03a2669
parent 0 307788aac0a8
--- a/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_HMAC_SHA1.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/rtp/srtpstack/tsrc/ut_srtpstack/src/UT_SRTPAuthentication_HMAC_SHA1.cpp	Fri Apr 16 15:18:54 2010 +0300
@@ -312,36 +312,67 @@
 void UT_SRTPAuthentication_HMAC_SHA1::Teardown(  )
     {
     delete iAuthenticator;
-    
+    iAuthenticator = NULL;
+	
 	delete iRFC2202_Test1_Key_160bits;
 	delete iRFC2202_Test1_Data_16bits;
 	delete iRFC2202_Test1_Tag_80bits;
 	delete iRFC2202_Test1_Tag_32bits;
+	
+	iRFC2202_Test1_Key_160bits = NULL;
+	iRFC2202_Test1_Data_16bits = NULL;
+	iRFC2202_Test1_Tag_80bits = NULL;
+	iRFC2202_Test1_Tag_32bits = NULL;
 
 	delete iRFC2202_Test2_Key;
 	delete iRFC2202_Test2_Data_28bits;
 	delete iRFC2202_Test2_Tag_80bits;
 	delete iRFC2202_Test2_Tag_32bits;
+	
+    iRFC2202_Test2_Key = NULL;
+	iRFC2202_Test2_Data_28bits = NULL;
+	iRFC2202_Test2_Tag_80bits = NULL;
+	iRFC2202_Test2_Tag_32bits = NULL;
 
 	delete iRFC2202_Test3_Key_160bits;
 	delete iRFC2202_Test3_Data_400bits;
 	delete iRFC2202_Test3_Tag_80bits;
 	delete iRFC2202_Test3_Tag_32bits;
+	
+    iRFC2202_Test3_Key_160bits = NULL;
+	iRFC2202_Test3_Data_400bits = NULL;
+	iRFC2202_Test3_Tag_80bits = NULL;
+	iRFC2202_Test3_Tag_32bits = NULL;
 
     delete iRFC2202_Test4_Key_200bits;
     delete iRFC2202_Test4_Data_400bits;
     delete iRFC2202_Test4_Tag_80bits;
     delete iRFC2202_Test4_Tag_32bits;
+	
+	iRFC2202_Test4_Key_200bits = NULL;
+    iRFC2202_Test4_Data_400bits = NULL;
+    iRFC2202_Test4_Tag_80bits = NULL;
+    iRFC2202_Test4_Tag_32bits = NULL;
 
     delete iRFC2202_Test5_Key_160bits;
     delete iRFC2202_Test5_Data;
     delete iRFC2202_Test5_Tag_80bits;
     delete iRFC2202_Test5_Tag_32bits;
 
+	iRFC2202_Test5_Key_160bits = NULL;
+    iRFC2202_Test5_Data = NULL;
+    iRFC2202_Test5_Tag_80bits = NULL;
+    iRFC2202_Test5_Tag_32bits = NULL;
+	
 	delete iRFC2202_Test6_Key_640bits;
 	delete iRFC2202_Test6_Data_54bits;
 	delete iRFC2202_Test6_Tag_80bits;
 	delete iRFC2202_Test6_Tag_32bits;
+	
+    iRFC2202_Test6_Key_640bits = NULL;
+	iRFC2202_Test6_Data_54bits = NULL;
+	iRFC2202_Test6_Tag_80bits = NULL;
+	iRFC2202_Test6_Tag_32bits = NULL;
 
 	delete iRFC2202_Test7_Key_640bits;
 	delete iRFC2202_Test7_Data_73bits;
@@ -351,10 +382,19 @@
 	delete iTest8_Data_168bits;
 	delete iTest8_Data2_32bits;
 	delete iTest8_Tag_80bits;
+	
+    iRFC2202_Test7_Key_640bits = NULL;
+	iRFC2202_Test7_Data_73bits = NULL;
+	iRFC2202_Test7_Tag_80bits = NULL;
+	iRFC2202_Test7_Tag_32bits = NULL;
+	iTest8_Key_160bits = NULL;
+	iTest8_Data_168bits = NULL;
+	iTest8_Data2_32bits = NULL;
+	iTest8_Tag_80bits = NULL;
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -368,7 +408,7 @@
  	delete result;     	 	 	
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test1_Key_160bits, 
  	                                         *iRFC2202_Test1_Data_16bits,
@@ -383,7 +423,7 @@
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test2_Key, 
  	                                         *iRFC2202_Test2_Data_28bits,
@@ -397,7 +437,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test2_Key, 
  	                                         *iRFC2202_Test2_Data_28bits,
@@ -412,7 +452,7 @@
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test3_Key_160bits, 
  	                                         *iRFC2202_Test3_Data_400bits,
@@ -426,7 +466,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test3_Key_160bits, 
  	                                         *iRFC2202_Test3_Data_400bits,
@@ -440,7 +480,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test4_Key_200bits, 
  	                                         *iRFC2202_Test4_Data_400bits,
@@ -454,7 +494,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test4_Key_200bits, 
  	                                         *iRFC2202_Test4_Data_400bits,
@@ -468,7 +508,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test5_Key_160bits, 
  	                                         *iRFC2202_Test5_Data,
@@ -482,7 +522,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test5_Key_160bits, 
  	                                         *iRFC2202_Test5_Data,
@@ -496,7 +536,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test6_Key_640bits, 
  	                                         *iRFC2202_Test6_Data_54bits,
@@ -510,7 +550,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test6_Key_640bits, 
  	                                         *iRFC2202_Test6_Data_54bits,
@@ -524,7 +564,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_80L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_EightyL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test7_Key_640bits, 
  	                                         *iRFC2202_Test7_Data_73bits,
@@ -538,7 +578,7 @@
  	delete result;    
     }
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL(  )
     {
  	HBufC8* result = iAuthenticator->AuthenticateL(32, *iRFC2202_Test7_Key_640bits, 
  	                                         *iRFC2202_Test7_Data_73bits,
@@ -553,7 +593,7 @@
     }
 
 
-void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_Test8_32L(  )
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_Test8_ThirtyTwoL(  )
     {
     TBuf8<20> buf; 
     TBuf8<19> buf2;
@@ -630,6 +670,12 @@
  	CleanupStack::PopAndDestroy(result); 	
  	}
 
+void UT_SRTPAuthentication_HMAC_SHA1::UT_AuthenticateL_Test_KeyChangedL(  )
+    {
+    UT_AuthenticateL_RFC2202_Test1_EightyL();
+    UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL();
+    }
+
 void UT_SRTPAuthentication_HMAC_SHA1::Hex(HBufC8& aString)
 {
     TPtr8 ptr=aString.Des();
@@ -663,106 +709,112 @@
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 1 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test1_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test1_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 2 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test2_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test2_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 2 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test2_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test2_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 3 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test3_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test3_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 3 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test3_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test3_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 4 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test4_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test4_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 4 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test4_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test4_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 5 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test5_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test5_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 5 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test5_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test5_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 6 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test6_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test6_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 6 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test6_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test6_ThirtyTwoL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 7 80 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test7_80L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test7_EightyL, Teardown)
 
 EUNIT_TEST(
     "AuthenticateL - 7 32 bits",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_RFC2202_Test7_32L, Teardown)
+    SetupL, UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL, Teardown)
 EUNIT_TEST(
     "AuthenticateL - RealPacket",
     "SRTPAuthentication_HMAC_SHA1",
     "AuthenticateL with Real Packet",
     "FUNCTIONALITY",
-    SetupL, UT_AuthenticateL_Test8_32L, Teardown)
+    SetupL, UT_AuthenticateL_Test8_ThirtyTwoL, Teardown)
     
-
+EUNIT_TEST(
+    "AuthenticateL - KeyChanged",
+    "SRTPAuthentication_HMAC_SHA1",
+    "AuthenticateL",
+    "FUNCTIONALITY",
+    SetupL, UT_AuthenticateL_Test_KeyChangedL, Teardown)
+    
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE