diff --git a/TCCUsefulFunctions_CNL113472_Common.tpd b/TCCUsefulFunctions_CNL113472_Common.tpd
index f13aed554575a964de1a64ed65a0f71f182c1e16..4862ac01455d29d27375b036525c0215b598f0a7 100644
--- a/TCCUsefulFunctions_CNL113472_Common.tpd
+++ b/TCCUsefulFunctions_CNL113472_Common.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
+ Copyright (c) 2018 Ericsson
 
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_Common.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_IPsec.tpd b/TCCUsefulFunctions_CNL113472_IPsec.tpd
index de94e2ef500252229826200134fb1e3aacc02db1..483ad67e3b9bb9246dd4db4af2efebca65e73984 100644
--- a/TCCUsefulFunctions_CNL113472_IPsec.tpd
+++ b/TCCUsefulFunctions_CNL113472_IPsec.tpd
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
-
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+ Copyright (c) 2018 Ericsson
 
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_IPsec.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_Interface.tpd b/TCCUsefulFunctions_CNL113472_Interface.tpd
index d852adfa1a0c94aa2e05405e396b50a49411fa0b..5584d4e89cee4f804bb7733f4db6746b798b3ad8 100644
--- a/TCCUsefulFunctions_CNL113472_Interface.tpd
+++ b/TCCUsefulFunctions_CNL113472_Interface.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
+ Copyright (c) 2018 Ericsson
 
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_Interface.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_Maths.tpd b/TCCUsefulFunctions_CNL113472_Maths.tpd
index a89ba9ad32178195249cbf7ae9e8f086d0db2a6f..2a83bf5ebcda854b0f4e32cef3fe201df005af36 100644
--- a/TCCUsefulFunctions_CNL113472_Maths.tpd
+++ b/TCCUsefulFunctions_CNL113472_Maths.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
+ Copyright (c) 2018 Ericsson
 
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_Maths.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd b/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
index d3143d54f657db98362472304c70283154e20e96..5620ded1ab71475ad2c676e96dab76ee9a9fb8b1 100644
--- a/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
+++ b/TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
-
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+ Copyright (c) 2018 Ericsson
 
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_OpenSecurity.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd b/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
index 73208fcfe714df559d5b6dacfc849f981103f7ce..26527f05ac85b55157219b93361e3f9f1e4c20b7 100644
--- a/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
+++ b/TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
+ Copyright (c) 2018 Ericsson
 
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_PermutatedParameters.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_Regexp.tpd b/TCCUsefulFunctions_CNL113472_Regexp.tpd
index 13b3d9359f9b69df205820e425a09be57fec021f..b0538dc8550e2866da86c6a53e3d25b8f34bf824 100644
--- a/TCCUsefulFunctions_CNL113472_Regexp.tpd
+++ b/TCCUsefulFunctions_CNL113472_Regexp.tpd
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
-
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+ Copyright (c) 2018 Ericsson
 
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_Regexp.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_TitanSim.tpd b/TCCUsefulFunctions_CNL113472_TitanSim.tpd
index 74539c0d232a1d553544a0a698379557f3f9b694..3f3f871d59bbd21b9d71ac30d518e5b59f4d82f2 100644
--- a/TCCUsefulFunctions_CNL113472_TitanSim.tpd
+++ b/TCCUsefulFunctions_CNL113472_TitanSim.tpd
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
-
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+ Copyright (c) 2018 Ericsson
 
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_TitanSim.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/TCCUsefulFunctions_CNL113472_XPath.tpd b/TCCUsefulFunctions_CNL113472_XPath.tpd
index 2bf643fb879b78e36c3958f43d565d43dbed3b23..1105eb8000dc8a9c21411aa260dfe07c811eced1 100644
--- a/TCCUsefulFunctions_CNL113472_XPath.tpd
+++ b/TCCUsefulFunctions_CNL113472_XPath.tpd
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2017 Ericsson
-
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Eclipse Public License v1.0
-  which accompanies this distribution, and is available at
-  http://www.eclipse.org/legal/epl-v10.html
+ Copyright (c) 2018 Ericsson
 
+  The copyright to the computer  program(s) herein  is the property of Ericsson.
+  The program(s) may be used and/or copied only with the written permission
+  of Ericsson or in accordance with  the terms and conditions  stipulated in the
+  agreement/contract under which the program(s) has been supplied.
 
 
    File:               TCCUsefulFunctions_CNL113472_XPath.tpd
    Description:        tpd project file
-   Rev:                R30A
+   Rev:                R35B
    Prodnr:             CNL 113 472
 
  -->
diff --git a/demo/TCCAssertion_Example.ttcn b/demo/TCCAssertion_Example.ttcn
index a600570aa40b0933f75c03ff0b875165e71821f9..ac1c6132246dabbf399223058351ca1c74b7da38 100644
--- a/demo/TCCAssertion_Example.ttcn
+++ b/demo/TCCAssertion_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2005                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCAssertion_Example.ttcn
 //  Description:        TCC Useful Functions: Assertion Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-11-14
 //  Contact:            http://ttcn.ericsson.se
@@ -34,4 +35,4 @@ control
   log(" ----####--- NO Assertion tests executed ----####--- ");
 }
 
-}
+}
\ No newline at end of file
diff --git a/demo/TCCConversion_Example.ttcn b/demo/TCCConversion_Example.ttcn
index 4dca33a6b3c242fad6f7836ac620500c214b0812..ba5a25d450ff95ad1ec5cabbb34f3ddc9f4ac34b 100644
--- a/demo/TCCConversion_Example.ttcn
+++ b/demo/TCCConversion_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2013                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCConversion_Example.ttcn
 //  Description:        TCC Useful Functions: Conversion Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-09-24
 //  Contact:            http://ttcn.ericsson.se
@@ -248,6 +249,6 @@ control
 
 }//end of module
 with {
-extension "version R30A"
+extension "version R32A"
 }
 
diff --git a/demo/TCCDateTime_Example.ttcn b/demo/TCCDateTime_Example.ttcn
index 37880f59f35463320ba19c099b6dabcdc81e429b..40347a4ca577f3096da59d26959701515ee68c7d 100644
--- a/demo/TCCDateTime_Example.ttcn
+++ b/demo/TCCDateTime_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2011                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCDateTime_Example.ttcn
 //  Description:        TCC Useful testcases: DateTime testcases.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2011-05-30
 //  Contact:            http://ttcn.ericsson.se
@@ -35,7 +36,16 @@ type component DateTime_CT
 testcase f_test_time() runs on DateTime_CT
 {
   log(" ----------- f_time ----------- ");
-  log("Time (f_time): ", f_time());    
+  log("Time (f_time): ", f_time());
+
+  // no check
+  setverdict(pass);
+}
+// test f_time_ms testcase
+testcase f_test_time_ms() runs on DateTime_CT
+{
+  log(" ----------- f_time_ms ----------- ");
+  log("Time (f_time_ms): ", f_time_ms());
 
   // no check
   setverdict(pass);
@@ -45,23 +55,83 @@ testcase f_test_time() runs on DateTime_CT
 testcase f_test_ctime() runs on DateTime_CT
 {
   log(" ----------- f_ctime ----------- ");
-  log("CTime (f_ctime) - an hour before: ", 
-    f_ctime(f_time() - 3600)); 
+  log("CTime (f_ctime) - an hour before: ",
+    f_ctime(f_time() - 3600));
+
+  var charstring vl_time_1 := "Wed Sep 21 14:13:42 2039\n";
+  var charstring vl_time_2 := f_ctime(2200220022);
+  log("CTime (f_ctime) - test string: ",vl_time_1);
+  log("CTime (f_ctime) - func result: ",vl_time_2);
+  if (match(vl_time_1,vl_time_2)) {
+    setverdict(pass);
+  } else {
+    setverdict(fail);
+  }
+}
 
-  log("CTime (f_ctime) - large integer test: ", f_ctime(2200220022));
-    
-  // no check
-  setverdict(pass);
+
+// test f_ctime_ms testcase
+testcase f_test_ctime_ms() runs on DateTime_CT
+{
+  log(" ----------- f_ctime_ms ----------- ");
+  log("CTime (f_ctime_ms) - an hour before: ",
+    f_ctime_ms(f_time_ms() - 3600000));
+
+  var charstring vl_time_1 := "Wed Sep 21 14:13:42.478 2039\n";
+  var charstring vl_time_2 := f_ctime_ms(2200220022478);
+  log("CTime (f_ctime_ms) - test string: ",vl_time_1);
+  log("CTime (f_ctime_ms) - func result: ",vl_time_2);
+  if (match(vl_time_1,vl_time_2)) {
+    setverdict(pass);
+  } else {
+    setverdict(fail);
+  }
+}
+
+// test f_ctime_UTC testcase
+testcase f_test_ctime_UTC() runs on DateTime_CT
+{
+  log(" ----------- f_ctime_UTC ----------- ");
+  log("CTime (f_ctime_UTC) - an hour before: ",
+    f_ctime_UTC(f_time() - 3600));
+
+  var charstring vl_time_1 := "Wed Sep 21 12:13:42 2039\n";
+  var charstring vl_time_2 := f_ctime_UTC(2200220022);
+  log("CTime (f_ctime_UTC) - test string: ",vl_time_1);
+  log("CTime (f_ctime_UTC) - func result: ",vl_time_2);
+  if (match(vl_time_1,vl_time_2)) {
+    setverdict(pass);
+  } else {
+    setverdict(fail);
+  }
+}
+
+// test f_ctime_ms_UTC testcase
+testcase f_test_ctime_ms_UTC() runs on DateTime_CT
+{
+  log(" ----------- f_ctime_ms_UTC ----------- ");
+  log("CTime (f_ctime_ms_UTC) - an hour before: ",
+    f_ctime_ms_UTC(f_time_ms() - 3600000));
+
+  var charstring vl_time_1 := "Wed Sep 21 12:13:42.478 2039\n";
+  var charstring vl_time_2 := f_ctime_ms_UTC(2200220022478);
+  log("CTime (f_ctime_ms_UTC) - test string: ",vl_time_1);
+  log("CTime (f_ctime_ms_UTC) - func result: ",vl_time_2);
+  if (match(vl_time_1,vl_time_2)) {
+    setverdict(pass);
+  } else {
+    setverdict(fail);
+  }
 }
 
 // test f_time2str testcase
 testcase f_test_getTimeFormatted() runs on DateTime_CT
 {
   log(" ----------- f_getTimeFormatted ----------- ");
-  log("TimeFormatted (f_getTimeFormatted): ", 
+  log("TimeFormatted (f_getTimeFormatted): ",
     f_getTimeFormatted(f_time(),"Now is %m %I:%M%p."));
-  log("TimeFormatted (f_getTimeFormatted) - large integer test: ", 
-    f_getTimeFormatted(2200220022," is %Y.%m %I:%M%p."));      
+  log("TimeFormatted (f_getTimeFormatted) - large integer test: ",
+    f_getTimeFormatted(2200220022," is %Y.%m %I:%M%p."));
 
   // no check
   setverdict(pass);
@@ -71,13 +141,13 @@ testcase f_test_getTimeFormatted() runs on DateTime_CT
 testcase f_test_time2sec() runs on DateTime_CT
 {
   log(" ----------- f_time2sec ----------- ");
-  log("Time2Sec (f_time2sec): ", 
-    f_time2sec(2010,5,24,17,0,20));    
+  log("Time2Sec (f_time2sec): ",
+    f_time2sec(2010,5,24,17,0,20));
 
   var integer t1 := f_time2sec(2050,5,5,0,0,0);
   var integer t2 := f_time2sec(2050,5,5,0,0,30);
   log("Time2Sec (f_time2sec) - large integer test: ", t1, ", ", t2);
-  
+
   // no check
   setverdict(pass);
 }
@@ -86,11 +156,11 @@ testcase f_test_time2sec() runs on DateTime_CT
 testcase f_test_getCurrentDateWithOffset() runs on DateTime_CT
 {
   log(" ----------- f_getCurrentDateWithOffset ----------- ");
-  log("Date (f_getDateFromSeconds): ", 
-    f_getCurrentDateWithOffset(0));    
+  log("Date (f_getDateFromSeconds): ",
+    f_getCurrentDateWithOffset(0));
 
-  log("Date (f_getDateFromSeconds) - large integer test: ", 
-    f_getCurrentDateWithOffset(2200220022));    
+  log("Date (f_getDateFromSeconds) - large integer test: ",
+    f_getCurrentDateWithOffset(2200220022));
 
   // no check
   setverdict(pass);
@@ -100,8 +170,19 @@ testcase f_test_getCurrentDateWithOffset() runs on DateTime_CT
 testcase f_test_getCurrentGMTDate() runs on DateTime_CT
 {
   log(" ----------- f_getCurrentGMTDate ----------- ");
-  log("GMT Date (f_getCurrentGMTDate): ", 
-    f_getCurrentGMTDate());    
+  log("GMT Date (f_getCurrentGMTDate): ",
+    f_getCurrentGMTDate());
+
+  // no check
+  setverdict(pass);
+}
+
+// test f_getCurrentGMTDate_ms testcase
+testcase f_test_getCurrentGMTDate_ms() runs on DateTime_CT
+{
+  log(" ----------- f_getCurrentGMTDate_ms ----------- ");
+  log("GMT Date (f_getCurrentGMTDate_ms): ",
+    f_getCurrentGMTDate_ms());
 
   // no check
   setverdict(pass);
@@ -119,7 +200,7 @@ testcase f_test_tic() runs on DateTime_CT
   {
     a := a + 1;
   }
-  
+
   tictac := f_tic();
   log("Tics since program start (f_tic): ", tictac);
 
@@ -147,7 +228,7 @@ testcase f_test_toc() runs on DateTime_CT
   }
 
   time := f_toc(vl_start);
-  log("Seconds since vl_start (f_toc): ", time);    
+  log("Seconds since vl_start (f_toc): ", time);
 
   // approx 2 seconds has elapsed sinece last tic
   if (time > 0.0) { setverdict(pass); }
@@ -167,11 +248,11 @@ testcase f_test_timeDiff() runs on DateTime_CT
   T_timer.timeout;
   vl_end := f_time();
 
-  var integer diff := f_timeDiff(vl_end, vl_start); 
-  log("Time diff (f_timeDiff): ", diff); 
-  
+  var integer diff := f_timeDiff(vl_end, vl_start);
+  log("Time diff (f_timeDiff): ", diff);
+
   var integer largeDiff := f_timeDiff(vl_end+5500550055, vl_start+2200220022);
-  log("Time diff (f_timeDiff) - large integer test: ", largeDiff); 
+  log("Time diff (f_timeDiff) - large integer test: ", largeDiff);
 
   if ((diff > 0) and (largeDiff > 3300330033)) { setverdict(pass); }
   else { setverdict(fail); }
@@ -270,11 +351,16 @@ control
   log(" ################### DateTime ################### ");
 
   execute(f_test_time());
+  execute(f_test_time_ms());
   execute(f_test_ctime());
+  execute(f_test_ctime_ms());
+  execute(f_test_ctime_UTC());
+  execute(f_test_ctime_ms_UTC());
   execute(f_test_getTimeFormatted());
   execute(f_test_time2sec());
   execute(f_test_getCurrentDateWithOffset());
   execute(f_test_getCurrentGMTDate());
+  execute(f_test_getCurrentGMTDate_ms());
   execute(f_test_tic());
   execute(f_test_toc());
   execute(f_test_timeDiff());
diff --git a/demo/TCCEncoding_Example.ttcn b/demo/TCCEncoding_Example.ttcn
index 9b192c747b4c8a0664f0f0fd8f50f28f9e9e31a1..fb62fc4a1227633ef8abf0fe679a2db7c63b24a6 100644
--- a/demo/TCCEncoding_Example.ttcn
+++ b/demo/TCCEncoding_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2013                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEncoding_Example.ttcn
 //  Description:        TCC Useful Functions: Message Encoding Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-02-05
 //  Contact:            http://ttcn.ericsson.se
@@ -151,5 +152,5 @@ control {
   execute(tc_005_artf265694());   
 }
 
-} with {extension "version R30A"}
+} with {extension "version R32A"}
 
diff --git a/demo/TCCEnv_Example.ttcn b/demo/TCCEnv_Example.ttcn
index 1ca5b5867c90319897043d3a0375d7f1faa7917b..452f7cd1ab552f4fec9cb88b1414f7d563cfcde9 100644
--- a/demo/TCCEnv_Example.ttcn
+++ b/demo/TCCEnv_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2008                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCEnv_Example.ttcn
 //  Description:        TCC Useful Functions: Environment Handling Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-12-10
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCFileIO_Example.ttcn b/demo/TCCFileIO_Example.ttcn
index 2fb9dac05ea2bec305aef55d9b1affc91b3d7221..19311954836be4f4053acf93412fd48ce5646a2c 100644
--- a/demo/TCCFileIO_Example.ttcn
+++ b/demo/TCCFileIO_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2008                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileIO_Example.ttcn
 //  Description:        TCC Useful Functions: File IO Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-12-10
 //  Contact:            http://ttcn.ericsson.se
@@ -311,11 +312,29 @@ testcase TC_test_read_TLV() runs on empty_CT
   else
   {
     setverdict(pass);
-  } 
+  }
 }
 
+testcase TC_test_getFileInfo() runs on empty_CT {
+  var charstring vl_text_in := "TCCFileIO.cc";
+  
+  var FIO_FileInfo v_result;
+  v_result := f_FIO_getFileInfo(vl_text_in);
+  log(v_result);
+  
+  if (v_result.fileType == RegularFile and v_result.lastFileModification > 0)
+  {
+    setverdict(pass);
+  }
+  else
+  {
+    setverdict(fail);
+  }
+  
+}
 control
 {
+  execute (TC_test_getFileInfo());
   execute (TC_test ());
   execute (TC_test_open ());
   execute (TC_test_close ());
diff --git a/demo/TCCFileSystem_Example.ttcn b/demo/TCCFileSystem_Example.ttcn
index 2013c8e011a98e4c08d9a98a458bf52edd942b5e..6b84283d88d34071b56693aec52393ba9e8176ae 100644
--- a/demo/TCCFileSystem_Example.ttcn
+++ b/demo/TCCFileSystem_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2011                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCFileSystem_Example.ttcn
 //  Description:        TCC Useful testcases: FileSystem testcases.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2011-07-14
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCIPsec_Example.ttcn b/demo/TCCIPsec_Example.ttcn
index 121fdd092e1a76a78a6e45c1f4877ca7cb093380..1e698706a5c2aad77aee28aafd2cbaa2ab2c036c 100644
--- a/demo/TCCIPsec_Example.ttcn
+++ b/demo/TCCIPsec_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2013                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCAssertion_Example.ttcn
 //  Description:        TCC Useful Functions: Assertion Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-01-09
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCInterface_Example.ttcn b/demo/TCCInterface_Example.ttcn
index 7f8f1e70cc12d5dad3f717b8022c252b4619ce6c..88eb01a9900169e1a166d5bb1b88093af3b65aef 100644
--- a/demo/TCCInterface_Example.ttcn
+++ b/demo/TCCInterface_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2008                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCInterface_Example.ttcn
 //  Description:        TCC Useful Functions: Interface Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-12-10
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCMaths_Example.ttcn b/demo/TCCMaths_Example.ttcn
index 571d13f68baebca0e2a15ecc16601b5da6e7f3f8..27b3b389a66538d6e1d5afab379c12d2c2c759a4 100644
--- a/demo/TCCMaths_Example.ttcn
+++ b/demo/TCCMaths_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2005                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMaths_Example.ttcn
 //  Description:        TCC Useful testcases: Maths testcases.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-12-09
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCMessageHandling_Example.ttcn b/demo/TCCMessageHandling_Example.ttcn
index c98c05866d12691e054ec36ccca8f0a94600bd32..b935bd79c631534cffd0d59247d0807484266078 100644
--- a/demo/TCCMessageHandling_Example.ttcn
+++ b/demo/TCCMessageHandling_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2013                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCMessageHandling_Example.ttcn
 //  Description:        TCC Useful Functions: Message Handling Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2013-03-28
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCPermutatedParameters_Example.ttcn b/demo/TCCPermutatedParameters_Example.ttcn
index a4e58d5d778aabd27ee15f06b19e1e9c1fd58174..54f8c38990ac4d27399841728dd56dfe4219db2e 100644
--- a/demo/TCCPermutatedParameters_Example.ttcn
+++ b/demo/TCCPermutatedParameters_Example.ttcn
@@ -1,14 +1,3 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
-///////////////////////////////////////////////////////////////////////////////
-
-
 module TCCPermutatedParameters_Example {
 
 import from TCCPermutatedParameters_Definitions all;
@@ -67,4 +56,4 @@ control {
   execute(tc_001_getPermutatedParams());
 }
 
-}
+}
\ No newline at end of file
diff --git a/demo/TCCRegexp_Example.ttcn b/demo/TCCRegexp_Example.ttcn
index 53485751ca2a696ad9cd21c6a6d6012f1f1c240c..8c7b547da1a2d68efb29b84f3bb3302be44187e6 100644
--- a/demo/TCCRegexp_Example.ttcn
+++ b/demo/TCCRegexp_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2017                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCRegexp_Example.ttcn
 //  Description:        TCC Useful Functions: Regular Expression Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Contact:            http://ttcn.ericsson.se
 ///////////////////////////////////////////////
diff --git a/demo/TCCSecurity_Example.ttcn b/demo/TCCSecurity_Example.ttcn
new file mode 100644
index 0000000000000000000000000000000000000000..1ba699ad65c8227061c7d9482ef82b148d8bd250
--- /dev/null
+++ b/demo/TCCSecurity_Example.ttcn
@@ -0,0 +1,603 @@
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2013                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+//
+//  File:               TCCSecurity_Example.ttcn
+//  Description:        TCC Useful testcases: Security testcases.
+//  Rev:                R32A
+//  Prodnr:             CNL 113 472
+//  Updated:            2013-02-08
+//  Contact:            http://ttcn.ericsson.se
+///////////////////////////////////////////////
+
+module TCCSecurity_Example 
+{
+
+import from TCCSecurity_Functions all;
+
+type component Security_CT {
+  var DigestData dg;
+
+  var AKAInput aka_input;
+  var SIMOutput sim_output;
+};
+type component  IKEv2_CT {
+  var DigestData dg;
+
+  var AKAInput aka_input;
+  var SIMOutput sim_output;
+};
+
+//////////////////////////////////////////////////////////////
+// Security functions
+//////////////////////////////////////////////////////////////
+
+type record DigestData {
+  charstring nonce,
+  charstring cnonce,
+  charstring user, 
+  charstring realm,
+  charstring passwd,
+  charstring alg,
+  charstring nonceCount,
+  charstring method,
+  charstring qop,
+  charstring URI,
+  charstring HEntity
+}
+
+type record AKAInput {
+  octetstring OP,
+  octetstring k,
+  octetstring rand,
+  octetstring sqn, 
+  octetstring amf
+}
+
+type record SIMOutput {
+  octetstring sres,
+  octetstring kc
+}
+
+const octetstring c_OP := '00'O;
+
+// test f_calculateDigestResponse function
+testcase f_test_digestresponse() runs on Security_CT
+{
+  log(" ----------- f_calculateDigestResponse ----------- ");
+
+  dg := {
+    nonce := "dcd98b7102dd2f0e8b11d0f600bfb0c093",
+    cnonce := "0a4f113b",
+    user := "Mufasa",
+    realm := "testrealm@host.com",
+    passwd := "password",
+    alg := "MD5",
+    nonceCount := "00000001",
+    method := "GET",
+    qop := "auth",
+    URI := "/dir/index.html",
+    HEntity := "d41d8cd98f00b204e9800998ecf8427e" // MD5 hash of entity body
+  }
+
+  log("Data to compute digest from: ", dg);
+  log("Digest response: ", 
+    f_calculateDigestResponse(
+        dg.nonce,
+        dg.cnonce,
+        dg.user,
+        dg.realm,
+        dg.passwd,
+        dg.alg,
+        dg.nonceCount,
+        dg.method,
+        dg.qop,
+        dg.URI,
+        dg.HEntity));
+
+  // no check
+  setverdict(pass);
+}
+
+testcase f_test_MD5() runs on Security_CT
+{ 
+  var charstring v_hash := f_calculateMD5("")
+  log("MD5 Hash of empty string: ", v_hash)
+  log("Expected: ", "d41d8cd98f00b204e9800998ecf8427e");
+  if (v_hash == "d41d8cd98f00b204e9800998ecf8427e") {
+  setverdict(pass);
+  }
+  else {
+     setverdict(fail, "MD5 Hash test failed");
+  } 
+}
+
+testcase tc_HMACMD5() runs on Security_CT
+{
+  var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog");
+  var octetstring key := char2oct("key");
+  
+  while (lengthof(key) < 64) {
+     key := key & '00'O;
+  }
+  var octetstring hash := f_calculateHMACMD5(msg, key);
+  log("HMAC MD5 Hash: ", hash);
+  log("Expected: ", '80070713463e7749b90c2dc24911e275'O);
+  if(hash == '80070713463e7749b90c2dc24911e275'O) {
+    setverdict(pass);
+  }
+  else {
+    setverdict(fail, "MD5 Hash test failed");
+  }  
+}
+
+testcase tc_HMACMD5_2() runs on Security_CT
+{
+  var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog");
+  var octetstring key := char2oct("key");
+  
+  var octetstring hash := f_calculate_HMAC_MD5(key,msg,16);
+  log("HMAC MD5 Hash: ", hash);
+  log("Expected: ", '80070713463e7749b90c2dc24911e275'O);
+  if(hash == '80070713463e7749b90c2dc24911e275'O) {
+    setverdict(pass);
+  }
+  else {
+    setverdict(fail, "MD5 Hash test 2  failed");
+  }
+}
+
+testcase tc_HMACMD5_3() runs on Security_CT
+{
+  var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog");
+  var octetstring key := char2oct("key");
+  
+  var octetstring hash := f_calculate_HMAC_MD5(key,msg,8);
+  log("HMAC MD5 Hash: ", hash);
+  log("Expected: ", '80070713463e7749'O);
+  if(hash == '80070713463e7749'O) {
+    setverdict(pass);
+  }
+  else {
+    setverdict(fail, "MD5 Hash test 2  failed");
+  }
+}
+
+testcase tc_HMACMD5_4() runs on Security_CT
+{
+  var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog");
+  var octetstring key := char2oct("01234567890123456789012345678901234567890123456789012345678901234");
+  
+  var octetstring hash := f_calculate_HMAC_MD5(key,msg,16);
+  log("HMAC MD5 Hash: ", hash);
+  log("Expected: ", '6c5f927cd3311e7d2cc569d8f2bfcf98'O);
+  if(hash == '6c5f927cd3311e7d2cc569d8f2bfcf98'O) {
+    setverdict(pass);
+  }
+  else {
+    setverdict(fail, "MD5 Hash test 2  failed");
+  }
+}
+
+testcase tc_HMAC_SHA1() runs on Security_CT
+{
+  var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog");
+  var octetstring key := char2oct("key");
+  
+  var octetstring hash := f_calculate_HMAC_SHA1(key,msg,20);
+  log("HMAC SHA1Hash: ", hash);                     
+  log("Expected: ", 'de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9'O);
+  if(hash == 'de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9'O) {
+    setverdict(pass);
+  }
+  else {
+    setverdict(fail, "SHA1 Hash test 2  failed");
+  }
+}
+
+testcase tc_HMAC_SHA256() runs on Security_CT
+{
+  var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog");
+  var octetstring key := char2oct("key");
+  
+  var octetstring hash := f_calculate_HMAC_SHA256(key,msg,32);
+  log("HMAC SHA256Hash: ", hash);                     
+  log("Expected: ", 'f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8'O);                     
+  if(hash == 'f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8'O) {
+    setverdict(pass);
+  }
+  else {
+    setverdict(fail, "SHA256 Hash test 2  failed");
+  }
+}
+
+// test tc_AKA_functions function
+testcase tc_AKA_functions() runs on Security_CT
+{
+  log(" ----------- tc_AKA_functions ----------- ");
+
+  aka_input := 
+  {
+    OP := '00'O,
+    k := str2oct("1234567890123456"),
+    rand := int2oct(9876, 16),
+    sqn := int2oct(1234, 6), 
+    amf := '0000'O
+  }
+
+log("AMF: ", str2oct("12"));
+  log("Data to compute AKA output from: ", aka_input);
+  log("f_IMSAKA_f1 output MAC-A: ", 
+      f_IMSAKA_f1
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand,
+        aka_input.sqn,
+        aka_input.amf
+       )
+      );
+  log("f_IMSAKA_f2 output RES: ", 
+      f_IMSAKA_f2
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand
+       )
+      );
+  log("f_IMSAKA_f3 output CK: ", 
+      f_IMSAKA_f3
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand
+       )
+      );
+  log("f_IMSAKA_f4 output IK: ", 
+      f_IMSAKA_f4
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand
+       )
+      );
+  log("f_IMSAKA_f5 output AK: ", 
+      f_IMSAKA_f5
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand
+       )
+      );
+    log("f_IMSAKA_f1star output MAC-S: ", 
+      f_IMSAKA_f1star
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand,
+        aka_input.sqn,
+        aka_input.amf
+       )
+      );
+  log("f_IMSAKA_f5star output AK-S: ", 
+      f_IMSAKA_f5star
+      (
+        aka_input.OP,
+        aka_input.k,
+        aka_input.rand
+       )
+  );
+  log("f_IMSAKA_calculateAUTN output AUTN: ", 
+      f_IMSAKA_calculateAUTN
+      (
+        aka_input.sqn,
+        f_IMSAKA_f5(aka_input.OP,aka_input.k,aka_input.rand),
+      aka_input.amf,
+      f_IMSAKA_f1(aka_input.OP,aka_input.k,aka_input.rand,aka_input.sqn,aka_input.amf)
+       )
+  );
+  
+  f_EAPSIM_A3A8(aka_input.k, aka_input.rand, sim_output.sres, sim_output.kc)
+  log("sim_output.sres: ", sim_output.sres, " sim_output.sres: ", sim_output.kc);
+  
+  setverdict(pass);
+}
+
+testcase tc_EIA() runs on Security_CT
+{
+ var BIT_32 v_MAC := f_calculate128_EIA3
+ (   
+  '00000000000000000000000000000000'O, //key  
+  '00000000'O,  
+  0,
+  '0'B,
+  '0'B
+ )
+ log(v_MAC);
+ if (v_MAC == oct2bit('c8a9595e'O))
+ {setverdict(pass)}
+ else {setverdict(fail)}
+}
+
+testcase tc_EEA() runs on Security_CT
+{ 
+  var bitstring v_oct := f_calculate128_EEA3
+  (
+   '173d14ba5003731d7a60049470f00a29'O,   
+   '66035492'O,  
+    15,
+    '0'B,  
+    oct2bit('6cf65340735552ab0c9752fa6f9025fe0bd675d9005875b2'O) & '0'B 
+  )
+  log(v_oct);
+  
+  if (v_oct == ( oct2bit('a6c85fc66afb8533aafc2518dfe784940ee1e4b030238cc8'O) & '0'B))
+  {setverdict(pass)}
+  else {setverdict(fail)}
+}
+
+testcase tc_3des_ecb() runs on Security_CT
+{
+  var octetstring vl_key := '000102030405060708090A0B0C0D0E0F0011223344556677'O
+  
+  var octetstring vl_data := '61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047'O
+  log(vl_data)
+  var octetstring vl_encrypted_data := ef_3DES_ECB_Encrypt(vl_data, vl_key);
+  log(vl_encrypted_data)
+  
+  var octetstring vl_decrypted_data := ef_3DES_ECB_Decrypt(vl_encrypted_data, vl_key);
+  log(vl_decrypted_data)
+  
+  if(match(vl_data, vl_decrypted_data))
+  {
+    setverdict(pass);
+  } else {
+    log(match(vl_data, vl_decrypted_data))
+    setverdict(fail);
+  }
+}
+
+testcase tc_DH1024() runs on IKEv2_CT
+{    
+  var octetstring vl_key_other := '73DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF5239'O
+  log("Public key:")
+  log(vl_key_other)
+  
+  var octetstring vl_priv_key := '9FCF731129397EF7DC51562D71DD819DE35891B739BD6BE7A5177F676F1A06775A0E915E3758130FE5493B95C7A67F11F45E4C541DDD2834E4A9248F18EE2597936499C97D25227C4A4B78BABD4F33BBC3E3A2C591369A3A4FAF3D851839249E23E90D15051268986E562D76D756F7FAF942FFBC4669199A3C04E31335E2BD70'O
+  log("Private key:")
+  log(vl_priv_key)
+  
+  var octetstring vl_shared_secret := ef_DH_shared_secret(vl_key_other, vl_priv_key);
+  log("Shared secret:")
+  log(vl_shared_secret)
+}
+
+testcase tc_DH2048() runs on IKEv2_CT
+{
+  var octetstring vl_key_other := '73DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523961A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E'O
+  log("Public key:")
+  log(vl_key_other)
+  
+  var octetstring vl_priv_key := '61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E0E915E3758130FE5493B95C7A67F11F45E4C541DDD2834E4A9248F18EE2597936499C97D25227C4A4B789FCF731129397EF7DC51562D71DD819DE35891B739BD6BE7A5177F676F1A06775ABABD4F33BBC3E3A2C591369A3A4FAF3D851839249E23E90D15051268986E562D76D756F7FAF942FFBC4669199A3C04E31335E2BD70'O
+  log("Private key:")
+  log(vl_priv_key)
+  
+  var octetstring vl_shared_secret := ef_DH_shared_secret(vl_key_other, vl_priv_key);
+  log("Shared secret:")
+  log(vl_shared_secret)
+}
+
+testcase tc_3DES_CBC() runs on IKEv2_CT
+{
+  var octetstring vl_data := '61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047'O
+  var octetstring vl_key := '000102030405060708090A0B0C0D0E0F0011223344556677'O
+  var octetstring vl_iv := '0001020304050607'O
+  
+  var octetstring vl_encrypted := ef_3DES_CBC_Encrypt(vl_data, vl_key, vl_iv);
+  log("Encrypted data: ")
+  log(vl_encrypted)
+  
+  var octetstring vl_decrypted := ef_3DES_CBC_Decrypt(vl_encrypted, vl_key, vl_iv);
+  log("Decrypted data: ")
+  log(vl_decrypted)
+
+  log("Original data: ")
+  log(vl_data)
+
+  if(match(vl_data, vl_decrypted))
+  {
+    setverdict(pass);
+  } else {
+    log(match(vl_data, vl_decrypted))
+    setverdict(fail);
+  }
+}
+
+testcase tc_AES_XCBC_128_no_data() runs on IKEv2_CT
+{
+  var octetstring vl_data := ''O
+  var octetstring vl_key := '000102030405060708090a0b0c0d0e0f'O
+  
+  var octetstring vl_computed_value := ef_Calculate_AES_XCBC_128(vl_data, vl_key, 16);
+  log("Computed value: ")
+  log(vl_computed_value)
+  
+  var octetstring vl_xcbc_value := '75f0251d528ac01c4573dfd584d79f29'O
+  log("XCBC value: ")
+  log(vl_xcbc_value)
+
+  if(match(vl_computed_value, vl_xcbc_value))
+  {
+    setverdict(pass);
+  } else {
+    log(match(vl_computed_value, vl_xcbc_value))
+    setverdict(fail);
+  }
+}
+
+testcase tc_AES_XCBC_128_20byte_data() runs on IKEv2_CT
+{
+  var octetstring vl_data := '000102030405060708090a0b0c0d0e0f10111213'O
+  var octetstring vl_key := '000102030405060708090a0b0c0d0e0f'O
+  
+  var octetstring vl_computed_value := ef_Calculate_AES_XCBC_128(vl_data, vl_key, 16);
+  log("Computed value: ")
+  log(vl_computed_value)
+  
+  var octetstring vl_xcbc_value := '47f51b4564966215b8985c63055ed308'O
+  log("XCBC value: ")
+  log(vl_xcbc_value)
+
+  if(match(vl_computed_value, vl_xcbc_value))
+  {
+    setverdict(pass);
+  } else {
+    log(match(vl_computed_value, vl_xcbc_value))
+    setverdict(fail);
+  }
+}
+
+testcase tc_test_f_calculate128_EEA1() runs on Security_CT{
+  var OCT_16 key := '5ACB1D644C0D51204EA5F1451010D852'O
+  var OCT_4 count := 'FA556B26'O
+  var INT_5 bearer := 3
+  var BIT_1 direction := '1'B
+  var BIT_1_65504 msg_in := oct2bit('AD9C441F890B38C457A49D421407E8'O)
+  var BIT_1_65504 msg_out:= f_calculate128_EEA1(key,count,bearer,direction,msg_in);
+  log(msg_out)
+  if(msg_out=='101110100000111100110001001100000000001100110100110001010110101101010010101001110100100101111100101110101100000001000110'B){
+    setverdict(pass)
+  } else {
+    setverdict(fail)
+  }
+  
+}
+
+testcase tc_test_f_calculate128_EIA1() runs on Security_CT{
+  var OCT_16 key := '2BD6459F82C5B300952C49104881FF48'O
+  var OCT_4 count := '38A6F056'O
+  var integer bearer := 31;
+  var BIT_1 direction := '0'B
+  var BIT_1_65504 msg_in := '0011001100110010001101000110001001100011001110010011100001100001001101110011010001111001'B  //substr(oct2bit('6B227737296F393C8079353EDC87E2E805D2EC49A4F2D8E0'O),0,88);
+  var BIT_1_65504 msg_out:= f_calculate128_EIA1(key,count,bearer,direction,msg_in);
+  log(msg_out)
+  if(msg_out=='01110011000111110001000101100101'B){
+    setverdict(pass)
+  } else {
+    setverdict(fail)
+  }
+  
+  
+  
+}
+
+testcase tc_test_f_calculate128_EIA2_1() runs on Security_CT{
+  var OCT_16 key := 'd3c5d592327fb11c4035c6680af8c6d1'O
+  var OCT_4 count := '398a59b4'O
+  var integer bearer := 26;
+  var BIT_1 direction := '1'B
+  var octetstring msg_in := '484583d5afe082ae'O
+  var octetstring msg_out:= f_calculate128_EIA2(key,count,bearer,direction,msg_in);
+  log("Result   ",msg_out)
+  log("Expected ",'B93787E6'O)
+  if(msg_out=='B93787E6'O){
+    setverdict(pass)
+  } else {
+    setverdict(fail)
+  }
+  
+  
+  
+}
+testcase tc_test_f_calculate128_EIA2_2() runs on Security_CT{
+  var OCT_16 key := 'b3120ffdb2cf6af4e73eaf2ef4ebec69'O
+  var OCT_4 count := '296f393c'O
+  var integer bearer := 11;
+  var BIT_1 direction := '1'B
+  var octetstring msg_in := '00000000000000000101010101010101e0958045f3a0bba4e3968346f0a3b8a7c02a018ae640765226b987c913e6cbf083570016cf83efbc61c082513e21561a427c009d28c298eface78ed6d56c2d4505ad032e9c04dc60e73a81696da665c6c48603a57b45ab33221585e68ee3169187fb0239528632dd656c807ea3248b7b46d002b2b5c7458eb85b9ce95879e0340859055e3b0abbc3eace8719caa80265c97205d5dc4bcc902fe1839629ed71328a0f0449f588557e6898860e042aecd84b2404c212c9222da5bf8a89ef6797870cf50771a60f66a2ee62853657addf04cdde07fa414e11f12b4d81b9b4e8ac538ea30666688d881f6c348421992f31b94f8806ed8fccff4c9123b89642527ad613b109bf75167485f1268bf884b4cd23d29a0934925703d634098f7767f1be7491e708a8bb949a3873708aef4a36239e50cc08235cd5ed6bbe578668a17b58c1171d0b90e813a9e4f58a89d719b11042d6360b1b0f52deb730a58d58faf46315954b0a872691475977dc88c0d733feff54600a0cc1d0300aaaeb94572c6e95b01ae90de04f1dce47f87e8fa7bebf77e1dbc20d6ba85cb9143d518b285dfa04b698bf0cf7819f20fa7a288eb0703d995c59940c7c66de57a9b70f82379b70e2031e450fcfd2181326fcd28d8823baaa80df6e0f443559647539fd8907c0ffd9d79c130ed81c9afd9b7e848c9fed38443d5d380e53fbdb8ac8c3d3f06876054f122461107de92fea09c6f6923a188d53afe54a10f60e6e9d5a03d996b5fbc820f8a637116a27ad04b444a0932dd60fbd12671c11e1c0ec73e789879faa3d42c64d20cd1252742a3768c25a901585888ecee1e612d9936b403b0775949a66cdfd99a29b1345baa8d9d5400c91024b0a607363b013ce5de9ae869d3b8d95b0570b3c2d391422d32450cbcfae96652286e96dec1214a9346527980a8192eac1c39a3aaf6f15351da6be764df89772ec0407d06e4415befae7c92580df9bf507497c8f2995160d4e218daacb02944abf83340ce8be1686a960faf90e2d90c55cc6475babc3171a80a363174954955d7101dab16ae8179167e21444b443a9eaaa7c91de36d118c39d389f8dd4469a846c9a262bf7fa18487a79e8de11699e0b8fdf557cb48719d453ba713056109b93a218c89675ac195fb4fb06639b3797144955b3c9327d1aec003d42ecd0ea98abf19ffb4af3561a67e77c35bf15c59c2412da881db02b1bfbcebfac5152bc99bc3f1d15f771001b7029fedb028f8b852bc4407eb83f891c9ca733254fdd1e9edb56919ce9fea21c174072521c18319a54b5d4efbebddf1d8b69b1cbf25f489fcc981372547cf41d008ef0bca1926f934b735e090b3b251eb33a36f82ed9b29cf4cb944188fa0e1e38dd778f7d1c9d987b28d132dfb9731fa4f4b416935be49de30516af3578581f2f13f561c0663361941eab249a4bc123f8d15cd711a956a1bf20fe6eb78aea2373361da0426c79a530c3bb1de0c99722ef1fde39ac2b00a0a8ee7c800a08bc2264f89f4effe627ac2f0531fb554f6d21d74c590a70adfaa390bdfbb3d68e46215cab187d2368d5a71f5ebec081cd3b20c082dbe4cd2faca28773795d6b0c10204b659a939ef29bbe1088243624429927a7eb576dd3a00ea5e01af5d47583b2272c0c161a806521a16ff9b0a722c0cf26b025d5836e2258a4f7d4773ac801e4263bc294f43def7fa8703f3a4197463525887652b0b2a4a2a7cf87f00914871e25039113c7e1618da34064b57a43c463249fb8d05e0f26f4a6d84972e7a9054824145f91295cdbe39a6f920facc659712b46a54ba295bbe6a90154e91b33985a2bcd420ad5c67ec9ad8eb7ac6864db272a516bc94c2839b0a8169a6bf58e1a0c2ada8c883b7bf497a49171268ed15ddd2969384e7ff4bf4aab2ec9ecc6529cf629e2df0f08a77a65afa12aa9b505df8b287ef6cc91493d1caa39076e28ef1ea028f5118de61ae02bb6aefc3343a050292f199f401857b2bead5e6ee2a1f191022f9278016f047791a9d18da7d2a6d27f2e0e51c2f6ea30e8ac49a0604f4c13542e85b68381b9fdcfa0ce4b2d341354852d360245c536b612af71f3e77c9095ae2dbde504b265733dabfe10a20fc7d6d32c21ccc72b8b3444ae663d65922d17f82caa2b865cd88913d291a65899026ea1328439723c198c36b0c3c8d085bfaf8a320fde334b4a4919b44c2b95f6e8ecf73393f7f0d2a40e60b1d406526b022ddc331810b1a5f7c347bd53ed1f105d6a0d30aba477e178889ab2ec55d558deab2630204336962b4db5b663b6902b89e85b31bc6af50fc50accb3fb9b57b663297031378db47896d7fbaf6c600add2c67f936db037986db856eb49cf2db3f7da6d23650e438f1884041b013119e4c2ae5af37cccdfb68660738b58b3c59d1c0248437472aba1f35ca1fb90cd714aa9f635534f49e7c5bba81c2b6b36fdee21ca27e347f793d2ce944edb23c8c9b914be10335e350feb5070394b7a4a15c0ca120283568b7bfc254fe838b137a2147ce7c113a3a4d65499d9e86b87dbcc7f03bbd3a3ab1aa243ece5ba9bcf25f82836cfe473b2d83e7a7201cd0b96a72451e863f6c3ba664a6d073d1f7b5ed990865d978bd3815d06094fc9a2aba5221c22d5ab996389e3721e3af5f05beddc2875e0dfaeb39021ee27a41187cbb45ef40c3e73bc03989f9a30d12c54ba7d2141da8a875493e65776ef35f97debc2286cc4af9b4623eee902f840c52f1b8ad658939aef71f3f72b9ec1de21588bd35484ea44436343ff95ead6ab1d8afb1b2a303df1b71e53c4aea6b2e3e9372be0d1bc99798b0ce3cc10d2a596d565dba82f88ce4cff3b33d5d24e9c0831124bf1ad54b792532983dd6c3a8b7d0'O
+  var octetstring msg_out:= f_calculate128_EIA2(key,count,bearer,direction,msg_in);
+  log("Result   ",msg_out)
+  log("Expected ",'ebd5ccb0'O)
+  if(msg_out=='ebd5ccb0'O){
+    setverdict(pass)
+  } else {
+    setverdict(fail)
+  }
+  
+  
+  
+}
+testcase tc_test_f_calculate128_EIA2_3() runs on Security_CT{
+  var OCT_16 key := '83fd23a244a74cf358da3019f1722635'O
+  var OCT_4 count := '36af6144'O
+  var integer bearer := 15;
+  var BIT_1 direction := '1'B
+  var octetstring msg_in:='35c68716633c66fb750c266865d53c11ea05b1e9fa49c8398d48e1efa5909d3947902837f5ae96d5a05bc8d61ca8dbef1b13a4b4abfe4fb1006045b674bb54729304c382be53a5af05556176f6eaa2ef1d05e4b083181ee674cda5a485f74d7a'O  var octetstring msg_out:= f_calculate128_EIA2(key,count,bearer,direction,msg_in);
+  log("Result   ",msg_out)
+  log("Expected ",'e657e182'O)
+  if(msg_out=='e657e182'O){
+    setverdict(pass)
+  } else {
+    setverdict(fail)
+  }
+  
+  
+  
+}
+testcase tc_test_f_calculate128_EEA2() runs on Security_CT{
+  var OCT_16 key := 'd3c5d592327fb11c4035c6680af8c6d1'O
+  var OCT_4 count := '398a59b4'O
+  var integer bearer := 21;
+  var BIT_1 direction := '1'B
+  var octetstring msg_in := '981ba6824c1bfb1ab485472029b71d808ce33e2cc3c0b5fc1f3de8a6dc66b1f0'O
+  var octetstring msg_out:= f_calculate128_EEA2(key,count,bearer,direction,msg_in);
+  log(msg_out)
+  
+  if(msg_out=='E9FED8A63D155304D71DF20BF3E82214B20ED7DAD2F233DC3C22D7BDEEED8E78'O){
+    setverdict(pass)
+  } else {
+    setverdict(fail)
+  }
+  
+  
+}
+
+
+// execute security tests
+control
+{
+  log(" ################### Security ################### ");
+
+  execute(f_test_digestresponse()); 
+  execute(f_test_MD5());
+  execute(tc_AKA_functions());
+  execute(tc_HMACMD5());  
+  execute(tc_HMACMD5_2()); 
+  execute(tc_HMACMD5_3()); 
+  execute(tc_HMACMD5_4());
+  execute(tc_HMAC_SHA1()); 
+  execute(tc_HMAC_SHA256());       
+  execute(tc_EIA());
+  execute(tc_EEA()); 
+  execute(tc_3des_ecb());  
+  execute(tc_DH1024());  
+  execute(tc_DH2048());  
+  execute(tc_3DES_CBC());  
+  execute(tc_AES_XCBC_128_no_data());
+  execute(tc_AES_XCBC_128_20byte_data());
+  execute(tc_test_f_calculate128_EEA1())
+  execute(tc_test_f_calculate128_EIA1())
+  execute(tc_test_f_calculate128_EIA2_1())
+  execute(tc_test_f_calculate128_EIA2_2())
+  execute(tc_test_f_calculate128_EIA2_3())
+  execute(tc_test_f_calculate128_EEA2())
+}
+
+} with {extension "version R32A"}
diff --git a/demo/TCCTemplate_Example.ttcn b/demo/TCCTemplate_Example.ttcn
index 44c9c459f616f12958eb71d2bb18c96b2d8043bf..fd0456023176143d2bf8da0bb2110c8b7f2edfc2 100644
--- a/demo/TCCTemplate_Example.ttcn
+++ b/demo/TCCTemplate_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2005                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTemplate_Example.ttcn
 //  Description:        TCC Useful Functions: Template Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-12-20
 //  Contact:            http://ttcn.ericsson.se
diff --git a/demo/TCCTitanMetadata_Example.ttcn b/demo/TCCTitanMetadata_Example.ttcn
index 91f4efd3d219fe4aad0ce93f693dd2bf88f840c0..2db083f755a0d5c9807a0024259ccc9475986485 100644
--- a/demo/TCCTitanMetadata_Example.ttcn
+++ b/demo/TCCTitanMetadata_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2005                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCTitanMetadata_Example.ttcn
 //  Description:        TCC Useful Functions: Titan Metadata Functions.
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2007-11-14
 //  Contact:            http://ttcn.ericsson.se
@@ -44,4 +45,4 @@ control {
   execute(f_test_compilationTime());
 }
 
-}
+}
\ No newline at end of file
diff --git a/demo/TCCXPathSupport_Example.ttcn b/demo/TCCXPathSupport_Example.ttcn
index 3b8f110e276420a89251f277aaa759f7d4cb4606..f495c7cdd3046448072261a1e1988caaabadc3cf 100644
--- a/demo/TCCXPathSupport_Example.ttcn
+++ b/demo/TCCXPathSupport_Example.ttcn
@@ -1,16 +1,17 @@
 ///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2017 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
+//                                                                           //
+// Copyright Test Competence Center (TCC) ETH 2008                           //
+//                                                                           //
+// The copyright to the computer  program(s) herein  is the property of TCC. //
+// The program(s) may be used and/or copied only with the written permission //
+// of TCC or in accordance with  the terms and conditions  stipulated in the //
+// agreement/contract under which the program(s) have been supplied          //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:               TCCXPathSupport_Example.ttcn
 //  Description:        TCC Useful Functions: XPath Support Functions
-//  Rev:                R30A
+//  Rev:                R32A
 //  Prodnr:             CNL 113 472
 //  Updated:            2008-09-04
 //  Contact:            http://ttcn.ericsson.se
diff --git a/doc/TCCUsefulFunctions_CNL113472_1551.doc b/doc/TCCUsefulFunctions_CNL113472_1551.doc
index 1ae7690e94907c6ac2e85a3aa75789ffb477a29c..609b2ff757a4e3a675f4f43958d1fce3380d1498 100644
Binary files a/doc/TCCUsefulFunctions_CNL113472_1551.doc and b/doc/TCCUsefulFunctions_CNL113472_1551.doc differ
diff --git a/doc/TCCUsefulFunctions_CNL113472_PRI.doc b/doc/TCCUsefulFunctions_CNL113472_PRI.doc
index d90970b743c58ed176fc9063cc44ae4fa12e7614..ac0448adf3a7e532e2913ee0782bd7df5b378850 100644
Binary files a/doc/TCCUsefulFunctions_CNL113472_PRI.doc and b/doc/TCCUsefulFunctions_CNL113472_PRI.doc differ
diff --git a/src/TCCAssertion.cc b/src/TCCAssertion.cc
index 03d0d96a5bc908cf060e00c68a069674d09d433a..5813a0d9a3dca2c3526ae41fd37eda83767528c3 100644
--- a/src/TCCAssertion.cc
+++ b/src/TCCAssertion.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCAssertion.cc
 //  Description:        TCC Useful Functions: Assert Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCAssertion_Functions.ttcn b/src/TCCAssertion_Functions.ttcn
index 526c950b8fe53cee8a1cee7fc38f430882912493..eebea19c72e0dbadab7db651f827b814747da408 100644
--- a/src/TCCAssertion_Functions.ttcn
+++ b/src/TCCAssertion_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCAssertion_Functions.ttcn
 //  Description:        TCC Useful Functions: Assert Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCConversion.cc b/src/TCCConversion.cc
index 6d5f58a78ce0df434e7a95732d92067a1490dd69..27fae126a26a6a01a776e9ca2b6db0c1339a890b 100644
--- a/src/TCCConversion.cc
+++ b/src/TCCConversion.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCConversion.cc
 //  Description:        TCC Useful Functions: Conversion Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCConversion_Functions.ttcn b/src/TCCConversion_Functions.ttcn
index b4df9b6d9dbe172609e47b136035fd0d45bf5a3f..f52ea2baa5bb6db30d4d555bfe32a9b5d31172ba 100644
--- a/src/TCCConversion_Functions.ttcn
+++ b/src/TCCConversion_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCConversion_Functions.ttcn
 //  Description:        TCC Useful Functions: Conversion Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -969,5 +969,5 @@ return boolean
 
 }//end of module
 with {
-extension "version R30A"}
+extension "version R35B"}
 
diff --git a/src/TCCDateTime.cc b/src/TCCDateTime.cc
index 553426f205145721946c5ef6ffa98f8515fede1a..0256c8812d48b84511e726a3fb225dadd9fd8adc 100644
--- a/src/TCCDateTime.cc
+++ b/src/TCCDateTime.cc
@@ -10,36 +10,49 @@
 //
 //  File:               TCCDateTime.cc
 //  Description:        TCC Useful Functions: DateTime Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "TCCDateTime_Functions.hh"
 #include <time.h>
+#include <sys/time.h>
 #include <stdlib.h>
 
-namespace TCCDateTime__Functions 
+namespace TCCDateTime__Functions
 {
+  const char * TCC_WEEKDAY[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
+  const char * TCC_MONTH[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
+
+  //format time string in the following format Www Mmm dd hh:mm::ss.SSS yyyy
+  CHARSTRING formatTimeString(const struct tm* ti, int msec)
+  {
+    char ret_val[30];
+    sprintf(ret_val,"%.3s %.3s %.2d %.2d:%.2d:%.2d.%.3d %.4d\n",
+        TCC_WEEKDAY[ti->tm_wday], TCC_MONTH[ti->tm_mon], ti->tm_mday,
+        ti->tm_hour, ti->tm_min, ti->tm_sec, msec,ti->tm_year + 1900);
+    return ret_val;
+  }
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__time
-// 
+//
 //  Purpose:
 //    Current calendar time of the system in seconds
 //
 //  Parameters:
 //    -
-// 
+//
 //  Return Value:
 //    integer - time value
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
   INTEGER f__time()
   {
@@ -50,74 +63,157 @@ namespace TCCDateTime__Functions
     return i;
   }
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__time__ms
+//
+//  Purpose:
+//    Current calendar time of the system in milliseconds
+//
+//  Parameters:
+//    -
+//
+//  Return Value:
+//    integer - time value
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+  INTEGER f__time__ms()
+  {
+    struct timeval ct;
+    gettimeofday(&ct,0);
+    INTEGER i;
+    i.set_long_long_val(ct.tv_sec*1000 + ct.tv_usec/1000);
+    return i;
+  }
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__ctime
-// 
+//
 //  Purpose:
 //    Convert a time value in seconds to human readable string.
 //    The time represented as local time
 //
 //  Parameters:
 //    pl__sec - *in* *integer* - time value
-// 
+//
 //  Return Value:
-//    integer - converted time value
+//    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
-CHARSTRING f__ctime(const INTEGER& pl__sec)
-{
+  CHARSTRING f__ctime(const INTEGER& pl__sec)
+  {
     time_t cur_time = pl__sec.get_long_long_val();
     return ctime(&cur_time);
-}
+  }
 
 ///////////////////////////////////////////////////////////////////////////////
+//  Function: f__ctime__ms
+//
+//  Purpose:
+//    Convert a time value in milliseconds to human readable string.
+//    The time represented as local time
+//
+//  Parameters:
+//    pl__msec - *in* *integer* - time value
+//
+//  Return Value:
+//    charstring - formatted time in string format
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+  CHARSTRING f__ctime__ms(const INTEGER& pl__msec)
+  {
+    time_t ct = pl__msec.get_long_long_val()/1000;
+    int msec = pl__msec.get_long_long_val()%1000;
+    struct tm * ti = localtime(&ct);
+    return  formatTimeString(ti,msec);
+  }
+///////////////////////////////////////////////////////////////////////////////
 //  Function: f__ctime__UTC
-// 
+//
 //  Purpose:
 //    Convert a time value in seconds to human readable string.
 //    The time represented as UTC
 //
 //  Parameters:
 //    pl__sec - *in* *integer* - time value
-// 
+//
 //  Return Value:
-//    integer - converted time value
+//    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
-CHARSTRING f__ctime__UTC(const INTEGER& pl__sec)
-{
-    time_t cur_time = pl__sec.get_long_long_val();
-    return asctime(gmtime(&cur_time));
-}
+  CHARSTRING f__ctime__UTC(const INTEGER& pl__sec)
+  {
+      time_t cur_time = pl__sec.get_long_long_val();
+      return asctime(gmtime(&cur_time));
+  }
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__ctime__ms__UTC
+//
+//  Purpose:
+//    Convert a time value in milliseconds to human readable string.
+//    The time represented as UTC
+//
+//  Parameters:
+//    pl__msec - *in* *integer* - time value
+//
+//  Return Value:
+//    charstring - formatted time in string format
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+  CHARSTRING f__ctime__ms__UTC(const INTEGER& pl__msec)
+  {
+    time_t ct = pl__msec.get_long_long_val()/1000;
+    int msec = pl__msec.get_long_long_val()%1000;
+    struct tm * ti = gmtime(&ct);
+    return formatTimeString(ti,msec);
+  }
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__getTimeFormatted
-// 
+//
 //  Purpose:
 //    Return the current calendar time in a formatted way
 //
 //  Parameters:
 //    pl__sec - *in* *integer* - time value
 //    pl__format - *in* *charstring* - format string
-// 
+//
 //  Return Value:
 //    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    *Specifier / Replaced by / Example*
 //
@@ -170,7 +266,7 @@ CHARSTRING f__ctime__UTC(const INTEGER& pl__sec)
 //    ----------------------------------------------------------------------------------------------------------
 //
 //    * The specifiers whose description is marked with an asterisk (*) are locale-dependent.
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
   CHARSTRING f__getTimeFormatted(const INTEGER& pl__sec, const CHARSTRING& pl__format)
   {
@@ -178,12 +274,12 @@ CHARSTRING f__ctime__UTC(const INTEGER& pl__sec)
     size_t str_len = 255;
     char ret_val[str_len];
     strftime (ret_val, str_len, (const char *)pl__format, localtime(&in_time));
-    return ret_val; 
+    return ret_val;
   }
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__time2sec
-// 
+//
 //  Purpose:
 //    Function to convert a formated time value to seconds.
 //    The time is expressed as local time.
@@ -195,23 +291,23 @@ CHARSTRING f__ctime__UTC(const INTEGER& pl__sec)
 //    pl__hour - *in* *integer* - day (e.g. 12)
 //    pl__min - *in* *integer* - day (e.g. 50)
 //    pl__sec - *in* *integer* - day (e.g. 7)
-// 
+//
 //  Return Value:
 //    integer - time in seconds
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    time in seconds since January 1, 1900
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
-INTEGER f__time2sec(const INTEGER& pl__year,
-		      const INTEGER& pl__mon,
-		      const INTEGER& pl__mday,
-		      const INTEGER& pl__hour,
-		      const INTEGER& pl__min,
-		      const INTEGER& pl__sec) 
+  INTEGER f__time2sec(const INTEGER& pl__year,
+                      const INTEGER& pl__mon,
+                      const INTEGER& pl__mday,
+                      const INTEGER& pl__hour,
+                      const INTEGER& pl__min,
+                      const INTEGER& pl__sec)
   {
     struct tm tms;
     tms.tm_sec = pl__sec;
@@ -230,10 +326,9 @@ INTEGER f__time2sec(const INTEGER& pl__year,
     return i;
   }
 
-
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__time2sec__UTC
-// 
+//
 //  Purpose:
 //    Function to convert a formated time value to seconds.
 //    The time is expressed as UTC.
@@ -245,24 +340,24 @@ INTEGER f__time2sec(const INTEGER& pl__year,
 //    pl__hour - *in* *integer* - day (e.g. 12)
 //    pl__min - *in* *integer* - day (e.g. 50)
 //    pl__sec - *in* *integer* - day (e.g. 7)
-// 
+//
 //  Return Value:
 //    integer - time in seconds
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    time in seconds since January 1, 1900
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 
-INTEGER f__time2sec__UTC(const INTEGER& pl__year,
-		      const INTEGER& pl__mon,
-		      const INTEGER& pl__mday,
-		      const INTEGER& pl__hour,
-		      const INTEGER& pl__min,
-		      const INTEGER& pl__sec) 
+  INTEGER f__time2sec__UTC(const INTEGER& pl__year,
+                           const INTEGER& pl__mon,
+                           const INTEGER& pl__mday,
+                           const INTEGER& pl__hour,
+                           const INTEGER& pl__min,
+                           const INTEGER& pl__sec)
   {
     struct tm tms;
     tms.tm_sec = pl__sec;
@@ -285,25 +380,25 @@ INTEGER f__time2sec__UTC(const INTEGER& pl__year,
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__getCurrentDateWithOffset
-// 
+//
 //  Purpose:
 //    Generate a date from the actual date and time plus the parameter
-//    in seconds e.g. getSdate(30) will return a charstring containing 
+//    in seconds e.g. getSdate(30) will return a charstring containing
 //    the date and time of 30 seconds later
 //
 //  Parameters:
 //    pl__sec - *in* *integer* - offset time value
-// 
+//
 //  Return Value:
 //    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
-///////////////////////////////////////////////////////////////////////////////  
+//
+///////////////////////////////////////////////////////////////////////////////
   CHARSTRING f__getCurrentDateWithOffset(const INTEGER& pl__sec)
   {
     time_t cur_time;
@@ -314,38 +409,66 @@ INTEGER f__time2sec__UTC(const INTEGER& pl__year,
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__getCurrentGMTDate
-// 
+//
 //  Purpose:
-//    Return the current GMT date in format RFC 1123-Date 
-//    e.g.:Sat, 13 Nov 2010 23:30:02 GMT
+//    Return the current GMT date in format RFC 1123-Date
+//    e.g.:Mon Nov 20 11:22:08 2017
 //
 //  Parameters:
 //    -
-// 
+//
 //  Return Value:
 //    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
-///////////////////////////////////////////////////////////////////////////////  
+//
+///////////////////////////////////////////////////////////////////////////////
   CHARSTRING f__getCurrentGMTDate()
   {
     time_t cur_time;
     time( &cur_time );
-
     return asctime( gmtime( &cur_time ) );
   }
-  
-  
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__getCurrentGMTDate__ms
+//
+//  Purpose:
+//    Return the current GMT date in format Www Mmm dd hh:mm:ss.SSS yyyy
+//    e.g.:Mon Nov 20 11:22:08.683 2017
+//
+//  Parameters:
+//    -
+//
+//  Return Value:
+//    charstring - formatted time in string format
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+  CHARSTRING f__getCurrentGMTDate__ms()
+  {
+    struct timeval cur_time;
+    gettimeofday(&cur_time,0);
+    time_t sec = cur_time.tv_sec;
+    int msec = cur_time.tv_usec/1000;
+    struct tm * ti = gmtime(&sec);
+    return formatTimeString(ti,msec);
+  }
+
 //////////////////////////////////////////////////////////////////////////////
 //  Function: f__tic
-// 
+//
 //  Purpose:
-//    Return the number of clock ticks used by the application since 
+//    Return the number of clock ticks used by the application since
 //    the program was launched
 //
 //    OR
@@ -358,84 +481,84 @@ INTEGER f__time2sec__UTC(const INTEGER& pl__year,
 //
 //  Parameters:
 //    -
-// 
+//
 //  Return Value:
 //    integer - tics since program start
 //
 //  Errors:
 //    -
-// 
+//
 //  Detailed description:
 //    -
-// 
-/////////////////////////////////////////////////////////////////////////////// 
-INTEGER f__tic()
-{
+//
+///////////////////////////////////////////////////////////////////////////////
+  INTEGER f__tic()
+  {
     INTEGER i;
     i.set_long_long_val(clock());
     return i;
-}
+  }
 
 //////////////////////////////////////////////////////////////////////////////
 //  Function: f__toc
-// 
+//
 //  Purpose:
-//    Elapsed seconds since time t (only when f__tic() returns the number of 
+//    Elapsed seconds since time t (only when f__tic() returns the number of
 //    clock ticks elapsed since the program was launched)
 //
 //    Warning! This function depends on used library version. Be careful!
 //
 //  Parameters:
 //    t - *in* *integer* - time value
-// 
+//
 //  Return Value:
 //    float - elapsed seconds
 //
 //  Errors:
 //    -
-// 
+//
 //  Detailed description:
 //    f__tic counts clock tics since program start. f__toc counts seconds
 //    since clock() readout in t till current time
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
-FLOAT f__toc(const INTEGER& t)
-{
+  FLOAT f__toc(const INTEGER& t)
+  {
     clock_t tt = (clock_t)t.get_long_long_val();
     return FLOAT((double)(clock()-tt)/CLOCKS_PER_SEC);
-}
-  
+  }
+
 //////////////////////////////////////////////////////////////////////////////
 //  Function: f__timeDiff
-// 
+//
 //  Purpose:
 //    Difference between two time
 //
 //  Parameters:
 //    t_start - *in* *integer* - start time
 //    t_stop - *in* *integer* - stop time
-// 
+//
 //  Return Value:
 //    integer - t_stop-t_start
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
-INTEGER f__timeDiff(const INTEGER& t_stop, const INTEGER& t_start)
-{
+  INTEGER f__timeDiff(const INTEGER& t_stop, const INTEGER& t_start)
+  {
     if(!t_stop.is_bound())
     {
-        TTCN_error("Stop time is unbound in call to function TimeDiff");
+      TTCN_error("Stop time is unbound in call to function TimeDiff");
     }
     if(!t_start.is_bound())
     {
-        TTCN_error("Start time is unbound in call to function TimeDiff");
+      TTCN_error("Start time is unbound in call to function TimeDiff");
     }
     return t_stop-t_start;
-}
+  }
 
 } // end of Namespace
diff --git a/src/TCCDateTime_Functions.ttcn b/src/TCCDateTime_Functions.ttcn
index 2be3f65640b3ce72d2fad8b63911781d0a91a1f4..9343310253ac391699f01027d6877b4533461299 100644
--- a/src/TCCDateTime_Functions.ttcn
+++ b/src/TCCDateTime_Functions.ttcn
@@ -10,20 +10,20 @@
 //
 //  File:               TCCDateTime_Functions.ttcn
 //  Description:        TCC Useful Functions: DateTime Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Module: TCCDateTime_Functions
-// 
+//
 //  Purpose:
 //    This module supports date and time handling
-// 
+//
 //  Module Parameters:
-//      - 
-// 
+//      -
+//
 //  Module depends on:
 //    -
 //
@@ -32,85 +32,150 @@ module TCCDateTime_Functions {
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_time
-// 
+//
 //  Purpose:
 //    Current calendar time of the system in seconds
 //
 //  Parameters:
 //    -
-// 
+//
 //  Return Value:
 //    integer - time value
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 external function f_time() return integer;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_time_ms
+//
+//  Purpose:
+//    Current calendar time of the system in milliseconds
+//
+//  Parameters:
+//    -
+//
+//  Return Value:
+//    integer - time value
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_time_ms() return integer;
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_ctime
-// 
+//
 //  Purpose:
 //    Convert a time value in seconds to human readable string
 //    The time represented as local time
 //
 //  Parameters:
 //    pl_sec - *in* *integer* - time value
-// 
+//
 //  Return Value:
-//    integer - converted time value
+//    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
-///////////////////////////////////////////////////////////////////////////////  
+//
+///////////////////////////////////////////////////////////////////////////////
 external function f_ctime(integer pl_sec) return charstring;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_ctime_ms
+//
+//  Purpose:
+//    Convert a time value in milliseconds to human readable string
+//    The time represented as local time
+//
+//  Parameters:
+//    pl_msec - *in* *integer* - time value
+//
+//  Return Value:
+//    charstring - formatted time in string format
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_ctime_ms(integer pl_msec) return charstring;
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_ctime_UTC
-// 
+//
 //  Purpose:
 //    Convert a time value in seconds to human readable string
 //    The time represented as UTC
 //
 //  Parameters:
 //    pl_sec - *in* *integer* - time value
-// 
+//
 //  Return Value:
-//    integer - converted time value
+//    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
-///////////////////////////////////////////////////////////////////////////////  
+//
+///////////////////////////////////////////////////////////////////////////////
 external function f_ctime_UTC(integer pl_sec) return charstring;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_ctime_ms_UTC
+//
+//  Purpose:
+//    Convert a time value in milliseconds to human readable string
+//    The time represented as UTC
+//
+//  Parameters:
+//    pl_msec - *in* *integer* - time value
+//
+//  Return Value:
+//    charstring - formatted time in string format
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_ctime_ms_UTC(integer pl_msec) return charstring;
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_getTimeFormatted
-// 
+//
 //  Purpose:
 //    Return the current calendar time in a formatted way
 //
 //  Parameters:
 //    pl_sec - *in* *integer* - time value in seconds
 //    pl_format - *in* *charstring* - format string
-// 
+//
 //  Return Value:
 //    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    *Specifier / Replaced by / Example*
 //
@@ -163,14 +228,14 @@ external function f_ctime_UTC(integer pl_sec) return charstring;
 //    ----------------------------------------------------------------------------------------------------------
 //
 //    * The specifiers whose description is marked with an asterisk (*) are locale-dependent.
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
-external function f_getTimeFormatted(integer pl_sec, charstring pl_format) 
+external function f_getTimeFormatted(integer pl_sec, charstring pl_format)
 return charstring;
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_time2sec
-// 
+//
 //  Purpose:
 //    function to convert a formated time value to seconds
 //    The time represented as local time
@@ -182,29 +247,29 @@ return charstring;
 //    pl_hour - *in* *integer* - day (e.g. 12)
 //    pl_min - *in* *integer* - day (e.g. 50)
 //    pl_sec - *in* *integer* - day (e.g. 7)
-// 
+//
 //  Return Value:
 //    integer - time in seconds
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    time in seconds since January 1, 1900
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 external function f_time2sec(
-  integer pl_year, 
-  integer pl_mon, 
-  integer pl_day, 
+  integer pl_year,
+  integer pl_mon,
+  integer pl_day,
   integer pl_hour,
   integer pl_min,
-  integer pl_sec) 
+  integer pl_sec)
 return integer;
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_time2sec_UTC
-// 
+//
 //  Purpose:
 //    function to convert a formated time value to seconds
 //    The time represented as UTC
@@ -216,78 +281,98 @@ return integer;
 //    pl_hour - *in* *integer* - day (e.g. 12)
 //    pl_min - *in* *integer* - day (e.g. 50)
 //    pl_sec - *in* *integer* - day (e.g. 7)
-// 
+//
 //  Return Value:
 //    integer - time in seconds
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    time in seconds since January 1, 1900
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 external function f_time2sec_UTC(
-  integer pl_year, 
-  integer pl_mon, 
-  integer pl_day, 
+  integer pl_year,
+  integer pl_mon,
+  integer pl_day,
   integer pl_hour,
   integer pl_min,
-  integer pl_sec) 
+  integer pl_sec)
 return integer;
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_getCurrentDateWithOffset
-// 
+//
 //  Purpose:
 //    Generate a date from the actual date and time plus the parameter
-//    in seconds e.g. getSdate(30) will return a charstring containing 
+//    in seconds e.g. getSdate(30) will return a charstring containing
 //    the date and time of 30 seconds later
 //
 //  Parameters:
 //    pl_sec - *in* *integer* - offset time value
-// 
+//
 //  Return Value:
 //    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 external function f_getCurrentDateWithOffset(integer pl_sec) return charstring;
- 
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_getCurrentGMTDate
-// 
+//
 //  Purpose:
-//    Return the current GMT date in format RFC 1123-Date 
-//    ex :Sat, 13 Nov 2010 23:30:02 GMT
+//    Return the current GMT date in format RFC 1123-Date
+//    ex :Mon Nov 20 11:22:08 2017
 //
 //  Parameters:
 //    -
-// 
+//
 //  Return Value:
 //    charstring - formatted time in string format
 //
 //  Errors:
-//    - 
-// 
+//    -
+//
 //  Detailed description:
 //    -
-// 
-///////////////////////////////////////////////////////////////////////////////  
+//
+///////////////////////////////////////////////////////////////////////////////
 external function f_getCurrentGMTDate() return charstring;
 
-//external function f_getCurrentTimeValue() return TimeValue;
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_getCurrentGMTDate_ms
+//
+//  Purpose:
+//    Return the current GMT date in format Www Mmm dd hh:mm:ss.SSS yyyy
+//    ex :Mon Nov 20 11:22:08.693 2017
+//
+//  Parameters:
+//    -
+//
+//  Return Value:
+//    charstring - formatted time in string format
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    -
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_getCurrentGMTDate_ms() return charstring;
 
 //////////////////////////////////////////////////////////////////////////////
 //  Function: f_tic
-// 
+//
 //  Purpose:
-//    Return the number of clock ticks used by the application since 
+//    Return the number of clock ticks used by the application since
 //    the program was launched
 //
 //    OR
@@ -300,63 +385,63 @@ external function f_getCurrentGMTDate() return charstring;
 //
 //  Parameters:
 //    -
-// 
+//
 //  Return Value:
 //    integer - tics since program start
 //
 //  Errors:
 //    -
-// 
+//
 //  Detailed description:
 //    -
-// 
-/////////////////////////////////////////////////////////////////////////////// 
+//
+///////////////////////////////////////////////////////////////////////////////
 external function f_tic() return integer;
 
 //////////////////////////////////////////////////////////////////////////////
 //  Function: f_toc
-// 
+//
 //  Purpose:
-//    Elapsed seconds since time t (only when f_tic() returns the number of 
+//    Elapsed seconds since time t (only when f_tic() returns the number of
 //    clock ticks elapsed since the program was launched)
 //
 //    Warning! This function depends on used library version. Be careful!
 //
 //  Parameters:
 //    t - *in* *integer* - time value
-// 
+//
 //  Return Value:
 //    float - elapsed seconds
 //
 //  Errors:
 //    -
-// 
+//
 //  Detailed description:
 //    f_tic counts clock tics since program start. f_toc counts seconds
 //    since clock() readout in t till current time
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 external function f_toc(integer t) return float;
-  
+
 //////////////////////////////////////////////////////////////////////////////
 //  Function: f_timeDiff
-// 
+//
 //  Purpose:
 //    Difference between two time
 //
 //  Parameters:
 //    t_start - *in* *integer* - start time
 //    t_stop - *in* *integer* - stop time
-// 
+//
 //  Return Value:
 //    integer - t_stop-t_start
 //
 //  Errors:
 //    -
-// 
+//
 //  Detailed description:
 //    -
-// 
+//
 ///////////////////////////////////////////////////////////////////////////////
 external function f_timeDiff(integer t_stop, integer t_start) return integer;
 
diff --git a/src/TCCEncoding.cc b/src/TCCEncoding.cc
index 00f4d07ed3b04d993f728fcc30b77b0ccc5a4243..182c95f23378213fd7d1c760f671c65585386e4e 100644
--- a/src/TCCEncoding.cc
+++ b/src/TCCEncoding.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCEncoding.cc
 //  Description:        TCC Useful Functions: Message Encoding Functions.
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCEncoding_Functions.ttcn b/src/TCCEncoding_Functions.ttcn
index b9f721a5e88c67dc3bac815f0ac3752a13fcc437..6c00fbb296faa6450080c51ab9d03caa73f0e70e 100644
--- a/src/TCCEncoding_Functions.ttcn
+++ b/src/TCCEncoding_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCEncoding_Functions.ttcn
 //  Description:        TCC Useful Functions: Message Encoding Functions.
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -730,4 +730,4 @@ public function f_enc_TBCD_hex(in hexstring pl_hex) return octetstring
   return vl_oct;
 }
 
-} with {extension "version R30A"}
+} with {extension "version R35B"}
diff --git a/src/TCCEnv.cc b/src/TCCEnv.cc
index de7bb1e06c5d7b7022226883a4e7f87dcc9edf5f..40757fd7281589aa1e42ad8f8bce8125e4dca03e 100644
--- a/src/TCCEnv.cc
+++ b/src/TCCEnv.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCEnv.cc
 //  Description:        TCC Useful Functions: Environment Handling Functions.
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCEnv_Functions.ttcn b/src/TCCEnv_Functions.ttcn
index 57d05c8b54f850770cfeb640d2208e140fcd6382..5723950cc9a09992ec9c2b32333cf953dead48a9 100644
--- a/src/TCCEnv_Functions.ttcn
+++ b/src/TCCEnv_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCEnv_Functions.ttcn
 //  Description:        TCC Useful Functions: Environment Handling Functions.
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCFileIO.cc b/src/TCCFileIO.cc
index 91be44a0c02b94ed47b5f1d722034ae9fed579b0..c40e650f20b6f859b8ca059113f3e96f94afa2e2 100644
--- a/src/TCCFileIO.cc
+++ b/src/TCCFileIO.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCFileIO.cc
 //  Description:        TCC Useful Functions: FileIO Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -1391,4 +1391,48 @@ BOOLEAN f__FIO__fileList(const CHARSTRING& dirname, FileList& filelist) {
   }
 }
 
+FIO__FileInfo f__FIO__getFileInfo(const CHARSTRING& name) {
+  FIO__FileType type = FIO__FileType::Unknown;
+  FIO__FileInfo result (type, OMIT_VALUE, OMIT_VALUE, OMIT_VALUE, OMIT_VALUE, OMIT_VALUE, OMIT_VALUE, OMIT_VALUE, OMIT_VALUE, 0, 0, 0);
+  struct stat sb;
+
+  if (!f__FIO__fileOrDirExists(name)) {
+	  type = FIO__FileType::NotExists;
+  } else {
+    if (stat(name, &sb) == -1) {
+    	type = FIO__FileType::ErrorReadingFile;
+    }
+
+    switch (sb.st_mode & S_IFMT) {
+      case S_IFBLK:  type = FIO__FileType::BlockDevice;      break;
+      case S_IFCHR:  type = FIO__FileType::CharacterDevice;  break;
+      case S_IFDIR:  type = FIO__FileType::Directory;        break;
+      case S_IFIFO:  type = FIO__FileType::FIFO__Pipe;       break;
+      case S_IFLNK:  type = FIO__FileType::Symlink;          break;
+      case S_IFREG:  type = FIO__FileType::RegularFile;      break;
+      case S_IFSOCK: type = FIO__FileType::Socket;           break;
+      default:       type = FIO__FileType::Unknown;          break;
+    }
+  }
+
+  result.fileType() = type;
+
+  if (type != FIO__FileType::NotExists && type != FIO__FileType::ErrorReadingFile) {
+    result.nodeNumber() =  sb.st_ino;
+    result.mode() =  sb.st_mode;
+    result.linkCount() =  sb.st_nlink;
+    result.ownership() =  sb.st_uid;
+    result.groupId() =  sb.st_gid;
+    result.blockSize() =  sb.st_blksize;
+    result.fileSize() =  sb.st_size;
+    result.blocksAllocated() =  sb.st_blocks;
+
+    result.lastStatusChange().set_long_long_val(sb.st_ctime);
+    result.lastFileAccess().set_long_long_val(sb.st_atime);
+    result.lastFileModification().set_long_long_val(sb.st_mtime);
+  }
+
+  return result;
+}
+
 }
diff --git a/src/TCCFileIO_Functions.ttcn b/src/TCCFileIO_Functions.ttcn
index 94b5bc61f4ee133e1006f1fa7766fcf644c45da1..ffe4ef6d4c9dcb6027499b3f155f0da8cc2680bc 100644
--- a/src/TCCFileIO_Functions.ttcn
+++ b/src/TCCFileIO_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCFileIO_Functions.ttcn
 //  Description:        TCC Useful Functions: FileIO Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -609,4 +609,55 @@ type record of charstring FileList;
 external function f_FIO_fileList (in charstring p_name,
                                   inout FileList p_files) return boolean;
 
+type enumerated FIO_FileType {
+  BlockDevice,
+  CharacterDevice,
+  Directory,
+  FIFO_Pipe,
+  Symlink,
+  RegularFile,
+  Socket,
+  Unknown,
+  NotExists,
+  ErrorReadingFile
+};
+
+type record FIO_FileInfo {
+  FIO_FileType fileType,                    //The type of the file
+  integer nodeNumber optional,              //inode number
+  integer mode optional,                    //protection 
+  integer linkCount optional,               //number of hard links
+  integer ownership optional,               //user ID of owner
+  integer groupId optional,                 //group ID of owner
+  integer blockSize optional,               //blocksize for file system I/O
+  integer fileSize optional,                //total size, in bytes
+  integer blocksAllocated optional,         //number of 512B blocks allocated
+  integer lastStatusChange,                 //time of last access
+  integer lastFileAccess,                   //time of last modification
+  integer lastFileModification              //time of last status change
 }
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_FIO_getFileType
+//
+//  Purpose:
+//    Returns the file type of the given file
+//
+//  Parameters:
+//    p_name - *in* *charstring* - name of the file or directory to check
+//
+//  Return Value:
+//   - FIO_FileInfo: Contains the file type, and information about it.
+//
+//  Errors:
+//   - If the file is not found, FIO_FileInfo.fileType will be NotExists
+//   - If the file can not be accessed, FIO_FileInfo.fileType will be ErrorReadingFile
+//   - If the file type is unknown, FIO_FileInfo.fileType will be Unknown
+//
+//  Detailed description:
+//    Returns information about a given file
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_FIO_getFileInfo (in charstring p_name) return FIO_FileInfo;
+
+}
\ No newline at end of file
diff --git a/src/TCCFileSystem.cc b/src/TCCFileSystem.cc
index eae95786dad6a3e32d031d5ea85b1ad0824f4b5b..9c56ca978dd9bde27a611259163abdb1a368ab07 100644
--- a/src/TCCFileSystem.cc
+++ b/src/TCCFileSystem.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCFileSystem.cc
 //  Description:        TCC Useful Functions: FileSystem Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCFileSystem_Functions.ttcn b/src/TCCFileSystem_Functions.ttcn
index 5606ccf0a736b6975125403915e734fcbb2dd895..32d4d828a610db7dbe754357d8bdd81bf50bab28 100644
--- a/src/TCCFileSystem_Functions.ttcn
+++ b/src/TCCFileSystem_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCC_FileSystem_Functions.ttcn
 //  Description:        TCC Useful Functions: FileSystem Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec.cc b/src/TCCIPsec.cc
index 06dcc7852e683fab8f6d7a8fb1d5182114a0b65f..5dddc62727f5e16909bc3b16217c65d218fbeac3 100644
--- a/src/TCCIPsec.cc
+++ b/src/TCCIPsec.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec.cc
 //  Description:        TCC Useful Functions: IPsec Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_Definitions.ttcn b/src/TCCIPsec_Definitions.ttcn
index 49e2d4d13d3d69d9876b88c4fe88100cb6c0d430..5751e08cf32ef7a431519a19fe383456c992a4ee 100644
--- a/src/TCCIPsec_Definitions.ttcn
+++ b/src/TCCIPsec_Definitions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_Definitions.ttcn
 //  Description:        TCC Useful Functions: Definitions for IPsec functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_Functions.ttcn b/src/TCCIPsec_Functions.ttcn
index f831e11aa126d4f37282e6292df4bcdb1679f237..34a44ad0dac84ee84413de1caefcc5c02c42d07b 100644
--- a/src/TCCIPsec_Functions.ttcn
+++ b/src/TCCIPsec_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_Functions.ttcn
 //  Description:        TCC Useful Functions: IPsec Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_XFRM.cc b/src/TCCIPsec_XFRM.cc
index 3c8ad7f18d8e3753c4fab4a3ca8d5629e5a88f91..633709e79f6e1ea7ff0c9689bcded78a2a9c896d 100644
--- a/src/TCCIPsec_XFRM.cc
+++ b/src/TCCIPsec_XFRM.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_XFRM.cc
 //  Description:        TCC Useful Functions: IPsec XFRM Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_XFRM.hh b/src/TCCIPsec_XFRM.hh
index 0e8fbf8249315bcb55c6787c3f785f8b0bc21036..d27e02a144f6efca767930e37572708977120e3f 100644
--- a/src/TCCIPsec_XFRM.hh
+++ b/src/TCCIPsec_XFRM.hh
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_XFRM.hh
 //  Description:        TCC Useful Functions: IPsec XFRM Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_XFRM_Definitions.ttcn b/src/TCCIPsec_XFRM_Definitions.ttcn
index 67bcb899c085bab9a15bf6858b9da18e77eebe8c..5791371e7027f0295d8cf5d70953de58c858d29b 100644
--- a/src/TCCIPsec_XFRM_Definitions.ttcn
+++ b/src/TCCIPsec_XFRM_Definitions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_XFRM_Definitions.ttcn
 //  Description:        TCC Useful Functions: IPsec XFRM Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_XFRM_SA.cc b/src/TCCIPsec_XFRM_SA.cc
index 0f4a3dc77808d0ea910b4dcd942d1869a53f3650..d993b57a90ed8ab16d6520ceba00b9175854eaf5 100644
--- a/src/TCCIPsec_XFRM_SA.cc
+++ b/src/TCCIPsec_XFRM_SA.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_XFRM_SA.cc
 //  Description:        TCC Useful Functions: IPsec XFRM Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCIPsec_XFRM_SP.cc b/src/TCCIPsec_XFRM_SP.cc
index b5597d242590c841501bac61ffbd6c7a6a095ade..23f25816d3018f932a599435a8e8bad6beb87c45 100644
--- a/src/TCCIPsec_XFRM_SP.cc
+++ b/src/TCCIPsec_XFRM_SP.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCIPsec_XFRM_SP.cc
 //  Description:        TCC Useful Functions: IPsec XFRM Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -91,7 +91,7 @@ void f_add_template(
 
    if(ipv4)xTmpl->family = AF_INET;
   else xTmpl->family = AF_INET6;
-      
+
   if(tmpl.reqid().ispresent())xTmpl->reqid  =  tmpl.reqid()().get_long_long_val();
   else xTmpl->reqid = 0;  //0:require else:unique
 
@@ -103,10 +103,10 @@ void f_add_template(
 
    xTmpl->optional = 0;
    switch(tmpl.level()){
-     case Level::use:{xTmpl->optional = 1;break;} 
+     case Level::use:{xTmpl->optional = 1;break;}
      default:        {xTmpl->optional = 0;}      //Level -- 0:required 1:use
    };
-  
+
    xTmpl->aalgos = (~(__u32)0);
    xTmpl->ealgos = (~(__u32)0);
    xTmpl->calgos = (~(__u32)0);
@@ -125,7 +125,7 @@ void f_set_SP_add_info(
 
   pol = (struct xfrm_userpolicy_info*)NLMSG_DATA(memo);
   memset(pol,0,sizeof(struct xfrm_userpolicy_info));
-  
+
   int addr_family = f_set_IP_address(pol_info.dst().ip__address(), &pol->sel.daddr);
    if(addr_family >= 0){
     pol->sel.family = addr_family;
@@ -147,7 +147,7 @@ void f_set_SP_add_info(
       pol->sel.prefixlen_s = 128;
     };
   }; //else default value will be set: 0.0.0.0
- 
+
   if(pol_info.dst().address__prefix().ispresent()){pol->sel.prefixlen_d = pol_info.dst().address__prefix()();};
    if(pol_info.src().address__prefix().ispresent()){pol->sel.prefixlen_s = pol_info.src().address__prefix()();};
    if(pol_info.dst().port__number().ispresent()){
@@ -158,10 +158,10 @@ void f_set_SP_add_info(
      pol->sel.sport = htons(pol_info.src().port__number()());
      pol->sel.sport_mask = 0xffff;
    };
- 
+
    pol->sel.ifindex = 0;
    pol->sel.user = 0;
- 
+
   if(pol_info.protocol() != TransportProtocol::ANY){
     pol->sel.proto = pol_info.protocol();
   } else {
@@ -195,20 +195,20 @@ void f_set_SP_add_info(
   if(pol_info.info().ispresent()){
     f_process_additionalInfo(pol, pol_info.info()());
   };
-    
+
   Template__List list = pol_info.tmpl();
-  
+
   ahdr = (struct nlattr*)((char*)pol+NLA_ALIGN(sizeof(*pol)));
   ahdr->nla_len = NLA_HDRLEN+sizeof(*tmpl)*numberOfTmpls;
    ahdr->nla_type = XFRMA_TMPL;
-   
+
   for(int i = 0;i<numberOfTmpls;i++){
     TTCN_Logger::log( TTCN_DEBUG,"######   %d. template:",i+1);
     if(i>0){
        tmpl = (struct xfrm_user_tmpl*)((char*)tmpl+NLA_ALIGN(sizeof(*tmpl)));
     } else {
        tmpl = (struct xfrm_user_tmpl*)((char*)ahdr+NLA_HDRLEN);
-    };  
+    };
 
     f_add_template(tmpl,list[i],pol->share,ipv4);
   };
@@ -235,7 +235,7 @@ void f_set_SP_delete_info(
     };
   }; //else default value will be set: 0.0.0.0
 
-    
+
   temp = inet_pton(AF_INET,pol_info.src().ip__address(),(void*)&pol->sel.saddr.a4);
   if(temp > 0){
     pol->sel.family = AF_INET;
@@ -253,12 +253,17 @@ void f_set_SP_delete_info(
   if(pol_info.dst().address__prefix().ispresent()){pol->sel.prefixlen_d = pol_info.dst().address__prefix()();};
    if(pol_info.src().address__prefix().ispresent()){pol->sel.prefixlen_s = pol_info.src().address__prefix()();};
 
-  if(pol_info.dst().port__number().ispresent())pol->sel.dport = htons(pol_info.dst().port__number()());
-  if(pol_info.src().port__number().ispresent())pol->sel.sport = htons(pol_info.src().port__number()());
-  pol->sel.dport_mask = pol->sel.sport_mask = 0xffff;
- 
-  pol->sel.proto = pol_info.protocol();
+  if(pol_info.dst().port__number().ispresent()){
+    pol->sel.dport = htons(pol_info.dst().port__number()());
+    pol->sel.dport_mask = 0xffff;
+  };
+
+  if(pol_info.src().port__number().ispresent()){
+    pol->sel.sport = htons(pol_info.src().port__number()());
+    pol->sel.sport_mask = 0xffff;
+  };
 
+  pol->sel.proto = pol_info.protocol();
   pol->dir = pol_info.dir();
 }
 
diff --git a/src/TCCInterface.cc b/src/TCCInterface.cc
index 5d3d9157cbd01213e04f0cc06b2b0a0ed333850c..ebcf52e47f3ce08d71968327a33033847393029a 100644
--- a/src/TCCInterface.cc
+++ b/src/TCCInterface.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCInterface.cc
 //  Description:        TCC Useful Functions: Interface Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -1066,7 +1066,7 @@ IPAddresses f__getIpAddresses(const CHARSTRING& hostname){
   CharstringList ipv6list(NULL_VALUE);
 
   if ((status = getaddrinfo((const char*)hostname, NULL, &hints, &res)) != 0) {
-    TTCN_warning("f_getIpAddresses: getaddrinfo: %s for \"%s\"\n", gai_strerror(status), (const char*)hostname);
+    TTCN_Logger::log(TTCN_DEBUG, "f_getIpAddresses: getaddrinfo: %s for \"%s\"\n", gai_strerror(status), (const char*)hostname);
     return IPAddresses(ipv4list, ipv6list);
   }
 
diff --git a/src/TCCInterface_Functions.ttcn b/src/TCCInterface_Functions.ttcn
index 1d3c0a318a41ca370bb8ac51367d420a8a58f550..6c75e6c3f544053d63c5ecd7edc965a2cd3b85f7 100644
--- a/src/TCCInterface_Functions.ttcn
+++ b/src/TCCInterface_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCInterface_Functions.ttcn
 //  Description:        TCC Useful Functions: Interface Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCInterface_ip.h b/src/TCCInterface_ip.h
index 5eaee6d095c2956ac00185048408b304bf9007bd..0f071abeec18375d91cddbb30e7156c3371e71fb 100644
--- a/src/TCCInterface_ip.h
+++ b/src/TCCInterface_ip.h
@@ -10,7 +10,7 @@
 //
 //  File:               TCCInterface_ip.h
 //  Description:        TCC Useful Functions: Interface Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCMaths.cc b/src/TCCMaths.cc
index 28afd8c57fc7dc95c0a6b82d97445031e7c8aeb6..2cd81429aac4af07108197a229f1404aa3d0cc24 100644
--- a/src/TCCMaths.cc
+++ b/src/TCCMaths.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCMaths.cc
 //  Description:        TCC Useful Functions: Maths Functions.
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCMaths_Functions.ttcn b/src/TCCMaths_Functions.ttcn
index ba9fa568e6952d12c38d744304ec67d5dc3525fb..55ace3b1c1feee04bffd46754773515f35a8ccd6 100644
--- a/src/TCCMaths_Functions.ttcn
+++ b/src/TCCMaths_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCMaths_Functions.ttcn
 //  Description:        TCC Useful Functions: Math Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCMaths_GenericTypes.ttcn b/src/TCCMaths_GenericTypes.ttcn
index 3d783063364fe06078d909f03baae32f592bd584..106aa0efae185d190301b080d984cfd3c95d67e6 100644
--- a/src/TCCMaths_GenericTypes.ttcn
+++ b/src/TCCMaths_GenericTypes.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCMaths_GenericTypes.ttcn
 //  Description:        TCC Useful Functions: Generic Types For Maths
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCMessageHandling.cc b/src/TCCMessageHandling.cc
index 07893e7de839fcc95d2b15adf1ecc06c67a84bed..43a802b3fbcb811a483f8cdbcbe231915793e3f9 100644
--- a/src/TCCMessageHandling.cc
+++ b/src/TCCMessageHandling.cc
@@ -9,7 +9,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  File:     TCCMessageHandling.cc
-//  Rev:      R30A
+//  Rev:      R35B
 //  Prodnr:   CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCMessageHandling_Functions.ttcn b/src/TCCMessageHandling_Functions.ttcn
index 6d2b3f9b5dde570e448aaa47c8074c00cd50ece4..aadfb44c73cd0924e8f874c94ca8473fa4a9172f 100644
--- a/src/TCCMessageHandling_Functions.ttcn
+++ b/src/TCCMessageHandling_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCMessageHandling_Functions.ttcn
 //  Description:        TCC Useful Functions: MessageHandling Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCOpenSecurity.cc b/src/TCCOpenSecurity.cc
index 527faee0024f74d9ad2f3a6f8448791fc3751e61..6044607063ad3e752a74b248b95d1454cbcb0413 100644
--- a/src/TCCOpenSecurity.cc
+++ b/src/TCCOpenSecurity.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCOpenSecurity.cc
 //  Description:        TCC Useful Functions: Security Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -25,9 +25,259 @@
 #include <openssl/sha.h>
 #include <openssl/rand.h>
 
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#include <openssl/modes.h>
+#endif
+
 namespace TCCOpenSecurity__Functions {
+void tohex(unsigned char * Bin,unsigned char *Hex)
+{
+    unsigned short i;
+    unsigned char j;
+
+    for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
+        j = (Bin[i] >> 4) & 0xf;
+        if (j <= 9)
+            Hex[i*2] = (j + '0');
+         else
+            Hex[i*2] = (j + 'a' - 10);
+        j = Bin[i] & 0xf;
+        if (j <= 9)
+            Hex[i*2+1] = (j + '0');
+         else
+            Hex[i*2+1] = (j + 'a' - 10);
+    };
+    Hex[MD5_DIGEST_LENGTH*2] = '\0';
+}
+
+void CalculateHA1(
+    const CHARSTRING& alg,
+    const CHARSTRING& username,
+    const CHARSTRING& realm,
+    const CHARSTRING& password,
+    const CHARSTRING& nonce,
+    const CHARSTRING& cnonce,
+    CHARSTRING& sessionkey
+    )
+{
+  MD5_CTX Md5Ctx;
+  unsigned char ha1[MD5_DIGEST_LENGTH];
+  unsigned char hexha1[MD5_DIGEST_LENGTH*2+1];
+
+  MD5_Init(&Md5Ctx);
+  MD5_Update(&Md5Ctx, (const char*)username, username.lengthof());
+  MD5_Update(&Md5Ctx, ":", 1);
+  MD5_Update(&Md5Ctx, (const char*)realm, realm.lengthof());
+  MD5_Update(&Md5Ctx, ":", 1);
+  MD5_Update(&Md5Ctx, (const char*)password,password.lengthof() );
+  MD5_Final(ha1, &Md5Ctx);
+  if (alg == "md5-sess" ) {
+    MD5_Init(&Md5Ctx);
+    MD5_Update(&Md5Ctx, ha1, MD5_DIGEST_LENGTH);
+    MD5_Update(&Md5Ctx, ":", 1);
+    MD5_Update(&Md5Ctx, nonce, nonce.lengthof());
+    MD5_Update(&Md5Ctx, ":", 1);
+    MD5_Update(&Md5Ctx, cnonce, cnonce.lengthof());
+    MD5_Final(ha1, &Md5Ctx);
+  };
+  tohex(ha1,hexha1);
+  sessionkey=CHARSTRING(MD5_DIGEST_LENGTH*2,(const char*)hexha1);
+}
+
+void CalculateDigestResponse(
+    const CHARSTRING& ha1,        /* H(A1) */
+    const CHARSTRING& nonce,      /* nonce from server */
+    const CHARSTRING& nonceCount, /* 8 hex digits */
+    const CHARSTRING& cnonce,     /* client nonce */
+    const CHARSTRING& qop,        /* qop-value: "", "auth", "auth-int" */
+    const CHARSTRING& method,     /* method from the request */
+    const CHARSTRING& digestUri,  /* requested URL */
+    const CHARSTRING& hentity,    /* H(entity body) if qop="auth-int" */
+    CHARSTRING& response          /* request-digest or response-digest */
+    )
+{
+  MD5_CTX Md5Ctx;
+  unsigned char ha2[MD5_DIGEST_LENGTH];
+  unsigned char hexha2[MD5_DIGEST_LENGTH*2+1];
+  unsigned char resp[MD5_DIGEST_LENGTH];
+  unsigned char hexresp[MD5_DIGEST_LENGTH*2+1];
+
+
+  // calculate H(A2)
+  MD5_Init(&Md5Ctx);
+  MD5_Update(&Md5Ctx, (const char*)method, method.lengthof() );
+  MD5_Update(&Md5Ctx, ":", 1);
+  MD5_Update(&Md5Ctx, (const char*)digestUri, digestUri.lengthof());
+  if (qop == "auth-int") {
+    MD5_Update(&Md5Ctx, ":", 1);
+    MD5_Update(&Md5Ctx, (const char*)hentity, hentity.lengthof());
+  };
+  MD5_Final(ha2, &Md5Ctx);
+
+  // calculate response
+  MD5_Init(&Md5Ctx);
+  MD5_Update(&Md5Ctx, (const char*)ha1, ha1.lengthof());
+  MD5_Update(&Md5Ctx, ":", 1);
+  MD5_Update(&Md5Ctx, (const char*)nonce, nonce.lengthof());
+  MD5_Update(&Md5Ctx, ":", 1);
+  if (qop.lengthof()>0) {
+    MD5_Update(&Md5Ctx, (const char*)nonceCount, nonceCount.lengthof());
+    MD5_Update(&Md5Ctx, ":", 1);
+    MD5_Update(&Md5Ctx, (const char*)cnonce, cnonce.lengthof());
+    MD5_Update(&Md5Ctx, ":", 1);
+    MD5_Update(&Md5Ctx, (const char*)qop, qop.lengthof() );
+    MD5_Update(&Md5Ctx, ":", 1);
+  };
+  tohex(ha2,hexha2);
+  
+  MD5_Update(&Md5Ctx, (const char*)hexha2, MD5_DIGEST_LENGTH*2);
+  MD5_Final(resp, &Md5Ctx);
+  tohex(resp,hexresp);
+  response=CHARSTRING(MD5_DIGEST_LENGTH*2,(const char*)hexresp);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateDigestResponse
+//
+//  Purpose:
+//    Calculate digest response
+//
+//  Parameters:
+//      nonce - *in* *charstring* -   a server-specified data string which may
+//  `                                 be uniquely generated each time a 401
+//                                    response is made
+//      cnonce - *in* *charstring* -  client nonce
+//      user - *in* *charstring* -    user name
+//      realm - *in* *charstring* -   user realm
+//      passwd - *in* *charstring* -  user password
+//      alg - *in* *charstring* -     a string indicating a pair of algorithms
+//                                    used to produce the digest and a checksum
+//      nonceCount - *in* *charstring* - nonce count (8 hex digits)
+//      method - *in* *charstring* -  method (from the request)
+//      qop - *in* *charstring* -     qop-value: "", "auth", "auth-int"
+//      URI - *in* *charstring* -     digest URI
+//      HEntity - *in* *charstring* - H(entity body) if qop="auth-int"
+//
+//  Return Value:
+//    charstring - digest response
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    Support HTTP authentication (detailed description in RFC 2617) using
+//    uses one-way hash (md5) specified in RFC 1321.
+//    When a request arrives to server for an access-protected object, it
+//    responds an "401 Unauthorized" status code and a WWW-Authenticate
+//    header (encapsulate nonce and other necessary parameters). The client
+//    is expected to retry the request, passing an Authorization header with
+//    response field calculated with f_calculateDigestResponse().
+//
+//    Overview: http://en.wikipedia.org/wiki/Digest_access_authentication
+//
+///////////////////////////////////////////////////////////////////////////////
+CHARSTRING f__calculateDigestResponse(
+  const CHARSTRING& nonce,
+  const CHARSTRING& cnonce,
+  const CHARSTRING& user,
+  const CHARSTRING& realm,
+  const CHARSTRING& passwd,
+  const CHARSTRING& alg,
+  const CHARSTRING& nonceCount,
+  const CHARSTRING& method,
+  const CHARSTRING& qop,
+  const CHARSTRING& URI,
+  const CHARSTRING& HEntity)
+{
+  CHARSTRING ha1;
+  CHARSTRING Response;
+
+  CalculateHA1(alg,user,realm,passwd,nonce,cnonce,ha1);
+
+  CalculateDigestResponse(ha1,nonce,nonceCount,cnonce,qop,method,URI,HEntity,Response);
+
+  return Response;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateDigestHA1
+//
+//  Purpose:
+//    Calculate digest H(A1) hash
+//
+//  Parameters:
+//      nonce - *in* *charstring* -   a server-specified data string which may
+//  `                                 be uniquely generated each time a 401
+//                                    response is made
+//      cnonce - *in* *charstring* -  client nonce
+//      user - *in* *charstring* -    user name
+//      realm - *in* *charstring* -   user realm
+//      passwd - *in* *charstring* -  user password
+//      alg - *in* *charstring* -     a string indicating a pair of algorithms
+//                                    used to produce the digest and a checksum
+//
+//  Return Value:
+//    charstring - digest response
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    Overview: http://en.wikipedia.org/wiki/Digest_access_authentication
+//
+///////////////////////////////////////////////////////////////////////////////
+CHARSTRING f__calculateDigestHA1(
+  const CHARSTRING& nonce,
+  const CHARSTRING& cnonce,
+  const CHARSTRING& user,
+  const CHARSTRING& realm,
+  const CHARSTRING& passwd,
+  const CHARSTRING& alg)
+{
+  CHARSTRING ha1;
+
+  CalculateHA1(alg,user,realm,passwd,nonce,cnonce,ha1);
+
+  return ha1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f__calculateMD5
+//
+//  Purpose:
+//    Compute MD5 hash value
+//
+//  Parameters:
+//      pszHashInput - *in* *charstring* -  input value to compute hash of
+//
+//  Return Value:
+//      hashValue - *out* *charstring* -  hexa hash value of input
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      -
+//
+///////////////////////////////////////////////////////////////////////////////
+CHARSTRING  f__calculateMD5(const CHARSTRING& pszHashInput)
+{
+   unsigned char md[MD5_DIGEST_LENGTH];
+   MD5((const unsigned char*)(const char *)pszHashInput,pszHashInput.lengthof(),md);
 
 
+   return oct2str(OCTETSTRING(MD5_DIGEST_LENGTH,md));
+}
+
+OCTETSTRING  f__calculateMD5__oct(const OCTETSTRING& pszHashInput)
+{
+   unsigned char md[MD5_DIGEST_LENGTH];
+   MD5((const unsigned char*)pszHashInput,pszHashInput.lengthof(),md);
+
+
+   return OCTETSTRING(MD5_DIGEST_LENGTH,md);
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f__calculateRAND__oct
 //
@@ -447,33 +697,32 @@ OCTETSTRING ef__3DES__ECB__Encrypt (const OCTETSTRING& pl__data, const OCTETSTRI
    unsigned char* outbuf=NULL;
   const unsigned char* data= (const unsigned char*)pl__data;
 
-  EVP_CIPHER_CTX ctx;
-  EVP_CIPHER_CTX_init(&ctx);
+  EVP_CIPHER_CTX *ctx=EVP_CIPHER_CTX_new();
 
-  if(EVP_EncryptInit_ex(&ctx, EVP_des_ede3_ecb(), NULL, pl__key, NULL))
+  if(EVP_EncryptInit_ex(ctx, EVP_des_ede3_ecb(), NULL, pl__key, NULL))
   {
-    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+    int block_size = EVP_CIPHER_CTX_block_size(ctx);
      if(!pl__use__padding) {  // the padding is used by default
-      EVP_CIPHER_CTX_set_padding(&ctx,0);
+      EVP_CIPHER_CTX_set_padding(ctx,0);
       if(pl__data.lengthof()%block_size){
         TTCN_warning("ef_3DES_ECB_Encrypt: The length of the pl_data should be n * %d (the block size) if padding is not used.", block_size);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
     }
     if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
     {
-      if(!EVP_EncryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+      if(!EVP_EncryptUpdate(ctx, outbuf, &outl, data, pl__data.lengthof())){
         TTCN_warning("ef_3DES_ECB_Encrypt: EVP_EncryptUpdate failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
       position = outl;
-      if(!EVP_EncryptFinal_ex(&ctx, &outbuf[position], &outl)){
+      if(!EVP_EncryptFinal_ex(ctx, &outbuf[position], &outl)){
         TTCN_warning("ef_3DES_ECB_Encrypt: EVP_EncryptFinal_ex failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
 
@@ -482,10 +731,11 @@ OCTETSTRING ef__3DES__ECB__Encrypt (const OCTETSTRING& pl__data, const OCTETSTRI
       Free(outbuf);
     }
 
-    EVP_CIPHER_CTX_cleanup(&ctx);
+    EVP_CIPHER_CTX_free(ctx);
 
   } else {
         TTCN_warning("ef_3DES_ECB_Encrypt: EVP_EncryptInit_ex failed.");
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
   }
 
@@ -524,34 +774,34 @@ OCTETSTRING ef__3DES__ECB__Decrypt (const OCTETSTRING& pl__data, const OCTETSTRI
    unsigned char* outbuf=NULL;
   const unsigned char* data= (const unsigned char*)pl__data;
 
-  EVP_CIPHER_CTX ctx;
-  EVP_CIPHER_CTX_init(&ctx);
+  EVP_CIPHER_CTX *ctx=EVP_CIPHER_CTX_new();
+  EVP_CIPHER_CTX_init(ctx);
 
-  if(EVP_DecryptInit_ex(&ctx, EVP_des_ede3_ecb(), NULL, pl__key, NULL))
+  if(EVP_DecryptInit_ex(ctx, EVP_des_ede3_ecb(), NULL, pl__key, NULL))
   {
-    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+    int block_size = EVP_CIPHER_CTX_block_size(ctx);
     if(pl__data.lengthof()%block_size){
       TTCN_warning("ef_3DES_ECB_Decrypt: The length of the pl_data should be n * %d (the block size)!", block_size);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+      EVP_CIPHER_CTX_free(ctx);
       return OCTETSTRING(0,NULL);
     }
      if(!pl__use__padding) {  // the padding is used by default
-      EVP_CIPHER_CTX_set_padding(&ctx,0);
+      EVP_CIPHER_CTX_set_padding(ctx,0);
     }
     if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
     {
-      if(!EVP_DecryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+      if(!EVP_DecryptUpdate(ctx, outbuf, &outl, data, pl__data.lengthof())){
         TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptUpdate failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
       position = outl;
 
-      if(!EVP_DecryptFinal_ex(&ctx, &outbuf[position], &outl)){
+      if(!EVP_DecryptFinal_ex(ctx, &outbuf[position], &outl)){
         TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptFinal_ex failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
 
@@ -560,10 +810,11 @@ OCTETSTRING ef__3DES__ECB__Decrypt (const OCTETSTRING& pl__data, const OCTETSTRI
       Free(outbuf);
     }
 
-    EVP_CIPHER_CTX_cleanup(&ctx);
+    EVP_CIPHER_CTX_free(ctx);
 
   } else {
         TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptInit_ex failed.");
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
   }
 
@@ -605,35 +856,35 @@ OCTETSTRING ef__3DES__CBC__Encrypt (const OCTETSTRING& pl__data, const OCTETSTRI
    unsigned char* outbuf=NULL;
   const unsigned char* data= (const unsigned char*)pl__data;
 
-  EVP_CIPHER_CTX ctx;
-  EVP_CIPHER_CTX_init(&ctx);
+  EVP_CIPHER_CTX *ctx=EVP_CIPHER_CTX_new();
+  EVP_CIPHER_CTX_init(ctx);
 
-  if(EVP_EncryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, pl__key, pl__iv))
+  if(EVP_EncryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, pl__key, pl__iv))
   {
-    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+    int block_size = EVP_CIPHER_CTX_block_size(ctx);
      if(!pl__use__padding) {  // the padding is used by default
-      EVP_CIPHER_CTX_set_padding(&ctx,0);
+      EVP_CIPHER_CTX_set_padding(ctx,0);
       if(pl__data.lengthof()%block_size){
         TTCN_warning("ef_3DES_CBC_Encrypt: The length of the pl_data should be n * %d (the block size) if padding is not used.", block_size);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
     }
     if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
     {
-      if(!EVP_EncryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+      if(!EVP_EncryptUpdate(ctx, outbuf, &outl, data, pl__data.lengthof())){
         TTCN_warning("ef_3DES_CBC_Encrypt: EVP_EncryptUpdate failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
 
       position = outl;
 
-      if(!EVP_EncryptFinal_ex(&ctx, &outbuf[position], &outl)){
+      if(!EVP_EncryptFinal_ex(ctx, &outbuf[position], &outl)){
         TTCN_warning("ef_3DES_CBC_Encrypt: EVP_EncryptFinal_ex failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
 
@@ -642,10 +893,11 @@ OCTETSTRING ef__3DES__CBC__Encrypt (const OCTETSTRING& pl__data, const OCTETSTRI
 
     ret_val=OCTETSTRING(position, outbuf);
     Free(outbuf);
-    EVP_CIPHER_CTX_cleanup(&ctx);
+    EVP_CIPHER_CTX_free(ctx);
 
   } else {
         TTCN_warning("ef_3DES_CBC_Encrypt: EVP_EncryptInit_ex failed.");
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
   }
 
@@ -685,35 +937,35 @@ OCTETSTRING ef__3DES__CBC__Decrypt (const OCTETSTRING& pl__data, const OCTETSTRI
    unsigned char* outbuf=NULL;
   const unsigned char* data= (const unsigned char*)pl__data;
 
-  EVP_CIPHER_CTX ctx;
-  EVP_CIPHER_CTX_init(&ctx);
+  EVP_CIPHER_CTX *ctx=EVP_CIPHER_CTX_new();
+  EVP_CIPHER_CTX_init(ctx);
 
-  if(EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, pl__key, pl__iv))
+  if(EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, pl__key, pl__iv))
   {
-    int block_size = EVP_CIPHER_CTX_block_size(&ctx);
+    int block_size = EVP_CIPHER_CTX_block_size(ctx);
     if(pl__data.lengthof()%block_size){
       TTCN_warning("ef__3DES__CBC__Decrypt: The length of the pl_data should be n * %d (the block size)!", block_size);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+      EVP_CIPHER_CTX_free(ctx);
       return OCTETSTRING(0,NULL);
     }
      if(!pl__use__padding) {  // the padding is used by default
-      EVP_CIPHER_CTX_set_padding(&ctx,0);
+      EVP_CIPHER_CTX_set_padding(ctx,0);
     }
     if((outbuf = (unsigned char*)Malloc(pl__data.lengthof() + block_size)) != NULL)
     {
-      if(!EVP_DecryptUpdate(&ctx, outbuf, &outl, data, pl__data.lengthof())){
+      if(!EVP_DecryptUpdate(ctx, outbuf, &outl, data, pl__data.lengthof())){
         TTCN_warning("ef_3DES_CBC_Decrypt: EVP_DecryptUpdate failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
 ;
       position = outl;
 
-      if(!EVP_DecryptFinal_ex(&ctx, &outbuf[position], &outl)){
+      if(!EVP_DecryptFinal_ex(ctx, &outbuf[position], &outl)){
         TTCN_warning("ef_3DES_ECB_Decrypt: EVP_DecryptFinal_ex failed.");
         Free(outbuf);
-        EVP_CIPHER_CTX_cleanup(&ctx);
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
       }
       position += outl;
@@ -721,10 +973,11 @@ OCTETSTRING ef__3DES__CBC__Decrypt (const OCTETSTRING& pl__data, const OCTETSTRI
       Free(outbuf);
     }
 
-    EVP_CIPHER_CTX_cleanup(&ctx);
+    EVP_CIPHER_CTX_free(ctx);
 
   } else {
         TTCN_warning("ef_3DES_CBC_Decrypt: EVP_DecryptInit_ex failed.");
+        EVP_CIPHER_CTX_free(ctx);
         return OCTETSTRING(0,NULL);
   }
 
@@ -767,22 +1020,22 @@ OCTETSTRING ef__Calculate__AES__XCBC__128 (const OCTETSTRING& pl__data, const OC
   unsigned char key3[block_size] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 };
   unsigned char e[block_size] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
-  EVP_CIPHER_CTX ctx;
-  EVP_CIPHER_CTX_init(&ctx);
+  EVP_CIPHER_CTX *ctx=EVP_CIPHER_CTX_new();
+  EVP_CIPHER_CTX_init(ctx);
 
-  EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
-  EVP_EncryptUpdate(&ctx, key1, &outl, key1, block_size);
-  EVP_CIPHER_CTX_cleanup(&ctx);
+  EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
+  EVP_EncryptUpdate(ctx, key1, &outl, key1, block_size);
+  EVP_CIPHER_CTX_cleanup(ctx);
 
-  EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
-  EVP_EncryptUpdate(&ctx, key2, &outl, key2, block_size);
-  EVP_CIPHER_CTX_cleanup(&ctx);
+  EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
+  EVP_EncryptUpdate(ctx, key2, &outl, key2, block_size);
+  EVP_CIPHER_CTX_cleanup(ctx);
 
-  EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
-  EVP_EncryptUpdate(&ctx, key3, &outl, key3, block_size);
-  EVP_CIPHER_CTX_cleanup(&ctx);
+  EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, pl__key, NULL);
+  EVP_EncryptUpdate(ctx, key3, &outl, key3, block_size);
+  EVP_CIPHER_CTX_cleanup(ctx);
 
-  if(EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key1, NULL))
+  if(EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key1, NULL))
   {
     for(int i = 0; i < data_length - block_size; i += block_size)
     {
@@ -791,9 +1044,9 @@ OCTETSTRING ef__Calculate__AES__XCBC__128 (const OCTETSTRING& pl__data, const OC
         e[j] ^= data[i+j];
       }
 
-      EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key1, NULL);
-      EVP_EncryptUpdate(&ctx, e, &outl, e, block_size);
-      EVP_CIPHER_CTX_cleanup(&ctx);
+      EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key1, NULL);
+      EVP_EncryptUpdate(ctx, e, &outl, e, block_size);
+      EVP_CIPHER_CTX_cleanup(ctx);
     }
 
     int last_block_length = data_length % block_size;
@@ -824,13 +1077,14 @@ OCTETSTRING ef__Calculate__AES__XCBC__128 (const OCTETSTRING& pl__data, const OC
       }
 
     }
-    EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key1, NULL);
-    EVP_EncryptUpdate(&ctx, e, &outl, e, block_size);
-    EVP_CIPHER_CTX_cleanup(&ctx);
+    EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key1, NULL);
+    EVP_EncryptUpdate(ctx, e, &outl, e, block_size);
+    EVP_CIPHER_CTX_free(ctx);
 
     return OCTETSTRING(pl__out__length, (const unsigned char*)e);
 
   }
+  EVP_CIPHER_CTX_free(ctx);
   return OCTETSTRING(0,NULL);
 }
 
@@ -881,18 +1135,32 @@ INTEGER ef__DH__generate__private__public__keys (const INTEGER& pl__keyLength, O
       return INTEGER(0);
     }
   }
-  dh->p = prime;
 
   const char* generator = "2";
   BIGNUM* gen = BN_new();
   BN_hex2bn(&gen, generator);
-  dh->g = gen;
 
+#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
+  DH_set0_pqg(dh, prime, NULL, gen);
+#else
+  dh->p = prime;
+  dh->g = gen;
+#endif
+  
   DH_generate_key(dh);
-
-  int pub_len = BN_num_bytes(dh->pub_key);
+  const BIGNUM* pubk=NULL;
+  const BIGNUM* privk=NULL;
+
+#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
+  DH_get0_key(dh, &pubk, &privk);
+#else
+  pubk=dh->pub_key;
+  privk=dh->priv_key;
+#endif
+  
+  int pub_len = BN_num_bytes(pubk);
   unsigned char* pub_key = (unsigned char*)Malloc(pub_len * sizeof(unsigned char));
-  pub_len = BN_bn2bin(dh->pub_key, pub_key);
+  pub_len = BN_bn2bin(pubk, pub_key);
   if (key_length-pub_len > 0)
   {pl__pubkey =  int2oct(0,key_length-pub_len) + OCTETSTRING(pub_len, pub_key);}
   else
@@ -905,9 +1173,9 @@ INTEGER ef__DH__generate__private__public__keys (const INTEGER& pl__keyLength, O
       return INTEGER(0);
   }
 
-  int priv_len = BN_num_bytes(dh->priv_key);
+  int priv_len = BN_num_bytes(privk);
   unsigned char* priv_key = (unsigned char*)Malloc(priv_len * sizeof(unsigned char));
-  priv_len = BN_bn2bin(dh->priv_key, priv_key);
+  priv_len = BN_bn2bin(privk, priv_key);
   if (key_length-priv_len > 0)
   {pl__privkey =  int2oct(0,key_length-priv_len) + OCTETSTRING(priv_len, priv_key);}
   else
@@ -970,20 +1238,29 @@ OCTETSTRING ef__DH__shared__secret (const OCTETSTRING& pl__pubkey, const OCTETST
       return OCTETSTRING(0, NULL);
     }
   }
-  dh->p = prime;
 
   const char* generator = "2";
   BIGNUM* gen = BN_new();
   BN_hex2bn(&gen, generator);
+
+#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
+  DH_set0_pqg(dh, prime, NULL, gen);
+#else
+  dh->p = prime;
   dh->g = gen;
+#endif
 
   BIGNUM* priv_key = BN_new();
   BN_bin2bn((const unsigned char*)pl__privkey, key_length, priv_key);
-  dh->priv_key = priv_key;
 
   BIGNUM* pub_key = BN_new();
   BN_bin2bn((const unsigned char*)pl__pubkey, key_length, pub_key);
+#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
+  DH_set0_key(dh, pub_key, priv_key );
+#else
+  dh->priv_key = priv_key;
   dh->pub_key = pub_key;
+#endif
 
   if(DH_compute_key(shared_secret, pub_key, dh))
   {
@@ -1120,8 +1397,11 @@ OCTETSTRING f__AES__CTR__128__Encrypt__Decrypt__OpenSSL (const OCTETSTRING& p_ke
   unsigned char ecount_buf[AES_BLOCK_SIZE];
   memset(ecount_buf, 0, AES_BLOCK_SIZE);
 
-  AES_ctr128_encrypt((const unsigned char*)p_data, enc_data, data_len, &aes_k, k_iv, ecount_buf, &num);
-
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+   CRYPTO_ctr128_encrypt((const unsigned char*)p_data, enc_data, data_len, &aes_k, k_iv,ecount_buf , &num, (block128_f)AES_encrypt);
+#else
+   AES_ctr128_encrypt((const unsigned char*)p_data, enc_data, data_len, &aes_k, k_iv, ecount_buf, &num);
+#endif
   return OCTETSTRING(data_len, enc_data);
 }
 
diff --git a/src/TCCOpenSecurity_Functions.ttcn b/src/TCCOpenSecurity_Functions.ttcn
index 8152cf6203a564fd385395e3a1585c32738460de..ec4f212d80378a9d9388d49552943a25ed098238 100644
--- a/src/TCCOpenSecurity_Functions.ttcn
+++ b/src/TCCOpenSecurity_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCOpenSecurity.ttcn
 //  Description:        TCC Useful Functions: Security Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -20,6 +20,95 @@ module TCCOpenSecurity_Functions {
 type octetstring OCT_16 length(16);
 type octetstring OCT_64 length(64);
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateDigestResponse
+//
+//  Purpose:
+//    Calculate digest response
+//
+//  Parameters:
+//      nonce - *in* *charstring* -   a server-specified data string which may
+//  `                                 be uniquely generated each time a 401
+//                                    response is made
+//      cnonce - *in* *charstring* -  client nonce
+//      user - *in* *charstring* -    user name
+//      realm - *in* *charstring* -   user realm
+//      passwd - *in* *charstring* -  user password
+//      alg - *in* *charstring* -     a string indicating a pair of algorithms
+//                                    used to produce the digest and a checksum
+//      nonceCount - *in* *charstring* - nonce count (8 hex digits)
+//      method - *in* *charstring* -  method (from the request)
+//      qop - *in* *charstring* -     qop-value: "", "auth", "auth-int"
+//      URI - *in* *charstring* -     digest URI
+//      HEntity - *in* *charstring* - H(entity body) if qop="auth-int"
+//
+//  Return Value:
+//    charstring - digest response
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    Support HTTP authentication (detailed description in RFC 2617) using
+//    uses one-way hash (md5) specified in RFC 1321.
+//    When a request arrives to server for an access-protected object, it
+//    responds an "401 Unauthorized" status code and a WWW-Authenticate
+//    header (encapsulate nonce and other necessary parameters). The client
+//    is expected to retry the request, passing an Authorization header with
+//    response field calculated with f_calculateDigestResponse().
+//
+//    Overview: http://en.wikipedia.org/wiki/Digest_access_authentication
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateDigestResponse(
+  charstring nonce,
+  charstring cnonce,
+  charstring user,
+  charstring realm,
+  charstring passwd,
+  charstring alg,
+  charstring nonceCount,
+  charstring method,
+  charstring qop,
+  charstring URI,
+  charstring HEntity) return charstring;
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateDigestHA1
+//
+//  Purpose:
+//    Calculate digest H(A1) hash
+//
+//  Parameters:
+//      nonce - *in* *charstring* -   a server-specified data string which may
+//  `                                 be uniquely generated each time a 401
+//                                    response is made
+//      cnonce - *in* *charstring* -  client nonce
+//      user - *in* *charstring* -    user name
+//      realm - *in* *charstring* -   user realm
+//      passwd - *in* *charstring* -  user password
+//      alg - *in* *charstring* -     a string indicating a pair of algorithms
+//                                    used to produce the digest and a checksum
+//
+//  Return Value:
+//    charstring - digest response
+//
+//  Errors:
+//    -
+//
+//  Detailed description:
+//    Overview: http://en.wikipedia.org/wiki/Digest_access_authentication
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateDigestHA1(
+  charstring nonce,
+  charstring cnonce,
+  charstring user,
+  charstring realm,
+  charstring passwd,
+  charstring alg) return charstring;
+
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_calculateRAND_oct
@@ -42,6 +131,29 @@ type octetstring OCT_64 length(64);
 ///////////////////////////////////////////////////////////////////////////////
 external function f_calculateRAND_oct(in integer pl_length) return octetstring;
 
+///////////////////////////////////////////////////////////////////////////////
+//  Function: f_calculateMD5
+//
+//  Purpose:
+//    Compute MD5 hash value
+//
+//  Parameters:
+//      pszHashInput - *in* *charstring* -  input value to compute MD5 hash
+//
+//  Return Value:
+//      charstring - hexa hash value of input
+//
+//  Errors:
+//      -
+//
+//  Detailed description:
+//      - MD5() is an openssl specific function, should be found under openssl/md5.h
+//
+///////////////////////////////////////////////////////////////////////////////
+external function f_calculateMD5(in charstring pszHashInput) return charstring;
+
+external function f_calculateMD5_oct(in octetstring pszHashInput) return octetstring;
+
 ///////////////////////////////////////////////////////////////////////////////
 //  Function: f_calculateSHA1
 //
diff --git a/src/TCCPermutatedParameters_Definitions.ttcn b/src/TCCPermutatedParameters_Definitions.ttcn
index 6c81a0fecf8a08cdd11dc58f6fe0a4893a93f34d..14338d6842db584948ea7563a21eea3a599938d1 100644
--- a/src/TCCPermutatedParameters_Definitions.ttcn
+++ b/src/TCCPermutatedParameters_Definitions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCPermutatedParameters_Definitions.ttcn
 //  Description:        definitions for permutated params
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //////////////////////////////////////////////////////////////////////////////
 
@@ -156,4 +156,4 @@ type record of PP_ParamSet PP_ParamSetList; // is each CGPN has its own current
 ///////////////////////////////////////////////////////////
 type set of PP_SingleParam PP_ParamSet;  // ie params belonging to one particular call
 
-} with { extension "version R30A"}
+} with { extension "version R35B"}
diff --git a/src/TCCPermutatedParameters_Functions.ttcn b/src/TCCPermutatedParameters_Functions.ttcn
index a009dec18d45e5050d05e624543524bfa554a75b..145d62b729efd167b63f3df3a7114d0c923f6d7b 100644
--- a/src/TCCPermutatedParameters_Functions.ttcn
+++ b/src/TCCPermutatedParameters_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCPermutatedParameters_Functions.ttcn
 //  Description:        functions for permutated params
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //////////////////////////////////////////////////////////////////////////////
 
@@ -905,4 +905,4 @@ public function f_PP_getParamValueFromSet(
   return vl_ret;
 }
 
-} with { extension "version R30A"}
+} with { extension "version R35B"}
diff --git a/src/TCCRegexp.cc b/src/TCCRegexp.cc
index 3b70154ba674e62fdeb491fba65b337aa0b16235..cfac587e0c10f12b79cb50fdb0f154cbeb35ecb6 100644
--- a/src/TCCRegexp.cc
+++ b/src/TCCRegexp.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCRegexp_Functions.ttcn
 //  Description:        TCC Useful Functions: Regexp Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCRegexp_Functions.ttcn b/src/TCCRegexp_Functions.ttcn
index 325b28bfcf1f346815d13ad991a5ab98b4a6cc73..a496e0af341798064e2534fa3990061bfeba0139 100644
--- a/src/TCCRegexp_Functions.ttcn
+++ b/src/TCCRegexp_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCRegexp_Functions.ttcn
 //  Description:        TCC Useful Functions: Regexp Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCSystem.cc b/src/TCCSystem.cc
index cd600c7b15d1184bbc8cf10cec0846a5823a0e2e..5f8e6641e965b62876b2d122f9f6794f442b277b 100644
--- a/src/TCCSystem.cc
+++ b/src/TCCSystem.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCSystem.cc
 //  Description:        TCC Useful Functions: System Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCSystem_Functions.ttcn b/src/TCCSystem_Functions.ttcn
index d7c3bfd8722f81358c2d334918efd3a93fa4e360..2c669dbe6ec563f3fd4d5adc88b6092b005a0cc4 100644
--- a/src/TCCSystem_Functions.ttcn
+++ b/src/TCCSystem_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCSystem_Functions.ttcn
 //  Description:        TCC Useful Functions: System Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCTemplate_Functions.ttcn b/src/TCCTemplate_Functions.ttcn
index f1a77a96456bfe9a0a2b2bc035eb7cc67e320d41..3e8812f4f2907b8512e0f28606d4107d37ecf826 100644
--- a/src/TCCTemplate_Functions.ttcn
+++ b/src/TCCTemplate_Functions.ttcn
@@ -10,41 +10,41 @@
 //
 //  File:               TCCTemplate_Functions.ttcn
 //  Description:        TCC Useful Functions: Template Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////////
 //  Module: TCCTemplate_Functions
-// 
+//
 //  Purpose:
 //    This module supports template handling
-//    Originally for TitanSIM R2 needs it for substituting substrings in a 
+//    Originally for TitanSIM R2 needs it for substituting substrings in a
 //    charstring template.
-// 
+//
 //  Module Parameters:
-//      - 
-// 
+//      -
+//
 //  Module depends on:
 //    -
-// 
+//
 //  Current Owner:
 //    Zsolt Szalai (EZSOSZA)
-// 
+//
 //  Last Review Date:
 //    -
-// 
+//
 //  Comments:
 //     Intruduction of ? regexp like behavior like \(x)? in our own pattern
-//     couses many troubles, like with the current templatefunc signature it 
-//     can be impossible to determine the parameters(using 2 ? pattern) and 
-//     lookup may need much more and complicated additions or rewrite that 
+//     couses many troubles, like with the current templatefunc signature it
+//     can be impossible to determine the parameters(using 2 ? pattern) and
+//     lookup may need much more and complicated additions or rewrite that
 //     we may want at that time;
 //
 ///////////////////////////////////////////////////////////////////////////////
 module TCCTemplate_Functions {
-  
+
 //  import from TCCConversion_Functions all;
   import from TCCFileIO_Functions all;
 
@@ -52,7 +52,7 @@ module TCCTemplate_Functions {
     charstring TCCTemplate_opentoken := "$(";
     charstring TCCTemplate_closetoken := ")";
   }
-  
+
   type function templatefunc(in charstringList pl_params) runs on self return charstring;
 
   type record TCCSubstitution {
@@ -62,7 +62,7 @@ module TCCTemplate_Functions {
     }
 
   type record of TCCSubstitution TCCSubstitutionList;
-  
+
   type record of charstring charstringList;
 
 
@@ -70,23 +70,23 @@ module TCCTemplate_Functions {
 
     ///////////////////////////////////////////////////////////////////////////////
     //  Function: f_Template_substitutetemplate
-    // 
+    //
     //  Purpose:
     //    Makes the substitutions according to the dictonary given
     //
     //  Parameters:
     //    pl_dict - *in* *TCCSubstitutionList* - dictionary
-    //    pl_string - *in* *charstring* - string to substitute in 
-    // 
+    //    pl_string - *in* *charstring* - string to substitute in
+    //
     //  Return Value:
     //    charstring - substituted string
     //
     //  Errors:
-    //    - 
-    // 
+    //    -
+    //
     //  Detailed description:
     //    -
-    // 
+    //
     ///////////////////////////////////////////////////////////////////////////////
     function f_Template_substitutetemplate(in TCCSubstitutionList pl_dict, in charstring pl_string) return charstring{
       var charstring ret := pl_string;
@@ -106,7 +106,7 @@ module TCCTemplate_Functions {
 	    }
 	    return ret;*/
       //heuristic implementation end/////////////////////////////////////////////
-    
+
       var charstring t_open := TCCTemplate_opentoken;
       var charstring t_close := TCCTemplate_closetoken;
 
@@ -123,7 +123,7 @@ module TCCTemplate_Functions {
 	    if (i<lengthof(ret)){
 	      if (substr(ret,i,lengthof(t_close)) == t_close){
 		i := i + lengthof(t_close);
-		var charstring variable := substr(ret, tokenstart, i - tokenstart);
+		var charstring variable := substr(ret, tokenstart+lengthof(t_open), i-tokenstart-lengthof(t_open)-lengthof(t_close));
 		//log("Variable found: ", variable,"\n");
 		var charstringList params := {};
 		var integer recindex := f_Template_lookup(pl_dict, variable, params);
@@ -154,25 +154,25 @@ module TCCTemplate_Functions {
 
     ///////////////////////////////////////////////////////////////////////////////
     //  Function: f_Template_subsfiletemplate
-    // 
+    //
     //  Purpose:
-    //    Makes the substitutions in the content of the given file, 
+    //    Makes the substitutions in the content of the given file,
     //    according to the dictonary
     //
     //  Parameters:
     //    pl_dict - *in* *TCCSubstitutionList* - dictionary
     //    pl_file - *in* *charstring* - name of the file containing the template
-    // 
+    //
     //  Return Value:
     //    charstring - substituted string
     //
     //  Errors:
     //    From FIO - in this case "" returns
-    // 
+    //
     //  Detailed description:
     //    -
-    // 
-    ///////////////////////////////////////////////////////////////////////////////  
+    //
+    ///////////////////////////////////////////////////////////////////////////////
     function f_Template_subsfiletemplate(in TCCSubstitutionList pl_dict, in charstring pl_file) return charstring{
       var integer fd := f_FIO_open_rdonly(pl_file);
       if (fd == -1){
@@ -187,7 +187,7 @@ module TCCTemplate_Functions {
 	if (f_FIO_close(fd) == -1){log("Error while closing file!");}
 	return "";
       }
-      if (f_FIO_close(fd) == -1){log("Error while closing file!");} 
+      if (f_FIO_close(fd) == -1){log("Error while closing file!");}
       return f_Template_substitutetemplate(pl_dict, content);
     }
 
@@ -196,7 +196,7 @@ module TCCTemplate_Functions {
 
   group PrivateFunctions{
 
-    function f_Template_getparams(in charstring matched, in charstring patt) 
+    function f_Template_getparams(in charstring matched, in charstring patt)
     return charstringList
     {
       var integer pc := 0;
@@ -204,13 +204,13 @@ module TCCTemplate_Functions {
       for (var integer i:=0;i<lengthof(patt);i:=i+1){
 	if (patt[i]=="(" and i!=0 and patt[i-1]!="#" and patt[i-1]!="\\"){pc:=pc+1;}
       }
-      for (var integer i:=0;i<pc;i:=i+1){ 
-	params[sizeof(params)] := regexp(matched, patt, i); 
-      } 
+      for (var integer i:=0;i<pc;i:=i+1){
+	params[sizeof(params)] := regexp(matched, patt, i);
+      }
       return params;
     }
 
-    function f_Template_lookup(in TCCSubstitutionList pl_dict, in charstring pl_var, 
+    function f_Template_lookup(in TCCSubstitutionList pl_dict, in charstring pl_var,
 			       out charstringList pl_params) return integer{
       pl_params:={};
       for (var integer i:=0; i<sizeof(pl_dict);i:=i+1){ // simple search
@@ -224,9 +224,9 @@ module TCCTemplate_Functions {
 	while (j<lengthof(pl_dict[i].patt) and k<lengthof(pl_var)){
 	  while(j<lengthof(pl_dict[i].patt) and k<lengthof(pl_var) and pl_dict[i].patt[j] == pl_var[k]){
 	    j := j + 1;
-	    k := k + 1; 
+	    k := k + 1;
 	  }
-	  if (j<lengthof(pl_dict[i].patt) and pl_dict[i].patt[j]=="\\" and j+1<lengthof(pl_dict[i].patt) and pl_dict[i].patt[j+1]=="w" and j+2<lengthof(pl_dict[i].patt)){ 
+	  if (j<lengthof(pl_dict[i].patt) and pl_dict[i].patt[j]=="\\" and j+1<lengthof(pl_dict[i].patt) and pl_dict[i].patt[j+1]=="w" and j+2<lengthof(pl_dict[i].patt)){
 	    // we have found an escape, parameter begins
 	    j := j + 2;
 	    var integer paramstart := k;
@@ -244,6 +244,6 @@ module TCCTemplate_Functions {
 	}
       }
       return -1;
-    } 
-  } 
-}
+    }
+  }
+}
\ No newline at end of file
diff --git a/src/TCCTitanMetadata.cc b/src/TCCTitanMetadata.cc
index abb20073d88d494d279a962e4d2c67209ade5ac8..581f12a2f10ff362963a284e9c3e71c041f8c643 100644
--- a/src/TCCTitanMetadata.cc
+++ b/src/TCCTitanMetadata.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCTitanMetadata.cc
 //  Description:        TCC Useful Functions: TitanMetadata Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCTitanMetadata_Functions.ttcn b/src/TCCTitanMetadata_Functions.ttcn
index decbb9f60b9bb8bf1594d8544557cdba99cf9656..7bb2c39436418cce0b578004d7de0f736bc01645 100644
--- a/src/TCCTitanMetadata_Functions.ttcn
+++ b/src/TCCTitanMetadata_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCTitanMetadata_Functions.ttcn
 //  Description:        TCC Useful Functions: TitanMetadata Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCUsefulFunctions_Library.grp b/src/TCCUsefulFunctions_Library.grp
index 5fc46e2bfe7d44085e3620eb3c17a25399d112fd..d5704779575f6049bbc4d6adc621d7ba952ceef8 100644
--- a/src/TCCUsefulFunctions_Library.grp
+++ b/src/TCCUsefulFunctions_Library.grp
@@ -11,7 +11,7 @@
 //
 //  File:        TCCUsefulFunctions_Library.grp
 //  Description: FileGroup file for TCCUsefulFunctions ApplicationLibrary
-//  Rev:         R30A
+//  Rev:         R35B
 //  Prodnr:      CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -50,6 +50,8 @@
     <File path="TCCMessageHandling_Functions.ttcn" />
     <File path="TCCSecurity.cc" />
     <File path="TCCSecurity_Functions.ttcn" />
+    <File path="TCCOpenSecurity.cc" />
+    <File path="TCCOpenSecurity_Functions.ttcn" />
     <File path="TCCSystem.cc" />
     <File path="TCCSystem_Functions.ttcn" />
     <File path="TCCTemplate_Functions.ttcn" />
@@ -57,8 +59,6 @@
     <File path="TCCTitanMetadata_Functions.ttcn" />
     <File path="aka_algorythm_set.c" />
     <File path="aka_algorythm_set.h" />
-    <File path="digcalc.c" />
-    <File path="digcalc.h" />
     <File path="zuc.c" />
     <File path="zuc.h" />
     <File path="snow3g.c" />
diff --git a/src/TCCUsefulFunctions_PermutatedParameters.grp b/src/TCCUsefulFunctions_PermutatedParameters.grp
index 597c32db95bd540cbc3135a6ceb625957b4cbddb..ad37c1d3724edcdc0a594fd8e0b9d46661dcbee4 100644
--- a/src/TCCUsefulFunctions_PermutatedParameters.grp
+++ b/src/TCCUsefulFunctions_PermutatedParameters.grp
@@ -11,7 +11,7 @@
 //
 //  File:        TCCUsefulFunctions_PermutatedParameters.grp
 //  Description: FileGroup file for TCCUsefulFunctions Permutated Parameters
-//  Rev:         R30A
+//  Rev:         R35B
 //  Prodnr:      CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCXPathSupport.cc b/src/TCCXPathSupport.cc
index 17058ff699b9b5501be361c3c3326b8cf425ee7e..cf1077a7e954f9e18ce6c590876093f74178d689 100644
--- a/src/TCCXPathSupport.cc
+++ b/src/TCCXPathSupport.cc
@@ -10,7 +10,7 @@
 //
 //  File:               TCCXPathSupport_Functions.ttcn
 //  Description:        TCC Useful Functions: XPath Support Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/TCCXPathSupport_Functions.ttcn b/src/TCCXPathSupport_Functions.ttcn
index 1bc99e7ca19945db2d4fc9c076cafacc1039ff1b..4d6b0c93a1e8ce876b6620acad1a3d79dae7aecb 100644
--- a/src/TCCXPathSupport_Functions.ttcn
+++ b/src/TCCXPathSupport_Functions.ttcn
@@ -10,7 +10,7 @@
 //
 //  File:               TCCXPathSupport_Functions.ttcn
 //  Description:        TCC Useful Functions: XPath Support Functions
-//  Rev:                R30A
+//  Rev:                R35B
 //  Prodnr:             CNL 113 472
 //
 ///////////////////////////////////////////////////////////////////////////////