summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt24
-rw-r--r--packaging/secure-storage.spec15
-rwxr-xr-xserver/src/ss_server_main.c30
-rw-r--r--tests/ss_client_tests.c520
4 files changed, 584 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6c395d..2c961c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,7 @@ SET(ss_client_dir "./client/src")
SET(ss_client_include_dir "./client/include")
SET(ss_server_dir "./server/src")
SET(ss_server_include_dir "./server/include")
-SET(ss_test_dir "./testcases")
+SET(ss_test_dir "./tests")
## About debug
#SET(debug_type "") # for debug - use no debugging
@@ -34,7 +34,7 @@ SET(debug_type "-DSS_DLOG_USE") # for debug - use dlog
#SET(debug_type "") # for debug - DO NOT use
SET(use_key "-DUSE_KEY_FILE") # for private key - use key file
#SET(use_key "-DUSE_NOT") # for private key - use no private key, key will be fixed
-SET(smack_groupid "-DSMACK_GROUP_ID") # for group id sharing with smack label
+#SET(smack_groupid "-DSMACK_GROUP_ID") # for group id sharing with smack label
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
@@ -60,7 +60,8 @@ SET(ss-server_CFLAGS " -I. -I${ss_include_dir} -I${ss_server_include_dir} ${debu
SET(ss-server_LDFLAGS ${pkgs_LDFLAGS})
ADD_EXECUTABLE(ss-server ${ss-server_SOURCES})
-TARGET_LINK_LIBRARIES(ss-server ${pkgs_LDFLAGS} -lsecurity-server-client )
+#TARGET_LINK_LIBRARIES(ss-server ${pkgs_LDFLAGS} -lsecurity-server-client )
+TARGET_LINK_LIBRARIES(ss-server ${pkgs_LDFLAGS} )
SET_TARGET_PROPERTIES(ss-server PROPERTIES COMPILE_FLAGS "${ss-server_CFLAGS}")
####################################################################################################
@@ -74,3 +75,20 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/config DESTINATION share/secure-storag
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ss_manager.h DESTINATION include)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/secure-storage.service DESTINATION /usr/lib/systemd/system)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/secure-storage.socket DESTINATION /usr/lib/systemd/system)
+
+
+###################################################################################################
+## for ss-client-tests
+SET(ss-client-tests_SOURCES ${ss_test_dir}/ss_client_tests.c )
+SET(ss-client-tests_LDFLAGS " -module -avoid-version ${OPENSSL_LIBS}")
+SET(ss-client-tests_CFLAGS " ${CFLAGS} -fPIC -I${ss_client_include_dir} -I${ss_include_dir} ${OPENSSL_CFLAGS} ${debug_type} ")
+#SET(libss-client_LIBADD " ${OPENSSL_LIBS} ")
+
+ADD_EXECUTABLE(ss-client-tests ${ss-client-tests_SOURCES})
+TARGET_LINK_LIBRARIES(ss-client-tests ss-client )
+SET_TARGET_PROPERTIES(ss-client-tests PROPERTIES COMPILE_FLAGS "${ss-client-tests_CFLAGS}")
+
+INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/ss-client-tests DESTINATION bin)
+###################################################################################################
+
+
diff --git a/packaging/secure-storage.spec b/packaging/secure-storage.spec
index 171149d..9e57dbe 100644
--- a/packaging/secure-storage.spec
+++ b/packaging/secure-storage.spec
@@ -11,7 +11,7 @@ Source1003: ss-server.manifest
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(libsystemd-daemon)
-BuildRequires: pkgconfig(security-server)
+#BuildRequires: pkgconfig(security-server)
BuildRequires: cmake
BuildRequires: pkgconfig(dukgenerator)
@@ -47,6 +47,15 @@ Requires: libss-client = %{version}-%{release}
%description -n ss-server
Secure storage package (ss-server)
+%package -n ss-client-tests
+Summary: Internal test for secure-storage
+Group: Development
+Requires: libss-client = %{version}-%{release}
+
+%description -n ss-client-tests
+Internal test for secure-storage implementation
+
+
%prep
%setup -q
cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} .
@@ -114,3 +123,7 @@ systemctl daemon-reload
%{_libdir}/pkgconfig/secure-storage.pc
%{_libdir}/libss-client.so
+%files -n ss-client-tests
+%defattr(-,root,root,-)
+%{_bindir}/ss-client-tests
+
diff --git a/server/src/ss_server_main.c b/server/src/ss_server_main.c
index 34c1919..0f45611 100755
--- a/server/src/ss_server_main.c
+++ b/server/src/ss_server_main.c
@@ -48,7 +48,10 @@
#include "secure_storage.h"
#include "ss_server_main.h"
#include "ss_server_ipc.h"
+
+#ifdef SMACK_GROUP_ID
#include <security-server/security-server.h>
+#endif
#ifdef USE_KEY_FILE
#define CONF_FILE_PATH "/usr/share/secure-storage/config"
@@ -206,11 +209,14 @@ int IsDirExist(const char* dirpath)
int check_privilege_by_sockfd(int sockfd, const char* object, const char* access_rights)
{
+ int ret = 0;
+#ifdef SMACK_GROUP_ID
if(!IsSmackEnabled())
return 0;
- int ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
+ ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
SECURE_SLOGD("object : %s, access_rights : %s, ret : %d", object, access_rights, ret);
+#endif
return ret;
}
@@ -288,6 +294,7 @@ int GetProcessExecPath(int pid, char* buffer)
return 0;
}
+#ifdef SMACK_GROUP_ID
int GetProcessSmackLabel(int sockfd, char* proc_smack_label)
{
char* smack_label = security_server_get_smacklabel_sockfd(sockfd);
@@ -304,6 +311,7 @@ int GetProcessSmackLabel(int sockfd, char* proc_smack_label)
SECURE_SLOGD("defined smack label : %s", proc_smack_label);
return 0;
}
+#endif
int GetPathHash(const char *src, char *output)
{
@@ -441,7 +449,11 @@ int SsServerDataStoreFromFile(int sender_pid, const char* data_filepath, ssm_fla
//0. privilege check and get directory name
char dir[MAX_GROUP_ID_LEN] = {0,};
+#ifdef SMACK_GROUP_ID
if(GetProcessStorageDir(sockfd, sender_pid, group_id, dir) < 0)
+#else
+ if(GetProcessStorageDir(-1, sender_pid, group_id, dir) < 0)
+#endif
{
SLOGE("Failed to get storage dir\n");
return SS_SECURE_STORAGE_ERROR;
@@ -560,7 +572,11 @@ int SsServerDataStoreFromBuffer(int sender_pid, char* writebuffer, size_t bufLen
//0. get directory name and privilege check
char dir[MAX_GROUP_ID_LEN] = {0,};
+#ifdef SMACK_GROUP_ID
if(GetProcessStorageDir(sockfd, sender_pid, group_id, dir) < 0)
+#else
+ if(GetProcessStorageDir(-1, sender_pid, group_id, dir) < 0)
+#endif
{
SLOGE("Failed to get storage dir\n");
return SS_SECURE_STORAGE_ERROR;
@@ -674,7 +690,11 @@ int SsServerDataRead(int sender_pid, const char* data_filepath, char* pRetBuf, u
//0. get directory name and privilege check
char dir[MAX_GROUP_ID_LEN] = {0,};
+#ifdef SMACK_GROUP_ID
if(GetProcessStorageDir(sockfd, sender_pid, group_id, dir) < 0)
+#else
+ if(GetProcessStorageDir(-1, sender_pid, group_id, dir) < 0)
+#endif
{
SLOGE("Failed to get storage dir\n");
return SS_SECURE_STORAGE_ERROR;
@@ -761,7 +781,11 @@ int SsServerDeleteFile(int sender_pid, const char* data_filepath, ssm_flag flag,
//0. get directory name and privilege check
char dir[MAX_GROUP_ID_LEN] = {0,};
+#ifdef SMACK_GROUP_ID
if(GetProcessStorageDir(sockfd, sender_pid, group_id, dir) < 0)
+#else
+ if(GetProcessStorageDir(-1, sender_pid, group_id, dir) < 0)
+#endif
{
SLOGE("Failed to get storage dir\n");
return SS_SECURE_STORAGE_ERROR;
@@ -803,7 +827,11 @@ int SsServerGetInfo(int sender_pid, const char* data_filepath, char* file_info,
//0. get directory name and privilege check
char dir[MAX_GROUP_ID_LEN] = {0,};
+#ifdef SMACK_GROUP_ID
if(GetProcessStorageDir(sockfd, sender_pid, group_id, dir) < 0)
+#else
+ if(GetProcessStorageDir(-1, sender_pid, group_id, dir) < 0)
+#endif
{
SLOGE("Failed to get storage dir\n");
return SS_SECURE_STORAGE_ERROR;
diff --git a/tests/ss_client_tests.c b/tests/ss_client_tests.c
new file mode 100644
index 0000000..584ffc3
--- /dev/null
+++ b/tests/ss_client_tests.c
@@ -0,0 +1,520 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <ss_manager.h>
+
+#define TET_UNINITIATED -1
+#define TET_PASS 0
+#define TET_FAIL 1
+
+static void startup(void)
+{
+ printf("Make temporary directory - /opt/secure-storage/test/\n");
+ system("mkdir -p /opt/secure-storage/test");
+ printf("Make temporary file\n");
+ system("touch /opt/secure-storage/test/input.txt");
+ system("echo \"abcdefghij\" > /opt/secure-storage/test/input.txt");
+ system("cp /opt/secure-storage/test/input.txt /opt/secure-storage/test/input2.txt");
+}
+
+static void cleanup(void)
+{
+ printf("Remove tamporary file and directory\n");
+ system("rm -rf /opt/secure-storage/test");
+}
+
+static void tet_result(char *tc_name, int tetResult)
+{
+ if(tetResult == TET_PASS)
+ printf("[%s]...PASS\n\n", tc_name);
+ else
+ printf("[%s]...FAIL\n\n", tc_name);
+}
+
+/**
+ * @brief Positive test case of ssm_getinfo()
+ */
+static void utc_SecurityFW_ssm_getinfo_func_01(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+ ssm_file_info_t sfi;
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* get information */
+ ret = ssm_getinfo(filepath, &sfi, flag, group_id);
+ if(ret == 0) // success
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+error:
+ tet_result(__func__, tetResult);
+}
+
+/**
+ * @brief Negative test case of ssm_getinfo()
+ */
+static void utc_SecurityFW_ssm_getinfo_func_02(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input2.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+ ssm_file_info_t sfi;
+
+ printf("[%s] checkpoint1\n", __func__);
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ printf("[%s] checkpoint2 [%d]\n", __func__, ret);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* get information */
+ ret = ssm_getinfo(NULL, &sfi, flag, group_id);
+ printf("[%s] checkpoint3 [%d]\n", __func__, ret);
+ if(ret == 0) // success
+ tetResult = TET_FAIL;
+ else
+ tetResult = TET_PASS;
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ printf("[%s] checkpoint4 [%d]\n", __func__, ret);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+error:
+ tet_result(__func__, tetResult);
+}
+
+
+/**
+ * @brief Positive test case of ssm_read()
+ */
+static void utc_SecurityFW_ssm_read_func_01(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+
+ /* variables for ssm_read */
+ FILE* fp_original = NULL;
+ char buf[20];
+ char* retbuf = NULL;
+ int readlen = 0;
+ ssm_file_info_t sfi;
+
+ /* get original file content. after encrypting, original file will be deleted */
+ memset(buf, 0x00, 20);
+ fp_original = fopen(filepath, "r");
+ fgets(buf, 20, fp_original);
+ fclose(fp_original);
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* read and compare */
+ ssm_getinfo(filepath, &sfi, flag, group_id);
+ retbuf = (char*)malloc(sizeof(char) * (sfi.originSize + 1));
+ memset(retbuf, 0x00, (sfi.originSize + 1));
+ ret = ssm_read(filepath, retbuf, sfi.originSize, &readlen, flag, group_id);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto free_error;
+ }
+
+ if(tetResult != TET_UNINITIATED)
+ {
+ if(!memcmp(buf, retbuf, strlen(retbuf))) // if same
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+ }
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+free_error:
+ free(retbuf);
+error:
+ tet_result(__func__, tetResult);
+}
+
+
+/**
+ * @brief Negative test case of ssm_read()
+ */
+static void utc_SecurityFW_ssm_read_func_02(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input2.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+
+ /* variables for ssm_read */
+ FILE* fp_original = NULL;
+ char buf[20];
+ char* retbuf = NULL;
+ int readlen = 0;
+ ssm_file_info_t sfi;
+
+ /* get original file content. after encrypting, original file will be deleted */
+ memset(buf, 0x00, 20);
+ fp_original = fopen(filepath, "r");
+ fgets(buf, 20, fp_original);
+ fclose(fp_original);
+
+ printf("[%s] checkpoint1\n", __func__);
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ printf("[%s] checkpoint2 [%d]\n", __func__, ret);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+
+ /* read and compare */
+ ret = ssm_getinfo(filepath, &sfi, flag, group_id);
+ printf("[%s] checkpoint3 [%d]\n", __func__, ret);
+ retbuf = (char*)malloc(sizeof(char) * (sfi.originSize + 1));
+ memset(retbuf, 0x00, (sfi.originSize + 1));
+ ret = ssm_read(NULL, retbuf, sfi.originSize, &readlen, flag, group_id);
+ printf("[%s] checkpoint4 [%d]\n", __func__, ret);
+ if(ret != 0) // if fail,
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ printf("[%s] checkpoint5 [%d]\n", __func__, ret);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+ free(retbuf);
+error:
+ tet_result(__func__, tetResult);
+}
+
+
+
+/**
+ * @brief Positive test case of ssm_write_buffer()
+ */
+static void utc_SecurityFW_ssm_write_buffer_func_01(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_buffer */
+ int ret = -1;
+ char oribuf[20];
+ ssm_flag flag = SSM_FLAG_SECRET_OPERATION;
+ char* group_id = NULL;
+ char* filename = "write_buffer.txt";
+ int buflen = 0;
+
+ /* variables for ssm_read */
+ char buf[20];
+ char* retbuf = NULL;
+ int readlen = 0;
+ ssm_file_info_t sfi;
+
+ /* set contents in buffers */
+ memset(oribuf, 0x00, 20);
+ memset(buf, 0x00, 20);
+ strncpy(oribuf, "abcdefghij", 10); // original buffer
+ strncpy(buf, "abcdefghij", 10); // encrypting
+
+ buflen = strlen(buf);
+
+ /* write file to secure-storage */
+ ret = ssm_write_buffer(buf, buflen, filename, flag, group_id);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* read and compare */
+ ssm_getinfo(filename, &sfi, flag, group_id);
+ retbuf = (char*)malloc(sizeof(char) * (sfi.originSize + 1));
+ memset(retbuf, 0x00, (sfi.originSize + 1));
+
+ ret = ssm_read(filename, retbuf, sfi.originSize, &readlen, flag, group_id);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto free_error;
+ }
+
+ if(tetResult != TET_UNINITIATED)
+ {
+ if(!memcmp(oribuf, retbuf, strlen(retbuf))) // if same
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+ }
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filename, flag, group_id);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+free_error:
+ free(retbuf);
+error:
+ tet_result(__func__, tetResult);
+}
+
+
+/**
+ * @brief Negative test case of ssm_write_buffer()
+ */
+static void utc_SecurityFW_ssm_write_buffer_func_02(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_buffer */
+ int ret = -1;
+ char* filename = "write_buffer.txt";
+ ssm_flag flag = SSM_FLAG_SECRET_OPERATION;
+ char buf[20];
+ int buflen = 0;
+ char* group_id = NULL;
+
+ /* write file to secure-storage */
+ ret = ssm_write_buffer(NULL, buflen, filename, flag, group_id);
+ if(ret != 0) // if fail,
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+
+ tet_result(__func__, tetResult);
+}
+
+
+/**
+ * @brief Positive test case of ssm_write_file()
+ */
+static void utc_SecurityFW_ssm_write_file_func_01(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+
+ /* variables for ssm_read */
+ FILE* fp_original = NULL;
+ char buf[20];
+ char* retbuf = NULL;
+ int readlen = 0;
+ ssm_file_info_t sfi;
+
+ /* get original file content. after encrypting, original file will be deleted */
+ memset(buf, 0x00, 20);
+ fp_original = fopen(filepath, "r");
+ fgets(buf, 20, fp_original);
+ fclose(fp_original);
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ if(ret != 0) { // if fail,
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* read and compare */
+ ssm_getinfo(filepath, &sfi, flag, group_id);
+ retbuf = (char*)malloc(sizeof(char) * (sfi.originSize + 1));
+ memset(retbuf, 0x00, (sfi.originSize + 1));
+ ret = ssm_read(filepath, retbuf, sfi.originSize, &readlen, flag, group_id);
+ if(ret != 0) { // if fail,
+ tetResult = TET_UNINITIATED;
+ goto free_error;
+ }
+
+ if(tetResult != TET_UNINITIATED)
+ {
+ if(!memcmp(buf, retbuf, strlen(retbuf))) // if same
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+ }
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+free_error:
+ free(retbuf);
+error:
+ tet_result(__func__, tetResult);
+}
+
+/**
+ * @brief Negative test case of ssm_write_file()
+ */
+static void utc_SecurityFW_ssm_write_file_func_02(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_write_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(NULL, flag, group_id);
+ if(ret != 0) // if fail,
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+
+ tet_result(__func__, tetResult);
+}
+
+
+/**
+ * @brief Positive test case of ssm_delete_file()
+ */
+static void utc_SecurityFW_ssm_delete_file_func_01(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_delete_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* delete file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ if(ret == 0)
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+
+error:
+ tet_result(__func__, tetResult);
+}
+
+/*
+ * @brief Negative test case of ssm_delete_file()
+ */
+static void utc_SecurityFW_ssm_delete_file_func_02(void)
+{
+ int tetResult = TET_FAIL;
+ /* variables for ssm_delete_file */
+ int ret = -1;
+ char* filepath = "/opt/secure-storage/test/input2.txt";
+ ssm_flag flag = SSM_FLAG_DATA;
+ char* group_id = NULL;
+
+ printf("[%s] checkpoint1\n", __func__);
+
+ /* write file to secure-storage */
+ ret = ssm_write_file(filepath, flag, group_id);
+ printf("[%s] checkpoint2 [%d]\n", __func__, ret);
+ if(ret != 0) // if fail,
+ {
+ tetResult = TET_UNINITIATED;
+ goto error;
+ }
+
+ /* delete file */
+ ret = ssm_delete_file(NULL, flag, group_id);
+ printf("[%s] checkpoint3 [%d]\n", __func__, ret);
+ if(ret != 0)
+ tetResult = TET_PASS;
+ else
+ tetResult = TET_FAIL;
+
+ /* delete encrypted file */
+ ret = ssm_delete_file(filepath, flag, group_id);
+ printf("[%s] checkpoint4 [%d]\n", __func__, ret);
+ if(ret != 0)
+ tetResult = TET_UNINITIATED;
+
+error:
+ tet_result(__func__, tetResult);
+}
+
+
+int main()
+{
+ startup();
+ utc_SecurityFW_ssm_getinfo_func_01();
+ utc_SecurityFW_ssm_getinfo_func_02();
+ cleanup();
+
+ startup();
+ utc_SecurityFW_ssm_read_func_01();
+ utc_SecurityFW_ssm_read_func_02();
+ cleanup();
+
+ startup();
+ utc_SecurityFW_ssm_write_buffer_func_01();
+ utc_SecurityFW_ssm_write_buffer_func_02();
+ cleanup();
+
+ startup();
+ utc_SecurityFW_ssm_write_file_func_01();
+ utc_SecurityFW_ssm_write_file_func_02();
+ cleanup();
+
+ startup();
+ utc_SecurityFW_ssm_delete_file_func_01();
+ utc_SecurityFW_ssm_delete_file_func_02();
+ cleanup();
+
+ return 0;
+}