[UTC][yaca][ACR-641][Add initial TCs for yaca]
authorDongsun Lee <ds73.lee@samsung.com>
Wed, 10 Aug 2016 07:22:45 +0000 (16:22 +0900)
committerDong Sun Lee <ds73.lee@samsung.com>
Tue, 16 Aug 2016 10:25:34 +0000 (03:25 -0700)
Change-Id: I2fbebef315371177ef597b71302a1481e4ef1671
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
17 files changed:
packaging/utc/core-yaca-tests.spec [new file with mode: 0644]
packaging/utc/core-yaca-tests.xml [new file with mode: 0644]
src/utc/yaca/CMakeLists.txt [new file with mode: 0644]
src/utc/yaca/lorem.c [new file with mode: 0644]
src/utc/yaca/lorem.h [new file with mode: 0644]
src/utc/yaca/tct-yaca-core.c [new file with mode: 0644]
src/utc/yaca/tct-yaca-core_common_iot.h [new file with mode: 0644]
src/utc/yaca/tct-yaca-core_mobile.h [new file with mode: 0644]
src/utc/yaca/tct-yaca-core_tv.h [new file with mode: 0644]
src/utc/yaca/tct-yaca-core_wearable.h [new file with mode: 0644]
src/utc/yaca/utc-yaca-crypto.c [new file with mode: 0644]
src/utc/yaca/utc-yaca-digest.c [new file with mode: 0644]
src/utc/yaca/utc-yaca-encrypt.c [new file with mode: 0644]
src/utc/yaca/utc-yaca-key.c [new file with mode: 0644]
src/utc/yaca/utc-yaca-seal.c [new file with mode: 0644]
src/utc/yaca/utc-yaca-sign.c [new file with mode: 0644]
src/utc/yaca/utc-yaca-simple.c [new file with mode: 0644]

diff --git a/packaging/utc/core-yaca-tests.spec b/packaging/utc/core-yaca-tests.spec
new file mode 100644 (file)
index 0000000..f2d1c14
--- /dev/null
@@ -0,0 +1,76 @@
+%define MODULE_NAME yaca
+%define MODULE_LIBNAME yaca
+Name:       core-%{MODULE_NAME}-tests
+Summary:    Core API unit TC (%{name})
+Version:    0.1
+Release:    0
+Group:      Development/Tools
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(%{MODULE_LIBNAME})
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(capi-system-info)
+
+%description
+Core API unit TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+
+%if %{?ASAN_BUILD:1}0
+       %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_TV:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+%else
+       %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_TV:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+       %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+       cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="utc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       %endif
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+mkdir -p %{buildroot}/usr/share/packages/
+cp packaging/utc/%{name}.xml %{buildroot}/usr/share/packages/
+mkdir -p %{buildroot}/usr/apps/%{name}/bin
+%post
+
+%postun
+
+
+%files
+/usr/apps/%{name}/*
+/usr/share/packages/%{name}.xml
+/usr/share/license/%{name}
diff --git a/packaging/utc/core-yaca-tests.xml b/packaging/utc/core-yaca-tests.xml
new file mode 100644 (file)
index 0000000..77dd925
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="core-yaca-tests" version="0.1.0" api-version="3.0">
+    <label>CoreYacaTest</label>
+    <author email="test@tizen.org" href="www.tizen.org">test</author>
+    <description>Core API test Application</description>
+    <ui-application appid="core.yaca-tests" exec="/usr/apps/core-yaca-tests/bin/tct-yaca-core" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+    </ui-application>
+</manifest>
diff --git a/src/utc/yaca/CMakeLists.txt b/src/utc/yaca/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d6cbc58
--- /dev/null
@@ -0,0 +1,48 @@
+SET(PKG_NAME "yaca")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "yaca")
+SET(TC_SOURCES
+       lorem.c
+       utc-yaca-crypto.c
+       utc-yaca-digest.c
+       utc-yaca-encrypt.c
+       utc-yaca-key.c
+       utc-yaca-seal.c
+       utc-yaca-sign.c
+       utc-yaca-simple.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+       ${CAPI_LIB}
+       capi-appfw-application
+       capi-system-info
+       glib-2.0
+       bundle
+       dlog
+       elementary
+)
+
+INCLUDE_DIRECTORIES(
+       ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+       ${${CAPI_LIB}_LIBRARIES}
+       bundle
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+    DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
diff --git a/src/utc/yaca/lorem.c b/src/utc/yaca/lorem.c
new file mode 100644 (file)
index 0000000..d6f9f42
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+/**
+ * @file lorem.c
+ * @brief Lorem Ipsum
+ */
+
+#include "lorem.h"
+
+const char lorem8[LOREM8_SIZE] = "Lorem i";
+const char lorem16[LOREM16_SIZE] = "Lorem ipsum dol";
+const char lorem1024[LOREM1024_SIZE] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec non dolor tincidunt, vehicula erat non, pulvinar nisl. Suspendisse gravida commodo hendrerit. Sed ex magna, aliquet malesuada lectus ut, porttitor tincidunt ante. Nulla facilisi. Morbi nec scelerisque risus. Sed a gravida sapien. Cras sed neque bibendum, dapibus lectus sed, porta nulla. Morbi tristique velit lacus, at luctus turpis mollis sed. Nam quis sapien eu magna cursus venenatis. Phasellus et vestibulum urna, non pellentesque ex. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam pretium aliquam porta.\
+Morbi magna metus, commodo in fermentum id, mattis pretium mauris. Donec sed rhoncus justo. Duis fringilla sem quis velit dignissim bibendum. Sed porta efficitur ipsum, in dignissim magna molestie eu. Sed elementum maximus risus. Quisque cursus urna lectus, sit amet fringilla purus tempor eu. Praesent tincidunt dolor sit amet dolor vulputate, et molestie tellus euismod. Proin suscipit dictum amet.";
+
+const char lorem4096[LOREM4096_SIZE] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus congue semper ipsum, ac convallis magna rhoncus sit amet. Donec pellentesque maximus convallis. Mauris ut egestas sem. Maecenas efficitur suscipit auctor. Nunc malesuada laoreet porttitor. Donec gravida tortor nisi, in mattis lectus porta ut. Integer vehicula eros et tellus placerat, nec fermentum justo aliquet.\
+Maecenas metus massa, ultrices et ultricies sed, imperdiet nec dolor. Nam eget massa eros. Proin vitae laoreet metus, at scelerisque massa. Nullam convallis dolor id nisl iaculis, a gravida risus pretium. Proin non nunc eget nibh fermentum dignissim. Nullam tristique, odio eget rutrum sagittis, tortor purus cursus nunc, nec iaculis quam nunc ac metus. Cras ut tortor a eros porta vehicula non at lectus. Aliquam volutpat quis nisi ut mattis. Curabitur semper vehicula ultrices. Aenean cursus laoreet venenatis. Aenean vulputate, nisl id facilisis fringilla, neque velit posuere libero, et viverra tortor felis vitae urna. Sed in congue nunc. Fusce molestie tempor pharetra. Cras sodales pulvinar nunc non sollicitudin.\
+Maecenas vehicula metus ac tristique ultricies. Suspendisse potenti. Pellentesque suscipit egestas augue, sed dictum orci. Pellentesque eu lorem ultricies, vestibulum est in, bibendum turpis. Proin placerat tincidunt metus, eget volutpat dolor. Pellentesque varius leo eget velit lobortis, sit amet congue orci bibendum. Aliquam vitae posuere lorem. Donec sed convallis diam. Quisque aliquam interdum purus, eu ornare ex ullamcorper iaculis. In sit amet nisl eu nisl ultricies dapibus. Aenean finibus efficitur elit ut sodales. Nam sit amet auctor sem, eu iaculis nunc. Vivamus mattis arcu a viverra faucibus. In dignissim, nisi sit amet consectetur tempus, lorem dui fringilla augue, sit amet lacinia lectus sapien efficitur odio.\
+Nullam et egestas enim. Nam sit amet mi malesuada, dapibus felis quis, viverra mauris. Ut quis enim eu neque porta vehicula. Etiam ullamcorper vitae turpis vehicula blandit. Maecenas blandit tristique semper. Aliquam at sagittis enim. Donec quis molestie urna. Duis ut urna blandit, pellentesque magna ultrices, dignissim mi. Morbi fermentum ex massa, ut facilisis est tincidunt vel. Nam sed erat in lacus molestie mattis quis ut leo. Phasellus tempus elit urna, eget sagittis purus volutpat sed. Suspendisse aliquam, sem vel gravida lobortis, tortor orci ornare nisi, sed mollis ligula sem nec risus. In a ex nibh. Praesent odio est, molestie sed vestibulum id, varius sit amet lectus. Donec vel diam efficitur, tristique ligula a, aliquet felis. Nullam sit amet neque tellus.\
+Phasellus aliquet non libero non aliquet. Aliquam efficitur ultrices tortor vitae lobortis. Pellentesque sed dolor quis nisl faucibus eleifend vitae ultrices est. Integer et libero quis nisl sollicitudin volutpat sit amet a quam. Vivamus commodo dolor augue, volutpat dapibus odio dapibus et. Nulla sed congue nisl. Duis nunc sem, condimentum nec neque ac, blandit blandit quam. Integer tincidunt ipsum nec risus viverra mollis. In porta porttitor mattis. Nulla ac eleifend nibh. Vivamus suscipit at nunc ac interdum. In fermentum fringilla odio.\
+Sed nec erat eget mauris varius pulvinar. Ut fermentum ante non erat elementum, vitae tempor velit blandit. Curabitur turpis tellus, sodales sit amet mattis nec, volutpat ac magna. Nulla quam orci, rutrum sit amet imperdiet ut, iaculis in nisl. Donec semper vitae tellus nec bibendum. Nam pharetra hendrerit sapien quis rutrum. Morbi tincidunt justo ut sodales ullamcorper. Suspendisse eget pellentesque nulla, non placerat purus. Donec placerat id turpis in interdum. Curabitur lobortis risus et placerat commodo. Morbi pulvinar eros leo, scelerisque rutrum arcu pretium at. Quisque eget diam dui. Quisque bibendum luctus arcu quis semper. Nullam erat lacus, lacinia sit amet neque aliquam, lacinia maximus lorem.\
+Nunc ac purus vel sem laoreet interdum quis eget ligula. Aenean id nisl ut quam vehicula pretium sed sit amet urna. Aenean diam lorem, vehicula et sapien nec, pellentesque consectetur libero. Cras fringilla nibh eu libero nullam.";
diff --git a/src/utc/yaca/lorem.h b/src/utc/yaca/lorem.h
new file mode 100644 (file)
index 0000000..8d1ad45
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+/**
+ * @file lorem.h
+ * @brief
+ */
+
+#ifndef LOREM_H
+#define LOREM_H
+
+#include <stddef.h>
+
+/**
+ * Test strings, sizes include null-termination
+ */
+extern const char lorem8[];
+extern const char lorem16[];
+extern const char lorem1024[];
+extern const char lorem4096[];
+
+/**
+ * Sizes of test strings
+ */
+#define LOREM8_SIZE ((size_t)8)
+#define LOREM16_SIZE ((size_t)16)
+#define LOREM1024_SIZE ((size_t)1024)
+#define LOREM4096_SIZE ((size_t)4096)
+
+#endif
diff --git a/src/utc/yaca/tct-yaca-core.c b/src/utc/yaca/tct-yaca-core.c
new file mode 100644 (file)
index 0000000..6b6d47f
--- /dev/null
@@ -0,0 +1,134 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "tct_common.h"
+
+#ifdef MOBILE  //Starts MOBILE
+#include "tct-yaca-core_mobile.h"
+#endif  //MOBILE  //End MOBILE
+
+#ifdef WEARABLE  //Starts WEARABLE
+#include "tct-yaca-core_wearable.h"
+#endif  //WEARABLE  //End WEARABLE
+
+#ifdef TV  //Starts TV
+#include "tct-yaca-core_tv.h"
+#endif  //TV  //End TV
+
+#ifdef COMMON_IOT  //Starts COMMON_IOT
+#include "tct-yaca-core_common_iot.h"
+#endif  //COMMON_IOT  //End COMMON_IOT
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <app.h>
+#include <dlog.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+       Evas_Object *win;
+       Evas_Object *conform;
+       Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+       return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+       char* pszGetTCName = NULL;
+       int i = 0, result = 0, nRet = 0;
+       nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+       if (nRet != APP_CONTROL_ERROR_NONE) {
+               dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+               PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+               PRINT_TC_RESULT("%d", 1);
+               FREE_MEMORY_TC(pszGetTCName);
+               return;
+       }
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+       for (i = 0; tc_array[i].name; i++) {
+               if (0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName))) {
+                       DUMP_UTC_ERRLOG();
+                       if (tc_array[i].startup) {
+                               dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+                               tc_array[i].startup();
+                       }
+
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+                       result = tc_array[i].function();
+                       dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+                       if (tc_array[i].cleanup) {
+                               dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+                               tc_array[i].cleanup();
+                       }
+
+                       CLOSE_UTC_ERRLOG();
+                       PRINT_TC_RESULT("%d", result);
+                       FREE_MEMORY_TC(pszGetTCName);
+                       return;
+               }
+       }
+
+       dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+       PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+       PRINT_TC_RESULT("%d", 1);
+       FREE_MEMORY_TC(pszGetTCName);
+       return;
+}
+
+static void app_terminate(void *data)
+{
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+       int ret = 0;
+       appdata_s ad = {0,};
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.app_control = app_control;
+
+       //setting gcda file location for coverage
+       setenv("GCOV_PREFIX", "/tmp", 1);
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE) {
+               dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+               PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+               PRINT_TC_RESULT("%d", 1);
+               return ret;
+       }
+
+       dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+       return ret;
+}
diff --git a/src/utc/yaca/tct-yaca-core_common_iot.h b/src/utc/yaca/tct-yaca-core_common_iot.h
new file mode 100644 (file)
index 0000000..a2d50ad
--- /dev/null
@@ -0,0 +1,236 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_YACA_NATIVE_H__
+#define __TCT_YACA_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void utc_yaca_crypto_startup(void);
+extern void utc_yaca_crypto_cleanup(void);
+extern void utc_yaca_digest_startup(void);
+extern void utc_yaca_digest_cleanup(void);
+extern void utc_yaca_encrypt_startup(void);
+extern void utc_yaca_encrypt_cleanup(void);
+extern void utc_yaca_key_startup(void);
+extern void utc_yaca_key_cleanup(void);
+extern void utc_yaca_seal_startup(void);
+extern void utc_yaca_seal_cleanup(void);
+extern void utc_yaca_sign_startup(void);
+extern void utc_yaca_sign_cleanup(void);
+extern void utc_yaca_simple_startup(void);
+extern void utc_yaca_simple_cleanup(void);
+
+extern int utc_yaca_initialize_p(void);
+extern int utc_yaca_cleanup_p(void);
+extern int utc_yaca_malloc_p(void);
+extern int utc_yaca_malloc_n(void);
+extern int utc_yaca_zalloc_p(void);
+extern int utc_yaca_zalloc_n(void);
+extern int utc_yaca_realloc_p(void);
+extern int utc_yaca_realloc_n(void);
+extern int utc_yaca_free_p(void);
+extern int utc_yaca_memcmp_p(void);
+extern int utc_yaca_memcmp_n(void);
+extern int utc_yaca_randomize_bytes_p(void);
+extern int utc_yaca_randomize_bytes_n(void);
+extern int utc_yaca_context_set_property_p(void);
+extern int utc_yaca_context_set_property_n(void);
+extern int utc_yaca_context_get_property_p(void);
+extern int utc_yaca_context_get_property_n(void);
+extern int utc_yaca_context_destroy_p(void);
+extern int utc_yaca_context_get_output_length_p(void);
+extern int utc_yaca_context_get_output_length_n(void);
+extern int utc_yaca_digest_initialize_p(void);
+extern int utc_yaca_digest_initialize_n(void);
+extern int utc_yaca_digest_update_p(void);
+extern int utc_yaca_digest_update_n(void);
+extern int utc_yaca_digest_finalize_p(void);
+extern int utc_yaca_digest_finalize_n(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_p(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_n(void);
+extern int utc_yaca_encrypt_initialize_p(void);
+extern int utc_yaca_encrypt_initialize_n(void);
+extern int utc_yaca_encrypt_update_p(void);
+extern int utc_yaca_encrypt_update_n(void);
+extern int utc_yaca_encrypt_finalize_p(void);
+extern int utc_yaca_encrypt_finalize_n(void);
+extern int utc_yaca_decrypt_initialize_p(void);
+extern int utc_yaca_decrypt_initialize_n(void);
+extern int utc_yaca_decrypt_update_p(void);
+extern int utc_yaca_decrypt_update_n(void);
+extern int utc_yaca_decrypt_finalize_p(void);
+extern int utc_yaca_decrypt_finalize_n(void);
+extern int utc_yaca_key_get_type_p(void);
+extern int utc_yaca_key_get_type_n(void);
+extern int utc_yaca_key_get_bit_length_p(void);
+extern int utc_yaca_key_get_bit_length_n(void);
+extern int utc_yaca_key_import_p(void);
+extern int utc_yaca_key_import_n(void);
+extern int utc_yaca_key_export_p(void);
+extern int utc_yaca_key_export_n(void);
+extern int utc_yaca_key_generate_p(void);
+extern int utc_yaca_key_generate_n(void);
+extern int utc_yaca_key_extract_public_p(void);
+extern int utc_yaca_key_extract_public_n(void);
+extern int utc_yaca_key_destroy_p(void);
+extern int utc_yaca_key_derive_pbkdf2_p(void);
+extern int utc_yaca_key_derive_pbkdf2_n(void);
+extern int utc_yaca_seal_initialize_p(void);
+extern int utc_yaca_seal_initialize_n(void);
+extern int utc_yaca_seal_update_p(void);
+extern int utc_yaca_seal_update_n(void);
+extern int utc_yaca_seal_finalize_p(void);
+extern int utc_yaca_seal_finalize_n(void);
+extern int utc_yaca_open_initialize_p(void);
+extern int utc_yaca_open_initialize_n(void);
+extern int utc_yaca_open_update_p(void);
+extern int utc_yaca_open_update_n(void);
+extern int utc_yaca_open_finalize_p(void);
+extern int utc_yaca_open_finalize_n(void);
+extern int utc_yaca_sign_initialize_p(void);
+extern int utc_yaca_sign_initialize_n(void);
+extern int utc_yaca_sign_initialize_hmac_p(void);
+extern int utc_yaca_sign_initialize_hmac_n(void);
+extern int utc_yaca_sign_initialize_cmac_p(void);
+extern int utc_yaca_sign_initialize_cmac_n(void);
+extern int utc_yaca_sign_update_p(void);
+extern int utc_yaca_sign_update_n(void);
+extern int utc_yaca_sign_finalize_p(void);
+extern int utc_yaca_sign_finalize_n(void);
+extern int utc_yaca_verify_initialize_p(void);
+extern int utc_yaca_verify_initialize_n(void);
+extern int utc_yaca_verify_update_p(void);
+extern int utc_yaca_verify_update_n(void);
+extern int utc_yaca_verify_finalize_p(void);
+extern int utc_yaca_verify_finalize_n(void);
+extern int utc_yaca_simple_calculate_digest_p(void);
+extern int utc_yaca_simple_calculate_digest_n(void);
+extern int utc_yaca_simple_encrypt_p(void);
+extern int utc_yaca_simple_encrypt_n(void);
+extern int utc_yaca_simple_decrypt_p(void);
+extern int utc_yaca_simple_decrypt_n(void);
+extern int utc_yaca_simple_calculate_signature_p(void);
+extern int utc_yaca_simple_calculate_signature_n(void);
+extern int utc_yaca_simple_verify_signature_p(void);
+extern int utc_yaca_simple_verify_signature_n(void);
+extern int utc_yaca_simple_calculate_hmac_p(void);
+extern int utc_yaca_simple_calculate_hmac_n(void);
+extern int utc_yaca_simple_calculate_cmac_p(void);
+extern int utc_yaca_simple_calculate_cmac_n(void);
+
+testcase tc_array[] = {
+       {"utc_yaca_initialize_p", utc_yaca_initialize_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_cleanup_p", utc_yaca_cleanup_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_p", utc_yaca_malloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_n", utc_yaca_malloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_p", utc_yaca_zalloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_n", utc_yaca_zalloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_p", utc_yaca_realloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_n", utc_yaca_realloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_free_p", utc_yaca_free_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_p", utc_yaca_memcmp_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_n", utc_yaca_memcmp_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_p", utc_yaca_randomize_bytes_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_n", utc_yaca_randomize_bytes_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_p", utc_yaca_context_set_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_n", utc_yaca_context_set_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_p", utc_yaca_context_get_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_n", utc_yaca_context_get_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_destroy_p", utc_yaca_context_destroy_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_p", utc_yaca_context_get_output_length_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_n", utc_yaca_context_get_output_length_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_digest_initialize_p", utc_yaca_digest_initialize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_initialize_n", utc_yaca_digest_initialize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_p", utc_yaca_digest_update_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_n", utc_yaca_digest_update_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_p", utc_yaca_digest_finalize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_n", utc_yaca_digest_finalize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_p", utc_yaca_encrypt_get_iv_bit_length_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_n", utc_yaca_encrypt_get_iv_bit_length_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_p", utc_yaca_encrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_n", utc_yaca_encrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_p", utc_yaca_encrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_n", utc_yaca_encrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_p", utc_yaca_encrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_n", utc_yaca_encrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_p", utc_yaca_decrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_n", utc_yaca_decrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_p", utc_yaca_decrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_n", utc_yaca_decrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_p", utc_yaca_decrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_n", utc_yaca_decrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_key_get_type_p", utc_yaca_key_get_type_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_type_n", utc_yaca_key_get_type_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_p", utc_yaca_key_get_bit_length_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_n", utc_yaca_key_get_bit_length_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_p", utc_yaca_key_import_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_n", utc_yaca_key_import_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_p", utc_yaca_key_export_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_n", utc_yaca_key_export_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_p", utc_yaca_key_generate_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_n", utc_yaca_key_generate_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_p", utc_yaca_key_extract_public_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_n", utc_yaca_key_extract_public_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_destroy_p", utc_yaca_key_destroy_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_p", utc_yaca_key_derive_pbkdf2_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_n", utc_yaca_key_derive_pbkdf2_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_seal_initialize_p", utc_yaca_seal_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_initialize_n", utc_yaca_seal_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_p", utc_yaca_seal_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_n", utc_yaca_seal_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_p", utc_yaca_seal_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_n", utc_yaca_seal_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_p", utc_yaca_open_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_n", utc_yaca_open_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_p", utc_yaca_open_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_n", utc_yaca_open_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_p", utc_yaca_open_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_n", utc_yaca_open_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_sign_initialize_p", utc_yaca_sign_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_n", utc_yaca_sign_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_p", utc_yaca_sign_initialize_hmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_n", utc_yaca_sign_initialize_hmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_p", utc_yaca_sign_initialize_cmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_n", utc_yaca_sign_initialize_cmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_p", utc_yaca_sign_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_n", utc_yaca_sign_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_p", utc_yaca_sign_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_n", utc_yaca_sign_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_p", utc_yaca_verify_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_n", utc_yaca_verify_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_p", utc_yaca_verify_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_n", utc_yaca_verify_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_p", utc_yaca_verify_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_n", utc_yaca_verify_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_simple_calculate_digest_p", utc_yaca_simple_calculate_digest_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_digest_n", utc_yaca_simple_calculate_digest_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_p", utc_yaca_simple_encrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_n", utc_yaca_simple_encrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_p", utc_yaca_simple_decrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_n", utc_yaca_simple_decrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_p", utc_yaca_simple_calculate_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_n", utc_yaca_simple_calculate_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_p", utc_yaca_simple_verify_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_n", utc_yaca_simple_verify_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_p", utc_yaca_simple_calculate_hmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_n", utc_yaca_simple_calculate_hmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_p", utc_yaca_simple_calculate_cmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_n", utc_yaca_simple_calculate_cmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {NULL, NULL}
+};
+
+#endif // __TCT_YACA_NATIVE_H__
diff --git a/src/utc/yaca/tct-yaca-core_mobile.h b/src/utc/yaca/tct-yaca-core_mobile.h
new file mode 100644 (file)
index 0000000..a2d50ad
--- /dev/null
@@ -0,0 +1,236 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_YACA_NATIVE_H__
+#define __TCT_YACA_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void utc_yaca_crypto_startup(void);
+extern void utc_yaca_crypto_cleanup(void);
+extern void utc_yaca_digest_startup(void);
+extern void utc_yaca_digest_cleanup(void);
+extern void utc_yaca_encrypt_startup(void);
+extern void utc_yaca_encrypt_cleanup(void);
+extern void utc_yaca_key_startup(void);
+extern void utc_yaca_key_cleanup(void);
+extern void utc_yaca_seal_startup(void);
+extern void utc_yaca_seal_cleanup(void);
+extern void utc_yaca_sign_startup(void);
+extern void utc_yaca_sign_cleanup(void);
+extern void utc_yaca_simple_startup(void);
+extern void utc_yaca_simple_cleanup(void);
+
+extern int utc_yaca_initialize_p(void);
+extern int utc_yaca_cleanup_p(void);
+extern int utc_yaca_malloc_p(void);
+extern int utc_yaca_malloc_n(void);
+extern int utc_yaca_zalloc_p(void);
+extern int utc_yaca_zalloc_n(void);
+extern int utc_yaca_realloc_p(void);
+extern int utc_yaca_realloc_n(void);
+extern int utc_yaca_free_p(void);
+extern int utc_yaca_memcmp_p(void);
+extern int utc_yaca_memcmp_n(void);
+extern int utc_yaca_randomize_bytes_p(void);
+extern int utc_yaca_randomize_bytes_n(void);
+extern int utc_yaca_context_set_property_p(void);
+extern int utc_yaca_context_set_property_n(void);
+extern int utc_yaca_context_get_property_p(void);
+extern int utc_yaca_context_get_property_n(void);
+extern int utc_yaca_context_destroy_p(void);
+extern int utc_yaca_context_get_output_length_p(void);
+extern int utc_yaca_context_get_output_length_n(void);
+extern int utc_yaca_digest_initialize_p(void);
+extern int utc_yaca_digest_initialize_n(void);
+extern int utc_yaca_digest_update_p(void);
+extern int utc_yaca_digest_update_n(void);
+extern int utc_yaca_digest_finalize_p(void);
+extern int utc_yaca_digest_finalize_n(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_p(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_n(void);
+extern int utc_yaca_encrypt_initialize_p(void);
+extern int utc_yaca_encrypt_initialize_n(void);
+extern int utc_yaca_encrypt_update_p(void);
+extern int utc_yaca_encrypt_update_n(void);
+extern int utc_yaca_encrypt_finalize_p(void);
+extern int utc_yaca_encrypt_finalize_n(void);
+extern int utc_yaca_decrypt_initialize_p(void);
+extern int utc_yaca_decrypt_initialize_n(void);
+extern int utc_yaca_decrypt_update_p(void);
+extern int utc_yaca_decrypt_update_n(void);
+extern int utc_yaca_decrypt_finalize_p(void);
+extern int utc_yaca_decrypt_finalize_n(void);
+extern int utc_yaca_key_get_type_p(void);
+extern int utc_yaca_key_get_type_n(void);
+extern int utc_yaca_key_get_bit_length_p(void);
+extern int utc_yaca_key_get_bit_length_n(void);
+extern int utc_yaca_key_import_p(void);
+extern int utc_yaca_key_import_n(void);
+extern int utc_yaca_key_export_p(void);
+extern int utc_yaca_key_export_n(void);
+extern int utc_yaca_key_generate_p(void);
+extern int utc_yaca_key_generate_n(void);
+extern int utc_yaca_key_extract_public_p(void);
+extern int utc_yaca_key_extract_public_n(void);
+extern int utc_yaca_key_destroy_p(void);
+extern int utc_yaca_key_derive_pbkdf2_p(void);
+extern int utc_yaca_key_derive_pbkdf2_n(void);
+extern int utc_yaca_seal_initialize_p(void);
+extern int utc_yaca_seal_initialize_n(void);
+extern int utc_yaca_seal_update_p(void);
+extern int utc_yaca_seal_update_n(void);
+extern int utc_yaca_seal_finalize_p(void);
+extern int utc_yaca_seal_finalize_n(void);
+extern int utc_yaca_open_initialize_p(void);
+extern int utc_yaca_open_initialize_n(void);
+extern int utc_yaca_open_update_p(void);
+extern int utc_yaca_open_update_n(void);
+extern int utc_yaca_open_finalize_p(void);
+extern int utc_yaca_open_finalize_n(void);
+extern int utc_yaca_sign_initialize_p(void);
+extern int utc_yaca_sign_initialize_n(void);
+extern int utc_yaca_sign_initialize_hmac_p(void);
+extern int utc_yaca_sign_initialize_hmac_n(void);
+extern int utc_yaca_sign_initialize_cmac_p(void);
+extern int utc_yaca_sign_initialize_cmac_n(void);
+extern int utc_yaca_sign_update_p(void);
+extern int utc_yaca_sign_update_n(void);
+extern int utc_yaca_sign_finalize_p(void);
+extern int utc_yaca_sign_finalize_n(void);
+extern int utc_yaca_verify_initialize_p(void);
+extern int utc_yaca_verify_initialize_n(void);
+extern int utc_yaca_verify_update_p(void);
+extern int utc_yaca_verify_update_n(void);
+extern int utc_yaca_verify_finalize_p(void);
+extern int utc_yaca_verify_finalize_n(void);
+extern int utc_yaca_simple_calculate_digest_p(void);
+extern int utc_yaca_simple_calculate_digest_n(void);
+extern int utc_yaca_simple_encrypt_p(void);
+extern int utc_yaca_simple_encrypt_n(void);
+extern int utc_yaca_simple_decrypt_p(void);
+extern int utc_yaca_simple_decrypt_n(void);
+extern int utc_yaca_simple_calculate_signature_p(void);
+extern int utc_yaca_simple_calculate_signature_n(void);
+extern int utc_yaca_simple_verify_signature_p(void);
+extern int utc_yaca_simple_verify_signature_n(void);
+extern int utc_yaca_simple_calculate_hmac_p(void);
+extern int utc_yaca_simple_calculate_hmac_n(void);
+extern int utc_yaca_simple_calculate_cmac_p(void);
+extern int utc_yaca_simple_calculate_cmac_n(void);
+
+testcase tc_array[] = {
+       {"utc_yaca_initialize_p", utc_yaca_initialize_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_cleanup_p", utc_yaca_cleanup_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_p", utc_yaca_malloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_n", utc_yaca_malloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_p", utc_yaca_zalloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_n", utc_yaca_zalloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_p", utc_yaca_realloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_n", utc_yaca_realloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_free_p", utc_yaca_free_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_p", utc_yaca_memcmp_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_n", utc_yaca_memcmp_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_p", utc_yaca_randomize_bytes_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_n", utc_yaca_randomize_bytes_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_p", utc_yaca_context_set_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_n", utc_yaca_context_set_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_p", utc_yaca_context_get_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_n", utc_yaca_context_get_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_destroy_p", utc_yaca_context_destroy_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_p", utc_yaca_context_get_output_length_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_n", utc_yaca_context_get_output_length_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_digest_initialize_p", utc_yaca_digest_initialize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_initialize_n", utc_yaca_digest_initialize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_p", utc_yaca_digest_update_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_n", utc_yaca_digest_update_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_p", utc_yaca_digest_finalize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_n", utc_yaca_digest_finalize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_p", utc_yaca_encrypt_get_iv_bit_length_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_n", utc_yaca_encrypt_get_iv_bit_length_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_p", utc_yaca_encrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_n", utc_yaca_encrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_p", utc_yaca_encrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_n", utc_yaca_encrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_p", utc_yaca_encrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_n", utc_yaca_encrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_p", utc_yaca_decrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_n", utc_yaca_decrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_p", utc_yaca_decrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_n", utc_yaca_decrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_p", utc_yaca_decrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_n", utc_yaca_decrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_key_get_type_p", utc_yaca_key_get_type_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_type_n", utc_yaca_key_get_type_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_p", utc_yaca_key_get_bit_length_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_n", utc_yaca_key_get_bit_length_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_p", utc_yaca_key_import_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_n", utc_yaca_key_import_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_p", utc_yaca_key_export_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_n", utc_yaca_key_export_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_p", utc_yaca_key_generate_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_n", utc_yaca_key_generate_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_p", utc_yaca_key_extract_public_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_n", utc_yaca_key_extract_public_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_destroy_p", utc_yaca_key_destroy_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_p", utc_yaca_key_derive_pbkdf2_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_n", utc_yaca_key_derive_pbkdf2_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_seal_initialize_p", utc_yaca_seal_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_initialize_n", utc_yaca_seal_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_p", utc_yaca_seal_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_n", utc_yaca_seal_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_p", utc_yaca_seal_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_n", utc_yaca_seal_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_p", utc_yaca_open_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_n", utc_yaca_open_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_p", utc_yaca_open_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_n", utc_yaca_open_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_p", utc_yaca_open_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_n", utc_yaca_open_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_sign_initialize_p", utc_yaca_sign_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_n", utc_yaca_sign_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_p", utc_yaca_sign_initialize_hmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_n", utc_yaca_sign_initialize_hmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_p", utc_yaca_sign_initialize_cmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_n", utc_yaca_sign_initialize_cmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_p", utc_yaca_sign_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_n", utc_yaca_sign_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_p", utc_yaca_sign_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_n", utc_yaca_sign_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_p", utc_yaca_verify_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_n", utc_yaca_verify_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_p", utc_yaca_verify_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_n", utc_yaca_verify_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_p", utc_yaca_verify_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_n", utc_yaca_verify_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_simple_calculate_digest_p", utc_yaca_simple_calculate_digest_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_digest_n", utc_yaca_simple_calculate_digest_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_p", utc_yaca_simple_encrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_n", utc_yaca_simple_encrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_p", utc_yaca_simple_decrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_n", utc_yaca_simple_decrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_p", utc_yaca_simple_calculate_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_n", utc_yaca_simple_calculate_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_p", utc_yaca_simple_verify_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_n", utc_yaca_simple_verify_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_p", utc_yaca_simple_calculate_hmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_n", utc_yaca_simple_calculate_hmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_p", utc_yaca_simple_calculate_cmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_n", utc_yaca_simple_calculate_cmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {NULL, NULL}
+};
+
+#endif // __TCT_YACA_NATIVE_H__
diff --git a/src/utc/yaca/tct-yaca-core_tv.h b/src/utc/yaca/tct-yaca-core_tv.h
new file mode 100644 (file)
index 0000000..a2d50ad
--- /dev/null
@@ -0,0 +1,236 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_YACA_NATIVE_H__
+#define __TCT_YACA_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void utc_yaca_crypto_startup(void);
+extern void utc_yaca_crypto_cleanup(void);
+extern void utc_yaca_digest_startup(void);
+extern void utc_yaca_digest_cleanup(void);
+extern void utc_yaca_encrypt_startup(void);
+extern void utc_yaca_encrypt_cleanup(void);
+extern void utc_yaca_key_startup(void);
+extern void utc_yaca_key_cleanup(void);
+extern void utc_yaca_seal_startup(void);
+extern void utc_yaca_seal_cleanup(void);
+extern void utc_yaca_sign_startup(void);
+extern void utc_yaca_sign_cleanup(void);
+extern void utc_yaca_simple_startup(void);
+extern void utc_yaca_simple_cleanup(void);
+
+extern int utc_yaca_initialize_p(void);
+extern int utc_yaca_cleanup_p(void);
+extern int utc_yaca_malloc_p(void);
+extern int utc_yaca_malloc_n(void);
+extern int utc_yaca_zalloc_p(void);
+extern int utc_yaca_zalloc_n(void);
+extern int utc_yaca_realloc_p(void);
+extern int utc_yaca_realloc_n(void);
+extern int utc_yaca_free_p(void);
+extern int utc_yaca_memcmp_p(void);
+extern int utc_yaca_memcmp_n(void);
+extern int utc_yaca_randomize_bytes_p(void);
+extern int utc_yaca_randomize_bytes_n(void);
+extern int utc_yaca_context_set_property_p(void);
+extern int utc_yaca_context_set_property_n(void);
+extern int utc_yaca_context_get_property_p(void);
+extern int utc_yaca_context_get_property_n(void);
+extern int utc_yaca_context_destroy_p(void);
+extern int utc_yaca_context_get_output_length_p(void);
+extern int utc_yaca_context_get_output_length_n(void);
+extern int utc_yaca_digest_initialize_p(void);
+extern int utc_yaca_digest_initialize_n(void);
+extern int utc_yaca_digest_update_p(void);
+extern int utc_yaca_digest_update_n(void);
+extern int utc_yaca_digest_finalize_p(void);
+extern int utc_yaca_digest_finalize_n(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_p(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_n(void);
+extern int utc_yaca_encrypt_initialize_p(void);
+extern int utc_yaca_encrypt_initialize_n(void);
+extern int utc_yaca_encrypt_update_p(void);
+extern int utc_yaca_encrypt_update_n(void);
+extern int utc_yaca_encrypt_finalize_p(void);
+extern int utc_yaca_encrypt_finalize_n(void);
+extern int utc_yaca_decrypt_initialize_p(void);
+extern int utc_yaca_decrypt_initialize_n(void);
+extern int utc_yaca_decrypt_update_p(void);
+extern int utc_yaca_decrypt_update_n(void);
+extern int utc_yaca_decrypt_finalize_p(void);
+extern int utc_yaca_decrypt_finalize_n(void);
+extern int utc_yaca_key_get_type_p(void);
+extern int utc_yaca_key_get_type_n(void);
+extern int utc_yaca_key_get_bit_length_p(void);
+extern int utc_yaca_key_get_bit_length_n(void);
+extern int utc_yaca_key_import_p(void);
+extern int utc_yaca_key_import_n(void);
+extern int utc_yaca_key_export_p(void);
+extern int utc_yaca_key_export_n(void);
+extern int utc_yaca_key_generate_p(void);
+extern int utc_yaca_key_generate_n(void);
+extern int utc_yaca_key_extract_public_p(void);
+extern int utc_yaca_key_extract_public_n(void);
+extern int utc_yaca_key_destroy_p(void);
+extern int utc_yaca_key_derive_pbkdf2_p(void);
+extern int utc_yaca_key_derive_pbkdf2_n(void);
+extern int utc_yaca_seal_initialize_p(void);
+extern int utc_yaca_seal_initialize_n(void);
+extern int utc_yaca_seal_update_p(void);
+extern int utc_yaca_seal_update_n(void);
+extern int utc_yaca_seal_finalize_p(void);
+extern int utc_yaca_seal_finalize_n(void);
+extern int utc_yaca_open_initialize_p(void);
+extern int utc_yaca_open_initialize_n(void);
+extern int utc_yaca_open_update_p(void);
+extern int utc_yaca_open_update_n(void);
+extern int utc_yaca_open_finalize_p(void);
+extern int utc_yaca_open_finalize_n(void);
+extern int utc_yaca_sign_initialize_p(void);
+extern int utc_yaca_sign_initialize_n(void);
+extern int utc_yaca_sign_initialize_hmac_p(void);
+extern int utc_yaca_sign_initialize_hmac_n(void);
+extern int utc_yaca_sign_initialize_cmac_p(void);
+extern int utc_yaca_sign_initialize_cmac_n(void);
+extern int utc_yaca_sign_update_p(void);
+extern int utc_yaca_sign_update_n(void);
+extern int utc_yaca_sign_finalize_p(void);
+extern int utc_yaca_sign_finalize_n(void);
+extern int utc_yaca_verify_initialize_p(void);
+extern int utc_yaca_verify_initialize_n(void);
+extern int utc_yaca_verify_update_p(void);
+extern int utc_yaca_verify_update_n(void);
+extern int utc_yaca_verify_finalize_p(void);
+extern int utc_yaca_verify_finalize_n(void);
+extern int utc_yaca_simple_calculate_digest_p(void);
+extern int utc_yaca_simple_calculate_digest_n(void);
+extern int utc_yaca_simple_encrypt_p(void);
+extern int utc_yaca_simple_encrypt_n(void);
+extern int utc_yaca_simple_decrypt_p(void);
+extern int utc_yaca_simple_decrypt_n(void);
+extern int utc_yaca_simple_calculate_signature_p(void);
+extern int utc_yaca_simple_calculate_signature_n(void);
+extern int utc_yaca_simple_verify_signature_p(void);
+extern int utc_yaca_simple_verify_signature_n(void);
+extern int utc_yaca_simple_calculate_hmac_p(void);
+extern int utc_yaca_simple_calculate_hmac_n(void);
+extern int utc_yaca_simple_calculate_cmac_p(void);
+extern int utc_yaca_simple_calculate_cmac_n(void);
+
+testcase tc_array[] = {
+       {"utc_yaca_initialize_p", utc_yaca_initialize_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_cleanup_p", utc_yaca_cleanup_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_p", utc_yaca_malloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_n", utc_yaca_malloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_p", utc_yaca_zalloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_n", utc_yaca_zalloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_p", utc_yaca_realloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_n", utc_yaca_realloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_free_p", utc_yaca_free_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_p", utc_yaca_memcmp_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_n", utc_yaca_memcmp_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_p", utc_yaca_randomize_bytes_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_n", utc_yaca_randomize_bytes_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_p", utc_yaca_context_set_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_n", utc_yaca_context_set_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_p", utc_yaca_context_get_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_n", utc_yaca_context_get_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_destroy_p", utc_yaca_context_destroy_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_p", utc_yaca_context_get_output_length_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_n", utc_yaca_context_get_output_length_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_digest_initialize_p", utc_yaca_digest_initialize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_initialize_n", utc_yaca_digest_initialize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_p", utc_yaca_digest_update_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_n", utc_yaca_digest_update_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_p", utc_yaca_digest_finalize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_n", utc_yaca_digest_finalize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_p", utc_yaca_encrypt_get_iv_bit_length_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_n", utc_yaca_encrypt_get_iv_bit_length_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_p", utc_yaca_encrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_n", utc_yaca_encrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_p", utc_yaca_encrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_n", utc_yaca_encrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_p", utc_yaca_encrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_n", utc_yaca_encrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_p", utc_yaca_decrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_n", utc_yaca_decrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_p", utc_yaca_decrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_n", utc_yaca_decrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_p", utc_yaca_decrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_n", utc_yaca_decrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_key_get_type_p", utc_yaca_key_get_type_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_type_n", utc_yaca_key_get_type_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_p", utc_yaca_key_get_bit_length_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_n", utc_yaca_key_get_bit_length_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_p", utc_yaca_key_import_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_n", utc_yaca_key_import_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_p", utc_yaca_key_export_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_n", utc_yaca_key_export_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_p", utc_yaca_key_generate_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_n", utc_yaca_key_generate_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_p", utc_yaca_key_extract_public_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_n", utc_yaca_key_extract_public_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_destroy_p", utc_yaca_key_destroy_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_p", utc_yaca_key_derive_pbkdf2_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_n", utc_yaca_key_derive_pbkdf2_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_seal_initialize_p", utc_yaca_seal_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_initialize_n", utc_yaca_seal_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_p", utc_yaca_seal_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_n", utc_yaca_seal_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_p", utc_yaca_seal_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_n", utc_yaca_seal_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_p", utc_yaca_open_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_n", utc_yaca_open_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_p", utc_yaca_open_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_n", utc_yaca_open_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_p", utc_yaca_open_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_n", utc_yaca_open_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_sign_initialize_p", utc_yaca_sign_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_n", utc_yaca_sign_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_p", utc_yaca_sign_initialize_hmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_n", utc_yaca_sign_initialize_hmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_p", utc_yaca_sign_initialize_cmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_n", utc_yaca_sign_initialize_cmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_p", utc_yaca_sign_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_n", utc_yaca_sign_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_p", utc_yaca_sign_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_n", utc_yaca_sign_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_p", utc_yaca_verify_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_n", utc_yaca_verify_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_p", utc_yaca_verify_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_n", utc_yaca_verify_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_p", utc_yaca_verify_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_n", utc_yaca_verify_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_simple_calculate_digest_p", utc_yaca_simple_calculate_digest_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_digest_n", utc_yaca_simple_calculate_digest_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_p", utc_yaca_simple_encrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_n", utc_yaca_simple_encrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_p", utc_yaca_simple_decrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_n", utc_yaca_simple_decrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_p", utc_yaca_simple_calculate_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_n", utc_yaca_simple_calculate_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_p", utc_yaca_simple_verify_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_n", utc_yaca_simple_verify_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_p", utc_yaca_simple_calculate_hmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_n", utc_yaca_simple_calculate_hmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_p", utc_yaca_simple_calculate_cmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_n", utc_yaca_simple_calculate_cmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {NULL, NULL}
+};
+
+#endif // __TCT_YACA_NATIVE_H__
diff --git a/src/utc/yaca/tct-yaca-core_wearable.h b/src/utc/yaca/tct-yaca-core_wearable.h
new file mode 100644 (file)
index 0000000..a2d50ad
--- /dev/null
@@ -0,0 +1,236 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#ifndef __TCT_YACA_NATIVE_H__
+#define __TCT_YACA_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void utc_yaca_crypto_startup(void);
+extern void utc_yaca_crypto_cleanup(void);
+extern void utc_yaca_digest_startup(void);
+extern void utc_yaca_digest_cleanup(void);
+extern void utc_yaca_encrypt_startup(void);
+extern void utc_yaca_encrypt_cleanup(void);
+extern void utc_yaca_key_startup(void);
+extern void utc_yaca_key_cleanup(void);
+extern void utc_yaca_seal_startup(void);
+extern void utc_yaca_seal_cleanup(void);
+extern void utc_yaca_sign_startup(void);
+extern void utc_yaca_sign_cleanup(void);
+extern void utc_yaca_simple_startup(void);
+extern void utc_yaca_simple_cleanup(void);
+
+extern int utc_yaca_initialize_p(void);
+extern int utc_yaca_cleanup_p(void);
+extern int utc_yaca_malloc_p(void);
+extern int utc_yaca_malloc_n(void);
+extern int utc_yaca_zalloc_p(void);
+extern int utc_yaca_zalloc_n(void);
+extern int utc_yaca_realloc_p(void);
+extern int utc_yaca_realloc_n(void);
+extern int utc_yaca_free_p(void);
+extern int utc_yaca_memcmp_p(void);
+extern int utc_yaca_memcmp_n(void);
+extern int utc_yaca_randomize_bytes_p(void);
+extern int utc_yaca_randomize_bytes_n(void);
+extern int utc_yaca_context_set_property_p(void);
+extern int utc_yaca_context_set_property_n(void);
+extern int utc_yaca_context_get_property_p(void);
+extern int utc_yaca_context_get_property_n(void);
+extern int utc_yaca_context_destroy_p(void);
+extern int utc_yaca_context_get_output_length_p(void);
+extern int utc_yaca_context_get_output_length_n(void);
+extern int utc_yaca_digest_initialize_p(void);
+extern int utc_yaca_digest_initialize_n(void);
+extern int utc_yaca_digest_update_p(void);
+extern int utc_yaca_digest_update_n(void);
+extern int utc_yaca_digest_finalize_p(void);
+extern int utc_yaca_digest_finalize_n(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_p(void);
+extern int utc_yaca_encrypt_get_iv_bit_length_n(void);
+extern int utc_yaca_encrypt_initialize_p(void);
+extern int utc_yaca_encrypt_initialize_n(void);
+extern int utc_yaca_encrypt_update_p(void);
+extern int utc_yaca_encrypt_update_n(void);
+extern int utc_yaca_encrypt_finalize_p(void);
+extern int utc_yaca_encrypt_finalize_n(void);
+extern int utc_yaca_decrypt_initialize_p(void);
+extern int utc_yaca_decrypt_initialize_n(void);
+extern int utc_yaca_decrypt_update_p(void);
+extern int utc_yaca_decrypt_update_n(void);
+extern int utc_yaca_decrypt_finalize_p(void);
+extern int utc_yaca_decrypt_finalize_n(void);
+extern int utc_yaca_key_get_type_p(void);
+extern int utc_yaca_key_get_type_n(void);
+extern int utc_yaca_key_get_bit_length_p(void);
+extern int utc_yaca_key_get_bit_length_n(void);
+extern int utc_yaca_key_import_p(void);
+extern int utc_yaca_key_import_n(void);
+extern int utc_yaca_key_export_p(void);
+extern int utc_yaca_key_export_n(void);
+extern int utc_yaca_key_generate_p(void);
+extern int utc_yaca_key_generate_n(void);
+extern int utc_yaca_key_extract_public_p(void);
+extern int utc_yaca_key_extract_public_n(void);
+extern int utc_yaca_key_destroy_p(void);
+extern int utc_yaca_key_derive_pbkdf2_p(void);
+extern int utc_yaca_key_derive_pbkdf2_n(void);
+extern int utc_yaca_seal_initialize_p(void);
+extern int utc_yaca_seal_initialize_n(void);
+extern int utc_yaca_seal_update_p(void);
+extern int utc_yaca_seal_update_n(void);
+extern int utc_yaca_seal_finalize_p(void);
+extern int utc_yaca_seal_finalize_n(void);
+extern int utc_yaca_open_initialize_p(void);
+extern int utc_yaca_open_initialize_n(void);
+extern int utc_yaca_open_update_p(void);
+extern int utc_yaca_open_update_n(void);
+extern int utc_yaca_open_finalize_p(void);
+extern int utc_yaca_open_finalize_n(void);
+extern int utc_yaca_sign_initialize_p(void);
+extern int utc_yaca_sign_initialize_n(void);
+extern int utc_yaca_sign_initialize_hmac_p(void);
+extern int utc_yaca_sign_initialize_hmac_n(void);
+extern int utc_yaca_sign_initialize_cmac_p(void);
+extern int utc_yaca_sign_initialize_cmac_n(void);
+extern int utc_yaca_sign_update_p(void);
+extern int utc_yaca_sign_update_n(void);
+extern int utc_yaca_sign_finalize_p(void);
+extern int utc_yaca_sign_finalize_n(void);
+extern int utc_yaca_verify_initialize_p(void);
+extern int utc_yaca_verify_initialize_n(void);
+extern int utc_yaca_verify_update_p(void);
+extern int utc_yaca_verify_update_n(void);
+extern int utc_yaca_verify_finalize_p(void);
+extern int utc_yaca_verify_finalize_n(void);
+extern int utc_yaca_simple_calculate_digest_p(void);
+extern int utc_yaca_simple_calculate_digest_n(void);
+extern int utc_yaca_simple_encrypt_p(void);
+extern int utc_yaca_simple_encrypt_n(void);
+extern int utc_yaca_simple_decrypt_p(void);
+extern int utc_yaca_simple_decrypt_n(void);
+extern int utc_yaca_simple_calculate_signature_p(void);
+extern int utc_yaca_simple_calculate_signature_n(void);
+extern int utc_yaca_simple_verify_signature_p(void);
+extern int utc_yaca_simple_verify_signature_n(void);
+extern int utc_yaca_simple_calculate_hmac_p(void);
+extern int utc_yaca_simple_calculate_hmac_n(void);
+extern int utc_yaca_simple_calculate_cmac_p(void);
+extern int utc_yaca_simple_calculate_cmac_n(void);
+
+testcase tc_array[] = {
+       {"utc_yaca_initialize_p", utc_yaca_initialize_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_cleanup_p", utc_yaca_cleanup_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_p", utc_yaca_malloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_malloc_n", utc_yaca_malloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_p", utc_yaca_zalloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_zalloc_n", utc_yaca_zalloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_p", utc_yaca_realloc_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_realloc_n", utc_yaca_realloc_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_free_p", utc_yaca_free_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_p", utc_yaca_memcmp_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_memcmp_n", utc_yaca_memcmp_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_p", utc_yaca_randomize_bytes_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_randomize_bytes_n", utc_yaca_randomize_bytes_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_p", utc_yaca_context_set_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_set_property_n", utc_yaca_context_set_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_p", utc_yaca_context_get_property_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_property_n", utc_yaca_context_get_property_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_destroy_p", utc_yaca_context_destroy_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_p", utc_yaca_context_get_output_length_p, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_context_get_output_length_n", utc_yaca_context_get_output_length_n, utc_yaca_crypto_startup, utc_yaca_crypto_cleanup},
+       {"utc_yaca_digest_initialize_p", utc_yaca_digest_initialize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_initialize_n", utc_yaca_digest_initialize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_p", utc_yaca_digest_update_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_update_n", utc_yaca_digest_update_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_p", utc_yaca_digest_finalize_p, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_digest_finalize_n", utc_yaca_digest_finalize_n, utc_yaca_digest_startup, utc_yaca_digest_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_p", utc_yaca_encrypt_get_iv_bit_length_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_get_iv_bit_length_n", utc_yaca_encrypt_get_iv_bit_length_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_p", utc_yaca_encrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_initialize_n", utc_yaca_encrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_p", utc_yaca_encrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_update_n", utc_yaca_encrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_p", utc_yaca_encrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_encrypt_finalize_n", utc_yaca_encrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_p", utc_yaca_decrypt_initialize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_initialize_n", utc_yaca_decrypt_initialize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_p", utc_yaca_decrypt_update_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_update_n", utc_yaca_decrypt_update_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_p", utc_yaca_decrypt_finalize_p, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_decrypt_finalize_n", utc_yaca_decrypt_finalize_n, utc_yaca_encrypt_startup, utc_yaca_encrypt_cleanup},
+       {"utc_yaca_key_get_type_p", utc_yaca_key_get_type_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_type_n", utc_yaca_key_get_type_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_p", utc_yaca_key_get_bit_length_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_get_bit_length_n", utc_yaca_key_get_bit_length_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_p", utc_yaca_key_import_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_import_n", utc_yaca_key_import_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_p", utc_yaca_key_export_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_export_n", utc_yaca_key_export_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_p", utc_yaca_key_generate_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_generate_n", utc_yaca_key_generate_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_p", utc_yaca_key_extract_public_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_extract_public_n", utc_yaca_key_extract_public_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_destroy_p", utc_yaca_key_destroy_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_p", utc_yaca_key_derive_pbkdf2_p, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_key_derive_pbkdf2_n", utc_yaca_key_derive_pbkdf2_n, utc_yaca_key_startup, utc_yaca_key_cleanup},
+       {"utc_yaca_seal_initialize_p", utc_yaca_seal_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_initialize_n", utc_yaca_seal_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_p", utc_yaca_seal_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_update_n", utc_yaca_seal_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_p", utc_yaca_seal_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_seal_finalize_n", utc_yaca_seal_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_p", utc_yaca_open_initialize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_initialize_n", utc_yaca_open_initialize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_p", utc_yaca_open_update_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_update_n", utc_yaca_open_update_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_p", utc_yaca_open_finalize_p, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_open_finalize_n", utc_yaca_open_finalize_n, utc_yaca_seal_startup, utc_yaca_seal_cleanup},
+       {"utc_yaca_sign_initialize_p", utc_yaca_sign_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_n", utc_yaca_sign_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_p", utc_yaca_sign_initialize_hmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_hmac_n", utc_yaca_sign_initialize_hmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_p", utc_yaca_sign_initialize_cmac_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_initialize_cmac_n", utc_yaca_sign_initialize_cmac_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_p", utc_yaca_sign_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_update_n", utc_yaca_sign_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_p", utc_yaca_sign_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_sign_finalize_n", utc_yaca_sign_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_p", utc_yaca_verify_initialize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_initialize_n", utc_yaca_verify_initialize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_p", utc_yaca_verify_update_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_update_n", utc_yaca_verify_update_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_p", utc_yaca_verify_finalize_p, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_verify_finalize_n", utc_yaca_verify_finalize_n, utc_yaca_sign_startup, utc_yaca_sign_cleanup},
+       {"utc_yaca_simple_calculate_digest_p", utc_yaca_simple_calculate_digest_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_digest_n", utc_yaca_simple_calculate_digest_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_p", utc_yaca_simple_encrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_encrypt_n", utc_yaca_simple_encrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_p", utc_yaca_simple_decrypt_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_decrypt_n", utc_yaca_simple_decrypt_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_p", utc_yaca_simple_calculate_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_signature_n", utc_yaca_simple_calculate_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_p", utc_yaca_simple_verify_signature_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_verify_signature_n", utc_yaca_simple_verify_signature_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_p", utc_yaca_simple_calculate_hmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_hmac_n", utc_yaca_simple_calculate_hmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_p", utc_yaca_simple_calculate_cmac_p, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {"utc_yaca_simple_calculate_cmac_n", utc_yaca_simple_calculate_cmac_n, utc_yaca_simple_startup, utc_yaca_simple_cleanup},
+       {NULL, NULL}
+};
+
+#endif // __TCT_YACA_NATIVE_H__
diff --git a/src/utc/yaca/utc-yaca-crypto.c b/src/utc/yaca/utc-yaca-crypto.c
new file mode 100644 (file)
index 0000000..0f49f44
--- /dev/null
@@ -0,0 +1,504 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_crypto.h>
+#include <yaca_error.h>
+#include <yaca_key.h>
+#include <yaca_sign.h>
+
+//& set: Yaca
+
+#define TEST_MEM_SIZE 512
+
+/**
+ * @function        utc_yaca_crypto_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_crypto_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_crypto_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_crypto_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes the library.
+ * @scenario        Initializes the library.
+ */
+int utc_yaca_initialize_p(void)
+{
+       yaca_cleanup();
+
+       int ret = yaca_initialize();
+       assert_eq(ret, YACA_ERROR_NONE);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_cleanup_p
+ * @since_tizen     3.0
+ * @description     Cleans up the library.
+ * @scenario        Cleans up the library.
+ */
+int utc_yaca_cleanup_p(void)
+{
+       yaca_cleanup();
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_malloc_p
+ * @since_tizen     3.0
+ * @description     Allocates the memory.
+ * @scenario        Allocates the memory with valid paramters.
+ */
+int utc_yaca_malloc_p(void)
+{
+       void *memory;
+       size_t size = 1024;
+
+       int ret = yaca_malloc(size, &memory);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(memory);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_malloc_n
+ * @since_tizen     3.0
+ * @description     Allocates the memory.
+ * @scenario        Allocates the memory with invalid paramters.
+ */
+int utc_yaca_malloc_n(void)
+{
+       void *memory;
+       size_t size = 1024;
+
+       int ret = yaca_malloc(0, &memory);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_malloc(size, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_zalloc_p
+ * @since_tizen     3.0
+ * @description     Allocates the zeroed memory.
+ * @scenario        Allocates the zeroed memory with valid paramters.
+ */
+int utc_yaca_zalloc_p(void)
+{
+       void *memory = NULL;
+       size_t size = 1024;
+
+       int ret = yaca_zalloc(size, &memory);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(memory);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_zalloc_n
+ * @since_tizen     3.0
+ * @description     Allocates the zeroed memory.
+ * @scenario        Allocates the zeroed memory with invalid paramters.
+ */
+int utc_yaca_zalloc_n(void)
+{
+       void *memory;
+       size_t size = 1024;
+
+       int ret = yaca_zalloc(0, &memory);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_zalloc(size, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_realloc_p
+ * @since_tizen     3.0
+ * @description     Re-allocates the memory.
+ * @scenario        Re-allocates the memory with valid paramters.
+ */
+int utc_yaca_realloc_p(void)
+{
+       void *memory;
+       size_t size = 1024;
+
+       int ret = yaca_malloc(size, &memory);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_realloc(size*2, &memory);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(memory);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_realloc_n
+ * @since_tizen     3.0
+ * @description     Re-allocates the memory.
+ * @scenario        Re-allocates the memory with invalid paramters.
+ */
+int utc_yaca_realloc_n(void)
+{
+       void *memory;
+       size_t size = 1024;
+
+       int ret = yaca_realloc(0, &memory);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_realloc(size, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_free_p
+ * @since_tizen     3.0
+ * @description     Frees the memory.
+ * @scenario        Frees the memory.
+ */
+int utc_yaca_free_p(void)
+{
+       void *memory;
+       size_t size = 1024;
+
+       int ret = yaca_malloc(size, &memory);
+       assert_eq(ret, YACA_ERROR_NONE);
+       yaca_free(memory);
+
+       yaca_free(NULL);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_memcmp_p
+ * @since_tizen     3.0
+ * @description     Safely compares two buffers.
+ * @scenario        Safely compares two buffers with valid parameters.
+ */
+int utc_yaca_memcmp_p(void)
+{
+       unsigned char first[TEST_MEM_SIZE] = {1, };
+       unsigned char second[TEST_MEM_SIZE] = {1, };
+
+       int ret = yaca_memcmp(first, second, TEST_MEM_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_memcmp_n
+ * @since_tizen     3.0
+ * @description     Safely compares two buffers.
+ * @scenario        Safely compares two buffers with different values.
+ */
+int utc_yaca_memcmp_n(void)
+{
+       unsigned char first[TEST_MEM_SIZE] = {1, };
+       unsigned char second[TEST_MEM_SIZE] = {2, };
+
+       int ret = yaca_memcmp(first, second, TEST_MEM_SIZE);
+       assert_eq(ret, YACA_ERROR_DATA_MISMATCH);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_randomize_bytes_p
+ * @since_tizen     3.0
+ * @description     Generates random data.
+ * @scenario        Generates random data with valid parameters.
+ */
+int utc_yaca_randomize_bytes_p(void)
+{
+       char data[32] = {0, };
+
+       int ret = yaca_randomize_bytes(data, 32);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_randomize_bytes_n
+ * @since_tizen     3.0
+ * @description     Generates random data.
+ * @scenario        Generates random data with invalid parameters.
+ */
+int utc_yaca_randomize_bytes_n(void)
+{
+       char data[32] = {0, };
+
+       int ret = yaca_randomize_bytes(NULL, 32);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_randomize_bytes(data, 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_context_set_property_p
+ * @since_tizen     3.0
+ * @description     Sets the non-standard context properties.
+ * @scenario        Sets the non-standard context properties with valid parameters.
+ */
+int utc_yaca_context_set_property_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (void*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(prv);
+       yaca_context_destroy(ctx);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_context_set_property_n
+ * @since_tizen     3.0
+ * @description     Sets the non-standard context properties.
+ * @scenario        Sets the non-standard context properties with invalid parameters.
+ */
+int utc_yaca_context_set_property_n(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(NULL, YACA_PROPERTY_PADDING, (void*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_context_set_property(ctx, (yaca_property_e) -1, (void*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (void*)NULL, sizeof(padding));
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (void*)(&padding), 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(prv);
+       yaca_context_destroy(ctx);
+
+       return 0;
+}
+
+
+/**
+ * @testcase        utc_yaca_context_get_property_p
+ * @since_tizen     3.0
+ * @description     Gets the non-standard context properties.
+ * @scenario        Gets the non-standard context properties with valid parameters.
+ */
+int utc_yaca_context_get_property_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_padding_e *returned_padding = NULL;
+       size_t returned_size = 0;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (void*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_property(ctx, YACA_PROPERTY_PADDING, (void**)&returned_padding, &returned_size);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       assert_eq(padding, *returned_padding);
+       assert_eq(sizeof(padding), returned_size);
+
+       yaca_key_destroy(prv);
+       yaca_context_destroy(ctx);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_context_get_property_n
+ * @since_tizen     3.0
+ * @description     Gets the non-standard context properties.
+ * @scenario        Gets the non-standard context properties with invalid parameters.
+ */
+int utc_yaca_context_get_property_n(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_padding_e *returned_padding = NULL;
+       size_t returned_size = 0;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_property(NULL, YACA_PROPERTY_PADDING, (void**)&returned_padding, &returned_size);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_context_get_property(ctx, (yaca_padding_e) -1, (void**)&returned_padding, &returned_size);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_context_get_property(ctx, YACA_PROPERTY_PADDING, (void**)NULL, &returned_size);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(prv);
+       yaca_context_destroy(ctx);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_context_destroy_p
+ * @since_tizen     3.0
+ * @description     Destroys context.
+ * @scenario        Destroys context.
+ */
+int utc_yaca_context_destroy_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+
+       yaca_context_destroy((yaca_context_h) NULL);
+
+       yaca_key_destroy(prv);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_context_get_output_length_p
+ * @since_tizen     3.0
+ * @description     Gets the output length for a given context.
+ * @scenario        Gets the output length for a given context.
+ */
+int utc_yaca_context_get_output_length_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE)
+
+       size_t output_len = 0;
+       ret = yaca_context_get_output_length(ctx, 0, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE)
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_context_get_output_length_n
+ * @since_tizen     3.0
+ * @description     Gets the output length for a given context.
+ * @scenario        Gets the output length for a given context with invalid parameters.
+ */
+int utc_yaca_context_get_output_length_n(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       int ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE)
+
+       size_t output_len = 0;
+       ret = yaca_context_get_output_length(NULL, 512, &output_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_context_get_output_length(ctx, 512, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       return 0;
+}
+
+
diff --git a/src/utc/yaca/utc-yaca-digest.c b/src/utc/yaca/utc-yaca-digest.c
new file mode 100644 (file)
index 0000000..246c943
--- /dev/null
@@ -0,0 +1,357 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_error.h>
+#include <yaca_digest.h>
+#include <yaca_crypto.h>
+
+#include "lorem.h"
+
+//& set: Yaca
+
+/**
+ * @function        utc_yaca_digest_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_digest_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_digest_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_digest_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_digest_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes the digest context.
+ * @scenario        Initializes the digest context.
+ */
+int utc_yaca_digest_initialize_p(void)
+{
+       yaca_context_h ctx;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA256);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes the digest context.
+ * @scenario        Initializes the digest context with invalid parameters.
+ */
+int utc_yaca_digest_initialize_n(void)
+{
+       yaca_context_h ctx;
+
+       int ret = yaca_digest_initialize(NULL, YACA_DIGEST_SHA256);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_digest_initialize(&ctx, (yaca_digest_algorithm_e) -1);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_update_p
+ * @since_tizen     3.0
+ * @description     Feeds the data into the message digest algorithm.
+ * @scenario        Feeds the data into the message digest algorithm with valid parameters.
+ */
+int utc_yaca_digest_update_p(void)
+{
+       yaca_context_h ctx;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA256);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_update_n
+ * @since_tizen     3.0
+ * @description     Feeds the data into the message digest algorithm.
+ * @scenario        Feeds the data into the message digest algorithm with invalid parameters.
+ */
+int utc_yaca_digest_update_n(void)
+{
+       yaca_context_h ctx;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA256);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(NULL, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_digest_update(ctx, NULL, 1024);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_digest_update(ctx, lorem1024, 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_finalize_p
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with SHA256.
+ */
+int utc_yaca_digest_finalize_p(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA256);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(ctx, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_finalize_p2
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with MD5.
+ */
+int utc_yaca_digest_finalize_p2(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_MD5);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(ctx, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_finalize_p3
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with SHA1.
+ */
+int utc_yaca_digest_finalize_p3(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA1);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(ctx, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_finalize_p4
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with SHA224.
+ */
+int utc_yaca_digest_finalize_p4(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA224);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(ctx, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_finalize_p5
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with SHA384.
+ */
+int utc_yaca_digest_finalize_p5(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA384);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(ctx, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_digest_finalize_p6
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with SHA512.
+ */
+int utc_yaca_digest_finalize_p6(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA512);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(ctx, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
+
+
+
+
+
+/**
+ * @testcase        utc_yaca_digest_finalize_n
+ * @since_tizen     3.0
+ * @description     Calculates the final digest.
+ * @scenario        Calculates the final digest with invalid parameters.
+ */
+int utc_yaca_digest_finalize_n(void)
+{
+       yaca_context_h ctx;
+       size_t digest_len;
+       char *digest = NULL;
+
+       int ret = yaca_digest_initialize(&ctx, YACA_DIGEST_SHA256);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_update(ctx, lorem1024, 1024);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(digest_len, (void**) &digest);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_digest_finalize(NULL, digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_digest_finalize(ctx, NULL, &digest_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_digest_finalize(ctx, digest, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       return 0;
+}
+
diff --git a/src/utc/yaca/utc-yaca-encrypt.c b/src/utc/yaca/utc-yaca-encrypt.c
new file mode 100644 (file)
index 0000000..d0f35fd
--- /dev/null
@@ -0,0 +1,1048 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_error.h>
+#include <yaca_encrypt.h>
+#include <yaca_crypto.h>
+#include <yaca_key.h>
+
+#include "lorem.h"
+
+//& set: Yaca
+
+/**
+ * @function        utc_yaca_encrypt_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_encrypt_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_encrypt_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_encrypt_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_get_iv_bit_length_p
+ * @since_tizen     3.0
+ * @description     Returns the recommended/default length of the IV for a given encryption configuration.
+ * @scenario        Returns the recommended/default length of the IV for a given encryption configuration
+ *                  with valid parameters.
+ */
+int utc_yaca_encrypt_get_iv_bit_length_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       yaca_key_h key = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000, YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_get_iv_bit_length_n
+ * @since_tizen     3.0
+ * @description     Returns the recommended/default length of the IV for a given encryption configuration.
+ * @scenario        Returns the recommended/default length of the IV for a given encryption configuration
+ *                  with invalid parameters.
+ */
+int utc_yaca_encrypt_get_iv_bit_length_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       yaca_key_h key = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000, YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length((yaca_encrypt_algorithm_e) -1, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, (yaca_block_cipher_mode_e) -1, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, 0, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes the encrypt context.
+ * @scenario        Initializes the encrypt context.
+ */
+int utc_yaca_encrypt_initialize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes the encrypt context.
+ * @scenario        Initializes the encrypt context with invalid parameters.
+ */
+int utc_yaca_encrypt_initialize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_encrypt_initialize(NULL, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_initialize(&ctx, (yaca_encrypt_algorithm_e) -1, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_initialize(&ctx, algo, (yaca_block_cipher_mode_e) -1, key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, NULL, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_update_p
+ * @since_tizen     3.0
+ * @description     Encrypts chunk of the data.
+ * @scenario        Encrypts chunk of the data with valid parameters.
+ */
+int utc_yaca_encrypt_update_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_free(enc);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_update_n
+ * @since_tizen     3.0
+ * @description     Encrypts chunk of the data.
+ * @scenario        Encrypts chunk of the data with invalid parameters.
+ */
+int utc_yaca_encrypt_update_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_encrypt_update(NULL, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_update(ctx, NULL, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_update(ctx, lorem4096, 0, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, NULL, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, enc, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_free(enc);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_finalize_p
+ * @since_tizen     3.0
+ * @description     Encrypts the final chunk of the data.
+ * @scenario        Encrypts the final chunk of the data with valid parameters.
+ */
+int utc_yaca_encrypt_finalize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_encrypt_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_free(enc);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_encrypt_finalize_n
+ * @since_tizen     3.0
+ * @description     Encrypts the final chunk of the data.
+ * @scenario        Encrypts the final chunk of the data with invalid parameters.
+ */
+int utc_yaca_encrypt_finalize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_encrypt_finalize(NULL, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_finalize(ctx, NULL, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_encrypt_finalize(ctx, enc + written_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_free(enc);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_decrypt_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes the decrypt context.
+ * @scenario        Initializes the decrypt context.
+ */
+int utc_yaca_decrypt_initialize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_decrypt_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes the decrypt context.
+ * @scenario        Initializes the decrypt context with invalid parameters.
+ */
+int utc_yaca_decrypt_initialize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_decrypt_initialize(NULL, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_initialize(&ctx, (yaca_encrypt_algorithm_e) -1, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_initialize(&ctx, algo, (yaca_block_cipher_mode_e) -1, key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, NULL, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_decrypt_update_p
+ * @since_tizen     3.0
+ * @description     Encrypts chunk of the data.
+ * @scenario        Encrypts chunk of the data with valid parameters.
+ */
+int utc_yaca_decrypt_update_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char enc[256] = {0, };
+       size_t enc_len = sizeof(enc);
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_decrypt_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_free(dec);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_decrypt_update_n
+ * @since_tizen     3.0
+ * @description     Encrypts chunk of the data.
+ * @scenario        Encrypts chunk of the data with invalid parameters.
+ */
+int utc_yaca_decrypt_update_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char enc[256] = {0, };
+       size_t enc_len = sizeof(enc);
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_decrypt_update(NULL, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_update(ctx, NULL, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_update(ctx, enc, 0, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_update(ctx, enc, enc_len, NULL, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_update(ctx, enc, enc_len, dec, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_free(dec);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/*
+ * @testcase        utc_yaca_decrypt_finalize_p
+ * @since_tizen     3.0
+ * @description     Encrypts the final chunk of the data.
+ * @scenario        Encrypts the final chunk of the data with valid parameters.
+ */
+int utc_yaca_decrypt_finalize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char *enc = NULL;
+       size_t enc_len;
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       // encrypt
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_encrypt_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = rem + written_len;
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       // decrypt
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_decrypt_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = dec_len - written_len;
+       ret = yaca_decrypt_finalize(ctx, dec + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // compare
+       dec_len = rem + written_len;
+       assert_eq(LOREM4096_SIZE, dec_len);
+       int idx;
+       for (idx = 0; idx < LOREM4096_SIZE; idx++) {
+               assert_eq(lorem4096[idx], dec[idx]);
+       }
+
+       yaca_context_destroy(ctx);
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/*
+ * @testcase        utc_yaca_decrypt_finalize_p
+ * @since_tizen     3.0
+ * @description     Encrypts the final chunk of the data.
+ * @scenario        Encrypts the final chunk of the data with AES GCM.
+ */
+int utc_yaca_decrypt_finalize_p2(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_GCM;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       size_t iv_bit_len = YACA_KEY_LENGTH_IV_128BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       char *dec = NULL;
+       size_t enc_len;
+       size_t dec_len;
+
+       char *aad = NULL;
+       char *tag = NULL;
+       size_t aad_len = 16;
+       size_t tag_len = 16;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       // Key generation
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // IV generation
+       ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_zalloc(aad_len, (void**)&aad);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_randomize_bytes(aad, aad_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_zalloc(tag_len, (void**)&tag);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // Encryption
+       ret = yaca_encrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_GCM_AAD, aad, aad_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_encrypt_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_encrypt_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = rem + written_len;
+
+       // Set the tag length and get the tag after final encryption
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_GCM_TAG_LEN, (void*)&tag_len, sizeof(tag_len));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_property(ctx, YACA_PROPERTY_GCM_TAG, (void**)tag, &tag_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       // Decryption
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_GCM_AAD, aad, aad_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_decrypt_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = dec_len - written_len;
+
+       // Set expected tag value before final decryption
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_GCM_TAG, tag, tag_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_decrypt_finalize(ctx, dec + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = rem + written_len;
+
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_free(tag);
+       yaca_free(aad);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_decrypt_finalize_n
+ * @since_tizen     3.0
+ * @description     Encrypts the final chunk of the data.
+ * @scenario        Encrypts the final chunk of the data with invalid parameters.
+ */
+int utc_yaca_decrypt_finalize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+       size_t iv_bit_len;
+
+       char enc[256] = {0, };
+       size_t enc_len = sizeof(enc);
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_decrypt_initialize(&ctx, algo, bcm, key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the update
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // For the finalize
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_decrypt_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = dec_len - written_len;
+       ret = yaca_decrypt_finalize(NULL, dec + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_finalize(ctx, NULL, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_decrypt_finalize(ctx, dec + written_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
diff --git a/src/utc/yaca/utc-yaca-key.c b/src/utc/yaca/utc-yaca-key.c
new file mode 100644 (file)
index 0000000..c16d4d4
--- /dev/null
@@ -0,0 +1,658 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_error.h>
+#include <yaca_key.h>
+#include <yaca_crypto.h>
+#include <yaca_types.h>
+
+
+//& set: Yaca
+
+/**
+ * @function        utc_yaca_key_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_key_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_key_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_key_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_key_get_type_p
+ * @since_tizen     3.0
+ * @description     Gets key's type.
+ * @scenario        Gets key's type with valid parameters.
+ */
+int utc_yaca_key_get_type_p(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_type_e ret_key_type;
+       ret = yaca_key_get_type(key, &ret_key_type);
+       assert_eq(ret, YACA_ERROR_NONE);
+       assert_eq(key_type, ret_key_type);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_get_type_n
+ * @since_tizen     3.0
+ * @description     Gets key's type.
+ * @scenario        Gets key's type with invalid parameters.
+ */
+int utc_yaca_key_get_type_n(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_type_e ret_key_type;
+       ret = yaca_key_get_type(NULL, &ret_key_type);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_get_type(key, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_get_bit_length_p
+ * @since_tizen     3.0
+ * @description     Gets key's length.
+ * @scenario        Gets key's length with valid parameters.
+ */
+int utc_yaca_key_get_bit_length_p(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       size_t ret_key_bit_len;
+       ret = yaca_key_get_bit_length(key, &ret_key_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+       assert_eq(key_bit_len, ret_key_bit_len);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_get_bit_length_n
+ * @since_tizen     3.0
+ * @description     Gets key's length.
+ * @scenario        Gets key's length with invalid parameters.
+ */
+int utc_yaca_key_get_bit_length_n(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       size_t ret_key_bit_len;
+       ret = yaca_key_get_bit_length(NULL, &ret_key_bit_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_get_bit_length(key, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_import_p
+ * @since_tizen     3.0
+ * @description     Imports a key.
+ * @scenario        Imports a key with symmetric key type.
+ */
+int utc_yaca_key_import_p(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       yaca_key_h b64_imported = YACA_KEY_NULL;
+       yaca_key_h raw_imported = YACA_KEY_NULL;
+
+       char *raw = NULL;
+       size_t raw_len;
+       char *b64 = NULL;
+       size_t b64_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, b64, b64_len, &b64_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_RAW, NULL, &raw, &raw_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, raw, raw_len, &raw_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(key);
+       yaca_key_destroy(b64_imported);
+       yaca_key_destroy(raw_imported);
+       yaca_free(raw);
+       yaca_free(b64);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_import_p2
+ * @since_tizen     3.0
+ * @description     Imports a key.
+ * @scenario        Imports a key with DES key type.
+ */
+int utc_yaca_key_import_p2(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_DES;
+       size_t key_bit_len = YACA_KEY_LENGTH_192BIT;
+       int ret = YACA_ERROR_NONE;
+
+       yaca_key_h b64_imported = YACA_KEY_NULL;
+       yaca_key_h raw_imported = YACA_KEY_NULL;
+
+       char *raw = NULL;
+       size_t raw_len;
+       char *b64 = NULL;
+       size_t b64_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, b64, b64_len, &b64_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_RAW, NULL, &raw, &raw_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, raw, raw_len, &raw_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(key);
+       yaca_key_destroy(b64_imported);
+       yaca_key_destroy(raw_imported);
+       yaca_free(raw);
+       yaca_free(b64);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_import_p3
+ * @since_tizen     3.0
+ * @description     Imports a key.
+ * @scenario        Imports a key with RSA key type.
+ */
+int utc_yaca_key_import_p3(void)
+{
+       yaca_key_h pri_key = YACA_KEY_NULL;
+       yaca_key_h pub_key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_RSA_PRIV;
+       size_t key_bit_len = YACA_KEY_LENGTH_1024BIT;
+       char * password = "test_password";
+       int ret = YACA_ERROR_NONE;
+
+       yaca_key_h pem_imported = YACA_KEY_NULL;
+       yaca_key_h der_imported = YACA_KEY_NULL;
+       yaca_key_h pkcs8_imported = YACA_KEY_NULL;
+
+       char *der = NULL;
+       size_t der_len;
+       char *pem = NULL;
+       size_t pem_len;
+       char *pkcs8 = NULL;
+       size_t pkcs8_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &pri_key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(pri_key, &pub_key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(pri_key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_DER, NULL, &der, &der_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_RSA_PRIV, NULL, der, der_len, &der_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(pub_key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_PEM, NULL, &pem, &pem_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_RSA_PUB, NULL, pem, pem_len, &pem_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(pri_key, YACA_KEY_FORMAT_PKCS8, YACA_KEY_FILE_FORMAT_DER, password, &pkcs8, &pkcs8_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_RSA_PRIV, password, pkcs8, pkcs8_len, &pkcs8_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(pri_key);
+       yaca_key_destroy(pub_key);
+       yaca_key_destroy(pem_imported);
+       yaca_key_destroy(der_imported);
+       yaca_key_destroy(pkcs8_imported);
+       yaca_free(der);
+       yaca_free(pem);
+       yaca_free(pkcs8);
+
+       return 0;
+}
+
+/*
+ * @testcase        utc_yaca_key_import_p4
+ * @since_tizen     3.0
+ * @description     Imports a key.
+ * @scenario        Imports a key with DSA key type.
+ */
+int utc_yaca_key_import_p4(void)
+{
+       yaca_key_h pri_key = YACA_KEY_NULL;
+       yaca_key_h pub_key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_DSA_PRIV;
+       size_t key_bit_len = YACA_KEY_LENGTH_1024BIT;
+       int ret = YACA_ERROR_NONE;
+
+       yaca_key_h pem_imported = YACA_KEY_NULL;
+       yaca_key_h der_imported = YACA_KEY_NULL;
+
+       char *der = NULL;
+       size_t der_len;
+       char *pem = NULL;
+       size_t pem_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &pri_key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(pri_key, &pub_key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(pri_key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_PEM, NULL, &pem, &pem_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_DSA_PRIV, NULL, pem, pem_len, &pem_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(pub_key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_DER, NULL, &der, &der_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_DSA_PUB, NULL, der, der_len, &der_imported);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(pri_key);
+       yaca_key_destroy(pub_key);
+       yaca_key_destroy(pem_imported);
+       yaca_key_destroy(der_imported);
+       yaca_free(der);
+       yaca_free(pem);
+
+       return 0;
+}
+
+
+/**
+ * @testcase        utc_yaca_key_import_n
+ * @since_tizen     3.0
+ * @description     Imports a key.
+ * @scenario        Imports a key with invalid parameters.
+ */
+int utc_yaca_key_import_n(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       yaca_key_h b64_imported = YACA_KEY_NULL;
+
+       char *b64 = NULL;
+       size_t b64_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_import((yaca_key_type_e) -1, NULL, b64, b64_len, &b64_imported);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, NULL, b64_len, &b64_imported);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, b64, 0, &b64_imported);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_import(YACA_KEY_TYPE_SYMMETRIC, NULL, b64, b64_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(key);
+       yaca_key_destroy(b64_imported);
+       yaca_free(b64);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_export_p
+ * @since_tizen     3.0
+ * @description     Exports a key.
+ * @scenario        Exports a key with valid parameters.
+ */
+int utc_yaca_key_export_p(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       char *b64 = NULL;
+       size_t b64_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(key);
+       yaca_free(b64);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_export_n
+ * @since_tizen     3.0
+ * @description     Exports a key.
+ * @scenario        Exports a key with invalid parameters.
+ */
+int utc_yaca_key_export_n(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       char *b64 = NULL;
+       size_t b64_len;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_export(NULL, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_export(key, (yaca_key_format_e) -1, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, (yaca_key_file_format_e) -1, NULL, &b64, &b64_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, NULL, &b64_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_export(key, YACA_KEY_FORMAT_DEFAULT, YACA_KEY_FILE_FORMAT_BASE64, NULL, &b64, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_generate_p
+ * @since_tizen     3.0
+ * @description     Generates a secure key.
+ * @scenario        Generates a secure key with valid parameters.
+ */
+int utc_yaca_key_generate_p(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(key_type, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_generate_n
+ * @since_tizen     3.0
+ * @description     Generates a secure key.
+ * @scenario        Generates a secure key with invalid parameters.
+ */
+int utc_yaca_key_generate_n(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_type_e key_type = YACA_KEY_TYPE_SYMMETRIC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate((yaca_key_type_e) -1, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_generate(key_type, 0, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_generate(key_type, key_bit_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_extract_public_p
+ * @since_tizen     3.0
+ * @description     Extracts public key from a private one.
+ * @scenario        Extracts public key from a private one with valid parameters.
+ */
+int utc_yaca_key_extract_public_p(void)
+{
+       yaca_key_h rsa_priv = YACA_KEY_NULL;
+       yaca_key_h rsa_pub = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_1024BIT, &rsa_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(rsa_priv, &rsa_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(rsa_pub);
+       yaca_key_destroy(rsa_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_extract_public_n
+ * @since_tizen     3.0
+ * @description     Extracts public key from a private one.
+ * @scenario        Extracts public key from a private one with invalid parameters.
+ */
+int utc_yaca_key_extract_public_n(void)
+{
+       yaca_key_h dsa_priv = YACA_KEY_NULL;
+       yaca_key_h dsa_pub = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_DSA_PRIV, YACA_KEY_LENGTH_1024BIT, &dsa_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(NULL, &dsa_pub);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_extract_public(dsa_priv, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(dsa_pub);
+       yaca_key_destroy(dsa_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_destroy_p
+ * @since_tizen     3.0
+ * @description     Release the key created by the library.
+ * @scenario        Release the key created by the library with valid parameters.
+ */
+int utc_yaca_key_destroy_p(void)
+{
+       yaca_key_h dsa_priv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_DSA_PRIV, YACA_KEY_LENGTH_1024BIT, &dsa_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(dsa_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_derive_pbkdf2_p
+ * @since_tizen     3.0
+ * @description     Derives a key from user password.
+ * @scenario        Derives a key from user password with valid parameters.
+ */
+int utc_yaca_key_derive_pbkdf2_p(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                                                               YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_key_derive_pbkdf2_n
+ * @since_tizen     3.0
+ * @description     Derives a key from user password.
+ * @scenario        Derives a key from user password with invalid parameters.
+ */
+int utc_yaca_key_derive_pbkdf2_n(void)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2(NULL, "123456789", 10, 1000,
+                                                               YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_derive_pbkdf2("foo bar", NULL, 10, 1000,
+                                                               YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 0, 1000,
+                                                               YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 0,
+                                                               YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                                                               (yaca_digest_algorithm_e) -1, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                                                               YACA_DIGEST_SHA256, 0, &key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                                                               YACA_DIGEST_SHA256, key_bit_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+
+
+
+
+
diff --git a/src/utc/yaca/utc-yaca-seal.c b/src/utc/yaca/utc-yaca-seal.c
new file mode 100644 (file)
index 0000000..b304aa1
--- /dev/null
@@ -0,0 +1,914 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_error.h>
+#include <yaca_seal.h>
+#include <yaca_crypto.h>
+#include <yaca_key.h>
+
+#include "lorem.h"
+
+#include <dlog.h>
+
+//& set: Yaca
+
+/**
+ * @function        utc_yaca_seal_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_seal_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_seal_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_seal_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_seal_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes an asymmetric encryption context.
+ * @scenario        Initializes an asymmetric encryption context with valid parameters.
+ */
+int utc_yaca_seal_initialize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_seal_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes an asymmetric encryption context.
+ * @scenario        Initializes an asymmetric encryption context with invalid parameters.
+ */
+int utc_yaca_seal_initialize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       // checked
+       ret = yaca_seal_initialize(NULL, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       // checked
+       ret = yaca_seal_initialize(&ctx, NULL, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, (yaca_encrypt_algorithm_e)-1, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, (yaca_block_cipher_mode_e)-1, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, 0, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       //ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, NULL, &iv);
+       //assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       //ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, NULL);
+       //assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_seal_update_p
+ * @since_tizen     3.0
+ * @description     Encrypts piece of the data.
+ * @scenario        Encrypts piece of the data with valid parameters.
+ */
+int utc_yaca_seal_update_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(enc);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_seal_update_n
+ * @since_tizen     3.0
+ * @description     Encrypts piece of the data.
+ * @scenario        Encrypts piece of the data with invalid parameters.
+ */
+int utc_yaca_seal_update_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(NULL, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_update(ctx, NULL, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_update(ctx, lorem4096, 0, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, NULL, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(enc);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_seal_finalize_p
+ * @since_tizen     3.0
+ * @description     Encrypts the final piece of the data.
+ * @scenario        Encrypts the final piece of the data with valid parameters.
+ */
+int utc_yaca_seal_finalize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_seal_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = written_len + rem;
+
+       yaca_free(enc);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_seal_finalize_n
+ * @since_tizen     3.0
+ * @description     Encrypts the final piece of the data.
+ * @scenario        Encrypts the final piece of the data with invalid parameters.
+ */
+int utc_yaca_seal_finalize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_seal_finalize(NULL, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_finalize(ctx, NULL, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_seal_finalize(ctx, enc + written_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(enc);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_open_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes an asymmetric decryption context.
+ * @scenario        Initializes an asymmetric decryption context with valid parameters.
+ */
+int utc_yaca_open_initialize_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_open_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes an asymmetric decryption context.
+ * @scenario        Initializes an asymmetric decryption context with invalid parameters.
+ */
+int utc_yaca_open_initialize_n(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_1024BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_open_initialize(NULL, key_priv, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_initialize(&ctx, NULL, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_initialize(&ctx, key_priv, (yaca_encrypt_algorithm_e)-1, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, (yaca_block_cipher_mode_e) -1, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, 0, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, NULL, iv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, sym_key, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_open_update_p
+ * @since_tizen     3.0
+ * @description     Decrypts piece of the data.
+ * @scenario        Decrypts piece of the data with valid parameters.
+ */
+int utc_yaca_open_update_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_seal_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = written_len + rem;
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_open_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_open_update_n
+ * @since_tizen     3.0
+ * @description     Decrypts piece of the data.
+ * @scenario        Decrypts piece of the data with invalid parameters.
+ */
+int utc_yaca_open_update_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CBC;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_seal_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = written_len + rem;
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_open_update(NULL, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_update(ctx, NULL, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_update(ctx, enc, 0, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_update(ctx, enc, enc_len, NULL, &written_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_update(ctx, enc, enc_len, dec, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_open_finalize_p
+ * @since_tizen     3.0
+ * @description     Decrypts the final piece of the data.
+ * @scenario        Decrypts the final piece of the data with valid parameters.
+ */
+int utc_yaca_open_finalize_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_3DES_3TDEA;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CFB;
+       size_t key_bit_len = YACA_KEY_LENGTH_192BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_seal_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = written_len + rem;
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = 0;
+       ret = yaca_open_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = 0;
+       ret = yaca_open_finalize(ctx, dec + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = written_len + rem;
+       assert_eq(LOREM4096_SIZE, dec_len);
+
+       int i;
+       for (i = 0; i < LOREM4096_SIZE; i++)
+               assert_eq(lorem4096[i], dec[i]);
+
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_open_finalize_n
+ * @since_tizen     3.0
+ * @description     Decrypts the final piece of the data.
+ * @scenario        Decrypts the final piece of the data with invalid parameters.
+ */
+int utc_yaca_open_finalize_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_3DES_3TDEA;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_CFB;
+       size_t key_bit_len = YACA_KEY_LENGTH_192BIT;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key_pub = YACA_KEY_NULL;
+       yaca_key_h key_priv = YACA_KEY_NULL;
+       yaca_key_h sym_key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len;
+       char *dec = NULL;
+       size_t dec_len;
+
+       size_t block_len;
+       size_t output_len;
+       size_t written_len;
+       size_t rem;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_RSA_PRIV, YACA_KEY_LENGTH_2048BIT, &key_priv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(key_priv, &key_pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_seal_initialize(&ctx, key_pub, algo, bcm, key_bit_len, &sym_key, &iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = output_len + block_len;
+       ret = yaca_malloc(enc_len, (void**)&enc);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = enc_len;
+       ret = yaca_seal_update(ctx, lorem4096, LOREM4096_SIZE, enc, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = enc_len - written_len;
+       ret = yaca_seal_finalize(ctx, enc + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       enc_len = written_len + rem;
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_open_initialize(&ctx, key_priv, algo, bcm, key_bit_len, sym_key, iv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, LOREM4096_SIZE, &output_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &block_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       dec_len = output_len + block_len;
+       ret = yaca_malloc(dec_len, (void**)&dec);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       written_len = dec_len;
+       ret = yaca_open_update(ctx, enc, enc_len, dec, &written_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       rem = dec_len - written_len;
+       ret = yaca_open_finalize(NULL, dec + written_len, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_finalize(ctx, NULL, &rem);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_open_finalize(ctx, dec + written_len, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(sym_key);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key_pub);
+       yaca_key_destroy(key_priv);
+
+       return 0;
+}
+
+
diff --git a/src/utc/yaca/utc-yaca-sign.c b/src/utc/yaca/utc-yaca-sign.c
new file mode 100644 (file)
index 0000000..f48b9bf
--- /dev/null
@@ -0,0 +1,788 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_error.h>
+#include <yaca_sign.h>
+#include <yaca_crypto.h>
+#include <yaca_key.h>
+
+#include "lorem.h"
+
+#include <dlog.h>
+
+//& set: Yaca
+
+/**
+ * @function        utc_yaca_sign_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_sign_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_sign_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_sign_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_sign_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes a signature context.
+ * @scenario        Initializes a signature context with valid parameters.
+ */
+int utc_yaca_sign_initialize_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes a signature context.
+ * @scenario        Initializes a signature context with invalid parameters.
+ */
+int utc_yaca_sign_initialize_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(NULL, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_initialize(&ctx, (yaca_digest_algorithm_e) -1, prv);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_initialize_hmac_p
+ * @since_tizen     3.0
+ * @description     Initializes a signature context for HMAC.
+ * @scenario        Initializes a signature context for HMAC with valid parameters.
+ */
+int utc_yaca_sign_initialize_hmac_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize_hmac(&ctx, YACA_DIGEST_SHA512, key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_initialize_hmac_n
+ * @since_tizen     3.0
+ * @description     Initializes a signature context for HMAC.
+ * @scenario        Initializes a signature context for HMAC with invalid parameters.
+ */
+int utc_yaca_sign_initialize_hmac_n(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize_hmac(NULL, YACA_DIGEST_SHA512, key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_initialize_hmac(&ctx, (yaca_digest_algorithm_e) -1, key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_initialize_hmac(&ctx, YACA_DIGEST_SHA512, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_initialize_cmac_p
+ * @since_tizen     3.0
+ * @description     Initializes a signature context for CMAC.
+ * @scenario        Initializes a signature context for CMAC with valid parameters.
+ */
+int utc_yaca_sign_initialize_cmac_p(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize_cmac(&ctx, YACA_ENCRYPT_AES, key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_initialize_cmac_n
+ * @since_tizen     3.0
+ * @description     Initializes a signature context for CMAC.
+ * @scenario        Initializes a signature context for CMAC with invalid parameters.
+ */
+int utc_yaca_sign_initialize_cmac_n(void)
+{
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize_cmac(NULL, YACA_ENCRYPT_AES, key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_initialize_cmac(&ctx, (yaca_encrypt_algorithm_e) -1, key);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_initialize_cmac(&ctx, YACA_ENCRYPT_AES, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+
+/**
+ * @testcase        utc_yaca_sign_update_p
+ * @since_tizen     3.0
+ * @description     Feeds the data into the digital signature or MAC algorithm.
+ * @scenario        Feeds the data into the digital signature or MAC algorithm with valid parameters.
+ */
+int utc_yaca_sign_update_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_update_n
+ * @since_tizen     3.0
+ * @description     Feeds the data into the digital signature or MAC algorithm.
+ * @scenario        Feeds the data into the digital signature or MAC algorithm with invalid parameters.
+ */
+int utc_yaca_sign_update_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(NULL, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_update(ctx, NULL, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_update(ctx, lorem4096, 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_finalize_p
+ * @since_tizen     3.0
+ * @description     Calculates the final signature or MAC.
+ * @scenario        Calculates the final signature or MAC with valid parameters.
+ */
+int utc_yaca_sign_finalize_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_sign_finalize_n
+ * @since_tizen     3.0
+ * @description     Calculates the final signature or MAC.
+ * @scenario        Calculates the final signature or MAC with invalid parameters.
+ */
+int utc_yaca_sign_finalize_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(NULL, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_finalize(ctx, NULL, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_sign_finalize(ctx, signature, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_verify_initialize_p
+ * @since_tizen     3.0
+ * @description     Initializes a signature verification context for asymmetric signatures.
+ * @scenario        Initializes a signature verification context for asymmetric signatures
+ *                  with valid parameters.
+ */
+int utc_yaca_verify_initialize_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_initialize(&ctx, YACA_DIGEST_SHA512, pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_verify_initialize_n
+ * @since_tizen     3.0
+ * @description     Initializes a signature verification context for asymmetric signatures.
+ * @scenario        Initializes a signature verification context for asymmetric signatures
+ *                  with invalid parameters.
+ */
+int utc_yaca_verify_initialize_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_initialize(NULL, YACA_DIGEST_SHA512, pub);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_verify_initialize(&ctx, (yaca_digest_algorithm_e) -1, pub);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_verify_initialize(&ctx, YACA_DIGEST_SHA512, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_verify_update_p
+ * @since_tizen     3.0
+ * @description     Feeds the data into the digital signature verification algorithm.
+ * @scenario        Feeds the data into the digital signature verification algorithm with valid parameters.
+ */
+int utc_yaca_verify_update_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_initialize(&ctx, YACA_DIGEST_SHA512, pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_verify_update_n
+ * @since_tizen     3.0
+ * @description     Feeds the data into the digital signature verification algorithm.
+ * @scenario        Feeds the data into the digital signature verification algorithm with invalid parameters.
+ */
+int utc_yaca_verify_update_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_initialize(&ctx, YACA_DIGEST_SHA512, pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_update(NULL, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_verify_update(ctx, NULL, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_verify_update(ctx, lorem4096, 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_verify_finalize_p
+ * @since_tizen     3.0
+ * @description     Performs the verification.
+ * @scenario        Performs the verification with valid parameters.
+ */
+int utc_yaca_verify_finalize_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_initialize(&ctx, YACA_DIGEST_SHA512, pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_finalize(ctx, signature, signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_verify_finalize_n
+ * @since_tizen     3.0
+ * @description     Performs the verification.
+ * @scenario        Performs the verification with invalid parameters.
+ */
+int utc_yaca_verify_finalize_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       yaca_context_h ctx = YACA_CONTEXT_NULL;
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+       yaca_padding_e padding = YACA_PADDING_PKCS1_PSS;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_initialize(&ctx, YACA_DIGEST_SHA512, prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_get_output_length(ctx, 0, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_malloc(signature_len, (void**)&signature);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_sign_finalize(ctx, signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_context_destroy(ctx);
+       ctx = YACA_CONTEXT_NULL;
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_initialize(&ctx, YACA_DIGEST_SHA512, pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_context_set_property(ctx, YACA_PROPERTY_PADDING, (char*)(&padding), sizeof(padding));
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_update(ctx, lorem4096, LOREM4096_SIZE);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_verify_finalize(NULL, signature, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_verify_finalize(ctx, NULL, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_verify_finalize(ctx, signature, 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_context_destroy(ctx);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+
diff --git a/src/utc/yaca/utc-yaca-simple.c b/src/utc/yaca/utc-yaca-simple.c
new file mode 100644 (file)
index 0000000..139098d
--- /dev/null
@@ -0,0 +1,688 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "assert.h"
+
+#include <yaca_error.h>
+#include <yaca_simple.h>
+#include <yaca_crypto.h>
+#include <yaca_key.h>
+#include <yaca_encrypt.h>
+
+#include "lorem.h"
+
+//& set: Yaca
+
+/**
+ * @function        utc_yaca_simple_startup
+ * @description     Called before each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_simple_startup(void)
+{
+       yaca_initialize();
+}
+
+/**
+ * @function        utc_yaca_simple_cleanup
+ * @description     Called after each test
+ * @parameter       NA
+ * @return          NA
+ */
+void utc_yaca_simple_cleanup(void)
+{
+       yaca_cleanup();
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_digest_p
+ * @since_tizen     3.0
+ * @description     Calculates a digest of a buffer.
+ * @scenario        Calculates a digest of a buffer with valid parameters.
+ */
+int utc_yaca_simple_calculate_digest_p(void)
+{
+       int ret = YACA_ERROR_NONE;
+       char *digest = NULL;
+       size_t digest_len;
+
+       ret = yaca_simple_calculate_digest(YACA_DIGEST_SHA256, lorem1024, 1024, &digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(digest);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_digest_n
+ * @since_tizen     3.0
+ * @description     Calculates a digest of a buffer.
+ * @scenario        Calculates a digest of a buffer with invalid parameters.
+ */
+int utc_yaca_simple_calculate_digest_n(void)
+{
+       int ret = YACA_ERROR_NONE;
+       char *digest = NULL;
+       size_t digest_len;
+
+       ret = yaca_simple_calculate_digest((yaca_digest_algorithm_e)-1, lorem1024, 1024, &digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_digest(YACA_DIGEST_SHA256, NULL, 1024, &digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_digest(YACA_DIGEST_SHA256, lorem1024, 0, &digest, &digest_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_digest(YACA_DIGEST_SHA256, lorem1024, 1024, NULL, &digest_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_digest(YACA_DIGEST_SHA256, lorem1024, 1024, &digest, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(digest);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_encrypt_p
+ * @since_tizen     3.0
+ * @description     Encrypts data using a symmetric cipher.
+ * @scenario        Encrypts data using a symmetric cipher with valid parameters.
+ */
+int utc_yaca_simple_encrypt_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len = 0;
+       size_t iv_bit_len = 0;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                       YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_simple_encrypt(algo, bcm, key, iv, lorem4096, LOREM4096_SIZE, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(enc);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_encrypt_n
+ * @since_tizen     3.0
+ * @description     Encrypts data using a symmetric cipher.
+ * @scenario        Encrypts data using a symmetric cipher with invalid parameters.
+ */
+int utc_yaca_simple_encrypt_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len = 0;
+       size_t iv_bit_len = 0;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                       YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_simple_encrypt((yaca_encrypt_algorithm_e)-1, bcm, key, iv, lorem4096,
+                                                               LOREM4096_SIZE, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_encrypt(algo, (yaca_block_cipher_mode_e)-1, key, iv, lorem4096,
+                                                               LOREM4096_SIZE, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_encrypt(algo, bcm, NULL, iv, lorem4096, LOREM4096_SIZE, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_encrypt(algo, bcm, key, iv, NULL, LOREM4096_SIZE, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_encrypt(algo, bcm, key, iv, lorem4096, 0, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_encrypt(algo, bcm, key, iv, lorem4096, LOREM4096_SIZE, NULL, &enc_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+int encrypt_simple(const yaca_encrypt_algorithm_e algo,
+                                       const yaca_block_cipher_mode_e bcm,
+                                       const size_t key_bit_len)
+{
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       char *dec = NULL;
+       size_t enc_len;
+       size_t dec_len;
+       size_t iv_bit_len;
+
+       int ret = YACA_ERROR_NONE;
+
+       /* Key generation */
+       if ((ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                                                               YACA_DIGEST_SHA256, key_bit_len, &key)) != YACA_ERROR_NONE)
+               return ret;
+
+       if (ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len) != YACA_ERROR_NONE)
+               goto exit;
+
+       if (iv_bit_len > 0 && (ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv)) != YACA_ERROR_NONE)
+               goto exit;
+
+       if ((ret = yaca_simple_encrypt(algo, bcm, key, iv, lorem4096, LOREM4096_SIZE, &enc, &enc_len)) != YACA_ERROR_NONE)
+               goto exit;
+
+       if ((ret = yaca_simple_decrypt(algo, bcm, key, iv, enc, enc_len, &dec, &dec_len)) != YACA_ERROR_NONE)
+               goto exit;
+
+       assert_eq(LOREM4096_SIZE, dec_len);
+       int i;
+       for (i = 0; i < LOREM4096_SIZE; i++)
+               assert_eq(lorem4096[i], dec[i]);
+
+exit:
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return ret;
+}
+
+/**
+ * @testcase        utc_yaca_simple_decrypt_p
+ * @since_tizen     3.0
+ * @description     Decrypts data using a symmetric cipher.
+ * @scenario        Decrypts data using a symmetric cipher with valid parameters.
+ */
+int utc_yaca_simple_decrypt_p(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = encrypt_simple(algo, bcm, key_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       algo = YACA_ENCRYPT_CAST5;
+       bcm = YACA_BCM_CFB;
+       key_bit_len = YACA_KEY_LENGTH_UNSAFE_40BIT;
+
+       ret = encrypt_simple(algo, bcm, key_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       algo = YACA_ENCRYPT_UNSAFE_RC2;
+       bcm = YACA_BCM_CBC;
+       key_bit_len = YACA_KEY_LENGTH_UNSAFE_8BIT;
+
+       ret = encrypt_simple(algo, bcm, key_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       algo = YACA_ENCRYPT_UNSAFE_RC4;
+       bcm = YACA_BCM_NONE;
+       key_bit_len = YACA_KEY_LENGTH_2048BIT;
+
+       ret = encrypt_simple(algo, bcm, key_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_decrypt_n
+ * @since_tizen     3.0
+ * @description     Decrypts data using a symmetric cipher.
+ * @scenario        Decrypts data using a symmetric cipher with invalid parameters.
+ */
+int utc_yaca_simple_decrypt_n(void)
+{
+       yaca_encrypt_algorithm_e algo = YACA_ENCRYPT_AES;
+       yaca_block_cipher_mode_e bcm = YACA_BCM_ECB;
+       size_t key_bit_len = YACA_KEY_LENGTH_256BIT;
+
+       yaca_key_h key = YACA_KEY_NULL;
+       yaca_key_h iv = YACA_KEY_NULL;
+
+       char *enc = NULL;
+       size_t enc_len = 0;
+       char *dec = NULL;
+       size_t dec_len = 0;
+       size_t iv_bit_len = 0;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_derive_pbkdf2("foo bar", "123456789", 10, 1000,
+                       YACA_DIGEST_SHA256, key_bit_len, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_encrypt_get_iv_bit_length(algo, bcm, key_bit_len, &iv_bit_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       if (iv_bit_len > 0) {
+               ret = yaca_key_generate(YACA_KEY_TYPE_IV, iv_bit_len, &iv);
+               assert_eq(ret, YACA_ERROR_NONE);
+       }
+
+       ret = yaca_simple_encrypt(algo, bcm, key, iv, lorem4096, LOREM4096_SIZE, &enc, &enc_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_decrypt((yaca_encrypt_algorithm_e)-1, bcm, key, iv, enc, enc_len, &dec, &dec_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_decrypt(algo, (yaca_block_cipher_mode_e)-1, key, iv, enc, enc_len, &dec, &dec_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_decrypt(algo, bcm, NULL, iv, enc, enc_len, &dec, &dec_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_decrypt(algo, bcm, key, iv, NULL, enc_len, &dec, &dec_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_decrypt(algo, bcm, key, iv, enc, 0, &dec, &dec_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_decrypt(algo, bcm, key, iv, enc, enc_len, NULL, &dec_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_decrypt(algo, bcm, key, iv, enc, enc_len, &dec, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(enc);
+       yaca_free(dec);
+       yaca_key_destroy(iv);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_signature_p
+ * @since_tizen     3.0
+ * @description     Creates a signature using asymmetric private key.
+ * @scenario        Creates a signature using asymmetric private key with valid parameters.
+ */
+int utc_yaca_simple_calculate_signature_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h prv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(signature);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_signature_n
+ * @since_tizen     3.0
+ * @description     Creates a signature using asymmetric private key.
+ * @scenario        Creates a signature using asymmetric private key with invalid parameters.
+ */
+int utc_yaca_simple_calculate_signature_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h prv = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_signature((yaca_digest_algorithm_e)-1, prv, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, NULL, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, NULL, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, lorem4096, 0,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, lorem4096, LOREM4096_SIZE,
+                                 NULL, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, lorem4096, LOREM4096_SIZE,
+                                 &signature, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(signature);
+       yaca_key_destroy(prv);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_verify_signature_p
+ * @since_tizen     3.0
+ * @description     Verifies a signature using asymmetric public key.
+ * @scenario        Verifies a signature using asymmetric public key with valid parameters.
+ */
+int utc_yaca_simple_verify_signature_p(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_verify_signature(YACA_DIGEST_SHA512, pub, lorem4096, LOREM4096_SIZE,
+                                       signature, signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(signature);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_verify_signature_n
+ * @since_tizen     3.0
+ * @description     Verifies a signature using asymmetric public key.
+ * @scenario        Verifies a signature using asymmetric public key with invalid parameters.
+ */
+int utc_yaca_simple_verify_signature_n(void)
+{
+       yaca_key_type_e type = YACA_KEY_TYPE_RSA_PRIV;
+
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h prv = YACA_KEY_NULL;
+       yaca_key_h pub = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(type, YACA_KEY_LENGTH_1024BIT, &prv);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_key_extract_public(prv, &pub);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_signature(YACA_DIGEST_SHA512, prv, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_verify_signature((yaca_digest_algorithm_e)-1, pub, lorem4096, LOREM4096_SIZE,
+                                       signature, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_verify_signature(YACA_DIGEST_SHA512, NULL, lorem4096, LOREM4096_SIZE,
+                                       signature, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_verify_signature(YACA_DIGEST_SHA512, pub, NULL, LOREM4096_SIZE,
+                                       signature, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_verify_signature(YACA_DIGEST_SHA512, pub, lorem4096, 0,
+                                       signature, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_verify_signature(YACA_DIGEST_SHA512, pub, lorem4096, LOREM4096_SIZE,
+                                       NULL, signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_verify_signature(YACA_DIGEST_SHA512, pub, lorem4096, LOREM4096_SIZE,
+                                       signature, 0);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(signature);
+       yaca_key_destroy(prv);
+       yaca_key_destroy(pub);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_hmac_p
+ * @since_tizen     3.0
+ * @description     Calculates a HMAC of given message using symmetric key.
+ * @scenario        Calculates a HMAC of given message using symmetric key with valid parameters.
+ */
+int utc_yaca_simple_calculate_hmac_p(void)
+{
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_hmac(YACA_DIGEST_SHA512, key, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(signature);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_hmac_n
+ * @since_tizen     3.0
+ * @description     Calculates a HMAC of given message using symmetric key.
+ * @scenario        Calculates a HMAC of given message using symmetric key with invalid parameters.
+ */
+int utc_yaca_simple_calculate_hmac_n(void)
+{
+               char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_hmac((yaca_digest_algorithm_e)-1, key, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_hmac(YACA_DIGEST_SHA512, NULL, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_hmac(YACA_DIGEST_SHA512, key, NULL, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_hmac(YACA_DIGEST_SHA512, key, lorem4096, 0,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_hmac(YACA_DIGEST_SHA512, key, lorem4096, LOREM4096_SIZE,
+                                 NULL, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_hmac(YACA_DIGEST_SHA512, key, lorem4096, LOREM4096_SIZE,
+                                 &signature, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(signature);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_cmac_p
+ * @since_tizen     3.0
+ * @description     Calculates a CMAC of given message using symmetric key.
+ * @scenario        Calculates a CMAC of given message using symmetric key with valid parameters.
+ */
+int utc_yaca_simple_calculate_cmac_p(void)
+{
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_cmac(YACA_ENCRYPT_AES, key, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       yaca_free(signature);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+/**
+ * @testcase        utc_yaca_simple_calculate_cmac_n
+ * @since_tizen     3.0
+ * @description     Calculates a CMAC of given message using symmetric key.
+ * @scenario        Calculates a CMAC of given message using symmetric key with invalid parameters.
+ */
+int utc_yaca_simple_calculate_cmac_n(void)
+{
+       char *signature = NULL;
+       size_t signature_len;
+
+       yaca_key_h key = YACA_KEY_NULL;
+
+       int ret = YACA_ERROR_NONE;
+
+       ret = yaca_key_generate(YACA_KEY_TYPE_SYMMETRIC, YACA_KEY_LENGTH_256BIT, &key);
+       assert_eq(ret, YACA_ERROR_NONE);
+
+       ret = yaca_simple_calculate_cmac((yaca_encrypt_algorithm_e)-1, key, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_cmac(YACA_ENCRYPT_AES, NULL, lorem4096, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_cmac(YACA_ENCRYPT_AES, key, NULL, LOREM4096_SIZE,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_cmac(YACA_ENCRYPT_AES, key, lorem4096, 0,
+                                 &signature, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_cmac(YACA_ENCRYPT_AES, key, lorem4096, LOREM4096_SIZE,
+                                 NULL, &signature_len);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       ret = yaca_simple_calculate_cmac(YACA_ENCRYPT_AES, key, lorem4096, LOREM4096_SIZE,
+                                 &signature, NULL);
+       assert_eq(ret, YACA_ERROR_INVALID_PARAMETER);
+
+       yaca_free(signature);
+       yaca_key_destroy(key);
+
+       return 0;
+}
+
+