From b1b45226753950ec80ef3fd880dbb6424c544b32 Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Tue, 26 Apr 2016 17:05:15 +0200 Subject: [PATCH] Initial commmit for yaca tests. Change-Id: If6d2de0b8a59589ed8c607b21a01bd6fd698a692 --- CMakeLists.txt | 1 + packaging/security-tests.spec | 2 ++ src/CMakeLists.txt | 4 +++ src/security-tests-all.sh | 1 + src/security-tests.sh | 8 ++++- src/yaca/CMakeLists.txt | 39 ++++++++++++++++++++++ src/yaca/yaca-test-crypto.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++ src/yaca/yaca-test-digest.cpp | 41 ++++++++++++++++++++++++ src/yaca/yaca-test-encrypt.cpp | 57 +++++++++++++++++++++++++++++++++ src/yaca/yaca-test-key.cpp | 65 +++++++++++++++++++++++++++++++++++++ src/yaca/yaca-test-seal.cpp | 53 ++++++++++++++++++++++++++++++ src/yaca/yaca-test-sign.cpp | 53 ++++++++++++++++++++++++++++++ src/yaca/yaca-test-simple.cpp | 41 ++++++++++++++++++++++++ src/yaca/yaca-test.cpp | 30 +++++++++++++++++ 14 files changed, 467 insertions(+), 1 deletion(-) create mode 100644 src/yaca/CMakeLists.txt create mode 100644 src/yaca/yaca-test-crypto.cpp create mode 100644 src/yaca/yaca-test-digest.cpp create mode 100644 src/yaca/yaca-test-encrypt.cpp create mode 100644 src/yaca/yaca-test-key.cpp create mode 100644 src/yaca/yaca-test-seal.cpp create mode 100644 src/yaca/yaca-test-sign.cpp create mode 100644 src/yaca/yaca-test-simple.cpp create mode 100644 src/yaca/yaca-test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3571d97..c27dd7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,7 @@ IF(BUILD_ALL_TESTS) SET(BUILD_SM ON) SET(BUILD_CYNARA ON) SET(BUILD_WEB ON) + SET(BUILD_YACA ON) ENDIF(BUILD_ALL_TESTS) # If supported for the target machine, emit position-independent code,suitable diff --git a/packaging/security-tests.spec b/packaging/security-tests.spec index 18011c5..8907212 100644 --- a/packaging/security-tests.spec +++ b/packaging/security-tests.spec @@ -13,6 +13,7 @@ BuildRequires: pkgconfig(libcap) BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(security-manager) BuildRequires: pkgconfig(key-manager) +BuildRequires: pkgconfig(yaca) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dbus-1) @@ -87,6 +88,7 @@ echo "security-tests postinst done ..." /usr/bin/cynara-test /usr/bin/ckm-tests /usr/bin/ckm-integration-tests +/usr/bin/yaca-test %{ckm_test_dir}/* /etc/security-tests /usr/lib/security-tests/cynara-tests/plugins/single-policy/* diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9bba81d..471c28e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,3 +106,7 @@ ENDIF(BUILD_CYNARA) IF(BUILD_WEB) ADD_SUBDIRECTORY(libwebappenc-tests) ENDIF(BUILD_WEB) + +IF(BUILD_YACA) + ADD_SUBDIRECTORY(yaca) +ENDIF(BUILD_YACA) diff --git a/src/security-tests-all.sh b/src/security-tests-all.sh index da97c64..9ab5b5c 100644 --- a/src/security-tests-all.sh +++ b/src/security-tests-all.sh @@ -56,6 +56,7 @@ runTest smack runTest security-manager runTest cynara runTest ckm +runTest yaca printSummary diff --git a/src/security-tests.sh b/src/security-tests.sh index 9115beb..3956258 100644 --- a/src/security-tests.sh +++ b/src/security-tests.sh @@ -46,11 +46,17 @@ case $1 in echo ckm-tests "${@:2}" ;; +"yaca") + echo "=========================================================================" + echo "YACA TESTS" + echo + yaca-test "${@:2}" + ;; *) echo "Correct using:" echo " security_test.sh " echo - echo "modules: smack, security-manager, cynara, ckm" + echo "modules: smack, security-manager, cynara, ckm, yaca" ;; esac diff --git a/src/yaca/CMakeLists.txt b/src/yaca/CMakeLists.txt new file mode 100644 index 0000000..23c6211 --- /dev/null +++ b/src/yaca/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +# +# Contact: Dariusz Michaluk (d.michaluk@samsumg.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 CMakeLists.txt +# @author Dariusz Michaluk (d.michaluk@samsung.com) +# + +MESSAGE(STATUS "") +MESSAGE(STATUS "Generating makefile for the Yaca system tests...") + +FILE(GLOB yaca_test_SRCS *.cpp) + +## Setup target ################################################################ +SET(YACA_TEST "yaca-test") +ADD_EXECUTABLE(${YACA_TEST} ${yaca_test_SRCS}) + +## Link libraries ############################################################## +PKG_CHECK_MODULES(YACA_TEST_DEPS REQUIRED yaca) + +INCLUDE_DIRECTORIES(SYSTEM ${YACA_TEST_DEPS_INCLUDE_DIRS}) +TARGET_LINK_LIBRARIES(${YACA_TEST} ${YACA_TEST_DEPS_LIBRARIES} dpl-test-framework) + +## Install ##################################################################### +INSTALL(TARGETS ${YACA_TEST} DESTINATION bin) diff --git a/src/yaca/yaca-test-crypto.cpp b/src/yaca/yaca-test-crypto.cpp new file mode 100644 index 0000000..594fe5c --- /dev/null +++ b/src/yaca/yaca-test-crypto.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T1000_YACA_CRYPTO); + +RUNNER_TEST(T1001_yaca_init) +{ +} + +RUNNER_TEST(T1002_yaca_exit) +{ +} + +RUNNER_TEST(T1003_yaca_malloc) +{ +} + +RUNNER_TEST(T1004_yaca_zalloc) +{ +} + +RUNNER_TEST(T1005_yaca_realloc) +{ +} + +RUNNER_TEST(T1006_yaca_free) +{ +} + +RUNNER_TEST(T1007_yaca_rand_bytes) +{ +} + +RUNNER_TEST(T1008_yaca_ctx_set_param) +{ +} + +RUNNER_TEST(T1009_yaca_ctx_get_param) +{ +} + +RUNNER_TEST(T1010_yaca_ctx_free) +{ +} + +RUNNER_TEST(T1011_yaca_get_output_length) +{ +} diff --git a/src/yaca/yaca-test-digest.cpp b/src/yaca/yaca-test-digest.cpp new file mode 100644 index 0000000..b37fc64 --- /dev/null +++ b/src/yaca/yaca-test-digest.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T2000_YACA_DIGEST); + +RUNNER_TEST(T2001_yaca_digest_init) +{ +} + +RUNNER_TEST(T2002_yaca_digest_update) +{ +} + +RUNNER_TEST(T2003_yaca_digest_final) +{ +} diff --git a/src/yaca/yaca-test-encrypt.cpp b/src/yaca/yaca-test-encrypt.cpp new file mode 100644 index 0000000..9e3130b --- /dev/null +++ b/src/yaca/yaca-test-encrypt.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T3000_YACA_ENCRYPT); + +RUNNER_TEST(T3001_yaca_encrypt_init) +{ +} + +RUNNER_TEST(T3002_yaca_encrypt_update) +{ +} + +RUNNER_TEST(T3003_yaca_encrypt_final) +{ +} + +RUNNER_TEST(T3004_yaca_decrypt_init) +{ +} + +RUNNER_TEST(T3005_yaca_decrypt_update) +{ +} + +RUNNER_TEST(T3006_yaca_decrypt_final) +{ +} + +RUNNER_TEST(T3007_yaca_get_iv_bits) +{ +} diff --git a/src/yaca/yaca-test-key.cpp b/src/yaca/yaca-test-key.cpp new file mode 100644 index 0000000..f845d82 --- /dev/null +++ b/src/yaca/yaca-test-key.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T4000_YACA_KEY); + +RUNNER_TEST(T4001_yaca_key_get_bits) +{ +} + +RUNNER_TEST(T4002_yaca_key_import) +{ +} + +RUNNER_TEST(T4003_yaca_key_export) +{ +} + +RUNNER_TEST(T4004_yaca_key_gen) +{ +} + +RUNNER_TEST(T4005_yaca_key_gen_pair) +{ +} + +RUNNER_TEST(T4006_yaca_key_free) +{ +} + +RUNNER_TEST(T4007_yaca_key_derive_dh) +{ +} + +RUNNER_TEST(T4008_yaca_key_derive_kea) +{ +} + +RUNNER_TEST(T4009_yaca_key_derive_pbkdf2) +{ +} diff --git a/src/yaca/yaca-test-seal.cpp b/src/yaca/yaca-test-seal.cpp new file mode 100644 index 0000000..acd6baa --- /dev/null +++ b/src/yaca/yaca-test-seal.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T5000_YACA_SEAL); + +RUNNER_TEST(T5001_yaca_seal_init) +{ +} + +RUNNER_TEST(T5002_yaca_seal_update) +{ +} + +RUNNER_TEST(T5003_yaca_seal_final) +{ +} + +RUNNER_TEST(T5004_yaca_open_init) +{ +} + +RUNNER_TEST(T5005_yaca_open_update) +{ +} + +RUNNER_TEST(T5006_yaca_open_final) +{ +} diff --git a/src/yaca/yaca-test-sign.cpp b/src/yaca/yaca-test-sign.cpp new file mode 100644 index 0000000..918a525 --- /dev/null +++ b/src/yaca/yaca-test-sign.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T6000_YACA_SIGN); + +RUNNER_TEST(T6001_yaca_sign_init) +{ +} + +RUNNER_TEST(T6002_yaca_sign_update) +{ +} + +RUNNER_TEST(T6003_yaca_sign_final) +{ +} + +RUNNER_TEST(T6004_yaca_verify_init) +{ +} + +RUNNER_TEST(T6005_yaca_verify_update) +{ +} + +RUNNER_TEST(T6006_yaca_verify_final) +{ +} diff --git a/src/yaca/yaca-test-simple.cpp b/src/yaca/yaca-test-simple.cpp new file mode 100644 index 0000000..d7186aa --- /dev/null +++ b/src/yaca/yaca-test-simple.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +#include + + +RUNNER_TEST_GROUP_INIT(T7000_YACA_SIMPLE); + +RUNNER_TEST(T7001_yaca_digest_calc) +{ +} + +RUNNER_TEST(T7002_yaca_encrypt) +{ +} + +RUNNER_TEST(T7003_yaca_decrypt) +{ +} diff --git a/src/yaca/yaca-test.cpp b/src/yaca/yaca-test.cpp new file mode 100644 index 0000000..d922550 --- /dev/null +++ b/src/yaca/yaca-test.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Contact: Dariusz Michaluk (d.michaluk@samsumg.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 + * @author Dariusz Michaluk (d.michaluk@samsumg.com) + */ + +#include "dpl/test/test_runner.h" + +int main (int argc, char *argv[]) +{ + int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv); + return status; +} -- 2.7.4