From: Kim Kibum Date: Fri, 13 Jul 2012 02:00:48 +0000 (+0900) Subject: upload source X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1041c2fad9c3a386fd3e7bdd3c3f6a97d25838e3;p=pkgs%2Fd%2Fdrm-trusted.git upload source --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e1c9411 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Mahendra Kumar Prajapat +Harsha Shekar \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..fb0aca4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,55 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(drm-trusted CXX) + +#Verbose +#SET(CMAKE_VERBOSE_MAKEFILE ON) + +# Message +#MESSAGE("FLAGS: ${CMAKE_C_FLAGS}") +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(LIBDIR ${PREFIX}/lib) +SET(INCLUDEDIR ${PREFIX}/include) +SET(VERSION 0.0.1) + +SET(SRCS + service/drm_trusted_client.cpp + service/drm_trusted_client_ipc.cpp +) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +SET(extapi "-fvisibility=hidden") +SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${extapi}") + +#SET(DEBUG "-Wall -Werror -ggdb3 -fno-omit-frame-pointer -rdynamic -fno-optimize-sibling-calls -fstack-protector-all") +#SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${DEBUG}") + +INCLUDE(FindPkgConfig) +pkg_check_modules(exppkgs REQUIRED dlog capi-base-common) + +FOREACH(flag ${exppkgs_CFLAGS}) + SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}") +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} "-ldl" ) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${exppkgs_LDFLAGS}) +SET_TARGET_PROPERTIES( + drm-trusted + PROPERTIES + SOVERSION 0 + VERSION 0.0.1 +) + +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") + MESSAGE("add -DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc) +INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION /usr/include/drm-trusted/) \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a06208b --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/TC/build.sh b/TC/build.sh new file mode 100644 index 0000000..bb21e41 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +#Modify local TETware folder path +export TET_INSTALL_PATH=/path/to/TETware +if [ ! -d "$TET_INSTALL_PATH" ]; then + echo "TET_INSTALL_PATH = $TET_INSTALL_PATH doesn't exist" + echo "Modify this script build.sh with tetware directory" + exit +fi + +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +#FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +DATE=$(date +'%Y.%m.%d_%H.%M') +HTML_RESULT=$RESULT_DIR/drm_tc_trusted_client_build_result_$DATE.html +JOURNAL_RESULT=$RESULT_DIR/drm_tc_trusted_client_build_result_$DATE.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ + +# Log Levels +# LOG_LEVEL=3 prints only tet_infoline +# LOG_LEVEL=7 prints only tet_infoline & tet_printf +LOG_LEVEL=7 +grw -c $LOG_LEVEL -f chtml -o $HTML_RESULT $JOURNAL_RESULT + +# Copy the results outside drm-trusted +echo "Copy the results outside drm-trusted & in folder drm_tc_results_trusted_client" +mkdir -p ../../drm_tc_results_trusted_client +cp $RESULT_DIR/drm_tc_trusted_client_build_result_$DATE.* ../../drm_tc_results_trusted_client/ diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100644 index 0000000..abf4c7c --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +#Modify TETware path on target +export TET_INSTALL_PATH=/path/to/TETware +if [ ! -d "$TET_INSTALL_PATH" ]; then + echo "TET_INSTALL_PATH = $TET_INSTALL_PATH doesn't exist" + echo "Modify this script execute.sh with tetware directory" + exit +fi + +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH + +export TET_ROOT=$TET_TARGET_PATH + +export TET_SUITE_ROOT=`pwd` +#FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +DATE=$(date +'%Y.%m.%d_%H.%M') +HTML_RESULT=$RESULT_DIR/drm_tc_trusted_client_execute_result_$DATE.html +JOURNAL_RESULT=$RESULT_DIR/drm_tc_trusted_client_execute_result_$DATE.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ + +# Log Levels +# LOG_LEVEL=3 prints only tet_infoline +# LOG_LEVEL=7 prints only tet_infoline & tet_printf +LOG_LEVEL=7 +grw -c $LOG_LEVEL -f chtml -o $HTML_RESULT $JOURNAL_RESULT + +# Copy the results outside drm-trusted +mkdir -p ../../drm_tc_results_trusted_client +cp $RESULT_DIR/drm_tc_trusted_client_execute_result_$DATE.* ../../drm_tc_results_trusted_client/ diff --git a/TC/tet_code b/TC/tet_code new file mode 100644 index 0000000..a2cf6c1 --- /dev/null +++ b/TC/tet_code @@ -0,0 +1,12 @@ +# TET reserved codes +0 "PASS" +1 "FAIL" +2 "UNRESOLVED" +3 "NOTINUSE" +4 "UNSUPPORTED" +5 "UNTESTED" +6 "UNINITIATED" +7 "NORESULT" + +# Test suite additional codes +33 "INSPECT" diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..43cbc9b --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/unit/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..6192c78 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,3 @@ +TET_OUTPUT_CAPTURE=False +TET_BUILD_TOOL=make +TET_PASS_TC_NAME=True diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..c66eda4 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,2 @@ +TET_OUTPUT_CAPTURE=False +TET_CLEAN_TOOL=make clean diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..0d9d39a --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1 @@ +TET_OUTPUT_CAPTURE=False diff --git a/TC/unit/Makefile b/TC/unit/Makefile new file mode 100644 index 0000000..145156e --- /dev/null +++ b/TC/unit/Makefile @@ -0,0 +1,31 @@ +CC ?= gcc + +TARGETS = utc_drmtrustedclient_drm_trusted_handle_request_func \ + utc_drmtrustedclient_drm_trusted_open_decrypt_session_func \ + utc_drmtrustedclient_drm_trusted_close_decrypt_session_func \ + utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func \ + utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func \ + utc_drmtrustedclient_drm_trusted_read_decrypt_session_func \ + utc_drmtrustedclient_drm_trusted_set_decrypt_state_func \ + utc_drmtrustedclient_drm_trusted_open_convert_func \ + utc_drmtrustedclient_drm_trusted_write_convert_func \ + utc_drmtrustedclient_drm_trusted_close_convert_func + +PKGS = drm-trusted + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +all: $(TARGETS) + +$(TARGETS): %: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -rf $(TARGETS) ../results ../tet_tmp_dir diff --git a/TC/unit/drm_test_contents_def.h b/TC/unit/drm_test_contents_def.h new file mode 100644 index 0000000..fb16574 --- /dev/null +++ b/TC/unit/drm_test_contents_def.h @@ -0,0 +1,119 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * 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 drmcontentsdef.h + * @brief DRM TC Content MACROs. + * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com) + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: DRM TC Content MACROs + */ + +#ifndef __DRM_CONTENTS_DEF_H__ +#define __DRM_CONTENTS_DEF_H__ + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus */ + +#include "drm_trusted_client.h" + +#define FILE_PATH_MAX_SIZE (256) + +/* Modify path to local tc_data folder*/ +#define DRM_CONTENT_PATH "/path/to/tc_data" + +/* + * Valid File paths + */ +#define FILE_PATH_VALID_FILE_OMA_1 DRM_CONTENT_PATH"/flourish_count5.dcf" +#define FILE_PATH_VALID_FILE_OMA_2 DRM_CONTENT_PATH"/1202_F1_Jpg.dcf" + +/* + * This file will be generated as a part of DM to DCF conversion test-case + */ +#define FILE_PATH_VALID_DM_FILE_OMA_1 DRM_CONTENT_PATH"/image_cd.dm" + +#define FILE_PATH_VALID_FILE_OMA_9 DRM_CONTENT_PATH"/image_cd.dcf" + +/* + * Invalid File paths + */ +#define INVALID_POINTER_OBJECT NULL +#define FILE_PATH_INVALID_FILE_NULL NULL +#define FILE_PATH_INVALID_FILE_EMPTY "" + + +/** Valid RO file paths + * + */ +#define FILE_PATH_VALID_RO_FILE_OMA_1 DRM_CONTENT_PATH"/flourish_count5.dr" + +/** Invalid RO file paths + * + */ +#define FILE_PATH_INVALID_RO_FILE_OMA_1 DRM_CONTENT_PATH"/flourish_count5.dcf" + +/* + * Valid License Initiators + */ +/* Jazz_Audio_OPLs0.pya */ +#define LICENSE_INITIATOR_VALID_PR_FILE "http://playready.directtaps.net/pr/initiator.aspx?p=0&contentid=ZVXWl75xFUOdCY/tO8bLCA==&type=license&content=http://131.107.149.211/pr/media/1044/Jazz_Audio_OPLs0.pya" + +/* DomainTestVideo1.pyv */ +#define LICENSE_INITIATOR_VALID_PR_FILE_1 "http://playready.directtaps.net/pr/initiator.aspx?p=0&contentid=ybubwBx/XUidiUX3zdMRTg==&type=license&content=http://131.107.149.211/pr/media/1044/DomainTestVideo1.pyv" + +/* DomainTestVideo1.pyv */ +#define JOIN_DOMAIN_INITIATOR_VALID_PR_FILE_1 "http://playready.directtaps.net/pr/initiator.aspx?p=0&type=JOIN" + +/* DomainTestVideo1.pyv */ +#define LEAVE_DOMAIN_INITIATOR_VALID_PR_FILE_1 "http://playready.directtaps.net/pr/initiator.aspx?p=0&type=LEAVE" + +/* DomainTestVideo1.pyv */ +#define METERING_INITIATOR_VALID_PR_FILE_1 "http://playready.directtaps.net/pr/initiator.aspx?p=0&contentid=ybubwBx/XUidiUX3zdMRTg==&type=metering&content=http://131.107.149.211/pr/media/1044/DomainTestVideo1.pyv" + +/* ExpirationAudio1.pya */ +#define LICENSE_INITIATOR_VALID_PR_FILE_2 "http://playready.directtaps.net/pr/initiator.aspx?p=0&contentid=qTNJyCKLmUCdGpx1ZHQ0Aw==&type=license&content=http://131.107.149.211/pr/media/1044/ExpirationAudio1.pya" + +/* MD_h264_V4AES.pyv */ +#define LICENSE_INITIATOR_VALID_PR_FILE_3 "http://playready.directtaps.net/pr/initiator.aspx?p=0&contentid=ewIUg21KrEecS3qu8m9EMQ==&type=license&content=http://131.107.149.211/pr/media/1044/MD_h264_V4AES.pyv" + +/* jazz_wma_Domain_No_Copy.pya */ +#define LICENSE_INITIATOR_VALID_PR_FILE_4 "http://playready.directtaps.net/pr/initiator.aspx?p=1&contentid=fXZukDZR4kKMOIbSE+MuPg==&type=license&content=http://131.107.149.211/pr/media/1207/jazz_wma_Domain_No_Copy.pya" + +/* + * Invalid License Initiators + */ +#define INVALID_LICENSE_INITIATOR_PR_FILE_1 "http://playready.directtaps.net/prxx/initiatorxxxx.aspx?p=0&contentid=ZVXWl75xFUOdCY/tO8bLCA==&type=license&content=http://131.107.149.211/pr/media/1044/Jazz_Audio_OPLs0.pya" +#define INVALID_JOIN_DOMAIN_INITIATOR_1 "http://playready.directtaps.net/prxx/initiatorxxxx.aspx?p=0&type=JOIN" +#define INVALID_LEAVE_DOMAIN_INITIATOR_1 "http://playready.directtaps.net/prxx/initiatorxxxx.aspx?p=0&type=LEAVE" +#define INVALID_METERING_INITIATOR_1 "http://playready.directtaps.net/prxx/initiatorxxxx.aspx?p=0&contentid=ybubwBx/XUidiUX3zdMRTg==&type=metering&content=http://131.107.149.211/pr/media/1044/DomainTestVideo1.pyv" +#define INVALID_LICENSE_INITIATOR_PR_FILE_2 "http://playready.directtaps.net/pr/initiator.aspx?p=0&contentid=ZVXWl75xFUOdCY/tO8bLCA==&type=license&content=http://131.107.149.211/prxx/media/1044/Jazz_Audio_OPLs0xxxx.pya" + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __DRM_CONTENTS_DEF_H__ */ diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh new file mode 100644 index 0000000..54f482d --- /dev/null +++ b/TC/unit/tc_gen.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +TMPSTR=$0 +SCRIPT=${TMPSTR##*/} + +if [ $# -lt 2 ]; then + echo "Usage) $SCRIPT module_name api_name" + exit 1 +fi + +MODULE=$1 +API=$2 +TEMPLATE=utc_MODULE_API_func.c.in +TESTCASE=utc_${MODULE}_${API}_func + +sed -e ' + s^@API@^'"$API"'^g + s^@MODULE@^'"$MODULE"'^g + ' $TEMPLATE > $TESTCASE.c + +if [ ! -e "$TESTCASE.c" ]; then + echo "Failed" + exit 1 +fi +echo "Testcase file is $TESTCASE.c" +echo "Done" +echo "please put \"$TESTCASE\" as Target in Makefile" +echo "please put \"/unit/$TESTCASE\" in tslist" diff --git a/TC/unit/tslist b/TC/unit/tslist new file mode 100644 index 0000000..54be85a --- /dev/null +++ b/TC/unit/tslist @@ -0,0 +1,10 @@ +/unit/utc_drmtrustedclient_drm_trusted_handle_request_func +/unit/utc_drmtrustedclient_drm_trusted_open_decrypt_session_func +/unit/utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func +/unit/utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func +/unit/utc_drmtrustedclient_drm_trusted_read_decrypt_session_func +/unit/utc_drmtrustedclient_drm_trusted_set_decrypt_state_func +/unit/utc_drmtrustedclient_drm_trusted_close_decrypt_session_func +/unit/utc_drmtrustedclient_drm_trusted_open_convert_func +/unit/utc_drmtrustedclient_drm_trusted_write_convert_func +/unit/utc_drmtrustedclient_drm_trusted_close_convert_func diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in new file mode 100644 index 0000000..3f1125c --- /dev/null +++ b/TC/unit/utc_MODULE_API_func.c.in @@ -0,0 +1,67 @@ +#include +#include "pkgname.h" + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_@MODULE@_@API@_func_01(void); +static void utc_@MODULE@_@API@_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, + { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, +}; + +static int pid; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of @API@() + */ +static void utc_@MODULE@_@API@_func_01(void) +{ + int r = 0; + char buf[MAX_LOCAL_BUFSZ]; + + r = @API@(...); + + if (r<0) { + tet_infoline("@API@() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init @API@() + */ +static void utc_@MODULE@_@API@_func_02(void) +{ + int r = 0; + char buf[MAX_LOCAL_BUFSZ]; + + r = @API@(...); + + if (r>=0) { + tet_infoline("@API@() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_close_convert_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_close_convert_func.c new file mode 100644 index 0000000..eb525a5 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_close_convert_func.c @@ -0,0 +1,95 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * Ravi S + * + * + * 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 utc_drmtrustedclient_drm_trusted_close_convert_func.c + * @brief TETware unit testing functions for drm_trusted_close_convert. + * @author Ravi S (ravi.cs@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_close_convert_func_01(void); +static void utc_drmtrustedclient_drm_trusted_close_convert_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_close_convert_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_close_convert_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_close_convert:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_close_convert:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_close_convert() + */ +static void utc_drmtrustedclient_drm_trusted_close_convert_func_01(void) +{ + tet_printf("Already tested in utc_drmtrustedclient_drm_trusted_open_convert_func_01"); + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of drm_trusted_close_convert() + */ +static void utc_drmtrustedclient_drm_trusted_close_convert_func_02(void) +{ + int ret = -1; + + ret = drm_trusted_close_convert(NULL); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_close_convert ret=0x%x", ret); + tet_result(TET_FAIL); + } else { + tet_printf("drm_trusted_close_convert ret=0x%x", ret); + tet_result(TET_PASS); + } +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_close_decrypt_session_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_close_decrypt_session_func.c new file mode 100644 index 0000000..5acf3b1 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_close_decrypt_session_func.c @@ -0,0 +1,93 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 utc_drmtrustedclient_drm_trusted_close_decrypt_session_func.c + * @brief TETware unit testing functions for drm_trusted_close_decrypt_session. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_01(void); +static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_close_decrypt_session:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_close_decrypt_session:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_close_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_01(void) +{ + tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself"); + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of drm_trusted_close_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_02(void) +{ + int ret = -1; + + ret = drm_trusted_close_decrypt_session(NULL); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("close_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("close_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_handle_request_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_handle_request_func.c new file mode 100644 index 0000000..d2f438c --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_handle_request_func.c @@ -0,0 +1,1283 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * Ravi S + * + * + * 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 utc_drmtrustedclient_drm_trusted_handle_request.c + * @brief TETware unit testing functions for drm_trusted_handle_request. + * @author Harsha Shekar (h.shekar@samsung.com) + * @author Ravi S (ravi.cs@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include +#include "drm_trusted_client_types.h" + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_handle_request_func_01(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_02(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_03(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_04(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_05(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_06(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_07(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_08(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_09(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_10(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_11(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_12(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_13(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_14(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_15(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_16(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_17(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_18(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_19(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_20(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_21(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_22(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_23(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_24(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_25(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_26(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_27(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_28(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_29(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_30(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_31(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_32(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_33(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_34(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_35(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_36(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_37(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_38(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_39(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_40(void); +static void utc_drmtrustedclient_drm_trusted_handle_request_func_41(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_handle_request_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_02, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_03, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_04, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_05, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_06, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_07, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_08, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_09, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_10, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_11, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_12, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_13, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_14, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_15, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_16, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_17, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_18, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_19, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_20, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_21, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_22, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_23, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_24, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_25, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_26, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_27, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_28, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_29, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_30, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_31, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_32, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_33, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_34, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_35, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_36, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_37, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_38, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_39, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_40, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_handle_request_func_41, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_handle_request:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_handle_request:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_01(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK; + long int delta = 0, locatime = 0, securetime = 0; + struct tm* tmst = NULL; + drm_trusted_set_sec_clk_info_s sec_clk_info; + memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK"); + + locatime = (long int)time(NULL); + tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime)); + + securetime = locatime + delta; + tmst = localtime(&securetime); + tet_printf("Current Secure Time = %ld = %s \n", + securetime, asctime(tmst)); + + memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm)); + sec_clk_info.source_type = DRM_TRUSTED_TS_NITZ; + + ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Secure Clock Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Set Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_02(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK; + long int delta = 0, locatime = 0, securetime = 0; + struct tm* tmst = NULL; + drm_trusted_set_sec_clk_info_s sec_clk_info; + memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK"); + + locatime = (long int)time(NULL); + tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime)); + + securetime = locatime + delta; + tmst = localtime(&securetime); + tet_printf("Current Secure Time = %ld = %s \n", + securetime, asctime(tmst)); + + memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm)); + sec_clk_info.source_type = DRM_TRUSTED_TS_OCSP; + + ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Secure Clock Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Set Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_03(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK; + long int delta = 0, locatime = 0, securetime = 0; + struct tm* tmst = NULL; + drm_trusted_set_sec_clk_info_s sec_clk_info; + memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK"); + + locatime = (long int)time(NULL); + tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime)); + + securetime = locatime + delta; + tmst = localtime(&securetime); + tet_printf("Current Secure Time = %ld = %s \n", + securetime, asctime(tmst)); + + memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm)); + sec_clk_info.source_type = DRM_TRUSTED_TS_MS_TTS; + + ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Secure Clock Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Set Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_04(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK; + long int delta = 0, locatime = 0, securetime = 0; + struct tm* tmst = NULL; + drm_trusted_set_sec_clk_info_s sec_clk_info; + memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK"); + + locatime = (long int)time(NULL); + tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime)); + + securetime = locatime + delta; + tmst = localtime(&securetime); + tet_printf("Current Secure Time = %ld = %s \n", + securetime, asctime(tmst)); + + memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm)); + sec_clk_info.source_type = DRM_TRUSTED_TS_USER; + + ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Secure Clock Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Set Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ + +static void utc_drmtrustedclient_drm_trusted_handle_request_func_05(void) +{ + + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK"); + + ret = drm_trusted_handle_request(req_type, NULL, NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Secure Clock Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("Set Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_06(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK; + long int delta = 10, newtime = 0, oldtime = 0; + struct tm* tmst = NULL; + drm_trusted_update_sec_clk_info_s upd_clk_info; + memset(&upd_clk_info, 0x00, sizeof(drm_trusted_update_sec_clk_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK"); + + oldtime = (long int)time(NULL); + tet_printf("Old Local Time = %ld = %s \n",oldtime,ctime(&oldtime)); + + newtime = oldtime + delta; + tmst = localtime(&newtime); + tet_printf("New Local Time = %ld = %s \n",newtime,asctime(tmst)); + + upd_clk_info.before = oldtime; + upd_clk_info.after = newtime; + + ret = drm_trusted_handle_request(req_type,(void*)&upd_clk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Update Secure Clock Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Update Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_07(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK; + long int delta = 0, newtime = 0, oldtime = 0; + struct tm* tmst = NULL; + drm_trusted_update_sec_clk_info_s upd_clk_info; + memset(&upd_clk_info, 0x00, sizeof(drm_trusted_update_sec_clk_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK"); + + oldtime = (long int)time(NULL); + tet_printf("Old Local Time = %ld = %s \n",oldtime,ctime(&oldtime)); + + newtime = oldtime + delta; + tmst = localtime(&newtime); + tet_printf("New Local Time = %ld = %s \n",newtime,asctime(tmst)); + + upd_clk_info.before = oldtime; + upd_clk_info.after = newtime; + + ret = drm_trusted_handle_request(req_type,(void*)&upd_clk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Update Secure Clock Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Update Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_08(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK"); + + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Update Secure Clock Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("Update Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_09(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING; + drm_trusted_set_transaction_trk_info_s trk_info = {0,}; + trk_info.tracking_on = DRM_TRUSTED_TRUE; + + ret = drm_trusted_handle_request(req_type,(void*)&trk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Transaction Tracking Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Set Transaction Tracking FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_10(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING; + drm_trusted_set_transaction_trk_info_s trk_info = {0,}; + trk_info.tracking_on = DRM_TRUSTED_FALSE; + + ret = drm_trusted_handle_request(req_type,(void*)&trk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Set Transaction Tracking Success"); + tet_result(TET_PASS); + }else{ + tet_printf("Set Transaction Tracking FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_11(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING; + drm_trusted_set_transaction_trk_info_s trk_info = {0,}; + trk_info.tracking_on = DRM_TRUSTED_UNKNOWN; + + ret = drm_trusted_handle_request(req_type,(void*)&trk_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Update Secure Clock Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("Update Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_12(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING; + + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("Update Secure Clock Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("Update Secure Clock FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_13(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_MASTER_RESET"); +#if 0 + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_MASTER_RESET; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_MASTER_RESET"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); +#else + tet_printf("Disabling this test case here to ensure no interference with other test case"); +#endif + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("MASTER RESET Success"); + tet_result(TET_PASS); + }else{ + tet_printf("MASTER RESET FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_14(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT"); +#if 0 + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); +#else + tet_printf("Modify this test case if DRMv2 is supported!!"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("verifying encrypted certificate Success"); + tet_result(TET_PASS); + }else{ + tet_printf("verifying encrypted certificate FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_15(void) +{ + + int ret = DRM_TRUSTED_RETURN_SUCCESS; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB"); +#if 0 + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); +#else + tet_printf("Disabling this test case here to ensure no interference with other test case"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("CREATE_INIT_DB Success"); + tet_result(TET_PASS); + }else{ + tet_printf("CREATE_INIT_DB FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_16(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT"); +#if 0 + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); +#else + tet_printf("Modify this test case if DRMv2 is supported!!"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("REINSTALL_CERT Success"); + tet_result(TET_PASS); + }else{ + tet_printf("REINSTALL_CERT FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_17(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REMOVE_RO; + drm_trusted_remove_ro_info_s remove_ro_info; + memset(&remove_ro_info, 0x00, sizeof(drm_trusted_remove_ro_info_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_RO"); + + memcpy(remove_ro_info.filePath,FILE_PATH_VALID_FILE_OMA_1,strlen(FILE_PATH_VALID_FILE_OMA_1)); + ret = drm_trusted_handle_request(req_type,&remove_ro_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("REMOVE_RO Success"); + tet_result(TET_PASS); + }else{ + tet_printf("REMOVE_RO FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_18(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REMOVE_RO; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_RO"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("REMOVE_RO Success"); + tet_result(TET_FAIL); + + }else{ + tet_printf("REMOVE_RO FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_19(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO"); +#if 0 + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO; + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); +#else + tet_printf("Disabling this test case here to ensure no interference with other test case"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("REMOVE_ALL_RO Success"); + tet_result(TET_PASS); + }else{ + tet_printf("REMOVE_ALL_RO FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } +} + + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_20(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL; + drm_trusted_go_rights_url_info_s rights_url_info; + memset(&rights_url_info, 0x00, sizeof(drm_trusted_go_rights_url_info_s)); + memcpy(rights_url_info.file_path,FILE_PATH_VALID_FILE_OMA_1,strlen(FILE_PATH_VALID_FILE_OMA_1)); + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL"); + ret = drm_trusted_handle_request(req_type,&rights_url_info,NULL); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL"); +#endif + + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("GO_RIGHTS_URL Success"); + tet_result(TET_PASS); + }else{ + tet_printf("GO_RIGHTS_URL FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_21(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("GO_RIGHTS_URL Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("GO_RIGHTS_URL FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_22(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE; + drm_trusted_pd_set_dld_comp_info_s download_cmp_info; + memset(&download_cmp_info, 0x00, sizeof(drm_trusted_pd_set_dld_comp_info_s)); + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE"); + ret = drm_trusted_handle_request(req_type,&download_cmp_info,NULL); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE"); +#endif + + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PD_SET_DOWNLOAD_COMPLETE Success"); + tet_result(TET_PASS); + }else{ + tet_printf("PD_SET_DOWNLOAD_COMPLETE FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_23(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PD_SET_DOWNLOAD_COMPLETE Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("PD_SET_DOWNLOAD_COMPLETE FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_24(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO; + drm_trusted_pd_parse_status_info_s info_status; + drm_trusted_pd_parse_status_resp_s resp_status; + + memset(&info_status, 0x00, sizeof(drm_trusted_pd_parse_status_info_s)); + memset(&resp_status, 0x00, sizeof(drm_trusted_pd_parse_status_resp_s)); + + snprintf(info_status.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1); + tet_printf("Src file=%s",info_status.file_path); + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO"); + ret = drm_trusted_handle_request(req_type,&info_status,&resp_status); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PD_GET_PARSE_STATUS_INFO Success"); + tet_result(TET_PASS); + }else{ + tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_25(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO; + drm_trusted_pd_parse_status_info_s info_status; + + memset(&info_status, 0x00, sizeof(drm_trusted_pd_parse_status_info_s)); + + snprintf(info_status.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1); + tet_printf("Src file=%s",info_status.file_path); + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO"); + ret = drm_trusted_handle_request(req_type,&info_status,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PD_GET_PARSE_STATUS_INFO Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_26(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO; + drm_trusted_pd_parse_status_resp_s resp_status; + + memset(&resp_status, 0x00, sizeof(drm_trusted_pd_parse_status_resp_s)); + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO"); + ret = drm_trusted_handle_request(req_type,NULL,&resp_status); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PD_GET_PARSE_STATUS_INFO Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_27(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PD_GET_PARSE_STATUS_INFO Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_28(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 1 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE; + drm_trusted_piff_get_license_info_s license_info; + memset(&license_info, 0x00, sizeof(drm_trusted_piff_get_license_info_s)); + + /* Sample Content => SuperSpeedway_720_230.ismv */ + + /* Content Header <.W.R.M.H.E.A.D.E.R. .x.m.l.n.s.=.".h.t.t.p.:././.s.c.h.e.m.a.s...m.i.c.r.o.s.o.f.t...c.o.m./.D.R.M./.2.0.0.7./.0.3./.P.l.a.y.R.e.a.d.y.H.e.a.d.e.r.". .v.e.r.s.i.o.n.=.".4...0...0...0.".>. + * <.D.A.T.A.>. + * <.P.R.O.T.E.C.T.I.N.F.O.>. + * <.K.E.Y.L.E.N.>.1.6.<./.K.E.Y.L.E.N.>. + * <.A.L.G.I.D.>.A.E.S.C.T.R.<./.A.L.G.I.D.>. + * <./.P.R.O.T.E.C.T.I.N.F.O.>. + * <.K.I.D.>.A.m.f.j.C.T.O.P.b.E.O.l.3.W.D./.5.m.c.e.c.A.=.=.<./.K.I.D.>. + * <.C.H.E.C.K.S.U.M.>.B.G.w.1.a.Y.Z.1.Y.X.M.=.<./.C.H.E.C.K.S.U.M.>. + * <.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>. + * <.I.I.S._.D.R.M._.V.E.R.S.I.O.N.>.7...1...1.0.6.4...0.<./.I.I.S._.D.R.M._.V.E.R.S.I.O.N.>. + * <./.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>. + * <.L.A._.U.R.L.>.h.t.t.p.:././.p.l.a.y.r.e.a.d.y...d.i.r.e.c.t.t.a.p.s...n.e.t./.p.r./.s.v.c./.r.i.g.h.t.s.m.a.n.a.g.e.r...a.s.m.x.<./.L.A._.U.R.L.>. + * <.D.S._.I.D.>.A.H.+.0.3.j.u.K.b.U.G.b.H.l.1.V./.Q.I.w.R.A.=.=.<./.D.S._.I.D.>. + * <./.D.A.T.A.>. + * <./.W.R.M.H.E.A.D.E.R.>... */ + + unsigned char ContentHeader[] ={0x3C,0x00,0x57,0x00,0x52,0x00,0x4D,0x00,0x48,0x00,0x45,0x00,0x41,0x00,0x44,0x00,0x45,0x00,0x52,0x00,0x20,0x00,0x78,0x00,0x6D,0x00,0x6C,0x00,0x6E,0x00, + 0x73,0x00,0x3D,0x00,0x22,0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,0x3A,0x00,0x2F,0x00,0x2F,0x00,0x73,0x00,0x63,0x00,0x68,0x00,0x65,0x00,0x6D,0x00, + 0x61,0x00,0x73,0x00,0x2E,0x00,0x6D,0x00,0x69,0x00,0x63,0x00,0x72,0x00,0x6F,0x00,0x73,0x00,0x6F,0x00,0x66,0x00,0x74,0x00,0x2E,0x00,0x63,0x00,0x6F,0x00, + 0x6D,0x00,0x2F,0x00,0x44,0x00,0x52,0x00,0x4D,0x00,0x2F,0x00,0x32,0x00,0x30,0x00,0x30,0x00,0x37,0x00,0x2F,0x00,0x30,0x00,0x33,0x00,0x2F,0x00,0x50,0x00, + 0x6C,0x00,0x61,0x00,0x79,0x00,0x52,0x00,0x65,0x00,0x61,0x00,0x64,0x00,0x79,0x00,0x48,0x00,0x65,0x00,0x61,0x00,0x64,0x00,0x65,0x00,0x72,0x00,0x22,0x00, + 0x20,0x00,0x76,0x00,0x65,0x00,0x72,0x00,0x73,0x00,0x69,0x00,0x6F,0x00,0x6E,0x00,0x3D,0x00,0x22,0x00,0x34,0x00,0x2E,0x00,0x30,0x00,0x2E,0x00,0x30,0x00, + 0x2E,0x00,0x30,0x00,0x22,0x00,0x3E,0x00,0x3C,0x00,0x44,0x00,0x41,0x00,0x54,0x00,0x41,0x00,0x3E,0x00,0x3C,0x00,0x50,0x00,0x52,0x00,0x4F,0x00,0x54,0x00, + 0x45,0x00,0x43,0x00,0x54,0x00,0x49,0x00,0x4E,0x00,0x46,0x00,0x4F,0x00,0x3E,0x00,0x3C,0x00,0x4B,0x00,0x45,0x00,0x59,0x00,0x4C,0x00,0x45,0x00,0x4E,0x00, + 0x3E,0x00,0x31,0x00,0x36,0x00,0x3C,0x00,0x2F,0x00,0x4B,0x00,0x45,0x00,0x59,0x00,0x4C,0x00,0x45,0x00,0x4E,0x00,0x3E,0x00,0x3C,0x00,0x41,0x00,0x4C,0x00, + 0x47,0x00,0x49,0x00,0x44,0x00,0x3E,0x00,0x41,0x00,0x45,0x00,0x53,0x00,0x43,0x00,0x54,0x00,0x52,0x00,0x3C,0x00,0x2F,0x00,0x41,0x00,0x4C,0x00,0x47,0x00, + 0x49,0x00,0x44,0x00,0x3E,0x00,0x3C,0x00,0x2F,0x00,0x50,0x00,0x52,0x00,0x4F,0x00,0x54,0x00,0x45,0x00,0x43,0x00,0x54,0x00,0x49,0x00,0x4E,0x00,0x46,0x00, + 0x4F,0x00,0x3E,0x00,0x3C,0x00,0x4B,0x00,0x49,0x00,0x44,0x00,0x3E,0x00,0x41,0x00,0x6D,0x00,0x66,0x00,0x6A,0x00,0x43,0x00,0x54,0x00,0x4F,0x00,0x50,0x00, + 0x62,0x00,0x45,0x00,0x4F,0x00,0x6C,0x00,0x33,0x00,0x57,0x00,0x44,0x00,0x2F,0x00,0x35,0x00,0x6D,0x00,0x63,0x00,0x65,0x00,0x63,0x00,0x41,0x00,0x3D,0x00, + 0x3D,0x00,0x3C,0x00,0x2F,0x00,0x4B,0x00,0x49,0x00,0x44,0x00,0x3E,0x00,0x3C,0x00,0x43,0x00,0x48,0x00,0x45,0x00,0x43,0x00,0x4B,0x00,0x53,0x00,0x55,0x00, + 0x4D,0x00,0x3E,0x00,0x42,0x00,0x47,0x00,0x77,0x00,0x31,0x00,0x61,0x00,0x59,0x00,0x5A,0x00,0x31,0x00,0x59,0x00,0x58,0x00,0x4D,0x00,0x3D,0x00,0x3C,0x00, + 0x2F,0x00,0x43,0x00,0x48,0x00,0x45,0x00,0x43,0x00,0x4B,0x00,0x53,0x00,0x55,0x00,0x4D,0x00,0x3E,0x00,0x3C,0x00,0x43,0x00,0x55,0x00,0x53,0x00,0x54,0x00, + 0x4F,0x00,0x4D,0x00,0x41,0x00,0x54,0x00,0x54,0x00,0x52,0x00,0x49,0x00,0x42,0x00,0x55,0x00,0x54,0x00,0x45,0x00,0x53,0x00,0x3E,0x00,0x3C,0x00,0x49,0x00, + 0x49,0x00,0x53,0x00,0x5F,0x00,0x44,0x00,0x52,0x00,0x4D,0x00,0x5F,0x00,0x56,0x00,0x45,0x00,0x52,0x00,0x53,0x00,0x49,0x00,0x4F,0x00,0x4E,0x00,0x3E,0x00, + 0x37,0x00,0x2E,0x00,0x31,0x00,0x2E,0x00,0x31,0x00,0x30,0x00,0x36,0x00,0x34,0x00,0x2E,0x00,0x30,0x00,0x3C,0x00,0x2F,0x00,0x49,0x00,0x49,0x00,0x53,0x00, + 0x5F,0x00,0x44,0x00,0x52,0x00,0x4D,0x00,0x5F,0x00,0x56,0x00,0x45,0x00,0x52,0x00,0x53,0x00,0x49,0x00,0x4F,0x00,0x4E,0x00,0x3E,0x00,0x3C,0x00,0x2F,0x00, + 0x43,0x00,0x55,0x00,0x53,0x00,0x54,0x00,0x4F,0x00,0x4D,0x00,0x41,0x00,0x54,0x00,0x54,0x00,0x52,0x00,0x49,0x00,0x42,0x00,0x55,0x00,0x54,0x00,0x45,0x00, + 0x53,0x00,0x3E,0x00,0x3C,0x00,0x4C,0x00,0x41,0x00,0x5F,0x00,0x55,0x00,0x52,0x00,0x4C,0x00,0x3E,0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,0x3A,0x00, + 0x2F,0x00,0x2F,0x00,0x70,0x00,0x6C,0x00,0x61,0x00,0x79,0x00,0x72,0x00,0x65,0x00,0x61,0x00,0x64,0x00,0x79,0x00,0x2E,0x00,0x64,0x00,0x69,0x00,0x72,0x00, + 0x65,0x00,0x63,0x00,0x74,0x00,0x74,0x00,0x61,0x00,0x70,0x00,0x73,0x00,0x2E,0x00,0x6E,0x00,0x65,0x00,0x74,0x00,0x2F,0x00,0x70,0x00,0x72,0x00,0x2F,0x00, + 0x73,0x00,0x76,0x00,0x63,0x00,0x2F,0x00,0x72,0x00,0x69,0x00,0x67,0x00,0x68,0x00,0x74,0x00,0x73,0x00,0x6D,0x00,0x61,0x00,0x6E,0x00,0x61,0x00,0x67,0x00, + 0x65,0x00,0x72,0x00,0x2E,0x00,0x61,0x00,0x73,0x00,0x6D,0x00,0x78,0x00,0x3C,0x00,0x2F,0x00,0x4C,0x00,0x41,0x00,0x5F,0x00,0x55,0x00,0x52,0x00,0x4C,0x00, + 0x3E,0x00,0x3C,0x00,0x44,0x00,0x53,0x00,0x5F,0x00,0x49,0x00,0x44,0x00,0x3E,0x00,0x41,0x00,0x48,0x00,0x2B,0x00,0x30,0x00,0x33,0x00,0x6A,0x00,0x75,0x00, + 0x4B,0x00,0x62,0x00,0x55,0x00,0x47,0x00,0x62,0x00,0x48,0x00,0x6C,0x00,0x31,0x00,0x56,0x00,0x2F,0x00,0x51,0x00,0x49,0x00,0x77,0x00,0x52,0x00,0x41,0x00, + 0x3D,0x00,0x3D,0x00,0x3C,0x00,0x2F,0x00,0x44,0x00,0x53,0x00,0x5F,0x00,0x49,0x00,0x44,0x00,0x3E,0x00,0x3C,0x00,0x2F,0x00,0x44,0x00,0x41,0x00,0x54,0x00, + 0x41,0x00,0x3E,0x00,0x3C,0x00,0x2F,0x00,0x57,0x00,0x52,0x00,0x4D,0x00,0x48,0x00,0x45,0x00,0x41,0x00,0x44,0x00,0x45,0x00,0x52,0x00,0x3E,0x00,0x00,0x00}; + + + license_info.lic_header.header_len = sizeof(ContentHeader); + license_info.lic_header.header = (unsigned char*)ContentHeader; + + tet_printf("license_info.lic_header.header_len= %d",license_info.lic_header.header_len); + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE"); + ret = drm_trusted_handle_request(req_type,&license_info,NULL); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PIFF_GET_LICENSE Success"); + tet_result(TET_PASS); + }else{ + tet_printf("PIFF_GET_LICENSE FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_29(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("PIFF_GET_LICENSE Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("PIFF_GET_LICENSE FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_30(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE; + drm_trusted_sapps_decrypt_package_info_s package_info; + + memset(&package_info, 0x00, sizeof(drm_trusted_sapps_decrypt_package_info_s)); + + snprintf(package_info.sadcf_filepath,256, "%s",FILE_PATH_VALID_FILE_OMA_1); + snprintf(package_info.decrypt_filepath,256, "%s",FILE_PATH_VALID_FILE_OMA_9); + tet_printf("sapps dcf file:%s",package_info.sadcf_filepath); + tet_printf("decrypted file:%s",package_info.decrypt_filepath); + + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE"); + ret = drm_trusted_handle_request(req_type,&package_info,NULL); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_DECRYPT_PACKAGE Success"); + tet_result(TET_PASS); + }else{ + tet_printf("SAPPS_DECRYPT_PACKAGE FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_31(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_DECRYPT_PACKAGE Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_DECRYPT_PACKAGE FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_32(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE; + drm_trusted_sapps_consume_license_info_s cons_license_info; + + memset(&cons_license_info, 0x00, sizeof(drm_trusted_sapps_consume_license_info_s)); + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_SAPPS_CONSUME_LICENSE"); + ret = drm_trusted_handle_request(req_type,&cons_license_info,NULL); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_CONSUME_LICENSE Success"); + tet_result(TET_PASS); + }else{ + tet_printf("SAPPS_CONSUME_LICENSE FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_33(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_CONSUME_LICENSE Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_CONSUME_LICENSE FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_34(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST; + drm_trusted_sapps_gen_purchase_req_info_s gen_purchase_req_info; + drm_trusted_sapps_gen_purchase_req_resp_s gen_purchase_resp_info; + + memset(&gen_purchase_req_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_info_s)); + memset(&gen_purchase_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_resp_s)); + + snprintf(gen_purchase_req_info.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1); + tet_printf("sapps file:%s",gen_purchase_req_info.file_path); + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST"); + ret = drm_trusted_handle_request(req_type,&gen_purchase_req_info,&gen_purchase_resp_info); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success"); + tet_result(TET_PASS); + }else{ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_35(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST; + drm_trusted_sapps_gen_purchase_req_info_s gen_purchase_req_info; + + memset(&gen_purchase_req_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_info_s)); + snprintf(gen_purchase_req_info.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1); + tet_printf("sapps file:%s",gen_purchase_req_info.file_path); + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST"); + ret = drm_trusted_handle_request(req_type,&gen_purchase_req_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_36(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST; + drm_trusted_sapps_gen_purchase_req_resp_s gen_purchase_resp_info; + + memset(&gen_purchase_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_resp_s)); + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST"); + ret = drm_trusted_handle_request(req_type,NULL,&gen_purchase_resp_info); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_37(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + +/** + * @brief Positive test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_38(void) +{ + int ret = DRM_TRUSTED_RETURN_SUCCESS; +#if 0 + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST; + drm_trusted_sapps_gen_license_req_info_s gen_license_req_info; + drm_trusted_sapps_gen_license_req_resp_s gen_license_req_resp_info; + + memset(&gen_license_req_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_info_s)); + memset(&gen_license_req_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_resp_s)); + + tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST"); + ret = drm_trusted_handle_request(req_type,&gen_license_req_info,&gen_license_req_resp_info); +#else + tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST"); +#endif + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success"); + tet_result(TET_PASS); + }else{ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_39(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST; + drm_trusted_sapps_gen_license_req_info_s gen_license_req_info; + + memset(&gen_license_req_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_info_s)); + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST"); + ret = drm_trusted_handle_request(req_type,&gen_license_req_info,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} + + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_40(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST; + drm_trusted_sapps_gen_license_req_resp_s gen_license_req_resp_info; + + memset(&gen_license_req_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_resp_s)); + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST"); + ret = drm_trusted_handle_request(req_type,NULL,&gen_license_req_resp_info); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } +} + +/** + * @brief Negative test case of drm_trusted_handle_request() + */ +static void utc_drmtrustedclient_drm_trusted_handle_request_func_41(void) +{ + int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR; + drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST; + + tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST"); + ret = drm_trusted_handle_request(req_type,NULL,NULL); + tet_printf("ret=0x%x",ret); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success"); + tet_result(TET_FAIL); + }else{ + tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_open_convert_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_open_convert_func.c new file mode 100644 index 0000000..7f89268 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_open_convert_func.c @@ -0,0 +1,220 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * Ravi S + * + * + * 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 utc_drmtrustedclient_drm_trusted_open_convert_func.c + * @brief TETware unit testing functions for drm_trusted_open_convert. + * @author Ravi S (ravi.cs@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_open_convert_func_01(void); +static void utc_drmtrustedclient_drm_trusted_open_convert_func_02(void); +static void utc_drmtrustedclient_drm_trusted_open_convert_func_03(void); + + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_open_convert_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_open_convert_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_open_convert_func_03, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_open_convert:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_open_convert:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_open_convert() + */ +static void utc_drmtrustedclient_drm_trusted_open_convert_func_01(void) +{ + DRM_TRUSTED_CONVERT_HANDLE hConvert; + drm_trusted_opn_conv_info_s input; + drm_trusted_write_conv_info_s write_input; + drm_trusted_write_conv_resp_s output; + + FILE *fp = NULL; + unsigned int FileSize=-1; + unsigned char *buffer = NULL; + struct stat statbuf; + int readed_size = -1; + int ret = -1; + + /* memset the structures */ + memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE)); + memset(&input, 0x0, sizeof(drm_trusted_opn_conv_info_s)); + memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s)); + memset(&write_input, 0x0, sizeof(drm_trusted_opn_conv_info_s)); + memset(&statbuf, 0x0, sizeof(struct stat)); + + memcpy(input.filePath,FILE_PATH_VALID_FILE_OMA_9,strlen(FILE_PATH_VALID_FILE_OMA_9)); + input.install_RO = DRM_TRUSTED_FALSE; + + ret = drm_trusted_open_convert(&input,&hConvert); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_open_convert:ret=0x%x", ret); + } else { + tet_printf("drm_trusted_open_convert:ret=0x%x", ret); + tet_result(TET_FAIL); + return; + } + fp = fopen(FILE_PATH_VALID_DM_FILE_OMA_1, "r"); + if (fp == NULL) + { + tet_printf("fopen error:error=%s",strerror(errno)); + tet_result(TET_FAIL); + return; + } + + if(stat(FILE_PATH_VALID_DM_FILE_OMA_1, &statbuf) == 0 ) + FileSize = (unsigned int)statbuf.st_size; + tet_printf("FileSize=%u",FileSize); + if(FileSize == 0) + { + tet_result(TET_FAIL); + return; + } + buffer = (unsigned char *)malloc(FileSize + 1); + if(!buffer) + { + tet_printf("malloc failed:error=%s",strerror(errno)); + free(buffer); + tet_result(TET_FAIL); + return; + } + memset(buffer,0x0, FileSize+1); + readed_size = fread(buffer,1,FileSize,fp); + tet_printf("fread:read_size=%d",readed_size); + if(readed_size == -1) + { + tet_result(TET_FAIL); + return; + } + buffer[FileSize] = '\0'; + + write_input.data_len = FileSize; + write_input.data = buffer; + + ret = drm_trusted_write_convert(&write_input,&output,hConvert); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_write_convert:ret=0x%x", ret); + } else { + tet_printf("drm_trusted_write_convert:ret=0x%x", ret); + tet_result(TET_FAIL); + } + + tet_printf("bytes written=%d",output.write_size); + if(FileSize != output.write_size) + { + tet_printf("Data is not written successfully"); + tet_result(TET_FAIL); + return; + } + + ret = drm_trusted_close_convert(&hConvert); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_close_convert:ret=0x%x", ret); + tet_printf("drm_trusted_open_convert,drm_trusted_write_convert and drm_trusted_close_convert all have passed"); + tet_result(TET_PASS); + } else { + tet_printf("drm_trusted_close_convert:ret=0x%x", ret); + tet_result(TET_FAIL); + } +} + +/** + * @brief Negative test case of drm_trusted_open_convert() + */ +static void utc_drmtrustedclient_drm_trusted_open_convert_func_02(void) +{ + DRM_TRUSTED_CONVERT_HANDLE hConvert; + int ret = -1; + + /* memset the structures */ + memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE)); + + ret = drm_trusted_open_convert(NULL,&hConvert); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_open_convert ret=0x%x", ret); + tet_result(TET_FAIL); + } else { + tet_printf("drm_trusted_open_convert ret=0x%x", ret); + tet_result(TET_PASS); + } +} + +/** + * @brief Negative test case of drm_trusted_open_convert() + */ +static void utc_drmtrustedclient_drm_trusted_open_convert_func_03(void) +{ + drm_trusted_opn_conv_info_s input; + int ret = -1; + + /* memset the structures */ + memset(&input, 0x0, sizeof(drm_trusted_opn_conv_info_s)); + + ret = drm_trusted_open_convert(&input,NULL); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_open_convert ret=0x%x", ret); + tet_result(TET_FAIL); + } else { + tet_printf("drm_trusted_open_convert ret=0x%x", ret); + tet_result(TET_PASS); + } +} + diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_open_decrypt_session_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_open_decrypt_session_func.c new file mode 100644 index 0000000..093dcce --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_open_decrypt_session_func.c @@ -0,0 +1,324 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 utc_drmtrustedclient_drm_trusted_open_decrypt_session_func.c + * @brief TETware unit testing functions for drm_trusted_open_decrypt_session. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +//#define MAX_OUT_BUFFER_LEN (1024 * 1024) +#define MAX_OUT_BUFFER_LEN (10 * 1024) + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_01(void); +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_02(void); +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_03(void); +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_03, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_04, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + + +static void startup(void) { + tet_infoline("drm_trusted_open_decrypt_session:Test started"); +} + +static void cleanup(void) { + tet_infoline("drm_trusted_open_decrypt_session:Test completed"); +} + +void test_drm_trusted_operation_cb( + drm_trusted_user_operation_info_s *operation_info, void *output_data) +{ + tet_printf("Callback Hit:test_drm_trusted_operation_cb"); + tet_printf("operation_status=%d", operation_info->operation_status); + tet_printf("operation_type=%d", operation_info->operation_type); +} + +/** + * @brief Positive test case of drm_trusted_open_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_01(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_seek_decrypt_info_s seek_input_data; + drm_trusted_tell_decrypt_resp_data_s tell_output_data; + drm_trusted_set_consumption_state_info_s state_input_data; + drm_trusted_payload_info_s read_input_data; + drm_trusted_read_decrypt_resp_data_s read_output_data; + unsigned char *out_buffer = NULL; + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s)); + memset(&seek_input_data, 0x0, sizeof(drm_trusted_seek_decrypt_info_s)); + memset(&tell_output_data, 0x0, sizeof(drm_trusted_tell_decrypt_resp_data_s)); + memset(&state_input_data, 0x0, sizeof(drm_trusted_set_consumption_state_info_s)); + memset(&read_input_data, 0x0, sizeof(drm_trusted_payload_info_s)); + memset(&read_output_data, 0x0, sizeof(drm_trusted_read_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2, + strlen(FILE_PATH_VALID_FILE_OMA_2)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_PLAY; + + /* Open Decrypt Session */ + ret = drm_trusted_open_decrypt_session(&open_input_data, &open_output_data, + &pHandle); + + tet_printf("drm_trusted_open_decrypt_session ret = 0x%x", ret); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("open_decrypt_session success"); + } else { + tet_printf("open_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + + seek_input_data.offset = 0; + seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */ + + ret = drm_trusted_seek_decrypt_session(pHandle, &seek_input_data); + + tet_printf("drm_trusted_seek_decrypt_session ret = 0x%x", ret); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("seek_decrypt_session success"); + } else { + tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + + ret = drm_trusted_tell_decrypt_session(pHandle, &tell_output_data); + tet_printf("ret = 0x%x", ret); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("tell_decrypt_session success"); + } else { + tet_printf("tell_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + tet_printf("file-size = %u",tell_output_data.offset); + + seek_input_data.offset = 0; + seek_input_data.seek_mode = DRM_SEEK_SET; /* Set cursor to START */ + + ret = drm_trusted_seek_decrypt_session(pHandle, &seek_input_data); + tet_printf("drm_trusted_seek_decrypt_session ret = 0x%x", ret); + + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("seek_decrypt_session success"); + } else { + tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + + state_input_data.state = DRM_CONSUMPTION_STARTED; + ret = drm_trusted_set_decrypt_state(pHandle, &state_input_data); + tet_printf("drm_trusted_set_decrypt_state START ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("set_decrypt_state success"); + } else { + tet_printf("set_decrypt_state FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + + /* Allocate memory for Out Buffer */ + out_buffer = (unsigned char*) malloc(MAX_OUT_BUFFER_LEN); + if (!out_buffer) { + tet_printf("Memory Allocation Error!!!"); + tet_result(TET_FAIL); + } + + read_input_data.payload_data = out_buffer; + read_input_data.payload_data_len = (unsigned int) MAX_OUT_BUFFER_LEN; + + /* Handle READ / DECRYPT operation */ + ret = drm_trusted_read_decrypt_session(pHandle, &read_input_data, + &read_output_data); + tet_printf("drm_trusted_read_decrypt_session ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("read_decrypt_session success"); + } else { + tet_printf("read_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + + state_input_data.state = DRM_CONSUMPTION_STOPPED; + ret = drm_trusted_set_decrypt_state(pHandle, &state_input_data); + tet_printf("drm_trusted_set_decrypt_state STOPT ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("set_decrypt_state success"); + } else { + tet_printf("set_decrypt_state FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } + + if (out_buffer) + free (out_buffer); + + ret = drm_trusted_close_decrypt_session(&pHandle); + tet_printf("drm_trusted_close_decrypt_session ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("close_decrypt_session success"); + tet_result(TET_PASS); + } else { + tet_printf("close_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_FAIL); + } +} + +/** + * @brief negative test case of drm_trusted_open_decrypt_session() + * here open_input_data is NULL + */ +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_02(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + //drm_trusted_permission_type_e perm_type; + + /* memset the structures */ + memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s)); + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2, + strlen(FILE_PATH_VALID_FILE_OMA_2)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(NULL, &open_output_data, &pHandle); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("open_decrypt_session Success"); + tet_result(TET_FAIL); + } else { + tet_printf("open_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } +} + +/** + * @brief negative test case of drm_trusted_open_decrypt_session() + * here open_output_data is NULL + */ +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_03(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + //drm_trusted_permission_type_e perm_type; + + /* memset the structures */ + memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s)); + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2, + strlen(FILE_PATH_VALID_FILE_OMA_2)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data, NULL, &pHandle); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("open_decrypt_session Success"); + tet_result(TET_FAIL); + } else { + tet_printf("open_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } +} + +/** + * @brief negative test case of drm_trusted_open_decrypt_session() + * here Phandle is NULL + */ +static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_04(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + + //DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + //drm_trusted_permission_type_e perm_type; + + /* memset the structures */ + memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s)); + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2, + strlen(FILE_PATH_VALID_FILE_OMA_2)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data, &open_output_data, + NULL); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("open_decrypt_session Success"); + tet_result(TET_FAIL); + } else { + tet_printf("open_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_read_decrypt_session_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_read_decrypt_session_func.c new file mode 100644 index 0000000..ebc9845 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_read_decrypt_session_func.c @@ -0,0 +1,203 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 utc_drmtrustedclient_drm_trusted_read_decrypt_session_func.c + * @brief TETware unit testing functions for drm_trusted_read_decrypt_session. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_01(void); +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_02(void); +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_03(void); +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_03, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_04, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_read_decrypt_session:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_read_decrypt_session:Test completed"); +} + +/** + * @brief positive test case of drm_trusted_read_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_01(void) +{ + + tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself"); + tet_result(TET_PASS); +} + +/** + * @brief negative test case of drm_trusted_read_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_02(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + + drm_trusted_payload_info_s read_input_data; + drm_trusted_read_decrypt_resp_data_s read_output_data; + DRM_DECRYPT_HANDLE pHandle = NULL; + + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + tet_printf("ret = 0x%x",ret); + + ret = drm_trusted_read_decrypt_session(NULL,&read_input_data, + &read_output_data); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("read_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("read_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); +} + +/** + * @brief negative test case of drm_trusted_read_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_03(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + + drm_trusted_read_decrypt_resp_data_s read_output_data; + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + tet_printf("ret = 0x%x",ret); + + ret = drm_trusted_read_decrypt_session(pHandle,NULL, + &read_output_data); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("read_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("read_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} + +static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_04(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + + drm_trusted_payload_info_s read_input_data; + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + tet_printf("ret = 0x%x",ret); + + ret = drm_trusted_read_decrypt_session(pHandle,&read_input_data, + NULL); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("read_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("read_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} + diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func.c new file mode 100644 index 0000000..8797666 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func.c @@ -0,0 +1,171 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func.c + * @brief TETware unit testing functions for drm_trusted_seek_decrypt_session. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_01(void); +static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_02(void); +static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_03(void); + + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_03, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_seek_decrypt_session:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_seek_decrypt_session:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_seek_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_01(void) +{ + + tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself"); + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of drm_trusted_seek_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_02(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_seek_decrypt_info_s seek_input_data; + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + + seek_input_data.offset = 0; + seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */ + + ret = drm_trusted_seek_decrypt_session(NULL,&seek_input_data); + + tet_printf("ret = 0x%x",ret); + + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("seek_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} + +static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_03(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_seek_decrypt_info_s seek_input_data; + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + + seek_input_data.offset = 0; + seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */ + + ret = drm_trusted_seek_decrypt_session(pHandle,NULL); + + tet_printf("ret = 0x%x",ret); + + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("seek_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_set_decrypt_state_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_set_decrypt_state_func.c new file mode 100644 index 0000000..92efc86 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_set_decrypt_state_func.c @@ -0,0 +1,170 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 utc_drmtrustedclient_drm_trusted_set_decrypt_state_func.c + * @brief TETware unit testing functions for drm_trusted_set_decrypt_state. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_01(void); +static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_02(void); +static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_03(void); + + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_03, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_set_decrypt_state:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_set_decrypt_state:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_set_decrypt_state() + */ +static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_01(void) +{ + + tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself"); + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of drm_trusted_set_decrypt_state() + */ +static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_02(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_set_consumption_state_info_s state_input_data; + + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; +// open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + + tet_printf("ret = 0x%x",ret); + + state_input_data.state = DRM_CONSUMPTION_STARTED; + ret = drm_trusted_set_decrypt_state(NULL,&state_input_data); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("set_decrypt_state success"); + tet_result(TET_FAIL); + }else{ + tet_printf("set_decrypt_state FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} + +/** + * @brief negative test case of drm_trusted_set_decrypt_state() + */ +static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_03(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_set_consumption_state_info_s state_input_data; + + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; +// open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + + tet_printf("ret = 0x%x",ret); + + state_input_data.state = DRM_CONSUMPTION_STARTED; + ret = drm_trusted_set_decrypt_state(pHandle,NULL); + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("set_decrypt_state success"); + tet_result(TET_FAIL); + }else{ + tet_printf("set_decrypt_state FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func.c new file mode 100644 index 0000000..b62e918 --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func.c @@ -0,0 +1,187 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func.c + * @brief TETware unit testing functions for drm_trusted_tell_decrypt_session. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_01(void); +static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_02(void); +static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_03(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_03, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_tell_decrypt_session:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_tell_decrypt_session:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_tell_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_01(void) +{ + + tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself"); + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of drm_trusted_tell_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_02(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_seek_decrypt_info_s seek_input_data; + drm_trusted_tell_decrypt_resp_data_s tell_output_data; + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + + tet_printf("ret = 0x%x",ret); + + seek_input_data.offset = 0; + seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */ + + ret = drm_trusted_seek_decrypt_session(pHandle,&seek_input_data); + + tet_printf("ret = 0x%x",ret); + + ret = drm_trusted_tell_decrypt_session(NULL,&tell_output_data); + + tet_printf("ret = 0x%x",ret); + + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("tell_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("tell_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} + +/** + * @brief Negative test case of drm_trusted_tell_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_03(void) +{ + /* Initialize variables & structures */ + drm_trusted_open_decrypt_info_s open_input_data; + drm_trusted_open_decrypt_resp_data_s open_output_data; + drm_trusted_seek_decrypt_info_s seek_input_data; + + DRM_DECRYPT_HANDLE pHandle = NULL; + int ret = -1; + + /* memset the structures */ + memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s)); + memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s)); + + /* Enter Appropriate Inputs */ + memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1, + strlen(FILE_PATH_VALID_FILE_OMA_1)); + open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1; + open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY; + //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb; + + /* Open Decrypt Session*/ + ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data, + &pHandle); + + tet_printf("ret = 0x%x",ret); + + seek_input_data.offset = 0; + seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */ + + ret = drm_trusted_seek_decrypt_session(pHandle,&seek_input_data); + + tet_printf("ret = 0x%x",ret); + + ret = drm_trusted_tell_decrypt_session(pHandle,NULL); + + tet_printf("ret = 0x%x",ret); + + if(DRM_TRUSTED_RETURN_SUCCESS == ret){ + tet_printf("tell_decrypt_session success"); + tet_result(TET_FAIL); + }else{ + tet_printf("tell_decrypt_session FAILED: ret=0x%x", ret); + tet_result(TET_PASS); + } + ret = drm_trusted_close_decrypt_session(&pHandle); + + tet_printf("ret = 0x%x",ret); +} + diff --git a/TC/unit/utc_drmtrustedclient_drm_trusted_write_convert_func.c b/TC/unit/utc_drmtrustedclient_drm_trusted_write_convert_func.c new file mode 100644 index 0000000..daefe5e --- /dev/null +++ b/TC/unit/utc_drmtrustedclient_drm_trusted_write_convert_func.c @@ -0,0 +1,153 @@ +/* + * drm-trusted-client TCs + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * Ravi S + * + * + * 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 utc_drmtrustedclient_drm_trusted_write_convert_func.c + * @brief TETware unit testing functions for drm_trusted_write_convert. + * @author Ravi S (ravi.cs@samsung.com) + * @version 0.1 + * @history 0.1: Initial draft + */ + +#include +#include "drm_test_contents_def.h" +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_drmtrustedclient_drm_trusted_write_convert_func_01(void); +static void utc_drmtrustedclient_drm_trusted_write_convert_func_02(void); +static void utc_drmtrustedclient_drm_trusted_write_convert_func_03(void); +static void utc_drmtrustedclient_drm_trusted_write_convert_func_04(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_drmtrustedclient_drm_trusted_write_convert_func_01, POSITIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_write_convert_func_02, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_write_convert_func_03, NEGATIVE_TC_IDX }, + { utc_drmtrustedclient_drm_trusted_write_convert_func_04, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static void startup(void) +{ + tet_infoline("drm_trusted_write_convert:Test started"); +} + +static void cleanup(void) +{ + tet_infoline("drm_trusted_write_convert:Test completed"); +} + +/** + * @brief Positive test case of drm_trusted_close_decrypt_session() + */ +static void utc_drmtrustedclient_drm_trusted_write_convert_func_01(void) +{ + tet_printf("Already tested in utc_drmtrustedclient_drm_trusted_open_convert_func_01"); + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of drm_trusted_write_convert() + */ +static void utc_drmtrustedclient_drm_trusted_write_convert_func_02(void) +{ + drm_trusted_write_conv_info_s input; + drm_trusted_write_conv_resp_s output; + int ret = -1; + + /* memset the structures */ + memset(&input, 0x0, sizeof(drm_trusted_write_conv_info_s)); + memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s)); + + ret = drm_trusted_write_convert(&input,&output,NULL); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_write_convert ret=0x%x", ret); + tet_result(TET_FAIL); + } else { + tet_printf("drm_trusted_write_convert ret=0x%x", ret); + tet_result(TET_PASS); + } +} + +/** + * @brief Negative test case of drm_trusted_write_convert() + */ +static void utc_drmtrustedclient_drm_trusted_write_convert_func_03(void) +{ + drm_trusted_write_conv_info_s input; + DRM_TRUSTED_CONVERT_HANDLE hConvert; + int ret = -1; + + /* memset the structures */ + memset(&input, 0x0, sizeof(drm_trusted_write_conv_info_s)); + memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE)); + + ret = drm_trusted_write_convert(&input,NULL,hConvert); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_write_convert ret=0x%x", ret); + tet_result(TET_FAIL); + } else { + tet_printf("drm_trusted_write_convert ret=0x%x", ret); + tet_result(TET_PASS); + } +} + +/** + * @brief Negative test case of drm_trusted_write_convert() + */ +static void utc_drmtrustedclient_drm_trusted_write_convert_func_04(void) +{ + drm_trusted_write_conv_resp_s output; + DRM_TRUSTED_CONVERT_HANDLE hConvert; + int ret = -1; + + /* memset the structures */ + memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s)); + memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE)); + + ret = drm_trusted_write_convert(NULL,&output,hConvert); + tet_printf("ret = 0x%x", ret); + if (DRM_TRUSTED_RETURN_SUCCESS == ret) { + tet_printf("drm_trusted_write_convert ret=0x%x", ret); + tet_result(TET_FAIL); + } else { + tet_printf("drm_trusted_write_convert ret=0x%x", ret); + tet_result(TET_PASS); + } +} diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..6960314 --- /dev/null +++ b/debian/README @@ -0,0 +1,8 @@ +The Debian Package drm-trusted +---------------------------- + +Comments regarding the Package + + -- Hakjoo Ko Thu, 23 Feb 2012 11:34:57 +0530 + -- Mahendra Kumar Prajapat Thu, 23 Feb 2012 11:34:57 +0530 + -- Harsha Shekar Thu, 23 Feb 2012 11:34:57 +0530 diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..ef41f21 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,8 @@ +drm-trusted for Debian +---------------------- + + + + -- Hakjoo Ko Thu, 23 Feb 2012 11:34:57 +0530 + -- Mahendra Kumar Prajapat Thu, 23 Feb 2012 11:34:57 +0530 + -- Harsha Shekar Thu, 23 Feb 2012 11:34:57 +0530 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..7f1b5f0 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,64 @@ +drm-trusted (0.0.6-0) unstable; urgency=low + + * Added TCs and test utility + * Bug fixes and code clean up + * Modified by Harsha Shekar + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.6-0 + + -- Harsha Shekar Mon, 14 May 2012 19:24:24 +0900 + +drm-trusted (0.0.5-0) unstable; urgency=low + + * Issue fix in convert handle + * Removed multiple occurences of CID size + * Modified by Harsha Shekar + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.5-0 + + -- Harsha Shekar Fri, 11 May 2012 19:20:10 +0900 + +drm-trusted (0.0.4-0) unstable; urgency=low + + * Implementation of APIs like DM to DCF, master reset etc + * Modified by Harsha Shekar + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.4-0 + + -- Harsha Shekar Thu, 10 May 2012 10:31:48 +0900 + +drm-trusted (0.0.3-1) unstable; urgency=low + + * Modified spec file + * Modified by Harsha Shekar + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.3-1 + + -- Harsha Shekar Tue, 08 May 2012 18:28:13 +0900 + +drm-trusted (0.0.3-0) unstable; urgency=low + + * Removed compilation errors when both client and trusted client included + * Modified by Harsha Shekar + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.3-0 + + -- Harsha Shekar Thu, 03 May 2012 11:40:23 +0530 + +drm-trusted (0.0.2-0) unstable; urgency=low + + * Implementation of Consumption APIs + * Modified by Harsha Mahendra + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.2-0 + + -- Harsha Shekar Wed, 18 Apr 2012 14:45:06 +0530 + +drm-trusted (0.0.1-0) unstable; urgency=low + + * Initial drm-trusted client code + * Modification by Harsha Shekar + * Git: slp/pkgs/d/drm-trusted + * Tag: drm-trusted_0.0.1-0 + + -- Harsha Shekar Wed, 04 Apr 2012 13:50:25 +0530 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f2fb37c --- /dev/null +++ b/debian/control @@ -0,0 +1,25 @@ +Source: drm-trusted +Section: main +Priority: optional +Maintainer: Hakjoo Ko , Mahendra Kumar Prajapat +Uploaders: Harsha Shekar Mahendra Kumar Prajapat +Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev +Standards-Version: 3.7.2 + +Package: drm-trusted-0 +Section: main +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: DRM trusted client library package. To be used only by native/trusted applications + +Package: drm-trusted-dev +Section: main +Architecture: any +Depends: drm-trusted-0 (= ${Source-Version}), dlog-dev, capi-base-common-dev +Description: DRM trusted client library development package. To be used only by native/trusted applications + +Package: drm-trusted-0-dbg +Section: debug +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, drm-trusted-0 (=${Source-Version}) +Description: debug package of DRM trusted client library. To be used only by native/trusted applications diff --git a/debian/drm-trusted-0.install.in b/debian/drm-trusted-0.install.in new file mode 100644 index 0000000..9b75a8a --- /dev/null +++ b/debian/drm-trusted-0.install.in @@ -0,0 +1 @@ +@PREFIX@/lib/* \ No newline at end of file diff --git a/debian/drm-trusted-0.postinst b/debian/drm-trusted-0.postinst new file mode 100644 index 0000000..d5dcd37 --- /dev/null +++ b/debian/drm-trusted-0.postinst @@ -0,0 +1,8 @@ +#!/bin/sh +#if [ ${USER} = "root" ] +#then +# Do post installation operations as a root +#else +# Do post installation operations as a non-root +#fi + diff --git a/debian/drm-trusted-dev.install.in b/debian/drm-trusted-dev.install.in new file mode 100644 index 0000000..791161c --- /dev/null +++ b/debian/drm-trusted-dev.install.in @@ -0,0 +1,2 @@ +@PREFIX@/include/drm-trusted/drm_trusted_client.h +@PREFIX@/include/drm-trusted/drm_trusted_client_types.h diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..6bc34e7 --- /dev/null +++ b/debian/rules @@ -0,0 +1,124 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CFLAGS ?= -Wall -g +CFLAGS += -fPIC +CXXFLAGS ?= -Wall -g +CXXFLAGS += -fPIC + +PREFIX ?= /usr +DATADIR ?= /opt + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + +LDFLAGS += --rpath=$(PREFIX)/lib -Wl,--as-needed + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/ncurses.sgml > ncurses.1 + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ + done + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + rm -rf CMakeCache.txt + rm -rf CMakeFiles + rm -rf cmake_install.cmake + rm -rf Makefile + rm -rf install_manifest.txt + rm -rf *.pc + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + # Add here commands to install the package into debian/ncurses. + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + #dh_strip #before + dh_strip --dbg-package=drm-trusted-0-dbg #after + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install \ No newline at end of file diff --git a/drm-trusted.pc.in b/drm-trusted.pc.in new file mode 100644 index 0000000..10c3148 --- /dev/null +++ b/drm-trusted.pc.in @@ -0,0 +1,6 @@ +Name: drm-trusted +Description: DRM trusted client Package. To be used only by native/trusted applications +Version: @VERSION@ +Requires: dlog capi-base-common +Libs: -L@LIBDIR@ -ldrm-trusted +Cflags: -I@INCLUDEDIR@/drm-trusted \ No newline at end of file diff --git a/include/drm_trusted_client.h b/include/drm_trusted_client.h new file mode 100644 index 0000000..debe296 --- /dev/null +++ b/include/drm_trusted_client.h @@ -0,0 +1,334 @@ +/* + * drm-trusted-client + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * 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 drm_trusted_client.h + * @brief DRM Trusted Client API declaration header file. + * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com) + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @remarks ALL APIs with prefix drm_trusted_* are sensitive APIs & + * MUST be used by native & trusted applications + * @history 0.1: DRM Trusted Client API Declarations + */ + +#ifndef __DRM_TRUSTED_CLIENT_H__ +#define __DRM_TRUSTED_CLIENT_H__ + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus */ + +#include "drm_trusted_client_types.h" + +/** + * @defgroup DRMTRUSTEDCLIENT drm-trusted-client + * @{ + */ + +/** + * @} + */ + +/** + * @addtogroup DRMTRUSTEDCLIENT + * @{ + */ + +/** + * An application can do particular request to DRM. + * + * @param[in] request_type Request types as per enum drm_trusted_request_type_e. + * @param[in] input Pointer to appropriate structure as per + * request_type. + * @param[out] output Output data. Pointer to appropriate structure as + * per request_type. + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks Please typecast to appropriate data structures + * as per data types. + * + * if request_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK + * then input type: input = pointer to struct drm_trusted_update_sec_clk_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK + * then input type: input = pointer to struct drm_trusted_set_sec_clk_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING + * then input type: input = pointer to struct drm_trusted_set_transaction_trk_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_MASTER_RESET + * then input type: input = NULL + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT + * then input type: input = NULL + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB + * then input type: input = NULL + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT + * then input type: input = NULL + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_REMOVE_RO + * then input type: input = pointer to struct drm_trusted_remove_ro_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO + * then input type: input = NULL + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL + * then input type: input = pointer to struct drm_trusted_go_rights_url_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE + * then input type: input = pointer to struct drm_trusted_pd_set_dld_comp_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO + * then input type: input = pointer to struct drm_trusted_pd_parse_status_info_s + * and output type: output = pointer to struct drm_trusted_pd_parse_status_resp_s + * + * if request_type = DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE + * then input type: input = pointer to struct drm_trusted_piff_get_license_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE + * then input type: input = pointer to struct drm_trusted_sapps_decrypt_package_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE + * then input type: input = pointer to struct drm_trusted_sapps_consume_license_info_s + * and output type: output = NULL + * + * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST + * then input type: input = pointer to struct drm_trusted_sapps_gen_purchase_req_info_s + * and output type: output = pointer to struct drm_trusted_sapps_gen_purchase_req_resp_s + * + * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST + * then input type: input = pointer to struct drm_trusted_sapps_gen_license_req_info_s + * and output type: output = pointer to struct drm_trusted_sapps_gen_license_req_resp_s + * + * + * @see + * @since 0.1 + */ +int drm_trusted_handle_request(drm_trusted_request_type_e request_type, + void *input, void *output); + +/** + * An application can Open Decrypt Session for consumption. + * + * @param[in] input_data Pointer to drm_trusted_open_decrypt_info_s + * @param[out] output_data Pointer to drm_trusted_open_decrypt_resp_data_s + * @param[out] pHandle Pointer to DRM_DECRYPT_HANDLE + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @retval DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY if memory not available + * @remarks In drm_trusted_open_decrypt_info_s structure + * OMA, PR, OMA PD: filepath = DRM File path & lic_header = {0} + * PIFF: filepath = {0} & lic_header = Header from manifest file + * @see + * @since 0.1 + */ +int drm_trusted_open_decrypt_session(drm_trusted_open_decrypt_info_s *input_data, + drm_trusted_open_decrypt_resp_data_s *output_data, DRM_DECRYPT_HANDLE *pHandle); + + +/** + * An application can Read Decrypt Session for consumption. + * + * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session + * @param[in] input_data Pointer to drm_trusted_payload_info_s + * @param[out] output_data Pointer to drm_trusted_read_decrypt_resp_data_s + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @retval DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY if memory not available + * @remarks In drm_trusted_payload_info_s structure + * OMA,OMA_PD: input = payload_data (Encrypted buffer) + * output = payload_data (Decrypted buffer) + * + * PR,PIFF: input = payload_data (Encrypted buffer) + * input = payload_iv (Initialisation Vector) + * output = payload_data (Decrypted buffer) + * @see + * @since 0.1 + */ +int drm_trusted_read_decrypt_session(DRM_DECRYPT_HANDLE pHandle, + drm_trusted_payload_info_s *input_data, drm_trusted_read_decrypt_resp_data_s *output_data); + +/** + * An application can Seek Decrypt Session for consumption. + * + * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session + * @param[in] input_data Pointer to drm_trusted_seek_decrypt_info_s + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_seek_decrypt_session(DRM_DECRYPT_HANDLE pHandle, + drm_trusted_seek_decrypt_info_s *input_data); + +/** + * An application can Tell Decrypt Session for consumption. + * + * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session + * @param[out] output_data Pointer to drm_trusted_tell_decrypt_resp_data_s + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_tell_decrypt_session(DRM_DECRYPT_HANDLE pHandle, + drm_trusted_tell_decrypt_resp_data_s *output_data); + +/** + * An application can Set Decrypt state during consumption. + * + * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session + * @param[in] input_data Pointer to drm_trusted_set_consumption_state_info_s + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_set_decrypt_state(DRM_DECRYPT_HANDLE pHandle, + drm_trusted_set_consumption_state_info_s *input_data); + +/** + * An application can Close decrypt session for consumption. + * + * @param[in] pHandle Pointer to DRM_DECRYPT_HANDLE obtained from Open Decrypt Session + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_close_decrypt_session(DRM_DECRYPT_HANDLE *pHandle); + + +/** + * An application can prepare to convert a DRM file in OMADRM-v1. + * If a type of DRM file is FL, CD or FL-SD type, application can convert to SD type. + * This function prepare for converting and create file. + * + * @param[in] input Pointer to drm_trusted_opn_conv_info_s + * @param[out] hConvert Pointer to Open Convert Handle(DRM_TRUSTED_CONVERT_HANDLE) + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_open_convert(drm_trusted_opn_conv_info_s *input, + DRM_TRUSTED_CONVERT_HANDLE *hConvert); + +/** + * An application can write converted data. + * + * @param[in] input Pointer to drm_trusted_opn_conv_info_s + * @param[out] output Pointer to drm_trusted_write_conv_resp_s + * @param[in] hConvert Pointer to Open Convert Handle(DRM_TRUSTED_CONVERT_HANDLE) + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_write_convert(drm_trusted_write_conv_info_s *input, + drm_trusted_write_conv_resp_s *output, + DRM_TRUSTED_CONVERT_HANDLE hConvert); + +/** + * An application can release a resource for converting. + * + * @param[in] hConvert Pointer to Open Convert Handle(DRM_TRUSTED_CONVERT_HANDLE) + * + * @return 0 on success, else a negative error value + * @retval DRM_TRUSTED_RETURN_SUCCESS on success + * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid + * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error + * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_close_convert(DRM_TRUSTED_CONVERT_HANDLE *hConvert); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__DRM_TRUSTED_CLIENT_H__ */ diff --git a/include/drm_trusted_client_ipc.h b/include/drm_trusted_client_ipc.h new file mode 100644 index 0000000..9def50e --- /dev/null +++ b/include/drm_trusted_client_ipc.h @@ -0,0 +1,204 @@ +/* + * drm-trusted-client + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 drm_trusted_client_ipc.h + * @brief DRM Trusted Client Inter process communication declarations. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: DRM Trusted Client Inter process communication declarations. + */ + +#ifndef __DRM_TRUSTED_CLIENT_IPC_H__ +#define __DRM_TRUSTED_CLIENT_IPC_H__ + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus */ + +#include "drm_trusted_client_types.h" + +/* + * DRM Socket Path + */ +#define DRM_TRUSTED_SOCK_PATH "/tmp/DrmTrustedSocket" + +/* + * Maximum Size of Cookie + */ +#define DRM_TRUSTED_MAX_LEN_COOKIE (20) + +/** +* Maximum Request Data length +*/ +#define DRM_TRUSTED_MAX_REQUEST_DATA_LENGTH (4096) + +/** +* Maximum Response Data length +*/ +#define DRM_TRUSTED_MAX_RESPONSE_DATA_LENGTH (4096) + +/** +* Maximum number of Data Items +*/ +#define DRM_TRUSTED_MAX_DATA_ITEMS_NUM (5) + +/** +* Maximum Read/Write Chunk Size +*/ +#define DRM_TRUSTED_MAX_CHUNK_SIZE (100 * 1024) + +/** + * @enum drm_trusted_request_api_e + * @brief DRM API names. + */ +typedef enum { + DRM_TRUSTED_API_NONE = 100, /**< For initialization purpose */ + DRM_TRUSTED_HANDLE_REQUEST, /**< Trusted Handle Request */ + DRM_TRUSTED_OPEN_DECRYPT_SESSION, /**< Open Decrypt Session */ + DRM_TRUSTED_READ_DECRYPT_SESSION, /**< Read Decrypt Session */ + DRM_TRUSTED_TELL_DECRYPT_SESSION, /**< Seek Decrypt Session */ + DRM_TRUSTED_SEEK_DECRYPT_SESSION, /**< Tell Decrypt Session */ + DRM_TRUSTED_CLOSE_DECRYPT_SESSION, /**< Close Decrypt Session */ + DRM_TRUSTED_SET_DECRYPT_STATE, /**< Set Decrypt State */ + DRM_TRUSTED_OPEN_CONVERT, /**< Open Convert */ + DRM_TRUSTED_WRITE_CONVERT, /**< Write Convert */ + DRM_TRUSTED_CLOSE_CONVERT, /**< Close Convert */ + DRM_TRUSTED_API_MAX /**< Max enum value */ +} drm_trusted_request_api_e; + +/** + * @struct drm_trusted_client_info_s + * @brief Trusted Client Information structure. + * @remark It can be used to track drm trusted clients. + * It can be extended to add more parameters like pid, uid etc. + */ +typedef struct { + /** Trusted Client Id */ + int client_id; +} drm_trusted_client_info_s; + +/** + * @struct drm_trusted_req_fixed_data_s + * @brief DRM input parameter(request) fixed data structure. + */ +typedef struct { + + /** Trusted Client Request API */ + drm_trusted_request_api_e api_name; + + /** Trusted Client Request Type */ + drm_trusted_request_type_e req_type; + + /** Trusted Client specific Information */ + drm_trusted_client_info_s client_info; + + /** No of data items(Pointers) */ + unsigned int num_data_items; + + /** Length of each data item */ + unsigned int data_length[DRM_TRUSTED_MAX_DATA_ITEMS_NUM]; + + /** Decrypt Handle */ + DRM_DECRYPT_HANDLE pHandle; + + /** DRM Convert Handle */ + DRM_TRUSTED_CONVERT_HANDLE hConvert; + + /** Request Data */ + char request_data[DRM_TRUSTED_MAX_REQUEST_DATA_LENGTH]; + +}drm_trusted_req_fixed_data_s; + +/** + * @struct drm_trusted_request_data_s + * @brief DRM input parameter(request) structure. + */ +typedef struct { + + /** Fixed Data */ + drm_trusted_req_fixed_data_s fixed_data; + + /** Array of individual data items */ + char *data_items[DRM_TRUSTED_MAX_DATA_ITEMS_NUM]; + +} drm_trusted_request_data_s; + +/** + * @struct drm_trusted_server_resp_fixed_data_s + * @brief DRM output parameter(response) fixed data structure. + */ +typedef struct { + + /* Response Result */ + drm_trusted_result_e resp_result; + + /** No of data items(Pointers) */ + unsigned int num_data_items; + + /** Length of each data item */ + unsigned int data_length[DRM_TRUSTED_MAX_DATA_ITEMS_NUM]; + + /** Decrypt Handle */ + DRM_DECRYPT_HANDLE pHandle; + + /** DRM Convert Handle */ + DRM_TRUSTED_CONVERT_HANDLE hConvert; + + /* Response Data */ + char response_data[DRM_TRUSTED_MAX_RESPONSE_DATA_LENGTH]; + +} drm_trusted_resp_fixed_data_s; + +/** + * @struct drm_trusted_response_data_s + * @brief DRM output parameter(response) structure. + */ +typedef struct { + + /** Fixed Data */ + drm_trusted_resp_fixed_data_s fixed_data; + + /** Array of individual data items */ + char *data_items[DRM_TRUSTED_MAX_DATA_ITEMS_NUM]; + +} drm_trusted_response_data_s; + +/** + * This API is used to send a request to the Server to call corresponding API + * + * @param[in] client_in Carries the input parameters of Trusted Client API to Server + * @param[out] server_out Carries the output parameters of Trusted Client API from Server + * @return 0 on success & other values on failure + * @remarks + * @see + * @since 0.1 + */ +int drm_trusted_client_comm(drm_trusted_request_data_s *client_in, drm_trusted_response_data_s *server_out); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__DRM_TRUSTED_CLIENT_IPC_H__ */ diff --git a/include/drm_trusted_client_log.h b/include/drm_trusted_client_log.h new file mode 100644 index 0000000..0a9c82e --- /dev/null +++ b/include/drm_trusted_client_log.h @@ -0,0 +1,100 @@ +/* + * drm-trusted-client + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 drm_trusted_client_log.h + * @brief DRM Trusted Client log specific file. + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @history 0.1: DRM LOG definitions. + */ + +#ifndef __DRM_TRUSTED_CLIENT_LOG_H__ +#define __DRM_TRUSTED_CLIENT_LOG_H__ + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus */ + +#include +#include +#include +#include +#include +#include + +#define drmtrustedclientgettid() (long int)syscall(__NR_gettid) +#define DRM_TRUSTED_CLIENT_FILENAME(X) (strrchr((char *)(X), '/') ? (char *)(strrchr((char*)(X), '/') + 1) : ((char *)(X))) + +/* + * Enable this flag to use internal logging mechanism + */ +//#define __DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__ + +#ifdef __DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__ + +/* Use internal logging mechanism */ +extern const char *__progname; + +#define DRM_TRUSTED_CLIENT_LOG(FMT, ARG...) do{ \ + fprintf(stderr, "\n [EXE name=%s]:[PID=%ld]:[TID=%ld]:[%s:%s:%d]:", __progname, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__); \ + fprintf(stderr, FMT, ##ARG); \ + fprintf(stderr,"\n"); \ + }while(0); + +#define DRM_TRUSTED_CLIENT_EXCEPTION(FMT, ARG...) do{ \ + fprintf(stderr, "\n [EXE name=%s]:[PID=%ld]:[TID=%ld]:[%s:%s:%d]:[DRM-ERROR-CLIENT]:", __progname, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__); \ + fprintf(stderr, FMT, ##ARG); \ + fprintf(stderr,"\n"); \ + }while(0); + +#define DRM_TRUSTED_CLIENT_FRQ_LOG DRM_TRUSTED_CLIENT_LOG + +#else /*__DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__ */ + +/* Use DLOG logging mechanism */ +#include "dlog.h" + +/* DRM Trusted Client layer debug messages*/ +#define TAG_DRM_TRUSTED_CLIENT "DRM_TRUSTED_CLIENT" + +/* DLOG Level +DEBUG Debug message. - always compiled into application, but not logged at run time by default on release mode. on debug mode, this message will be logged at run time. +INFO Information message - Normal operational messages. above of this priority will always be logged. +WARN Warning messages - not an error, but indication that an error will occur if action is not taken +ERROR Error message - indicate error. +*/ + +/* Trusted Client layer related logs */ +#define DRM_TRUSTED_CLIENT_LOG(FMT, ARG...) SLOG(LOG_INFO, TAG_DRM_TRUSTED_CLIENT, "[PID=%ld]:[TID=%ld]:[%s:%s:%d]:"FMT, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__, ##ARG); +#define DRM_TRUSTED_CLIENT_FRQ_LOG(FMT, ARG...) SLOG(LOG_DEBUG, TAG_DRM_TRUSTED_CLIENT, "[PID=%ld]:[TID=%ld]:[%s:%s:%d]:"FMT, (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__, ##ARG); +#define DRM_TRUSTED_CLIENT_EXCEPTION(FMT, ARG...) SLOG(LOG_ERROR, TAG_DRM_TRUSTED_CLIENT, "[PID=%ld]:[TID=%ld]:[%s:%s:%d]:[DRM-ERROR-CLIENT]"FMT"\n", (long int)getpid(), drmtrustedclientgettid(), DRM_TRUSTED_CLIENT_FILENAME(__FILE__), __func__, __LINE__, ##ARG); + +#endif /* __DRM_TRUSTED_CLIENT_USE_INTERNAL_LOGGING__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __DRM_TRUSTED_CLIENT_LOG_H__*/ diff --git a/include/drm_trusted_client_types.h b/include/drm_trusted_client_types.h new file mode 100644 index 0000000..5552491 --- /dev/null +++ b/include/drm_trusted_client_types.h @@ -0,0 +1,835 @@ +/* + * drm-trusted-client + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hakjoo Ko + * Mahendra Kumar Prajapat + * Harsha Shekar + * + * + * 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 drm_trusted_client_types.h + * @brief DRM Trusted Client API macros, structures & enum declaration file. + * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com) + * @author Harsha Shekar (h.shekar@samsung.com) + * @version 0.1 + * @remarks ALL types with prefix drm_trusted_* are sensitive types & + * MUST be used by native & trusted applications + * @history 0.1: First version of DRM Trusted Client API macros, + * structures & enum declarations. + */ + +#ifndef __DRM_TRUSTED_CLIENT_TYPES_H__ +#define __DRM_TRUSTED_CLIENT_TYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus */ + +#include "tizen_error.h" +#include + + +#define DRM_TRUSTED_MAX_FILEPATH_LEN (256) + +/* + * Max length of APP ID + */ +#define DRM_TRUSTED_MAX_LEN_APP_ID (15) + +/* + * Max length of User ID + */ +#define DRM_TRUSTED_MAX_LEN_USER_GUID (15) + +/* + * Max length of Device ID + */ +#define DRM_TRUSTED_MAX_LEN_DEVICE_ID (15) + +/* + * Max length of Order ID + */ +#define DRM_TRUSTED_MAX_LEN_ORDER_ID (15) + +/* + * Max length of Service ID + */ +#define DRM_TRUSTED_MAX_LEN_SERVICE_ID (31) + +/* + * Max length of Account ID + */ +#define DRM_TRUSTED_MAX_LEN_ACCOUNT_ID (31) + +/* + * Max length of Content Type + */ +#define DRM_TRUSTED_MAX_LEN_CONTENT_TYPE (64) + +/* + * Max length of Content Id + */ +#define DRM_TRUSTED_MAX_LEN_CONTENT_ID (256) + +/* + * Max length of IP Address + */ +#define DRM_TRUSTED_MAX_LEN_IP_ADDR (64) + +/* + * Maximum Length of Rights URL field + */ +#define DRM_TRUSTED_MAX_LEN_RIGHTS_URL (256) + +/** + * @enum drm_trusted_result_e + * @brief DRM Return values. + */ +typedef enum { + /**< Success */ + DRM_TRUSTED_RETURN_SUCCESS = 0, + /**< Invalid Argument */ + DRM_TRUSTED_RETURN_INVALID_ARG = TIZEN_ERROR_INVALID_PARAMETER, + /**< Insufficient Memory */ + DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, + /**< Parsing Error */ + DRM_TRUSTED_RETURN_PARSING_ERROR = TIZEN_ERROR_DRM_CLASS | 0x01, + /**< DB Error */ + DRM_TRUSTED_RETURN_DB_ERROR = TIZEN_ERROR_DRM_CLASS | 0x02, + /**< File Error */ + DRM_TRUSTED_RETURN_FILE_ERROR = TIZEN_ERROR_DRM_CLASS | 0x03, + /**< Communication Error */ + DRM_TRUSTED_RETURN_COMMUNICATION_ERROR = TIZEN_ERROR_DRM_CLASS | 0x04, + /**< Internal Error */ + DRM_TRUSTED_RETURN_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN +} drm_trusted_result_e; + +/** + * @enum drm_trusted_request_type_e + * @brief DRM Trusted Request types. + */ +typedef enum { + /* For initialization purpose */ + DRM_TRUSTED_REQ_TYPE_NONE = -1, + + /* Request to update Secure Clock */ + DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK = 0, + + /* Request to Set Secure Clock */ + DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK, + + /* Request to Set Transaction tracking */ + DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING, + + /* Master Reset */ + DRM_TRUSTED_REQ_TYPE_MASTER_RESET, + + /* Verify Encrypted Certificate */ + DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT, + + /* Create Initial DB */ + DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB, + + /* Reinstall Certificate */ + DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT, + + /* Remove RO */ + DRM_TRUSTED_REQ_TYPE_REMOVE_RO, + + /* Remove All RO */ + DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO, + + /* Go Rights URL */ + DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL, + + /* Progressive Download Set Download */ + DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE, + + /* Progressive Download Parse Status */ + DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO, + + /* PIFF Get License */ + DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE, + + /* Samsung Apps Decrypt Package */ + DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE, + + /* Samsung Apps Consume License */ + DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE, + + /* Samsung Apps Generate Purchae Request */ + DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST, + + /* Samsung Apps Generate License Request */ + DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST + +} drm_trusted_request_type_e; + +/** + * @enum drm_trusted_time_source_e + * @brief DRM Trusted Time Source. + */ +typedef enum { + + /**