--- /dev/null
+Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+Harsha Shekar <h.shekar@samsung.com>
\ No newline at end of file
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)\r
+PROJECT(drm-trusted CXX)\r
+\r
+#Verbose\r
+#SET(CMAKE_VERBOSE_MAKEFILE ON)\r
+\r
+# Message\r
+#MESSAGE("FLAGS: ${CMAKE_C_FLAGS}")\r
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})\r
+SET(LIBDIR ${PREFIX}/lib)\r
+SET(INCLUDEDIR ${PREFIX}/include)\r
+SET(VERSION 0.0.1)\r
+\r
+SET(SRCS\r
+ service/drm_trusted_client.cpp\r
+ service/drm_trusted_client_ipc.cpp\r
+)\r
+\r
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)\r
+\r
+SET(extapi "-fvisibility=hidden")\r
+SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${extapi}")\r
+\r
+#SET(DEBUG "-Wall -Werror -ggdb3 -fno-omit-frame-pointer -rdynamic -fno-optimize-sibling-calls -fstack-protector-all")\r
+#SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${DEBUG}")\r
+\r
+INCLUDE(FindPkgConfig)\r
+pkg_check_modules(exppkgs REQUIRED dlog capi-base-common)\r
+\r
+FOREACH(flag ${exppkgs_CFLAGS})\r
+ SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")\r
+ENDFOREACH(flag)\r
+\r
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")\r
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})\r
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} "-ldl" )\r
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${exppkgs_LDFLAGS})\r
+SET_TARGET_PROPERTIES(\r
+ drm-trusted\r
+ PROPERTIES\r
+ SOVERSION 0\r
+ VERSION 0.0.1\r
+)\r
+\r
+FIND_PROGRAM(UNAME NAMES uname)\r
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")\r
+IF("${ARCH}" STREQUAL "arm")\r
+ ADD_DEFINITIONS("-DTARGET")\r
+ MESSAGE("add -DTARGET")\r
+ENDIF("${ARCH}" STREQUAL "arm")\r
+\r
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc)\r
+INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)\r
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)\r
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION /usr/include/drm-trusted/)
\ No newline at end of file
--- /dev/null
+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.
+
--- /dev/null
+#!/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/
--- /dev/null
+#!/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/
--- /dev/null
+# 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"
--- /dev/null
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/unit/tslist
--- /dev/null
+TET_OUTPUT_CAPTURE=False
+TET_BUILD_TOOL=make
+TET_PASS_TC_NAME=True
--- /dev/null
+TET_OUTPUT_CAPTURE=False
+TET_CLEAN_TOOL=make clean
--- /dev/null
+TET_OUTPUT_CAPTURE=False
--- /dev/null
+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
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file drmcontentsdef.h\r
+ * @brief DRM TC Content MACROs.\r
+ * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com)\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: DRM TC Content MACROs\r
+ */\r
+\r
+#ifndef __DRM_CONTENTS_DEF_H__\r
+#define __DRM_CONTENTS_DEF_H__\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /*__cplusplus */\r
+\r
+#include "drm_trusted_client.h"\r
+\r
+#define FILE_PATH_MAX_SIZE (256)\r
+\r
+/* Modify path to local tc_data folder*/\r
+#define DRM_CONTENT_PATH "/path/to/tc_data"\r
+\r
+/*\r
+ * Valid File paths\r
+ */\r
+#define FILE_PATH_VALID_FILE_OMA_1 DRM_CONTENT_PATH"/flourish_count5.dcf"\r
+#define FILE_PATH_VALID_FILE_OMA_2 DRM_CONTENT_PATH"/1202_F1_Jpg.dcf"\r
+\r
+/*\r
+ * This file will be generated as a part of DM to DCF conversion test-case\r
+ */\r
+#define FILE_PATH_VALID_DM_FILE_OMA_1 DRM_CONTENT_PATH"/image_cd.dm"\r
+\r
+#define FILE_PATH_VALID_FILE_OMA_9 DRM_CONTENT_PATH"/image_cd.dcf"\r
+\r
+/*\r
+ * Invalid File paths\r
+ */\r
+#define INVALID_POINTER_OBJECT NULL\r
+#define FILE_PATH_INVALID_FILE_NULL NULL\r
+#define FILE_PATH_INVALID_FILE_EMPTY ""\r
+\r
+\r
+/** Valid RO file paths\r
+ *\r
+ */\r
+#define FILE_PATH_VALID_RO_FILE_OMA_1 DRM_CONTENT_PATH"/flourish_count5.dr"\r
+\r
+/** Invalid RO file paths\r
+ *\r
+ */\r
+#define FILE_PATH_INVALID_RO_FILE_OMA_1 DRM_CONTENT_PATH"/flourish_count5.dcf"\r
+\r
+/*\r
+ * Valid License Initiators\r
+ */\r
+/* Jazz_Audio_OPLs0.pya */\r
+#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"\r
+\r
+/* DomainTestVideo1.pyv */\r
+#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"\r
+\r
+/* DomainTestVideo1.pyv */\r
+#define JOIN_DOMAIN_INITIATOR_VALID_PR_FILE_1 "http://playready.directtaps.net/pr/initiator.aspx?p=0&type=JOIN"\r
+\r
+/* DomainTestVideo1.pyv */\r
+#define LEAVE_DOMAIN_INITIATOR_VALID_PR_FILE_1 "http://playready.directtaps.net/pr/initiator.aspx?p=0&type=LEAVE"\r
+\r
+/* DomainTestVideo1.pyv */\r
+#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"\r
+\r
+/* ExpirationAudio1.pya */\r
+#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"\r
+\r
+/* MD_h264_V4AES.pyv */\r
+#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"\r
+\r
+/* jazz_wma_Domain_No_Copy.pya */\r
+#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"\r
+\r
+/*\r
+ * Invalid License Initiators\r
+ */\r
+#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"\r
+#define INVALID_JOIN_DOMAIN_INITIATOR_1 "http://playready.directtaps.net/prxx/initiatorxxxx.aspx?p=0&type=JOIN"\r
+#define INVALID_LEAVE_DOMAIN_INITIATOR_1 "http://playready.directtaps.net/prxx/initiatorxxxx.aspx?p=0&type=LEAVE"\r
+#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"\r
+#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"\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* __DRM_CONTENTS_DEF_H__ */\r
--- /dev/null
+#!/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"
--- /dev/null
+/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
--- /dev/null
+#include <tet_api.h>
+#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);
+}
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ * Ravi S <ravi.cs@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_close_convert_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_close_convert.\r
+ * @author Ravi S (ravi.cs@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_close_convert_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_close_convert_func_02(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_close_convert_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_close_convert_func_02, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_close_convert:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_close_convert:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_close_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_close_convert_func_01(void)\r
+{\r
+ tet_printf("Already tested in utc_drmtrustedclient_drm_trusted_open_convert_func_01");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_close_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_close_convert_func_02(void)\r
+{\r
+ int ret = -1;\r
+\r
+ ret = drm_trusted_close_convert(NULL);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_close_convert ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("drm_trusted_close_convert ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_close_decrypt_session_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_close_decrypt_session.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_02(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_02, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_close_decrypt_session:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_close_decrypt_session:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_close_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_01(void)\r
+{\r
+ tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_close_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_close_decrypt_session_func_02(void)\r
+{\r
+ int ret = -1;\r
+\r
+ ret = drm_trusted_close_decrypt_session(NULL);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("close_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("close_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ * Ravi S <ravi.cs@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_handle_request.c\r
+ * @brief TETware unit testing functions for drm_trusted_handle_request.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)
+ * @author Ravi S (ravi.cs@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include "drm_trusted_client_types.h"\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_03(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_04(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_05(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_06(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_07(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_08(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_09(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_10(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_11(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_12(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_13(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_14(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_15(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_16(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_17(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_18(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_19(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_20(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_21(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_22(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_23(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_24(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_25(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_26(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_27(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_28(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_29(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_30(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_31(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_32(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_33(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_34(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_35(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_36(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_37(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_38(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_39(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_40(void);\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_41(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_02, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_03, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_04, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_05, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_06, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_07, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_08, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_09, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_10, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_11, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_12, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_13, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_14, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_15, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_16, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_17, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_18, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_19, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_20, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_21, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_22, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_23, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_24, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_25, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_26, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_27, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_28, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_29, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_30, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_31, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_32, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_33, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_34, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_35, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_36, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_37, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_38, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_39, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_40, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_handle_request_func_41, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_handle_request:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_handle_request:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_01(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK;\r
+ long int delta = 0, locatime = 0, securetime = 0;\r
+ struct tm* tmst = NULL;\r
+ drm_trusted_set_sec_clk_info_s sec_clk_info;\r
+ memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK");\r
+\r
+ locatime = (long int)time(NULL);\r
+ tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime));\r
+\r
+ securetime = locatime + delta;\r
+ tmst = localtime(&securetime);\r
+ tet_printf("Current Secure Time = %ld = %s \n",\r
+ securetime, asctime(tmst));\r
+\r
+ memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm));\r
+ sec_clk_info.source_type = DRM_TRUSTED_TS_NITZ;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Secure Clock Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Set Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_02(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK;\r
+ long int delta = 0, locatime = 0, securetime = 0;\r
+ struct tm* tmst = NULL;\r
+ drm_trusted_set_sec_clk_info_s sec_clk_info;\r
+ memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK");\r
+\r
+ locatime = (long int)time(NULL);\r
+ tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime));\r
+\r
+ securetime = locatime + delta;\r
+ tmst = localtime(&securetime);\r
+ tet_printf("Current Secure Time = %ld = %s \n",\r
+ securetime, asctime(tmst));\r
+\r
+ memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm));\r
+ sec_clk_info.source_type = DRM_TRUSTED_TS_OCSP;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Secure Clock Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Set Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_03(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK;\r
+ long int delta = 0, locatime = 0, securetime = 0;\r
+ struct tm* tmst = NULL;\r
+ drm_trusted_set_sec_clk_info_s sec_clk_info;\r
+ memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK");\r
+\r
+ locatime = (long int)time(NULL);\r
+ tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime));\r
+\r
+ securetime = locatime + delta;\r
+ tmst = localtime(&securetime);\r
+ tet_printf("Current Secure Time = %ld = %s \n",\r
+ securetime, asctime(tmst));\r
+\r
+ memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm));\r
+ sec_clk_info.source_type = DRM_TRUSTED_TS_MS_TTS;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Secure Clock Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Set Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_04(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK;\r
+ long int delta = 0, locatime = 0, securetime = 0;\r
+ struct tm* tmst = NULL;\r
+ drm_trusted_set_sec_clk_info_s sec_clk_info;\r
+ memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK");\r
+\r
+ locatime = (long int)time(NULL);\r
+ tet_printf("Current Local Time = %ld = %s \n",locatime,ctime(&locatime));\r
+\r
+ securetime = locatime + delta;\r
+ tmst = localtime(&securetime);\r
+ tet_printf("Current Secure Time = %ld = %s \n",\r
+ securetime, asctime(tmst));\r
+\r
+ memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm));\r
+ sec_clk_info.source_type = DRM_TRUSTED_TS_USER;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&sec_clk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Secure Clock Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Set Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_05(void)\r
+{\r
+\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK");\r
+\r
+ ret = drm_trusted_handle_request(req_type, NULL, NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Secure Clock Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("Set Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_06(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK;\r
+ long int delta = 10, newtime = 0, oldtime = 0;\r
+ struct tm* tmst = NULL;\r
+ drm_trusted_update_sec_clk_info_s upd_clk_info;\r
+ memset(&upd_clk_info, 0x00, sizeof(drm_trusted_update_sec_clk_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK");\r
+\r
+ oldtime = (long int)time(NULL);\r
+ tet_printf("Old Local Time = %ld = %s \n",oldtime,ctime(&oldtime));\r
+\r
+ newtime = oldtime + delta;\r
+ tmst = localtime(&newtime);\r
+ tet_printf("New Local Time = %ld = %s \n",newtime,asctime(tmst));\r
+\r
+ upd_clk_info.before = oldtime;\r
+ upd_clk_info.after = newtime;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&upd_clk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Update Secure Clock Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Update Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_07(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK;\r
+ long int delta = 0, newtime = 0, oldtime = 0;\r
+ struct tm* tmst = NULL;\r
+ drm_trusted_update_sec_clk_info_s upd_clk_info;\r
+ memset(&upd_clk_info, 0x00, sizeof(drm_trusted_update_sec_clk_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK");\r
+\r
+ oldtime = (long int)time(NULL);\r
+ tet_printf("Old Local Time = %ld = %s \n",oldtime,ctime(&oldtime));\r
+\r
+ newtime = oldtime + delta;\r
+ tmst = localtime(&newtime);\r
+ tet_printf("New Local Time = %ld = %s \n",newtime,asctime(tmst));\r
+\r
+ upd_clk_info.before = oldtime;\r
+ upd_clk_info.after = newtime;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&upd_clk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Update Secure Clock Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Update Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_08(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK");\r
+\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Update Secure Clock Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("Update Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_09(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING;\r
+ drm_trusted_set_transaction_trk_info_s trk_info = {0,};\r
+ trk_info.tracking_on = DRM_TRUSTED_TRUE;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&trk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Transaction Tracking Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Set Transaction Tracking FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_10(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING;\r
+ drm_trusted_set_transaction_trk_info_s trk_info = {0,};\r
+ trk_info.tracking_on = DRM_TRUSTED_FALSE;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&trk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Set Transaction Tracking Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("Set Transaction Tracking FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_11(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING;\r
+ drm_trusted_set_transaction_trk_info_s trk_info = {0,};\r
+ trk_info.tracking_on = DRM_TRUSTED_UNKNOWN;\r
+\r
+ ret = drm_trusted_handle_request(req_type,(void*)&trk_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Update Secure Clock Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("Update Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_12(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING;\r
+\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("Update Secure Clock Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("Update Secure Clock FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_13(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_MASTER_RESET");\r
+#if 0\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_MASTER_RESET;\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_MASTER_RESET");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+#else\r
+ tet_printf("Disabling this test case here to ensure no interference with other test case");\r
+#endif\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("MASTER RESET Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("MASTER RESET FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_14(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT");\r
+#if 0\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+#else\r
+ tet_printf("Modify this test case if DRMv2 is supported!!");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("verifying encrypted certificate Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("verifying encrypted certificate FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_15(void)\r
+{\r
+\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB");\r
+#if 0\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB;
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+#else\r
+ tet_printf("Disabling this test case here to ensure no interference with other test case");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("CREATE_INIT_DB Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("CREATE_INIT_DB FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_16(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT");\r
+#if 0\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+#else\r
+ tet_printf("Modify this test case if DRMv2 is supported!!");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("REINSTALL_CERT Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("REINSTALL_CERT FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_17(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REMOVE_RO;\r
+ drm_trusted_remove_ro_info_s remove_ro_info;\r
+ memset(&remove_ro_info, 0x00, sizeof(drm_trusted_remove_ro_info_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_RO");\r
+\r
+ memcpy(remove_ro_info.filePath,FILE_PATH_VALID_FILE_OMA_1,strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ ret = drm_trusted_handle_request(req_type,&remove_ro_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("REMOVE_RO Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("REMOVE_RO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_18(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REMOVE_RO;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_RO");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("REMOVE_RO Success");\r
+ tet_result(TET_FAIL);\r
+\r
+ }else{\r
+ tet_printf("REMOVE_RO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_19(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO");\r
+#if 0\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO;
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+#else\r
+ tet_printf("Disabling this test case here to ensure no interference with other test case");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("REMOVE_ALL_RO Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("REMOVE_ALL_RO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+}\r
+\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_20(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL;\r
+ drm_trusted_go_rights_url_info_s rights_url_info;\r
+ memset(&rights_url_info, 0x00, sizeof(drm_trusted_go_rights_url_info_s));\r
+ memcpy(rights_url_info.file_path,FILE_PATH_VALID_FILE_OMA_1,strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL");\r
+ ret = drm_trusted_handle_request(req_type,&rights_url_info,NULL);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL");\r
+#endif\r
+\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("GO_RIGHTS_URL Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("GO_RIGHTS_URL FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_21(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("GO_RIGHTS_URL Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("GO_RIGHTS_URL FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_22(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE;\r
+ drm_trusted_pd_set_dld_comp_info_s download_cmp_info;\r
+ memset(&download_cmp_info, 0x00, sizeof(drm_trusted_pd_set_dld_comp_info_s));\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE");\r
+ ret = drm_trusted_handle_request(req_type,&download_cmp_info,NULL);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE");\r
+#endif\r
+\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PD_SET_DOWNLOAD_COMPLETE Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("PD_SET_DOWNLOAD_COMPLETE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_23(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PD_SET_DOWNLOAD_COMPLETE Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("PD_SET_DOWNLOAD_COMPLETE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_24(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO;\r
+ drm_trusted_pd_parse_status_info_s info_status;\r
+ drm_trusted_pd_parse_status_resp_s resp_status;\r
+\r
+ memset(&info_status, 0x00, sizeof(drm_trusted_pd_parse_status_info_s));\r
+ memset(&resp_status, 0x00, sizeof(drm_trusted_pd_parse_status_resp_s));\r
+\r
+ snprintf(info_status.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1);\r
+ tet_printf("Src file=%s",info_status.file_path);\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO");\r
+ ret = drm_trusted_handle_request(req_type,&info_status,&resp_status);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_25(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO;\r
+ drm_trusted_pd_parse_status_info_s info_status;\r
+\r
+ memset(&info_status, 0x00, sizeof(drm_trusted_pd_parse_status_info_s));\r
+\r
+ snprintf(info_status.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1);\r
+ tet_printf("Src file=%s",info_status.file_path);\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO");\r
+ ret = drm_trusted_handle_request(req_type,&info_status,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_26(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO;\r
+ drm_trusted_pd_parse_status_resp_s resp_status;\r
+\r
+ memset(&resp_status, 0x00, sizeof(drm_trusted_pd_parse_status_resp_s));\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO");\r
+ ret = drm_trusted_handle_request(req_type,NULL,&resp_status);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_27(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("PD_GET_PARSE_STATUS_INFO FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_28(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 1\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE;\r
+ drm_trusted_piff_get_license_info_s license_info;\r
+ memset(&license_info, 0x00, sizeof(drm_trusted_piff_get_license_info_s));\r
+\r
+ /* Sample Content => SuperSpeedway_720_230.ismv */\r
+\r
+ /* 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.".>.\r
+ * <.D.A.T.A.>.\r
+ * <.P.R.O.T.E.C.T.I.N.F.O.>.\r
+ * <.K.E.Y.L.E.N.>.1.6.<./.K.E.Y.L.E.N.>.\r
+ * <.A.L.G.I.D.>.A.E.S.C.T.R.<./.A.L.G.I.D.>.\r
+ * <./.P.R.O.T.E.C.T.I.N.F.O.>.\r
+ * <.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.>.\r
+ * <.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.>.\r
+ * <.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>.\r
+ * <.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.>.\r
+ * <./.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>.\r
+ * <.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.>.\r
+ * <.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.>.\r
+ * <./.D.A.T.A.>.\r
+ * <./.W.R.M.H.E.A.D.E.R.>... */\r
+\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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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};\r
+\r
+\r
+ license_info.lic_header.header_len = sizeof(ContentHeader);\r
+ license_info.lic_header.header = (unsigned char*)ContentHeader;\r
+\r
+ tet_printf("license_info.lic_header.header_len= %d",license_info.lic_header.header_len);\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE");\r
+ ret = drm_trusted_handle_request(req_type,&license_info,NULL);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PIFF_GET_LICENSE Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("PIFF_GET_LICENSE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_29(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("PIFF_GET_LICENSE Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("PIFF_GET_LICENSE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_30(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;\r
+ drm_trusted_sapps_decrypt_package_info_s package_info;\r
+\r
+ memset(&package_info, 0x00, sizeof(drm_trusted_sapps_decrypt_package_info_s));\r
+\r
+ snprintf(package_info.sadcf_filepath,256, "%s",FILE_PATH_VALID_FILE_OMA_1);\r
+ snprintf(package_info.decrypt_filepath,256, "%s",FILE_PATH_VALID_FILE_OMA_9);\r
+ tet_printf("sapps dcf file:%s",package_info.sadcf_filepath);\r
+ tet_printf("decrypted file:%s",package_info.decrypt_filepath);\r
+\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE");\r
+ ret = drm_trusted_handle_request(req_type,&package_info,NULL);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_DECRYPT_PACKAGE Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("SAPPS_DECRYPT_PACKAGE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_31(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_DECRYPT_PACKAGE Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_DECRYPT_PACKAGE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_32(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE;\r
+ drm_trusted_sapps_consume_license_info_s cons_license_info;\r
+\r
+ memset(&cons_license_info, 0x00, sizeof(drm_trusted_sapps_consume_license_info_s));\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_SAPPS_CONSUME_LICENSE");\r
+ ret = drm_trusted_handle_request(req_type,&cons_license_info,NULL);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_CONSUME_LICENSE Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("SAPPS_CONSUME_LICENSE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_33(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_CONSUME_LICENSE Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_CONSUME_LICENSE FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_34(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST;\r
+ drm_trusted_sapps_gen_purchase_req_info_s gen_purchase_req_info;\r
+ drm_trusted_sapps_gen_purchase_req_resp_s gen_purchase_resp_info;\r
+\r
+ memset(&gen_purchase_req_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_info_s));\r
+ memset(&gen_purchase_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_resp_s));\r
+\r
+ snprintf(gen_purchase_req_info.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1);\r
+ tet_printf("sapps file:%s",gen_purchase_req_info.file_path);\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,&gen_purchase_req_info,&gen_purchase_resp_info);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_35(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST;\r
+ drm_trusted_sapps_gen_purchase_req_info_s gen_purchase_req_info;\r
+\r
+ memset(&gen_purchase_req_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_info_s));\r
+ snprintf(gen_purchase_req_info.file_path,256, "%s",FILE_PATH_VALID_FILE_OMA_1);\r
+ tet_printf("sapps file:%s",gen_purchase_req_info.file_path);\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,&gen_purchase_req_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_36(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST;\r
+ drm_trusted_sapps_gen_purchase_req_resp_s gen_purchase_resp_info;\r
+\r
+ memset(&gen_purchase_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_purchase_req_resp_s));\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,NULL,&gen_purchase_resp_info);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_37(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_PURCHASE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_38(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_SUCCESS;\r
+#if 0\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST;\r
+ drm_trusted_sapps_gen_license_req_info_s gen_license_req_info;\r
+ drm_trusted_sapps_gen_license_req_resp_s gen_license_req_resp_info;\r
+\r
+ memset(&gen_license_req_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_info_s));\r
+ memset(&gen_license_req_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_resp_s));\r
+\r
+ tet_printf("Testing: DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,&gen_license_req_info,&gen_license_req_resp_info);\r
+#else\r
+ tet_printf("Proper test environment is not available for request_type:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST");\r
+#endif\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success");\r
+ tet_result(TET_PASS);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_39(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST;\r
+ drm_trusted_sapps_gen_license_req_info_s gen_license_req_info;\r
+\r
+ memset(&gen_license_req_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_info_s));\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,&gen_license_req_info,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
+\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_40(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST;\r
+ drm_trusted_sapps_gen_license_req_resp_s gen_license_req_resp_info;\r
+\r
+ memset(&gen_license_req_resp_info, 0x00, sizeof(drm_trusted_sapps_gen_license_req_resp_s));\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,NULL,&gen_license_req_resp_info);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_handle_request()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_handle_request_func_41(void)\r
+{\r
+ int ret = DRM_TRUSTED_RETURN_INTERNAL_ERROR;\r
+ drm_trusted_request_type_e req_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST;\r
+\r
+ tet_printf ("Testing:DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST");\r
+ ret = drm_trusted_handle_request(req_type,NULL,NULL);\r
+ tet_printf("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST Success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("SAPPS_GENERATE_LICENSE_REQUEST FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ * Ravi S <ravi.cs@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_open_convert_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_open_convert.\r
+ * @author Ravi S (ravi.cs@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <fcntl.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include <errno.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_open_convert_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_open_convert_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_open_convert_func_03(void);\r
+\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_open_convert_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_open_convert_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_open_convert_func_03, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_open_convert:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_open_convert:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_open_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_convert_func_01(void)\r
+{\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+ drm_trusted_opn_conv_info_s input;\r
+ drm_trusted_write_conv_info_s write_input;\r
+ drm_trusted_write_conv_resp_s output;\r
+\r
+ FILE *fp = NULL;\r
+ unsigned int FileSize=-1;\r
+ unsigned char *buffer = NULL;\r
+ struct stat statbuf;\r
+ int readed_size = -1;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE));\r
+ memset(&input, 0x0, sizeof(drm_trusted_opn_conv_info_s));\r
+ memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s));\r
+ memset(&write_input, 0x0, sizeof(drm_trusted_opn_conv_info_s));\r
+ memset(&statbuf, 0x0, sizeof(struct stat));\r
+\r
+ memcpy(input.filePath,FILE_PATH_VALID_FILE_OMA_9,strlen(FILE_PATH_VALID_FILE_OMA_9));\r
+ input.install_RO = DRM_TRUSTED_FALSE;\r
+\r
+ ret = drm_trusted_open_convert(&input,&hConvert);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_open_convert:ret=0x%x", ret);\r
+ } else {\r
+ tet_printf("drm_trusted_open_convert:ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ return;\r
+ }\r
+ fp = fopen(FILE_PATH_VALID_DM_FILE_OMA_1, "r");\r
+ if (fp == NULL)\r
+ {\r
+ tet_printf("fopen error:error=%s",strerror(errno));\r
+ tet_result(TET_FAIL);\r
+ return;\r
+ }\r
+\r
+ if(stat(FILE_PATH_VALID_DM_FILE_OMA_1, &statbuf) == 0 )\r
+ FileSize = (unsigned int)statbuf.st_size;\r
+ tet_printf("FileSize=%u",FileSize);\r
+ if(FileSize == 0)\r
+ {\r
+ tet_result(TET_FAIL);\r
+ return;\r
+ }\r
+ buffer = (unsigned char *)malloc(FileSize + 1);\r
+ if(!buffer)\r
+ {\r
+ tet_printf("malloc failed:error=%s",strerror(errno));\r
+ free(buffer);\r
+ tet_result(TET_FAIL);\r
+ return;\r
+ }\r
+ memset(buffer,0x0, FileSize+1);\r
+ readed_size = fread(buffer,1,FileSize,fp);\r
+ tet_printf("fread:read_size=%d",readed_size);\r
+ if(readed_size == -1)\r
+ {\r
+ tet_result(TET_FAIL);\r
+ return;\r
+ }\r
+ buffer[FileSize] = '\0';\r
+\r
+ write_input.data_len = FileSize;\r
+ write_input.data = buffer;\r
+\r
+ ret = drm_trusted_write_convert(&write_input,&output,hConvert);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_write_convert:ret=0x%x", ret);\r
+ } else {\r
+ tet_printf("drm_trusted_write_convert:ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ tet_printf("bytes written=%d",output.write_size);\r
+ if(FileSize != output.write_size)\r
+ {\r
+ tet_printf("Data is not written successfully");\r
+ tet_result(TET_FAIL);\r
+ return;\r
+ }\r
+\r
+ ret = drm_trusted_close_convert(&hConvert);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_close_convert:ret=0x%x", ret);\r
+ tet_printf("drm_trusted_open_convert,drm_trusted_write_convert and drm_trusted_close_convert all have passed");\r
+ tet_result(TET_PASS);\r
+ } else {\r
+ tet_printf("drm_trusted_close_convert:ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_open_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_convert_func_02(void)\r
+{\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE));\r
+\r
+ ret = drm_trusted_open_convert(NULL,&hConvert);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_open_convert ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("drm_trusted_open_convert ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_open_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_convert_func_03(void)\r
+{\r
+ drm_trusted_opn_conv_info_s input;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&input, 0x0, sizeof(drm_trusted_opn_conv_info_s));\r
+\r
+ ret = drm_trusted_open_convert(&input,NULL);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_open_convert ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("drm_trusted_open_convert ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_open_decrypt_session_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_open_decrypt_session.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+//#define MAX_OUT_BUFFER_LEN (1024 * 1024)\r
+#define MAX_OUT_BUFFER_LEN (10 * 1024)\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_03(void);\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_04(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_03, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_04, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+\r
+static void startup(void) {\r
+ tet_infoline("drm_trusted_open_decrypt_session:Test started");\r
+}\r
+\r
+static void cleanup(void) {\r
+ tet_infoline("drm_trusted_open_decrypt_session:Test completed");\r
+}\r
+\r
+void test_drm_trusted_operation_cb(\r
+ drm_trusted_user_operation_info_s *operation_info, void *output_data)\r
+{\r
+ tet_printf("Callback Hit:test_drm_trusted_operation_cb");\r
+ tet_printf("operation_status=%d", operation_info->operation_status);\r
+ tet_printf("operation_type=%d", operation_info->operation_type);\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_open_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_01(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_seek_decrypt_info_s seek_input_data;\r
+ drm_trusted_tell_decrypt_resp_data_s tell_output_data;\r
+ drm_trusted_set_consumption_state_info_s state_input_data;\r
+ drm_trusted_payload_info_s read_input_data;\r
+ drm_trusted_read_decrypt_resp_data_s read_output_data;\r
+ unsigned char *out_buffer = NULL;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ memset(&seek_input_data, 0x0, sizeof(drm_trusted_seek_decrypt_info_s));\r
+ memset(&tell_output_data, 0x0, sizeof(drm_trusted_tell_decrypt_resp_data_s));\r
+ memset(&state_input_data, 0x0, sizeof(drm_trusted_set_consumption_state_info_s));\r
+ memset(&read_input_data, 0x0, sizeof(drm_trusted_payload_info_s));\r
+ memset(&read_output_data, 0x0, sizeof(drm_trusted_read_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_2));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_PLAY;\r
+\r
+ /* Open Decrypt Session */\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data, &open_output_data,\r
+ &pHandle);\r
+\r
+ tet_printf("drm_trusted_open_decrypt_session ret = 0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("open_decrypt_session success");\r
+ } else {\r
+ tet_printf("open_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */\r
+\r
+ ret = drm_trusted_seek_decrypt_session(pHandle, &seek_input_data);\r
+\r
+ tet_printf("drm_trusted_seek_decrypt_session ret = 0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("seek_decrypt_session success");\r
+ } else {\r
+ tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ ret = drm_trusted_tell_decrypt_session(pHandle, &tell_output_data);\r
+ tet_printf("ret = 0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("tell_decrypt_session success");\r
+ } else {\r
+ tet_printf("tell_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+ tet_printf("file-size = %u",tell_output_data.offset);\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_SET; /* Set cursor to START */\r
+\r
+ ret = drm_trusted_seek_decrypt_session(pHandle, &seek_input_data);\r
+ tet_printf("drm_trusted_seek_decrypt_session ret = 0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("seek_decrypt_session success");\r
+ } else {\r
+ tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ state_input_data.state = DRM_CONSUMPTION_STARTED;\r
+ ret = drm_trusted_set_decrypt_state(pHandle, &state_input_data);\r
+ tet_printf("drm_trusted_set_decrypt_state START ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("set_decrypt_state success");\r
+ } else {\r
+ tet_printf("set_decrypt_state FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ /* Allocate memory for Out Buffer */\r
+ out_buffer = (unsigned char*) malloc(MAX_OUT_BUFFER_LEN);\r
+ if (!out_buffer) {\r
+ tet_printf("Memory Allocation Error!!!");\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ read_input_data.payload_data = out_buffer;\r
+ read_input_data.payload_data_len = (unsigned int) MAX_OUT_BUFFER_LEN;\r
+\r
+ /* Handle READ / DECRYPT operation */\r
+ ret = drm_trusted_read_decrypt_session(pHandle, &read_input_data,\r
+ &read_output_data);\r
+ tet_printf("drm_trusted_read_decrypt_session ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("read_decrypt_session success");\r
+ } else {\r
+ tet_printf("read_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ state_input_data.state = DRM_CONSUMPTION_STOPPED;\r
+ ret = drm_trusted_set_decrypt_state(pHandle, &state_input_data);\r
+ tet_printf("drm_trusted_set_decrypt_state STOPT ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("set_decrypt_state success");\r
+ } else {\r
+ tet_printf("set_decrypt_state FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+\r
+ if (out_buffer)\r
+ free (out_buffer);\r
+\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+ tet_printf("drm_trusted_close_decrypt_session ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("close_decrypt_session success");\r
+ tet_result(TET_PASS);\r
+ } else {\r
+ tet_printf("close_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief negative test case of drm_trusted_open_decrypt_session()\r
+ * here open_input_data is NULL\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_02(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+ //drm_trusted_permission_type_e perm_type;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_2));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(NULL, &open_output_data, &pHandle);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("open_decrypt_session Success");\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("open_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief negative test case of drm_trusted_open_decrypt_session()\r
+ * here open_output_data is NULL\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_03(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+ //drm_trusted_permission_type_e perm_type;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_2));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data, NULL, &pHandle);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("open_decrypt_session Success");\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("open_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief negative test case of drm_trusted_open_decrypt_session()\r
+ * here Phandle is NULL\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_open_decrypt_session_func_04(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+\r
+ //DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+ //drm_trusted_permission_type_e perm_type;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data, 0x0, sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data, 0x0, sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_2,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_2));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data, &open_output_data,\r
+ NULL);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("open_decrypt_session Success");\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("open_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_read_decrypt_session_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_read_decrypt_session.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_03(void);\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_04(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_03, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_04, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_read_decrypt_session:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_read_decrypt_session:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief positive test case of drm_trusted_read_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_01(void)\r
+{\r
+\r
+ tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief negative test case of drm_trusted_read_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_02(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+\r
+ drm_trusted_payload_info_s read_input_data;\r
+ drm_trusted_read_decrypt_resp_data_s read_output_data;\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ ret = drm_trusted_read_decrypt_session(NULL,&read_input_data,\r
+ &read_output_data);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("read_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("read_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+}\r
+\r
+/**\r
+ * @brief negative test case of drm_trusted_read_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_03(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+\r
+ drm_trusted_read_decrypt_resp_data_s read_output_data;\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ ret = drm_trusted_read_decrypt_session(pHandle,NULL,\r
+ &read_output_data);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("read_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("read_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
+\r
+static void utc_drmtrustedclient_drm_trusted_read_decrypt_session_func_04(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+\r
+ drm_trusted_payload_info_s read_input_data;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ ret = drm_trusted_read_decrypt_session(pHandle,&read_input_data,\r
+ NULL);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("read_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("read_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
+\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_seek_decrypt_session.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_03(void);\r
+\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_03, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_seek_decrypt_session:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_seek_decrypt_session:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_seek_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_01(void)\r
+{\r
+\r
+ tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_seek_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_02(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_seek_decrypt_info_s seek_input_data;\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */\r
+\r
+ ret = drm_trusted_seek_decrypt_session(NULL,&seek_input_data);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("seek_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
+\r
+static void utc_drmtrustedclient_drm_trusted_seek_decrypt_session_func_03(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_seek_decrypt_info_s seek_input_data;\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */\r
+\r
+ ret = drm_trusted_seek_decrypt_session(pHandle,NULL);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("seek_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("seek_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_set_decrypt_state_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_set_decrypt_state.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_03(void);\r
+\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_03, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_set_decrypt_state:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_set_decrypt_state:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_set_decrypt_state()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_01(void)\r
+{\r
+\r
+ tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_set_decrypt_state()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_02(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_set_consumption_state_info_s state_input_data;\r
+\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+// open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ state_input_data.state = DRM_CONSUMPTION_STARTED;\r
+ ret = drm_trusted_set_decrypt_state(NULL,&state_input_data);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("set_decrypt_state success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("set_decrypt_state FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
+\r
+/**\r
+ * @brief negative test case of drm_trusted_set_decrypt_state()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_set_decrypt_state_func_03(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_set_consumption_state_info_s state_input_data;\r
+\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+// open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ state_input_data.state = DRM_CONSUMPTION_STARTED;\r
+ ret = drm_trusted_set_decrypt_state(pHandle,NULL);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("set_decrypt_state success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("set_decrypt_state FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_tell_decrypt_session.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_03(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_03, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_tell_decrypt_session:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_tell_decrypt_session:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_tell_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_01(void)\r
+{\r
+\r
+ tet_printf("Positive test case has been verified in the Open Decrypt Session TC itself");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_tell_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_02(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_seek_decrypt_info_s seek_input_data;\r
+ drm_trusted_tell_decrypt_resp_data_s tell_output_data;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */\r
+\r
+ ret = drm_trusted_seek_decrypt_session(pHandle,&seek_input_data);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ ret = drm_trusted_tell_decrypt_session(NULL,&tell_output_data);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("tell_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("tell_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_tell_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_tell_decrypt_session_func_03(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_seek_decrypt_info_s seek_input_data;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath, FILE_PATH_VALID_FILE_OMA_1,\r
+ strlen(FILE_PATH_VALID_FILE_OMA_1));\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_OMA_V1;\r
+ open_input_data.permission = DRM_TRUSTED_PERMISSION_TYPE_ANY;\r
+ //open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */\r
+\r
+ ret = drm_trusted_seek_decrypt_session(pHandle,&seek_input_data);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ ret = drm_trusted_tell_decrypt_session(pHandle,NULL);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ tet_printf("tell_decrypt_session success");\r
+ tet_result(TET_FAIL);\r
+ }else{\r
+ tet_printf("tell_decrypt_session FAILED: ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+\r
+ tet_printf("ret = 0x%x",ret);\r
+}\r
+\r
--- /dev/null
+/*\r
+ * drm-trusted-client TCs\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ * Ravi S <ravi.cs@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file utc_drmtrustedclient_drm_trusted_write_convert_func.c\r
+ * @brief TETware unit testing functions for drm_trusted_write_convert.\r
+ * @author Ravi S (ravi.cs@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: Initial draft\r
+ */\r
+\r
+#include <tet_api.h>\r
+#include "drm_test_contents_def.h"\r
+#include <time.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+\r
+static void startup(void);\r
+static void cleanup(void);\r
+\r
+void (*tet_startup)(void) = startup;\r
+void (*tet_cleanup)(void) = cleanup;\r
+\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_01(void);\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_02(void);\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_03(void);\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_04(void);\r
+\r
+enum {\r
+ POSITIVE_TC_IDX = 0x01,\r
+ NEGATIVE_TC_IDX,\r
+};\r
+\r
+struct tet_testlist tet_testlist[] = {\r
+ { utc_drmtrustedclient_drm_trusted_write_convert_func_01, POSITIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_write_convert_func_02, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_write_convert_func_03, NEGATIVE_TC_IDX },\r
+ { utc_drmtrustedclient_drm_trusted_write_convert_func_04, NEGATIVE_TC_IDX },\r
+ { NULL, 0 }\r
+};\r
+\r
+static void startup(void)\r
+{\r
+ tet_infoline("drm_trusted_write_convert:Test started");\r
+}\r
+\r
+static void cleanup(void)\r
+{\r
+ tet_infoline("drm_trusted_write_convert:Test completed");\r
+}\r
+\r
+/**\r
+ * @brief Positive test case of drm_trusted_close_decrypt_session()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_01(void)\r
+{\r
+ tet_printf("Already tested in utc_drmtrustedclient_drm_trusted_open_convert_func_01");\r
+ tet_result(TET_PASS);\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_write_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_02(void)\r
+{\r
+ drm_trusted_write_conv_info_s input;\r
+ drm_trusted_write_conv_resp_s output;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&input, 0x0, sizeof(drm_trusted_write_conv_info_s));\r
+ memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s));\r
+\r
+ ret = drm_trusted_write_convert(&input,&output,NULL);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_write_convert ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("drm_trusted_write_convert ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_write_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_03(void)\r
+{\r
+ drm_trusted_write_conv_info_s input;\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&input, 0x0, sizeof(drm_trusted_write_conv_info_s));\r
+ memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE));\r
+\r
+ ret = drm_trusted_write_convert(&input,NULL,hConvert);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_write_convert ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("drm_trusted_write_convert ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
+\r
+/**\r
+ * @brief Negative test case of drm_trusted_write_convert()\r
+ */\r
+static void utc_drmtrustedclient_drm_trusted_write_convert_func_04(void)\r
+{\r
+ drm_trusted_write_conv_resp_s output;\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s));\r
+ memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE));\r
+\r
+ ret = drm_trusted_write_convert(NULL,&output,hConvert);\r
+ tet_printf("ret = 0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ tet_printf("drm_trusted_write_convert ret=0x%x", ret);\r
+ tet_result(TET_FAIL);\r
+ } else {\r
+ tet_printf("drm_trusted_write_convert ret=0x%x", ret);\r
+ tet_result(TET_PASS);\r
+ }\r
+}\r
--- /dev/null
+The Debian Package drm-trusted
+----------------------------
+
+Comments regarding the Package
+
+ -- Hakjoo Ko <hakjoo.ko@samsung.com> Thu, 23 Feb 2012 11:34:57 +0530
+ -- Mahendra Kumar Prajapat <mahendra.p@samsung.com> Thu, 23 Feb 2012 11:34:57 +0530
+ -- Harsha Shekar <h.shekar@samsung.com> Thu, 23 Feb 2012 11:34:57 +0530
--- /dev/null
+drm-trusted for Debian
+----------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Hakjoo Ko <hakjoo.ko@samsung.com> Thu, 23 Feb 2012 11:34:57 +0530
+ -- Mahendra Kumar Prajapat <mahendra.p@samsung.com> Thu, 23 Feb 2012 11:34:57 +0530
+ -- Harsha Shekar <h.shekar@samsung.com> Thu, 23 Feb 2012 11:34:57 +0530
--- /dev/null
+drm-trusted (0.0.6-0) unstable; urgency=low
+
+ * Added TCs and test utility
+ * Bug fixes and code clean up
+ * Modified by Harsha Shekar <h.shekar@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.6-0
+
+ -- Harsha Shekar <h.shekar@samsung.com> 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 <h.shekar@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.5-0
+
+ -- Harsha Shekar <h.shekar@samsung.com> 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 <h.shekar@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.4-0
+
+ -- Harsha Shekar <h.shekar@samsung.com> Thu, 10 May 2012 10:31:48 +0900
+
+drm-trusted (0.0.3-1) unstable; urgency=low
+
+ * Modified spec file
+ * Modified by Harsha Shekar <h.shekar@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.3-1
+
+ -- Harsha Shekar <h.shekar@samsung.com> 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 <h.shekar@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.3-0
+
+ -- Harsha Shekar <h.shekar@samsung.com> Thu, 03 May 2012 11:40:23 +0530
+
+drm-trusted (0.0.2-0) unstable; urgency=low
+
+ * Implementation of Consumption APIs
+ * Modified by Harsha <h.shekar@samsung.com> Mahendra <mahendra.p@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.2-0
+
+ -- Harsha Shekar <h.shekar@samsung.com> 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 <h.shekar@samsung.com>
+ * Git: slp/pkgs/d/drm-trusted
+ * Tag: drm-trusted_0.0.1-0
+
+ -- Harsha Shekar <h.shekar@samsung.com> Wed, 04 Apr 2012 13:50:25 +0530
--- /dev/null
+Source: drm-trusted
+Section: main
+Priority: optional
+Maintainer: Hakjoo Ko <hakjoo.ko@samsung.com>, Mahendra Kumar Prajapat <mahendra.p@samsung.com>
+Uploaders: Harsha Shekar <h.shekar@samsung.com> Mahendra Kumar Prajapat <mahendra.p@samsung.com>
+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
--- /dev/null
+@PREFIX@/lib/*
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+#if [ ${USER} = "root" ]
+#then
+# Do post installation operations as a root
+#else
+# Do post installation operations as a non-root
+#fi
+
--- /dev/null
+@PREFIX@/include/drm-trusted/drm_trusted_client.h
+@PREFIX@/include/drm-trusted/drm_trusted_client_types.h
--- /dev/null
+#!/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
--- /dev/null
+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
--- /dev/null
+/*
+ * drm-trusted-client
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>
+ * Harsha Shekar <h.shekar@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * @file 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__ */
--- /dev/null
+/*\r
+ * drm-trusted-client\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file drm_trusted_client_ipc.h\r
+ * @brief DRM Trusted Client Inter process communication declarations.\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: DRM Trusted Client Inter process communication declarations.\r
+ */\r
+\r
+#ifndef __DRM_TRUSTED_CLIENT_IPC_H__\r
+#define __DRM_TRUSTED_CLIENT_IPC_H__\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /*__cplusplus */\r
+\r
+#include "drm_trusted_client_types.h"\r
+\r
+/*\r
+ * DRM Socket Path\r
+ */\r
+#define DRM_TRUSTED_SOCK_PATH "/tmp/DrmTrustedSocket"\r
+\r
+/*\r
+ * Maximum Size of Cookie\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_COOKIE (20)\r
+\r
+/**\r
+* Maximum Request Data length\r
+*/\r
+#define DRM_TRUSTED_MAX_REQUEST_DATA_LENGTH (4096)\r
+\r
+/**\r
+* Maximum Response Data length\r
+*/\r
+#define DRM_TRUSTED_MAX_RESPONSE_DATA_LENGTH (4096)\r
+\r
+/**\r
+* Maximum number of Data Items\r
+*/\r
+#define DRM_TRUSTED_MAX_DATA_ITEMS_NUM (5)\r
+\r
+/**\r
+* Maximum Read/Write Chunk Size\r
+*/\r
+#define DRM_TRUSTED_MAX_CHUNK_SIZE (100 * 1024)\r
+\r
+/**\r
+ * @enum drm_trusted_request_api_e\r
+ * @brief DRM API names.\r
+ */\r
+typedef enum {\r
+ DRM_TRUSTED_API_NONE = 100, /**< For initialization purpose */\r
+ DRM_TRUSTED_HANDLE_REQUEST, /**< Trusted Handle Request */\r
+ DRM_TRUSTED_OPEN_DECRYPT_SESSION, /**< Open Decrypt Session */\r
+ DRM_TRUSTED_READ_DECRYPT_SESSION, /**< Read Decrypt Session */\r
+ DRM_TRUSTED_TELL_DECRYPT_SESSION, /**< Seek Decrypt Session */\r
+ DRM_TRUSTED_SEEK_DECRYPT_SESSION, /**< Tell Decrypt Session */\r
+ DRM_TRUSTED_CLOSE_DECRYPT_SESSION, /**< Close Decrypt Session */\r
+ DRM_TRUSTED_SET_DECRYPT_STATE, /**< Set Decrypt State */\r
+ DRM_TRUSTED_OPEN_CONVERT, /**< Open Convert */\r
+ DRM_TRUSTED_WRITE_CONVERT, /**< Write Convert */\r
+ DRM_TRUSTED_CLOSE_CONVERT, /**< Close Convert */\r
+ DRM_TRUSTED_API_MAX /**< Max enum value */\r
+} drm_trusted_request_api_e;\r
+\r
+/**\r
+ * @struct drm_trusted_client_info_s\r
+ * @brief Trusted Client Information structure.\r
+ * @remark It can be used to track drm trusted clients.\r
+ * It can be extended to add more parameters like pid, uid etc.\r
+ */\r
+typedef struct {\r
+ /** Trusted Client Id */\r
+ int client_id;\r
+} drm_trusted_client_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_req_fixed_data_s\r
+ * @brief DRM input parameter(request) fixed data structure.\r
+ */\r
+typedef struct {\r
+\r
+ /** Trusted Client Request API */\r
+ drm_trusted_request_api_e api_name;\r
+\r
+ /** Trusted Client Request Type */\r
+ drm_trusted_request_type_e req_type;\r
+\r
+ /** Trusted Client specific Information */\r
+ drm_trusted_client_info_s client_info;\r
+\r
+ /** No of data items(Pointers) */\r
+ unsigned int num_data_items;\r
+\r
+ /** Length of each data item */\r
+ unsigned int data_length[DRM_TRUSTED_MAX_DATA_ITEMS_NUM];\r
+\r
+ /** Decrypt Handle */\r
+ DRM_DECRYPT_HANDLE pHandle;\r
+\r
+ /** DRM Convert Handle */\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+\r
+ /** Request Data */\r
+ char request_data[DRM_TRUSTED_MAX_REQUEST_DATA_LENGTH];\r
+\r
+}drm_trusted_req_fixed_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_request_data_s\r
+ * @brief DRM input parameter(request) structure.\r
+ */\r
+typedef struct {\r
+\r
+ /** Fixed Data */\r
+ drm_trusted_req_fixed_data_s fixed_data;\r
+\r
+ /** Array of individual data items */\r
+ char *data_items[DRM_TRUSTED_MAX_DATA_ITEMS_NUM];\r
+\r
+} drm_trusted_request_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_server_resp_fixed_data_s\r
+ * @brief DRM output parameter(response) fixed data structure.\r
+ */\r
+typedef struct {\r
+\r
+ /* Response Result */\r
+ drm_trusted_result_e resp_result;\r
+\r
+ /** No of data items(Pointers) */\r
+ unsigned int num_data_items;\r
+\r
+ /** Length of each data item */\r
+ unsigned int data_length[DRM_TRUSTED_MAX_DATA_ITEMS_NUM];\r
+\r
+ /** Decrypt Handle */\r
+ DRM_DECRYPT_HANDLE pHandle;\r
+\r
+ /** DRM Convert Handle */\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+\r
+ /* Response Data */\r
+ char response_data[DRM_TRUSTED_MAX_RESPONSE_DATA_LENGTH];\r
+\r
+} drm_trusted_resp_fixed_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_response_data_s\r
+ * @brief DRM output parameter(response) structure.\r
+ */\r
+typedef struct {\r
+\r
+ /** Fixed Data */\r
+ drm_trusted_resp_fixed_data_s fixed_data;\r
+\r
+ /** Array of individual data items */\r
+ char *data_items[DRM_TRUSTED_MAX_DATA_ITEMS_NUM];\r
+\r
+} drm_trusted_response_data_s;\r
+\r
+/**\r
+ * This API is used to send a request to the Server to call corresponding API\r
+ *\r
+ * @param[in] client_in Carries the input parameters of Trusted Client API to Server\r
+ * @param[out] server_out Carries the output parameters of Trusted Client API from Server\r
+ * @return 0 on success & other values on failure\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+int drm_trusted_client_comm(drm_trusted_request_data_s *client_in, drm_trusted_response_data_s *server_out);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /*__DRM_TRUSTED_CLIENT_IPC_H__ */\r
--- /dev/null
+/*
+ * drm-trusted-client
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>
+ * Harsha Shekar <h.shekar@samsung.com>
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * @file 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 <sys/types.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
+#include <unistd.h>
+#include <string.h>
+
+#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__*/
--- /dev/null
+/*\r
+ * drm-trusted-client\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file drm_trusted_client_types.h\r
+ * @brief DRM Trusted Client API macros, structures & enum declaration file.\r
+ * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com)\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @remarks ALL types with prefix drm_trusted_* are sensitive types &\r
+ * MUST be used by native & trusted applications\r
+ * @history 0.1: First version of DRM Trusted Client API macros,\r
+ * structures & enum declarations.\r
+ */\r
+\r
+#ifndef __DRM_TRUSTED_CLIENT_TYPES_H__\r
+#define __DRM_TRUSTED_CLIENT_TYPES_H__\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /*__cplusplus */\r
+\r
+#include "tizen_error.h"\r
+#include <time.h>\r
+\r
+\r
+#define DRM_TRUSTED_MAX_FILEPATH_LEN (256)\r
+\r
+/*\r
+ * Max length of APP ID\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_APP_ID (15)\r
+\r
+/*\r
+ * Max length of User ID\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_USER_GUID (15)\r
+\r
+/*\r
+ * Max length of Device ID\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_DEVICE_ID (15)\r
+\r
+/*\r
+ * Max length of Order ID\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_ORDER_ID (15)\r
+\r
+/*\r
+ * Max length of Service ID\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_SERVICE_ID (31)\r
+\r
+/*\r
+ * Max length of Account ID\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_ACCOUNT_ID (31)\r
+\r
+/*\r
+ * Max length of Content Type\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_CONTENT_TYPE (64)\r
+\r
+/*\r
+ * Max length of Content Id\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_CONTENT_ID (256)\r
+\r
+/*\r
+ * Max length of IP Address\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_IP_ADDR (64)\r
+\r
+/*\r
+ * Maximum Length of Rights URL field\r
+ */\r
+#define DRM_TRUSTED_MAX_LEN_RIGHTS_URL (256)\r
+\r
+/**\r
+ * @enum drm_trusted_result_e\r
+ * @brief DRM Return values.\r
+ */\r
+typedef enum {\r
+ /**< Success */\r
+ DRM_TRUSTED_RETURN_SUCCESS = 0,\r
+ /**< Invalid Argument */\r
+ DRM_TRUSTED_RETURN_INVALID_ARG = TIZEN_ERROR_INVALID_PARAMETER,\r
+ /**< Insufficient Memory */\r
+ DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,\r
+ /**< Parsing Error */\r
+ DRM_TRUSTED_RETURN_PARSING_ERROR = TIZEN_ERROR_DRM_CLASS | 0x01,\r
+ /**< DB Error */\r
+ DRM_TRUSTED_RETURN_DB_ERROR = TIZEN_ERROR_DRM_CLASS | 0x02,\r
+ /**< File Error */\r
+ DRM_TRUSTED_RETURN_FILE_ERROR = TIZEN_ERROR_DRM_CLASS | 0x03,\r
+ /**< Communication Error */\r
+ DRM_TRUSTED_RETURN_COMMUNICATION_ERROR = TIZEN_ERROR_DRM_CLASS | 0x04,\r
+ /**< Internal Error */\r
+ DRM_TRUSTED_RETURN_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN\r
+} drm_trusted_result_e;\r
+\r
+/**\r
+ * @enum drm_trusted_request_type_e\r
+ * @brief DRM Trusted Request types.\r
+ */\r
+typedef enum {\r
+ /* For initialization purpose */\r
+ DRM_TRUSTED_REQ_TYPE_NONE = -1,\r
+\r
+ /* Request to update Secure Clock */\r
+ DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK = 0,\r
+\r
+ /* Request to Set Secure Clock */\r
+ DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK,\r
+\r
+ /* Request to Set Transaction tracking */\r
+ DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING,\r
+\r
+ /* Master Reset */\r
+ DRM_TRUSTED_REQ_TYPE_MASTER_RESET,\r
+\r
+ /* Verify Encrypted Certificate */\r
+ DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT,\r
+\r
+ /* Create Initial DB */\r
+ DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB,\r
+\r
+ /* Reinstall Certificate */\r
+ DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT,\r
+\r
+ /* Remove RO */\r
+ DRM_TRUSTED_REQ_TYPE_REMOVE_RO,\r
+\r
+ /* Remove All RO */\r
+ DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO,\r
+\r
+ /* Go Rights URL */\r
+ DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL,\r
+\r
+ /* Progressive Download Set Download */\r
+ DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE,\r
+\r
+ /* Progressive Download Parse Status */\r
+ DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO,\r
+\r
+ /* PIFF Get License */\r
+ DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE,\r
+\r
+ /* Samsung Apps Decrypt Package */\r
+ DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE,\r
+\r
+ /* Samsung Apps Consume License */\r
+ DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE,\r
+\r
+ /* Samsung Apps Generate Purchae Request */\r
+ DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST,\r
+\r
+ /* Samsung Apps Generate License Request */\r
+ DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST\r
+\r
+} drm_trusted_request_type_e;\r
+\r
+/**\r
+ * @enum drm_trusted_time_source_e\r
+ * @brief DRM Trusted Time Source.\r
+ */\r
+typedef enum {\r
+\r
+ /**<Time source = user,\r
+ * it is NOT a secure time source */\r
+ DRM_TRUSTED_TS_USER = 0,\r
+\r
+ /**<Time source = NITZ (Network Identity and Time Zone),\r
+ * it is a secure time source */\r
+ DRM_TRUSTED_TS_NITZ,\r
+\r
+ /**<Time source = OCSP (Online Certificate Status Protocol for OMA DRM),\r
+ * it is a secure time source */\r
+ DRM_TRUSTED_TS_OCSP,\r
+\r
+ /**<Time source = MS TTS (Microsoft Trusted Time Source for PlayReady),\r
+ * it is a secure time source*/\r
+ DRM_TRUSTED_TS_MS_TTS = 4, /* To map with DRM_EM_TIME_SOURCE */\r
+\r
+ /**<Time source = End of enum values */\r
+ DRM_TRUSTED_TS_MAX\r
+} drm_trusted_time_source_e;\r
+\r
+/**\r
+ * @enum drm_trusted_bool_type_e\r
+ * @brief DRM Bool values.\r
+ */\r
+typedef enum {\r
+ DRM_TRUSTED_FALSE = 0, /**< false */\r
+ DRM_TRUSTED_TRUE = 1, /**< true */\r
+ DRM_TRUSTED_UNKNOWN = 0xFFFFFFFF /**< error */\r
+} drm_trusted_bool_type_e;\r
+\r
+/**\r
+ * @enum drm_trusted_file_type_e\r
+ * @brief DRM file types.\r
+ */\r
+typedef enum {\r
+ DRM_TRUSTED_TYPE_UNDEFINED, /**< For initialization purpose */\r
+ DRM_TRUSTED_TYPE_OMA_V1, /**< OMA DRM v1 file */\r
+ DRM_TRUSTED_TYPE_OMA_V2, /**< OMA DRM v2 file */\r
+ DRM_TRUSTED_TYPE_PLAYREADY, /**< PlayReady file */\r
+ DRM_TRUSTED_TYPE_PLAYREADY_ENVELOPE, /**< PlayReady Envelope file */\r
+ DRM_TRUSTED_TYPE_DIVX, /**< DivX file */\r
+ DRM_TRUSTED_TYPE_OMA_PD, /**< Progressive Download file */\r
+ DRM_TRUSTED_TYPE_PIFF, /**< PIFF file */\r
+ DRM_TRUSTED_TYPE_SAPPS /**< Samsung Apps */\r
+} drm_trusted_file_type_e;\r
+\r
+/**\r
+ * @struct drm_trusted_update_sec_clk_info_s\r
+ * @brief DRM Update Secure Clock info structure.\r
+ */\r
+typedef struct {\r
+\r
+ /**< Local time before modification */\r
+ unsigned int before;\r
+\r
+ /**< Local time after modification */\r
+ unsigned int after;\r
+\r
+}drm_trusted_update_sec_clk_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_update_sec_clk_info_s\r
+ * @brief DRM Set Secure Clock info structure.\r
+ */\r
+typedef struct {\r
+\r
+ /**< Secure Time */\r
+ struct tm secure_time;\r
+\r
+ /**< Secure time source */\r
+ drm_trusted_time_source_e source_type;\r
+\r
+}drm_trusted_set_sec_clk_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_set_transaction_trk_info_s\r
+ * @brief DRM Set Transaction Tracking info structure.\r
+ */\r
+typedef struct {\r
+\r
+ /**< Transaction tracking flag */\r
+ drm_trusted_bool_type_e tracking_on;\r
+\r
+}drm_trusted_set_transaction_trk_info_s;\r
+\r
+\r
+/**\r
+ * @enum drm_trusted_permission_type_e\r
+ * @brief DRM Permission types.\r
+ */\r
+typedef enum {\r
+ DRM_TRUSTED_PERMISSION_TYPE_NONE, /**< For initialization purpose */\r
+ DRM_TRUSTED_PERMISSION_TYPE_ANY, /**< Any permission */\r
+ DRM_TRUSTED_PERMISSION_TYPE_PLAY, /**< Play Permission */\r
+ DRM_TRUSTED_PERMISSION_TYPE_COLLABORATIVE_PLAY, /**< Collaborative Play\r
+ (e.g gaming application) */\r
+\r
+ DRM_TRUSTED_PERMISSION_TYPE_DISPLAY, /**< Display Permission */\r
+ DRM_TRUSTED_PERMISSION_TYPE_EXECUTE, /**< Execute Permission */\r
+ DRM_TRUSTED_PERMISSION_TYPE_PRINT, /**< Print Permission */\r
+ DRM_TRUSTED_PERMISSION_TYPE_EXPORT_COPY, /**< Export-copy permission */\r
+ DRM_TRUSTED_PERMISSION_TYPE_EXPORT_MOVE /**< Export-move permission */\r
+} drm_trusted_permission_type_e;\r
+\r
+/**\r
+ * @enum drm_trusted_operation_type_e\r
+ * @brief DRM operation type.\r
+ */\r
+typedef enum {\r
+ /* License Acquisition Operation */\r
+ DRM_TRUSTED_OPERATION_TYPE_LICENSE_ACQ,\r
+\r
+ /* Join Domain Operation */\r
+ DRM_TRUSTED_OPERATION_TYPE_JOIN_DOMAIN,\r
+\r
+ /* Leave Domain Operation */\r
+ DRM_TRUSTED_OPERATION_TYPE_LEAVE_DOMAIN,\r
+\r
+ /* Metering Operation */\r
+ DRM_TRUSTED_OPERATION_TYPE_METERING_INFO,\r
+\r
+ /* Unknown Operation type */\r
+ DRM_TRUSTED_OPERATION_TYPE_UNKNOWN\r
+} drm_trusted_operation_type_e;\r
+\r
+/**\r
+ * @enum drm_trusted_operation_status_e\r
+ * @brief DRM operation status.\r
+ */\r
+typedef enum {\r
+ /** DRM operation is started */\r
+ DRM_TRUSTED_OPERATION_STATUS_STARTED,\r
+\r
+ /** DRM operation is in Progress */\r
+ DRM_TRUSTED_OPERATION_STATUS_INPROGRESS,\r
+\r
+ /** DRM operation is Completed */\r
+ DRM_TRUSTED_OPERATION_STATUS_COMPLETED,\r
+\r
+ /** During DRM operation, additional operation is to be performed */\r
+ DRM_TRUSTED_OPERATION_STATUS_ADDITIONAL_INFO,\r
+\r
+ /** An error occurred with respect to DRM operation */\r
+ DRM_TRUSTED_OPERATION_STATUS_ERROR\r
+} drm_trusted_operation_status_e;\r
+\r
+\r
+/**\r
+ * @enum drm_trusted_web_server_result_code_e\r
+ * @brief DRM Return values.\r
+ */\r
+typedef enum {\r
+ /** No server Error */\r
+ DRM_TRUSTED_RESULT_CODE_NONE,\r
+\r
+ /** Device Certificate is revoked.\r
+ * User shall be informed that their device needs to be updated.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_DEVCERT_REVOKED,\r
+\r
+ /** Indicates a server problem.Device shall silently retry 3 times.\r
+ * If failure persists, user shall be informed about a server failure\r
+ * and to try again later\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_INTERNAL_ERROR,\r
+\r
+ /** Means an invalid protocol message.\r
+ * This shall never happen unless there's been a "man in the middle"\r
+ * attack. Device shall perform a retry.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_INVALID_MESSAGE,\r
+\r
+ /** Means that the device limit has been reached for this domain and\r
+ * therefore the device cannot join this Domain.\r
+ * The application on the device shall provide the appropriate\r
+ * response to the end user.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_DEVICE_LIMIT_REACHED,\r
+\r
+ /** Indicates that the device shall join a Domain and then\r
+ * retry license acquisition.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_DOMAIN_REQUIRED,\r
+\r
+ /** Indicates that the device shall renew the Domain Certificate\r
+ * for this Domain. The device shall join Domain and then retry\r
+ * license acquisition.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_RENEW_DOMAIN,\r
+\r
+ /** Device shall leave Domain */\r
+ DRM_TRUSTED_RESULT_CODE_NOT_A_MEMBER,\r
+\r
+ /** Means that device is not using correct protocol, most likely\r
+ * because server has been updated since device was manufactured.\r
+ * The device shall notify user to check for updates or fail gracefully.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_PROTOCOL_VERSION_MISMATCH,\r
+\r
+ /** User shall always be authenticated before making license acquisitions.\r
+ * If this error happens, device shall notify user to contact\r
+ * customer service.\r
+ */\r
+ DRM_TRUSTED_RESULT_CODE_UNKNOWN_ACCOUNTID,\r
+\r
+ /** Device shall follow redirect. */\r
+ DRM_TRUSTED_RESULT_CODE_PROTOCOL_REDIRECT,\r
+\r
+ /** Service specific Server errors */\r
+ DRM_TRUSTED_RESULT_CODE_SERVICE_SPECIFIC\r
+} drm_trusted_web_server_result_code_e;\r
+\r
+/**\r
+ * @enum drm_trusted_seek_mode_e\r
+ * @brief DRM Seek modes.\r
+ */\r
+typedef enum {\r
+ DRM_SEEK_SET, /** Seek Set */\r
+ DRM_SEEK_CUR, /** Seek Current */\r
+ DRM_SEEK_END /** Seek End */\r
+} drm_trusted_seek_mode_e;\r
+\r
+/**\r
+ * @enum drm_trusted_consumption_state_e\r
+ * @brief DRM Consumption states.\r
+ */\r
+typedef enum{\r
+ DRM_CONSUMPTION_NONE, /** Consumption None */\r
+ DRM_CONSUMPTION_STARTED, /** Consumption Started */\r
+ DRM_CONSUMPTION_PAUSED, /** Consumption Paused */\r
+ DRM_CONSUMPTION_RESUMED, /** Consumption Resumed */\r
+ DRM_CONSUMPTION_STOPPED, /** Consumption Stopped */\r
+ DRM_CONSUMPTION_PREVIEW /** Consumption Preview */\r
+}drm_trusted_consumption_state_e;\r
+\r
+/**\r
+ * @enum drm_trusted_pd_status_e\r
+ * @brief DRM PD status.\r
+ */\r
+typedef enum {\r
+ DRM_TRUSTED_PD_WAIT, /** 0 Chunk Data */\r
+ DRM_TRUSTED_PD_PARSE, /** 1 Header Parsing */\r
+ DRM_TRUSTED_PD_UNLOCK, /** 2 Unlock */\r
+ DRM_TRUSTED_PD_NEED_KEY, /** 3 Key */\r
+ DRM_TRUSTED_PD_DECRYPT, /** 4 Content Decrypt */\r
+ DRM_TRUSTED_PD_SKIP, /** 5 Content Skip */\r
+ DRM_TRUSTED_PD_EOF /** 6 End of File */\r
+} drm_trusted_pd_parse_status_e;\r
+\r
+/**\r
+ * @enum drm_trusted_dcf_embed_rourl_type_e\r
+ * @brief DRM Embedded RO URL type\r
+ */\r
+typedef enum {\r
+ DRM_ROURL_METHOD_ROPAYLOAD, /** Embedded Domain/Device RO in DCF */\r
+ DRM_ROURL_METHOD_SILENT, /** Silent in advance or silent on demand */\r
+ DRM_ROURL_MAX /** max value */\r
+} drm_trusted_dcf_embed_rourl_type_e;\r
+\r
+/**\r
+ * @brief DRM Decrypt Handle.\r
+ */\r
+typedef void *DRM_DECRYPT_HANDLE;\r
+\r
+/**\r
+ * @struct drm_trusted_license_header_info_s\r
+ * @brief DRM Header information.\r
+ */\r
+typedef struct {\r
+ unsigned int header_len; /** License Header Length */\r
+ unsigned char *header; /** License Header buffer */\r
+} drm_trusted_license_header_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_custom_data_info_s\r
+ * @brief DRM Custom Data Information.\r
+ */\r
+typedef struct {\r
+ char app_id[DRM_TRUSTED_MAX_LEN_APP_ID + 1]; /** App ID */\r
+ char user_guid[DRM_TRUSTED_MAX_LEN_USER_GUID +1]; /** User GID */\r
+ char device_id[DRM_TRUSTED_MAX_LEN_DEVICE_ID + 1]; /** Device ID */\r
+ char order_id[DRM_TRUSTED_MAX_LEN_ORDER_ID + 1]; /** Order ID */\r
+ char service_id[DRM_TRUSTED_MAX_LEN_SERVICE_ID + 1]; /** Service ID */\r
+ char account_id[DRM_TRUSTED_MAX_LEN_ACCOUNT_ID + 1]; /** Account ID */\r
+} drm_trusted_custom_data_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_user_operation_info_s\r
+ * @brief DRM operation information structure.\r
+ */\r
+typedef struct {\r
+ /** Type of OPERATION */\r
+ drm_trusted_operation_type_e operation_type;\r
+\r
+ /** Status of OPERATION */\r
+ drm_trusted_operation_status_e operation_status;\r
+} drm_trusted_user_operation_info_s;\r
+\r
+/**\r
+ * Function pointer to handle DRM operation notifications\r
+ *\r
+ * @param[out] operation_info operation information .\r
+ * @param[out] output_data Output data specific to operation.\r
+ * @return None\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+typedef void (*drm_trusted_operation_cb)(drm_trusted_user_operation_info_s *operation_info,\r
+ void *output_data);\r
+\r
+/**\r
+ * @struct drm_trusted_operation_cb_s\r
+ * @brief DRM Operation callback structure.\r
+ * @remark Currently one member but new callback can be added depending on\r
+ * requirements.\r
+ */\r
+typedef struct {\r
+ /** Callback */\r
+ drm_trusted_operation_cb callback;\r
+} drm_trusted_operation_cb_s;\r
+\r
+/**\r
+ * @struct drm_trusted_open_decrypt_info_s\r
+ * @brief DRM Open Decrypt Info.\r
+ */\r
+typedef struct {\r
+ char filePath[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** Filepath */\r
+ drm_trusted_file_type_e file_type; /** File type */\r
+ drm_trusted_license_header_info_s lic_header; /** License header info */\r
+ drm_trusted_custom_data_info_s custom_data; /** Custom Data */\r
+ drm_trusted_permission_type_e permission; /** Permission */\r
+ drm_trusted_operation_cb_s operation_callback; /** Operation Callback */\r
+} drm_trusted_open_decrypt_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_open_decrypt_resp_data_s\r
+ * @brief DRM Open Decrypt Response data.\r
+ */\r
+typedef struct {\r
+ drm_trusted_web_server_result_code_e result_code; /** Result Code */\r
+}drm_trusted_open_decrypt_resp_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_payload_info_s\r
+ * @brief DRM Payload data.\r
+ */\r
+typedef struct {\r
+ unsigned int payload_data_len; /** Payload data length */\r
+ unsigned int payload_iv_len; /** Payload IV length */\r
+ unsigned int media_offset; /** Media Offset */\r
+ unsigned char *payload_data; /** Payload Data */\r
+ unsigned char *payload_iv; /** Payload IV */\r
+}drm_trusted_payload_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_pd_resp_data_s\r
+ * @brief DRM PD related data structure.\r
+ */\r
+typedef struct {\r
+ drm_trusted_pd_parse_status_e pd_status; /** PD Parse status */\r
+ int index; /** container index */\r
+ char contentType[DRM_TRUSTED_MAX_LEN_CONTENT_TYPE + 1]; /** Content type */\r
+ unsigned int plaintextLen; /** Plain Text length */\r
+} drm_trusted_pd_resp_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_read_decrypt_resp_data_s\r
+ * @brief DRM Read Decrypt data.\r
+ */\r
+typedef struct {\r
+ unsigned int read_size; /** Read Size */\r
+ drm_trusted_pd_resp_data_s pd_resp_data; /** PD Reponse Data */\r
+}drm_trusted_read_decrypt_resp_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_seek_decrypt_info_s\r
+ * @brief DRM Seek Decrypt data.\r
+ */\r
+typedef struct {\r
+ int offset; /** Offset */\r
+ drm_trusted_seek_mode_e seek_mode; /** Seek Mode */\r
+} drm_trusted_seek_decrypt_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_tell_decrypt_resp_data_s\r
+ * @brief DRM Tell Decrypt data.\r
+ */\r
+typedef struct {\r
+ unsigned int offset; /** Offset */\r
+} drm_trusted_tell_decrypt_resp_data_s;\r
+\r
+/**\r
+ * @struct drm_trusted_set_consumption_state_info_s\r
+ * @brief DRM Consumption State info.\r
+ */\r
+typedef struct {\r
+ drm_trusted_consumption_state_e state; /** Consumption State */\r
+} drm_trusted_set_consumption_state_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_remove_ro_info_s\r
+ * @brief DRM Remove RO info.\r
+ */\r
+typedef struct {\r
+ char filePath[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** DRM Content path */\r
+} drm_trusted_remove_ro_info_s;\r
+\r
+/**\r
+ * Function pointer to handle DRM Roap Notifications\r
+ *\r
+ * @param[out] cbParam Parameter\r
+ * @param[out] appSessionData Application Session Data\r
+ * @param[out] agentSessionData DRM Agent Session Data\r
+ * @return None\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+typedef void (*drm_trusted_roap_service_cb) (void *cbParam, /**<parameter */\r
+ void *appSessionData, /**<application session data */\r
+ void *agentSessionData /**<DRM agent session data */\r
+ );\r
+\r
+/**\r
+* Type Definition Template\r
+*/\r
+typedef drm_trusted_roap_service_cb drm_trusted_roap_notify_cb;\r
+/**\r
+* Type Definition Template\r
+*/\r
+typedef drm_trusted_roap_service_cb drm_trusted_roap_consent_cb;\r
+/**\r
+* Type Definition Template\r
+*/\r
+typedef drm_trusted_roap_service_cb drm_trusted_roap_result_cb;\r
+\r
+/**\r
+ * @struct drm_trusted_roap_notification_cb_s\r
+ * @brief DRM Roap Notification callback structure.\r
+ */\r
+typedef struct {\r
+ drm_trusted_roap_notify_cb progressNotify; /** Progress Notify */\r
+ drm_trusted_roap_consent_cb userConsent; /** User Consent */\r
+ drm_trusted_roap_result_cb roapResult; /** Roap Result */\r
+} drm_trusted_roap_notification_cb_s;\r
+\r
+/**\r
+ * Function pointer to handle Start of Content download\r
+ *\r
+ * @param[out] appSessionData App Session Data.\r
+ * @return int\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+typedef int (*drm_trusted_content_start_download_cb) (void *appSessionData);\r
+\r
+/**\r
+ * Function pointer to handle Progress of content download\r
+ *\r
+ * @param[out] pData Data\r
+ * @param[out] DataLen Data length\r
+ * @param[out] appSessionData App Session Data.\r
+ * @return int\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+typedef int (*drm_trusted_content_progress_download_cb) (const void *pData,\r
+ unsigned int DataLen,\r
+ void *appSessionData);\r
+\r
+/**\r
+ * Function pointer to handle Start of content download\r
+ *\r
+ * @param[out] appSessionData App Session Data.\r
+ * @return int\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+typedef int (*drm_trusted_content_finish_download_cb) (void *appSessionData);\r
+\r
+/**\r
+ * @struct drm_trusted_content_download_cb_s\r
+ * @brief DRM Roap Notification callback structure.\r
+ */\r
+typedef struct {\r
+ drm_trusted_content_start_download_cb start_download_cb; /** Start Download */\r
+ drm_trusted_content_progress_download_cb progress_download_cb; /** Progress Download */\r
+ drm_trusted_content_finish_download_cb finish_download_cb; /** Finish Download */\r
+} drm_trusted_content_download_cb_s;\r
+\r
+/**\r
+ * @struct drm_trusted_appsession_datatype_s\r
+ * @brief DRM Application Session Data structure.\r
+ */\r
+typedef struct {\r
+ int profileID; /** Profile ID */\r
+ int is_progressive_download; /** Is Progressive Download */\r
+ char pProxyAddress[DRM_TRUSTED_MAX_LEN_IP_ADDR]; /** Proxy Address */\r
+ drm_trusted_content_download_cb_s content_download_cb; /** content Download callback */\r
+ unsigned int size_pData; /** Size of additional data */\r
+ void *pData; /** Additional Data */\r
+} drm_trusted_appsession_datatype_s;\r
+\r
+/**\r
+ * @struct drm_trusted_set_consumption_state_info_s\r
+ * @brief DRM Go Rights URL Info.\r
+ */\r
+typedef struct {\r
+ char file_path[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** Filepath with content index */\r
+ drm_trusted_dcf_embed_rourl_type_e rourl_type; /** Embedded RO URL Type */\r
+ drm_trusted_roap_notification_cb_s roap_notify; /** Roap Notification callback */\r
+ drm_trusted_appsession_datatype_s app_session_data; /** App Sesson Data */\r
+} drm_trusted_go_rights_url_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_pd_set_dld_comp_info_s\r
+ * @brief DRM Remove RO info.\r
+ */\r
+typedef struct {\r
+ DRM_DECRYPT_HANDLE pdHandle; /** DRM PD handle */\r
+} drm_trusted_pd_set_dld_comp_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_pd_parse_status_info_s\r
+ * @brief DRM PD Parse Status Info.\r
+ */\r
+typedef struct {\r
+ char file_path[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** File Path */\r
+ drm_trusted_bool_type_e bCurrDownloadSize; /** TRUE if current download size is known */\r
+} drm_trusted_pd_parse_status_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_pd_parse_status_resp_s\r
+ * @brief DRM PD Parse Status Response.\r
+ */\r
+typedef struct {\r
+ drm_trusted_pd_parse_status_e parse_status; /** Parse Status */\r
+ int nIndex; /** Index */\r
+ char contentType[DRM_TRUSTED_MAX_LEN_CONTENT_TYPE + 1]; /** Content Type */\r
+ unsigned int nFullPlaintextSize; /** Full Plain Text Size */\r
+ unsigned int nCurrDownloadPlaintextSize; /** Current Download Plain Text Size */\r
+} drm_trusted_pd_parse_status_resp_s;\r
+\r
+/**\r
+ * @struct drm_trusted_piff_get_license_info_s\r
+ * @brief DRM PIFF Get License Info.\r
+ */\r
+typedef struct {\r
+ drm_trusted_license_header_info_s lic_header; /** License header info */\r
+ drm_trusted_custom_data_info_s custom_data; /** Custom Data */\r
+ drm_trusted_operation_cb_s operation_callback; /** Operation callback */\r
+} drm_trusted_piff_get_license_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_sapps_decrypt_package_info_s\r
+ * @brief DRM Samsung Apps Decrypt Package info.\r
+ */\r
+typedef struct {\r
+ char sadcf_filepath[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** Samsung Apps DCF File Path */\r
+ char decrypt_filepath[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** Decrypted File Path */\r
+} drm_trusted_sapps_decrypt_package_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_sapps_consume_license_info_s\r
+ * @brief DRM Samsung Apps Consume License info.\r
+ */\r
+typedef struct {\r
+ char content_id[DRM_TRUSTED_MAX_LEN_CONTENT_ID];\r
+} drm_trusted_sapps_consume_license_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_sapps_gen_purchase_req_info_s\r
+ * @brief DRM SAPPS purchase request Info\r
+ */\r
+typedef struct {\r
+ char file_path[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** Samsung App File Path */\r
+ unsigned int purchase_req_buff_len; /** Purchase Request Buffer length */\r
+ unsigned int rights_url_len; /** Rights URL Length */\r
+} drm_trusted_sapps_gen_purchase_req_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_sapps_gen_purchase_req_resp_s\r
+ * @brief DRM SAPPS purchase request Response\r
+ */\r
+typedef struct {\r
+ char *purchase_req_buff; /** Purchase Request Buffer */\r
+ unsigned int size_pur_req_buff; /** Size of Purchase Request buffer */\r
+ char rights_url[DRM_TRUSTED_MAX_LEN_RIGHTS_URL]; /** Rights URL */\r
+} drm_trusted_sapps_gen_purchase_req_resp_s;\r
+\r
+/**\r
+ * @struct drm_trusted_sapps_gen_license_req_info_s\r
+ * @brief DRM SAPPS License request Info\r
+ */\r
+typedef struct {\r
+ char *purchase_req_buff; /** Purchase Request buffer */\r
+ unsigned int purchase_req_buff_len; /** Purchase Request buffer length */\r
+ unsigned int lic_req_buff_len; /** License Request buffer length */\r
+ unsigned int rights_url_len; /** Rights URL Length */\r
+} drm_trusted_sapps_gen_license_req_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_sapps_gen_license_req_resp_s\r
+ * @brief DRM SAPPS License request Response\r
+ */\r
+typedef struct {\r
+ char *lic_req_buff; /** License Request buffer */\r
+ unsigned int size_lic_req_buff; /** Size of License request buffer */\r
+ char rights_url[DRM_TRUSTED_MAX_LEN_RIGHTS_URL]; /** Rights URL */\r
+} drm_trusted_sapps_gen_license_req_resp_s;\r
+\r
+/**\r
+ * @brief DRM Convert Handle.\r
+ */\r
+typedef void* DRM_TRUSTED_CONVERT_HANDLE;\r
+\r
+/**\r
+ * @struct drm_trusted_opn_conv_info_s\r
+ * @brief DRM Open Convert Info.\r
+ */\r
+typedef struct {\r
+ char filePath[DRM_TRUSTED_MAX_FILEPATH_LEN]; /** Destination Filepath */\r
+ drm_trusted_bool_type_e install_RO; /** Flag whether to install RO */\r
+} drm_trusted_opn_conv_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_write_conv_info_s\r
+ * @brief DRM Write Convert Info.\r
+ */\r
+typedef struct {\r
+ unsigned int data_len; /** Data length */\r
+ unsigned char *data; /** Data */\r
+} drm_trusted_write_conv_info_s;\r
+\r
+/**\r
+ * @struct drm_trusted_write_conv_resp_s\r
+ * @brief DRM Write Convert Response.\r
+ */\r
+typedef struct {\r
+ unsigned int write_size; /** Write size into destination file*/\r
+} drm_trusted_write_conv_resp_s;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /*__DRM_TRUSTED_CLIENT_TYPES_H__ */\r
--- /dev/null
+Name: drm-trusted
+Summary: DRM trusted client Package
+Version: 0.0.6
+Release: 1
+Group: TO_BE/FILLED_IN
+License: Proprietary
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: cmake
+
+%description
+DRM trusted client library (Shared Object). To be used only by native/trusted applications
+
+
+%package devel
+Summary: Development files for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Development files for %{name}
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/*.so.*
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/drm-trusted/*
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/drm-trusted.pc
--- /dev/null
+/*\r
+ * drm-trusted-client\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file drm_trusted_client.cpp\r
+ * @brief DRM Trusted Client API defintions.\r
+ * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com)\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: First version of DRM Trusted Client API Definitions.\r
+ */\r
+\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <malloc.h>\r
+\r
+#include "drm_trusted_client.h"\r
+#include "drm_trusted_client_ipc.h"\r
+#include "drm_trusted_client_log.h"\r
+\r
+#ifndef EXPORT_API\r
+#define EXPORT_API __attribute__((visibility("default")))\r
+#endif\r
+\r
+/**\r
+ * An application can do particular request to DRM.\r
+ *\r
+ * @param[in] request_type Request types as per enum drm_trusted_request_type_e.\r
+ * @param[in] input Pointer to appropriate structure as per\r
+ * request_type.\r
+ * @param[out] output Output data. Pointer to appropriate structure as\r
+ * per request_type.\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks Please typecast to appropriate data structures\r
+ * as per data types.\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK\r
+ * then input type: input = pointer to struct drm_trusted_update_sec_clk_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK\r
+ * then input type: input = pointer to struct drm_trusted_set_sec_clk_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING\r
+ * then input type: input = pointer to struct drm_trusted_set_transaction_trk_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_MASTER_RESET\r
+ * then input type: input = NULL\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT\r
+ * then input type: input = NULL\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB\r
+ * then input type: input = NULL\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT\r
+ * then input type: input = NULL\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_REMOVE_RO\r
+ * then input type: input = pointer to struct drm_trusted_remove_ro_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO\r
+ * then input type: input = NULL\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL\r
+ * then input type: input = pointer to struct drm_trusted_go_rights_url_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE\r
+ * then input type: input = pointer to struct drm_trusted_pd_set_dld_comp_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO\r
+ * then input type: input = pointer to struct drm_trusted_pd_parse_status_info_s\r
+ * and output type: output = pointer to struct drm_trusted_pd_parse_status_resp_s\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE\r
+ * then input type: input = pointer to struct drm_trusted_piff_get_license_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE\r
+ * then input type: input = pointer to struct drm_trusted_sapps_decrypt_package_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE\r
+ * then input type: input = pointer to struct drm_trusted_sapps_consume_license_info_s\r
+ * and output type: output = NULL\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST\r
+ * then input type: input = pointer to struct drm_trusted_sapps_gen_purchase_req_info_s\r
+ * and output type: output = pointer to struct drm_trusted_sapps_gen_purchase_req_resp_s\r
+ *\r
+ * if request_type = DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST\r
+ * then input type: input = pointer to struct drm_trusted_sapps_gen_license_req_info_s\r
+ * and output type: output = pointer to struct drm_trusted_sapps_gen_license_req_resp_s\r
+ *\r
+ *\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+\r
+EXPORT_API int drm_trusted_handle_request(drm_trusted_request_type_e request_type,\r
+ void *input, void *output)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+ int retval = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("request_type = %d", request_type);\r
+\r
+ /* Check Input & Output Parameters */\r
+ switch (request_type) {\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK: {\r
+ if (!input) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p",\r
+ input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_update_sec_clk_info_s));\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK: {\r
+ if (!input) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p",\r
+ input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_set_sec_clk_info_s));\r
+\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING: {\r
+ if (!input) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p",\r
+ input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_set_transaction_trk_info_s));\r
+\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_MASTER_RESET:\r
+ case DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT:\r
+ case DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB:\r
+ case DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT:\r
+ case DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO: {\r
+ DRM_TRUSTED_CLIENT_LOG("No parameters to be read!!");\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_REMOVE_RO: {\r
+\r
+ if (!input || (((drm_trusted_remove_ro_info_s*)input)->filePath[0]) == '\0') {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p, filepath = %s",\r
+ input, (!input) ? "":((drm_trusted_remove_ro_info_s*)input)->filePath);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_remove_ro_info_s));\r
+ }\r
+\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL: {\r
+\r
+ if (!input || (((drm_trusted_go_rights_url_info_s*)input)->file_path[0]) == '\0') {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p, filepath = %s",\r
+ input, (!input) ? "":((drm_trusted_go_rights_url_info_s*)input)->file_path);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_go_rights_url_info_s));\r
+\r
+ if (((drm_trusted_go_rights_url_info_s*) input)->app_session_data.pData\r
+ && ((drm_trusted_go_rights_url_info_s*) input)->app_session_data.size_pData != 0) {\r
+\r
+ req_data.fixed_data.num_data_items = 1;\r
+\r
+ /* Fill details pertaining to additional pointers to be sent */\r
+ req_data.fixed_data.data_length[0] =\r
+ ((drm_trusted_go_rights_url_info_s*) input)->app_session_data.size_pData;\r
+\r
+ /* Allocate memory for data items */\r
+ req_data.data_items[0] = (char*) malloc(\r
+ req_data.fixed_data.data_length[0]);\r
+ if (!req_data.data_items[0]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[0]);\r
+ result = DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the buffer into data items */\r
+ memcpy(req_data.data_items[0],\r
+ ((drm_trusted_go_rights_url_info_s*) input)->app_session_data.pData,\r
+ ((drm_trusted_go_rights_url_info_s*) input)->app_session_data.size_pData);\r
+\r
+ }\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE: {\r
+\r
+ if (!input\r
+ || (!((drm_trusted_pd_set_dld_comp_info_s*) (input))->pdHandle)) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid argument!!, input = %p, pdHandle = %p",\r
+ input, (!input) ? NULL:((drm_trusted_pd_set_dld_comp_info_s*)(input))->pdHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ req_data.fixed_data.pHandle =\r
+ ((drm_trusted_pd_set_dld_comp_info_s*) (input))->pdHandle;\r
+ }\r
+\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO: {\r
+\r
+ if (!input\r
+ || (((drm_trusted_pd_parse_status_info_s*) (input))->file_path[0] == '\0')\r
+ || !output) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p, filepath = %s",\r
+ input, (!input) ? "":((drm_trusted_pd_parse_status_info_s*)input)->file_path);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_pd_parse_status_info_s));\r
+\r
+ }\r
+\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE: {\r
+\r
+ if (!input\r
+ || (((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header\r
+ == NULL)\r
+ || (((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header[0]\r
+ == '\0'\r
+ || (((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header_len\r
+ == 0))) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p",\r
+ input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Number of additional data items to be sent */\r
+ req_data.fixed_data.num_data_items = 1;\r
+\r
+ /* Fill details pertaining to additional pointers to be sent */\r
+ req_data.fixed_data.data_length[0] = ((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header_len;\r
+\r
+ /* Allocate memory for data items */\r
+ req_data.data_items[0] = (char*) malloc(\r
+ ((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header_len);\r
+ if (!req_data.data_items[0]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[0]);\r
+ result = DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy into data items */\r
+ memcpy( req_data.data_items[0],\r
+ ((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header,\r
+ ((drm_trusted_piff_get_license_info_s*) (input))->lic_header.header_len);\r
+\r
+ /* Copy the fixed value structure into request data */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_piff_get_license_info_s));\r
+\r
+ }\r
+\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE: {\r
+\r
+ if (!input\r
+ || (((drm_trusted_sapps_decrypt_package_info_s*) (input))->sadcf_filepath[0] == '\0')\r
+ || (((drm_trusted_sapps_decrypt_package_info_s*) (input))->decrypt_filepath[0] == '\0')) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p", input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_sapps_decrypt_package_info_s));\r
+ }\r
+\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE: {\r
+\r
+ if (!input || ((char*) input)[0] == '\0') {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p",\r
+ input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_sapps_consume_license_info_s));\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST: {\r
+\r
+ if (!input\r
+ || (((drm_trusted_sapps_gen_purchase_req_info_s*) input)->file_path[0] == '\0')\r
+ || (((drm_trusted_sapps_gen_purchase_req_info_s*) input)->purchase_req_buff_len == 0)\r
+ || (((drm_trusted_sapps_gen_purchase_req_info_s*) input)->rights_url_len == 0)) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p", input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_sapps_gen_purchase_req_info_s));\r
+ }\r
+\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST: {\r
+\r
+ if (!input\r
+ ||(!((drm_trusted_sapps_gen_license_req_info_s*) input)->purchase_req_buff)\r
+ || (((drm_trusted_sapps_gen_license_req_info_s*) input)->purchase_req_buff[0] == '\0')\r
+ || (((drm_trusted_sapps_gen_license_req_info_s*) input)->purchase_req_buff_len == 0)\r
+ || (((drm_trusted_sapps_gen_license_req_info_s*) input)->rights_url_len == 0)\r
+ || (((drm_trusted_sapps_gen_license_req_info_s*) input)->lic_req_buff_len == 0)) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, input = %p", input);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_sapps_gen_license_req_info_s));\r
+\r
+ /* Number of additional data items to be sent */\r
+ req_data.fixed_data.num_data_items = 1;\r
+\r
+ /* Fill details pertaining to additional pointers to be sent */\r
+ req_data.fixed_data.data_length[0] =\r
+ ((drm_trusted_sapps_gen_license_req_info_s*) input)->purchase_req_buff_len;\r
+\r
+ /* Allocate memory for data items */\r
+ req_data.data_items[0] = (char*) malloc(\r
+ req_data.fixed_data.data_length[0]);\r
+ if (!req_data.data_items[0]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[0]);\r
+ result = DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the buffer into data items */\r
+ memcpy(req_data.data_items[0],\r
+ ((drm_trusted_sapps_gen_license_req_info_s*) input)->purchase_req_buff,\r
+ ((drm_trusted_sapps_gen_license_req_info_s*) input)->purchase_req_buff_len);\r
+ }\r
+ }\r
+ break;\r
+\r
+\r
+ default:\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid argument!!, request_type = %d",\r
+ request_type);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("input=%p output=%p", input, output);\r
+\r
+ /* Fill other parameters to be sent */\r
+\r
+ /* Request type to be sent to the server */\r
+ req_data.fixed_data.req_type = request_type;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_HANDLE_REQUEST;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x", resp_data.fixed_data.resp_result);\r
+\r
+ /* Copy the response structure if necessary */\r
+ if (DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO == request_type) {\r
+\r
+ /* Copy the response into the output data */\r
+ memcpy(output, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_pd_parse_status_resp_s));\r
+ }\r
+\r
+ if (DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST\r
+ == request_type) {\r
+\r
+ /* Copy the response onto the output structure */\r
+ memcpy(output, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_sapps_gen_purchase_req_resp_s));\r
+\r
+ /* Copy the data items */\r
+ memcpy( ((drm_trusted_sapps_gen_purchase_req_resp_s*) output)->purchase_req_buff,\r
+ resp_data.data_items[0],\r
+ resp_data.fixed_data.data_length[0]);\r
+ }\r
+\r
+\r
+ if (DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST == request_type) {\r
+\r
+ /* Copy the response onto the output structure */\r
+ memcpy(output, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_sapps_gen_license_req_resp_s));\r
+\r
+ /* Copy the data items */\r
+ memcpy( ((drm_trusted_sapps_gen_license_req_resp_s*) output)->lic_req_buff,\r
+ resp_data.data_items[0],\r
+ resp_data.fixed_data.data_length[0]);\r
+ }\r
+\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ /* Free Request Data memory */\r
+ for (int i = 0; i < req_data.fixed_data.num_data_items; i++) {\r
+ if (req_data.data_items[i])\r
+ free(req_data.data_items[i]);\r
+ }\r
+\r
+ /* Free Response Data memory */\r
+ for (int i = 0; i < resp_data.fixed_data.num_data_items; i++) {\r
+ if (resp_data.data_items[i])\r
+ free(resp_data.data_items[i]);\r
+ }\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can Open Decrypt Session for consumption.\r
+ *\r
+ * @param[in] input_data Pointer to drm_trusted_open_decrypt_info_s\r
+ * @param[out] output_data Pointer to drm_trusted_open_decrypt_resp_data_s\r
+ * @param[out] pHandle Pointer to DRM_DECRYPT_HANDLE\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @retval DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY if memory not available\r
+ * @remarks In drm_trusted_open_decrypt_info_s structure\r
+ * OMA, PR, OMA PD: filepath = DRM File path & lic_header = {0}\r
+ * PIFF: filepath = {0} & lic_header = Header from manifest file\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_open_decrypt_session(drm_trusted_open_decrypt_info_s *input_data,\r
+ drm_trusted_open_decrypt_resp_data_s *output_data, DRM_DECRYPT_HANDLE *pHandle)\r
+{\r
+\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!input_data\r
+ || (input_data->filePath[0] == '\0'\r
+ && (!(input_data->lic_header.header)\r
+ || input_data->lic_header.header[0] == '\0'))\r
+ || !output_data || !pHandle) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, input_data = %p, output_data = %p, pHandle = %p",\r
+ input_data, output_data, pHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("input_data = %p, output_data = %p, pHandle = %p",\r
+ input_data, output_data, pHandle);\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input_data,\r
+ sizeof(drm_trusted_open_decrypt_info_s));\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.pHandle = *pHandle;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_OPEN_DECRYPT_SESSION;\r
+\r
+\r
+ if (input_data->lic_header.header != NULL\r
+ && input_data->lic_header.header[0] != '\0'\r
+ && input_data->lic_header.header_len > 0) {\r
+\r
+ /* Number of additional data items to be sent */\r
+ req_data.fixed_data.num_data_items = 1;\r
+\r
+ /* Fill details pertaining to additional pointers to be sent */\r
+ req_data.fixed_data.data_length[0] = input_data->lic_header.header_len;\r
+\r
+ /* Allocate memory for data items */\r
+ req_data.data_items[0] = (char*) malloc(\r
+ input_data->lic_header.header_len);\r
+ if (!req_data.data_items[0]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[0]);\r
+ result = DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy into data items */\r
+ memcpy(req_data.data_items[0], input_data->lic_header.header,\r
+ input_data->lic_header.header_len);\r
+ }\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+\r
+ /* Store the handle from the server into input handle */\r
+ *pHandle = resp_data.fixed_data.pHandle;\r
+\r
+ /* Copy the response into the output data */\r
+ memcpy(output_data, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ /* Free Request Data memory */\r
+ for (int i = 0; i < req_data.fixed_data.num_data_items; i++) {\r
+ if (req_data.data_items[i])\r
+ free(req_data.data_items[i]);\r
+ }\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+\r
+}\r
+\r
+/**\r
+ * An application can Read Decrypt Session for consumption.\r
+ *\r
+ * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session\r
+ * @param[in] input_data Pointer to drm_trusted_payload_info_s\r
+ * @param[out] output_data Pointer to drm_trusted_read_decrypt_resp_data_s\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @retval DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY if memory not available\r
+ * @remarks In drm_trusted_payload_info_s structure\r
+ * OMA,OMA_PD: input = payload_data (Encrypted buffer)\r
+ * output = payload_data (Decrypted buffer)\r
+ *\r
+ * PR,PIFF: input = payload_data (Encrypted buffer)\r
+ * input = payload_iv (Initialisation Vector)\r
+ * output = payload_data (Decrypted buffer)\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_read_decrypt_session(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_payload_info_s *input_data, drm_trusted_read_decrypt_resp_data_s *output_data)\r
+{\r
+\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!input_data || !output_data || !pHandle) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, input_data = %p, output_data = %p, pHandle = %p",\r
+ input_data, output_data, pHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("input_data = %p, output_data = %p, pHandle = %p",\r
+ input_data, output_data, pHandle);\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input_data,\r
+ sizeof(drm_trusted_payload_info_s));\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.pHandle = pHandle;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_READ_DECRYPT_SESSION;\r
+\r
+ /* Number of additional data items to be sent */\r
+\r
+ /* Send items that is filled by application */\r
+ if (!(input_data->payload_data) || input_data->payload_data_len == 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, payload_data = %p, payload_data_len = %d",\r
+ input_data->payload_data, input_data->payload_data_len);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+ req_data.fixed_data.num_data_items++;\r
+ }\r
+\r
+ if ((input_data->payload_iv && input_data->payload_iv_len == 0)\r
+ || (input_data->payload_iv_len != 0 && !(input_data->payload_iv))) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, payload_iv = %p, payload_iv_len = %d",\r
+ input_data->payload_iv, input_data->payload_iv_len);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+ req_data.fixed_data.num_data_items++;\r
+ }\r
+\r
+ /* Fill details pertaining to additional pointers to be sent */\r
+\r
+ /* Copy Payload data */\r
+ req_data.fixed_data.data_length[0] = input_data->payload_data_len;\r
+ req_data.data_items[0] = (char*)malloc(req_data.fixed_data.data_length[0]);\r
+ if (!req_data.data_items[0]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[0]);\r
+ goto ErrorExit;\r
+ }\r
+\r
+ memcpy(req_data.data_items[0], input_data->payload_data,\r
+ input_data->payload_data_len);\r
+\r
+ /* Copy Payload IV */\r
+ req_data.fixed_data.data_length[1] = input_data->payload_iv_len;\r
+ req_data.data_items[1] = (char*)malloc(req_data.fixed_data.data_length[1]);\r
+ if (!req_data.data_items[1]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[1]);\r
+ goto ErrorExit;\r
+ }\r
+\r
+ memcpy(req_data.data_items[1], input_data->payload_iv,\r
+ input_data->payload_iv_len);\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+\r
+ /* Copy the decrypted payload buffer */\r
+ input_data->payload_data_len = resp_data.fixed_data.data_length[0];\r
+ memcpy(input_data->payload_data, resp_data.data_items[0],\r
+ resp_data.fixed_data.data_length[0]);\r
+\r
+ /* Copy the response from the server into output data */\r
+ memcpy(output_data, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_read_decrypt_resp_data_s));\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ /* Free Request data memory */\r
+ for (int i = 0; i < req_data.fixed_data.num_data_items; i++) {\r
+ if (req_data.data_items[i])\r
+ free(req_data.data_items[i]);\r
+ }\r
+\r
+ /* Free Response data memory */\r
+ if (resp_data.data_items[0])\r
+ free (resp_data.data_items[0]);\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can Seek Decrypt Session for consumption.\r
+ *\r
+ * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session\r
+ * @param[in] input_data Pointer to drm_trusted_seek_decrypt_info_s\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_seek_decrypt_session(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_seek_decrypt_info_s *input_data)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!input_data || !pHandle) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, input_data = %p, pHandle = %p",\r
+ input_data, pHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("input_data = %p, pHandle = %p",\r
+ input_data, pHandle);\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input_data,\r
+ sizeof(drm_trusted_seek_decrypt_info_s));\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.pHandle = pHandle;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_SEEK_DECRYPT_SESSION;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can Tell Decrypt Session for consumption.\r
+ *\r
+ * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session\r
+ * @param[out] output_data Pointer to drm_trusted_tell_decrypt_resp_data_s\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_tell_decrypt_session(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_tell_decrypt_resp_data_s *output_data)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!output_data || !pHandle) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, output_data = %p, pHandle = %p",\r
+ output_data, pHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("output_data = %p, pHandle = %p",\r
+ output_data, pHandle);\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.pHandle = pHandle;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_TELL_DECRYPT_SESSION;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+\r
+ /* Copy the response obtained from the server into the output data */\r
+ memcpy(output_data, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_tell_decrypt_resp_data_s));\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can Set Decrypt state during consumption.\r
+ *\r
+ * @param[in] pHandle DRM_DECRYPT_HANDLE obtained from Open Decrypt Session\r
+ * @param[in] input_data Pointer to drm_trusted_set_consumption_state_info_s\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_set_decrypt_state(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_set_consumption_state_info_s *input_data)\r
+{\r
+\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!input_data || !pHandle) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, input_data = %p, pHandle = %p",\r
+ input_data, pHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("input_data = %p, pHandle = %p",\r
+ input_data, pHandle);\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input_data,\r
+ sizeof(drm_trusted_set_consumption_state_info_s));\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.pHandle = pHandle;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_SET_DECRYPT_STATE;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can Close decrypt session for consumption.\r
+ *\r
+ * @param[in] pHandle Pointer to DRM_DECRYPT_HANDLE obtained from Open Decrypt Session\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_close_decrypt_session(DRM_DECRYPT_HANDLE *pHandle)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!pHandle || !(*pHandle)) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid Args, pHandle = %p, *pHandle = %p",\r
+ pHandle, (!pHandle) ? NULL : *pHandle);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("pHandle = %p, *pHandle = %p",\r
+ pHandle, *pHandle);\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.pHandle = *pHandle;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_CLOSE_DECRYPT_SESSION;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can prepare to convert a DRM file in OMADRM-v1.\r
+ * If a type of DRM file is FL, CD or FL-SD type, application can convert to SD type.\r
+ * This function prepare for converting and create file.\r
+ *\r
+ * @param[in] input Pointer to drm_trusted_opn_conv_info_s\r
+ * @param[out] hConvert Pointer to Open Convert Handle(DRM_TRUSTED_CONVERT_HANDLE)\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_open_convert(drm_trusted_opn_conv_info_s *input,\r
+ DRM_TRUSTED_CONVERT_HANDLE *hConvert)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!input || !hConvert) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, input = %p, hConvert = %p, *hConvert = %p",\r
+ input, hConvert, (!hConvert) ? NULL : *hConvert);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_opn_conv_info_s));\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.hConvert = *hConvert;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_OPEN_CONVERT;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+\r
+ /* Store the Convert handle from the server into input handle */\r
+ *hConvert = resp_data.fixed_data.hConvert;\r
+ }\r
+\r
+ErrorExit:\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+}\r
+\r
+/**\r
+ * An application can write converted data.\r
+ *\r
+ * @param[in] input Pointer to drm_trusted_opn_conv_info_s\r
+ * @param[out] output Pointer to drm_trusted_write_conv_resp_s\r
+ * @param[in] hConvert Pointer to Open Convert Handle(DRM_TRUSTED_CONVERT_HANDLE)\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_write_convert(drm_trusted_write_conv_info_s *input,\r
+ drm_trusted_write_conv_resp_s *output,\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!input || !output || !hConvert) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Invalid Args, input = %p, output = %p, hConvert = %p",\r
+ input, output, hConvert);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("input = %p, output = %p, hConvert = %p",\r
+ input, output, hConvert);\r
+\r
+ /* Copy the input to Request Structure */\r
+ memcpy(req_data.fixed_data.request_data, input,\r
+ sizeof(drm_trusted_write_conv_info_s));\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.hConvert = hConvert;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_WRITE_CONVERT;\r
+\r
+ /* Number of additional data items to be sent */\r
+ /* Send items that is filled by application */\r
+ if (!(input->data) || input->data_len == 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION( "Invalid Args, data = %p, data_len = %d",\r
+ input->data, input->data_len);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ } else {\r
+ req_data.fixed_data.num_data_items++;\r
+ }\r
+\r
+ /* Fill details pertaining to additional pointers to be sent */\r
+ /* Copy data */\r
+ req_data.fixed_data.data_length[0] = input->data_len;\r
+ req_data.data_items[0] = (char*)malloc(req_data.fixed_data.data_length[0]);\r
+ if (!req_data.data_items[0]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Memory Allocation Error!, Buf = %p",\r
+ req_data.data_items[0]);\r
+ goto ErrorExit;\r
+ }\r
+\r
+ memcpy(req_data.data_items[0], input->data,\r
+ input->data_len);\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+\r
+ /* Copy the response from the server into output data */\r
+ memcpy(output, resp_data.fixed_data.response_data,\r
+ sizeof(drm_trusted_write_conv_resp_s));\r
+ }\r
+\r
+ErrorExit:\r
+ /* Free Request data memory */\r
+ for (int i = 0; i < req_data.fixed_data.num_data_items; i++) {\r
+ if (req_data.data_items[i])\r
+ free(req_data.data_items[i]);\r
+ }\r
+\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ * An application can release a resource for converting.\r
+ *\r
+ * @param[in] hConvert Pointer to Open Convert Handle(DRM_TRUSTED_CONVERT_HANDLE)\r
+ *\r
+ * @return 0 on success, else a negative error value\r
+ * @retval DRM_TRUSTED_RETURN_SUCCESS on success\r
+ * @retval DRM_TRUSTED_RETURN_INVALID_ARG if arguments are invalid\r
+ * @retval DRM_TRUSTED_RETURN_COMMUNICATION_ERROR if socket error\r
+ * @retval DRM_TRUSTED_RETURN_INTERNAL_ERROR if operation error\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+EXPORT_API int drm_trusted_close_convert(DRM_TRUSTED_CONVERT_HANDLE *hConvert)\r
+{\r
+ /* Local Variables */\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ drm_trusted_request_data_s req_data;\r
+ drm_trusted_response_data_s resp_data;\r
+ int ret_comm = 0;\r
+\r
+ /* memset the structures */\r
+ memset(&req_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&resp_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Check Input & Output Parameters */\r
+ if (!hConvert || !(*hConvert)) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Invalid Args, hConvert = %p, *hConvert = %p",\r
+ hConvert, (!hConvert) ? NULL : *hConvert);\r
+ return DRM_TRUSTED_RETURN_INVALID_ARG;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("hConvert = %p, *hConvert = %p",\r
+ hConvert, *hConvert);\r
+\r
+ /* Copy the handle into the request structure */\r
+ req_data.fixed_data.hConvert = *hConvert;\r
+\r
+ /* Tell the server which API to be used */\r
+ req_data.fixed_data.api_name = DRM_TRUSTED_CLOSE_CONVERT;\r
+\r
+ /* Send Data to DRM server */\r
+ /* Call the Client Communication API */\r
+ if ((ret_comm = drm_trusted_client_comm(&req_data, &resp_data)) != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("drm_trusted_client_comm error!!, ret_comm = %d",\r
+ ret_comm);\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Copy the response obtained from the server into the output parameter */\r
+ if (resp_data.fixed_data.resp_result != 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Error returned from server!!, resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ result = resp_data.fixed_data.resp_result;\r
+ goto ErrorExit;\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_LOG("resp_data.fixed_data.resp_result = 0x%x",\r
+ resp_data.fixed_data.resp_result);\r
+ }\r
+\r
+ErrorExit:\r
+ if (result != DRM_TRUSTED_RETURN_SUCCESS) {\r
+ /* Failure */\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("failed:result=0x%x", result);\r
+ return result;\r
+ } else {\r
+ /* Success */\r
+ DRM_TRUSTED_CLIENT_LOG("Success:result=0x%x", result);\r
+ return result;\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * drm-trusted-client\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file drm_trusted_client_ipc.cpp\r
+ * @brief DRM Trusted Client Inter process communication definitions.\r
+ * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com)\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: DRM Trusted Client Inter process communication definitions.\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <unistd.h>\r
+#include <sys/stat.h>\r
+#include <sys/un.h>\r
+#include <sys/types.h>\r
+#include <sys/socket.h>\r
+#include <errno.h>\r
+\r
+#include "drm_trusted_client_ipc.h"\r
+#include "drm_trusted_client_log.h"\r
+\r
+/**\r
+ * This API is used to send a request to the Server to call corresponding API\r
+ *\r
+ * @param[in] client_in Carries the input parameters of Trusted Client API to Server\r
+ * @param[out] server_out Carries the output parameters of Trusted Client API from Server\r
+ * @return 0 on success & other values on failure\r
+ * @remarks\r
+ * @see\r
+ * @since 0.1\r
+ */\r
+int drm_trusted_client_comm(drm_trusted_request_data_s *client_in, drm_trusted_response_data_s *server_out)\r
+{\r
+ int sockfd = 0;\r
+ struct sockaddr_un clientaddr;\r
+ drm_trusted_request_data_s send_data;\r
+ drm_trusted_response_data_s recv_data;\r
+ int temp_len_sock = 0;\r
+ int retval = 0;\r
+ drm_trusted_result_e result = DRM_TRUSTED_RETURN_SUCCESS;\r
+ unsigned int offset = 0;\r
+\r
+ int bytes_write = DRM_TRUSTED_MAX_CHUNK_SIZE;\r
+ int bytes_read = DRM_TRUSTED_MAX_CHUNK_SIZE;\r
+\r
+ /* memset the structures */\r
+ memset(&send_data, 0x0, sizeof(drm_trusted_request_data_s));\r
+ memset(&recv_data, 0x0, sizeof(drm_trusted_response_data_s));\r
+\r
+ /* Create a socket */\r
+ if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("socket error!!, sockfd = %d, error = %s",\r
+ sockfd, strerror(errno));\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Opened socket sockfd = %d",sockfd);\r
+\r
+ /* Copy the data received from the client into local */\r
+ memcpy(&send_data, client_in, sizeof(drm_trusted_request_data_s));\r
+\r
+ /* Set parameters to be used in connect */\r
+ temp_len_sock = strlen(DRM_TRUSTED_SOCK_PATH);\r
+\r
+ memset(&clientaddr, 0x00, sizeof(clientaddr));\r
+ clientaddr.sun_family = AF_UNIX;\r
+ memcpy(clientaddr.sun_path, DRM_TRUSTED_SOCK_PATH, temp_len_sock);\r
+ clientaddr.sun_path[temp_len_sock] = '\0';\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("Connecting socket sockfd = %d",sockfd);\r
+ if ((retval = connect(sockfd, (struct sockaddr*) &clientaddr,\r
+ sizeof(clientaddr))) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("connect error!!, retval = %d, error = %s",\r
+ retval, strerror(errno));\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* First write the static structures */\r
+ DRM_TRUSTED_CLIENT_LOG("Writing socket sockfd = %d size=%d",sockfd,sizeof(drm_trusted_req_fixed_data_s));\r
+ if ((retval = write(sockfd, (char*) &send_data.fixed_data,\r
+ sizeof(drm_trusted_req_fixed_data_s))) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("write error!!, retval = %d, error = %s",\r
+ retval, strerror(errno));\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Written socket sockfd = %d retval=%d",sockfd,retval);\r
+\r
+ /* Now send the additional data items if any */\r
+ if (send_data.fixed_data.num_data_items > 0) {\r
+\r
+ for (int i = 0; i < send_data.fixed_data.num_data_items; i++) {\r
+\r
+ if (send_data.fixed_data.data_length[i] > DRM_TRUSTED_MAX_CHUNK_SIZE) {\r
+\r
+ while (bytes_write > 0) {\r
+ DRM_TRUSTED_CLIENT_LOG("Writing socket sockfd = %d size=%d",sockfd,bytes_write);\r
+ if ((retval = write(sockfd,\r
+ (void*)(send_data.data_items[i] + offset), bytes_write))\r
+ < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "write error!!, retval = %d, error = %s",\r
+ retval, strerror(errno));\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Written socket sockfd = %d retval=%d",sockfd,retval);\r
+\r
+ offset += DRM_TRUSTED_MAX_CHUNK_SIZE;\r
+ bytes_write = (int)(send_data.fixed_data.data_length[i] - offset) > (int)DRM_TRUSTED_MAX_CHUNK_SIZE ?\r
+ DRM_TRUSTED_MAX_CHUNK_SIZE :\r
+ (int)(send_data.fixed_data.data_length[i] - offset);\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("offset = %d, bytes_write = %d", offset, bytes_write);\r
+\r
+ }\r
+ bytes_write = 0;\r
+ } else{\r
+ DRM_TRUSTED_CLIENT_LOG("Writing socket sockfd = %d size=%d",sockfd,send_data.fixed_data.data_length[i]);\r
+ if ((retval = write(sockfd, send_data.data_items[i], send_data.fixed_data.data_length[i])) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("write error!!, retval = %d, error = %s",\r
+ retval, strerror(errno));\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Written socket sockfd = %d retval=%d",sockfd,retval);\r
+ }\r
+ }\r
+ }\r
+\r
+ /* Set offset to be used again */\r
+ offset = 0;\r
+\r
+ /* Read the fixed data into the receive structure */\r
+ DRM_TRUSTED_CLIENT_LOG("Reading socket sockfd = %d size=%d",sockfd,sizeof(drm_trusted_resp_fixed_data_s));\r
+ if ((retval = read(sockfd, (char*) &recv_data.fixed_data,\r
+ sizeof(drm_trusted_resp_fixed_data_s))) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("read error!!, retval = %d, error = %s",\r
+ retval, strerror(errno));\r
+ result = DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Read socket sockfd = %d retval=%d",sockfd,retval);\r
+\r
+ if (recv_data.fixed_data.num_data_items > 0) {\r
+\r
+ for (int loop = 0; loop < recv_data.fixed_data.num_data_items; loop++) {\r
+\r
+ /* Allocate memory for the data items */\r
+ recv_data.data_items[loop] = (char*) malloc(\r
+ recv_data.fixed_data.data_length[loop]);\r
+ if (!recv_data.data_items[loop]) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Memory Allocation Error!, buf = %p",\r
+ recv_data.data_items[loop]);\r
+ recv_data.fixed_data.resp_result =\r
+ DRM_TRUSTED_RETURN_INSUFFICIENT_MEMORY;\r
+ goto ErrorExit;\r
+ }\r
+\r
+ if (recv_data.fixed_data.data_length[loop] > DRM_TRUSTED_MAX_CHUNK_SIZE) {\r
+\r
+ while (bytes_read > 0) {\r
+ DRM_TRUSTED_CLIENT_LOG("Reading socket sockfd = %d size=%d",sockfd,bytes_read);\r
+ if ((retval = read(sockfd,\r
+ (void*)(recv_data.data_items[loop] + offset),\r
+ bytes_read)) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION(\r
+ "Read error!!, retval = %d, error = %s", retval,\r
+ strerror(errno));\r
+ recv_data.fixed_data.resp_result =\r
+ DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Read socket sockfd = %d retval=%d",sockfd,retval);\r
+\r
+ offset += DRM_TRUSTED_MAX_CHUNK_SIZE;\r
+ bytes_read = (int)(recv_data.fixed_data.data_length[loop] - offset) > (int) DRM_TRUSTED_MAX_CHUNK_SIZE ?\r
+ DRM_TRUSTED_MAX_CHUNK_SIZE :\r
+ (int)(recv_data.fixed_data.data_length[loop] - offset);\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("offset = %d, bytes_write = %d", offset, bytes_read);\r
+\r
+ }\r
+ bytes_write = 0;\r
+ } else\r
+ {\r
+ DRM_TRUSTED_CLIENT_LOG("Reading socket sockfd = %d size=%d",sockfd,recv_data.fixed_data.data_length[loop]);\r
+ if ((retval = read(sockfd,\r
+ recv_data.data_items[loop],\r
+ recv_data.fixed_data.data_length[loop])) < 0) {\r
+ DRM_TRUSTED_CLIENT_EXCEPTION("Read error!!, retval = %d, error = %s",\r
+ retval, strerror(errno));\r
+ recv_data.fixed_data.resp_result =\r
+ DRM_TRUSTED_RETURN_COMMUNICATION_ERROR;\r
+ goto ErrorExit;\r
+ }\r
+ DRM_TRUSTED_CLIENT_LOG("Read socket sockfd = %d retval=%d",sockfd,retval);\r
+ }\r
+ }\r
+ }\r
+\r
+ /* Copy the data from the server back to the client into the output parameter */\r
+ memcpy(server_out, &recv_data, sizeof(drm_trusted_response_data_s));\r
+\r
+ DRM_TRUSTED_CLIENT_LOG("drm_trusted_client_comm success!!!, result = %d", result);\r
+\r
+ErrorExit:\r
+ if(-1 != sockfd){\r
+ DRM_TRUSTED_CLIENT_LOG("Closing Socket:sockfd=%d",sockfd);\r
+ retval = close(sockfd);\r
+ DRM_TRUSTED_CLIENT_LOG("Closed Socket:sockfd=%d retval=%d",sockfd,retval);\r
+ sockfd = -1;\r
+ }\r
+\r
+ return result;\r
+}\r
--- /dev/null
+CXX ?= g++\r
+TARGETS = test_drm_trusted_client\r
+PKGS = drm-trusted\r
+LDFLAGS = `pkg-config --libs $(PKGS)`\r
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`\r
+CFLAGS += -Wall -Wunused-function -Wunreachable-code -ggdb3 -fno-omit-frame-pointer -rdynamic -fno-optimize-sibling-calls -fstack-protector-all\r
+\r
+all: $(TARGETS)\r
+\r
+$(TARGETS): %: %.cpp\r
+ $(CXX) -o $@ $< $(CFLAGS) $(LDFLAGS)\r
+\r
+clean:\r
+ rm -f $(TARGETS)
\ No newline at end of file
--- /dev/null
+/*\r
+ * drm-trusted client test utility\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
+ * Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
+ * Harsha Shekar <h.shekar@samsung.com>\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+/**\r
+ * @file test_drm_trusted_client.cpp\r
+ * @brief Test case implementation specific to DRM trusted Client APIs.\r
+ * @author Mahendra Kumar Prajapat (mahendra.p@samsung.com)\r
+ * @author Harsha Shekar (h.shekar@samsung.com)\r
+ * @version 0.1\r
+ * @history 0.1: First version of DRM trusted Client test utility.\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include <memory.h>\r
+#include <stdarg.h>\r
+#include <sys/time.h>\r
+#include <sys/types.h>\r
+#include <time.h>\r
+#include <fcntl.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include <sys/syscall.h>\r
+#include <linux/unistd.h>\r
+#include <unistd.h>\r
+#include <dirent.h>\r
+#include <pthread.h>\r
+#include <assert.h>\r
+\r
+#include "drm_trusted_client.h"\r
+\r
+#define drm_trusted_client_tid() (long int)syscall(__NR_gettid)\r
+#define DRM_TRUSTED_CLIENT_TEST_FILENAME(X) (strrchr((char*)(X), '/') ? (char*)(strrchr((char*)(X), '/') + 1) : ((char*)(X)) )\r
+\r
+#define DRM_TRUSTED_CLIENT_TEST_LOG(FMT, ARG...) do{\\r
+ fprintf(stderr,"[PID=%ld]:[TID=%ld]:[%s:%s:%d]:",(long int)getpid(),drm_trusted_client_tid(),DRM_TRUSTED_CLIENT_TEST_FILENAME(__FILE__),__func__,__LINE__); \\r
+ fprintf(stderr,FMT,##ARG); \\r
+ fprintf(stderr,"\n"); \\r
+ } while(0);\r
+\r
+#define DRM_TRUSTED_CLIENT_TEST_EXCEPTION(FMT, ARG...) do{\\r
+ fprintf(stderr,"[PID=%ld]:[TID=%ld]:[%s:%s:%d]:",(long int)getpid(),drm_trusted_client_tid(),DRM_TRUSTED_CLIENT_TEST_FILENAME(__FILE__),__func__,__LINE__); \\r
+ fprintf(stderr,"[ERROR]"FMT,##ARG); \\r
+ fprintf(stderr,"\n"); \\r
+ } while(0);\r
+\r
+static void drm_trusted_print_buffer(const char* info, unsigned char* buffer, unsigned int buflen)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("\n********* %s:buflen=%u buffer=%p ******** \n",info,buflen,buffer);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("********* %s:Start******** \n",info);\r
+ unsigned int i;\r
+ for(i=1;i<=buflen;i++)\r
+ {\r
+ fprintf(stderr,"0x%02X ",buffer[i-1]);\r
+ if((i%16 )==0) fprintf(stderr,"\n");\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("********* %s:End ******** \n",info);\r
+}\r
+\r
+enum {\r
+ DRM_TRUSTED_CLIENT_TEST_NONE,\r
+ DRM_TRUSTED_CLIENT_TEST_handle_request,\r
+ DRM_TRUSTED_CLIENT_TEST_consume_content,\r
+ DRM_TRUSTED_CLIENT_TEST_CONVERT,\r
+ DRM_TRUSTED_CLIENT_TEST_MAX\r
+\r
+};\r
+\r
+void test_drm_trusted_operation_cb(drm_trusted_user_operation_info_s *operation_info,\r
+ void *output_data)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Callback Hit:test_drm_trusted_operation_cb");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("operation_status=%d",operation_info->operation_status);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("operation_type=%d",operation_info->operation_type);\r
+}\r
+\r
+/* Statically allocate 10 MB\r
+1 KB = 1024 B\r
+1 MB = 1024 KB = 1024 * 1024\r
+10 MB = 10 * 1024 * 1024 B\r
+*/\r
+//#define MAX_OUT_BUFFER_LEN (10 * 1024 * 1024)\r
+#define MAX_OUT_BUFFER_LEN (10 * 1024)\r
+\r
+\r
+void _handle_container_drm_content(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_file_type_e file_type)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p, file_type=%d",pHandle,file_type);\r
+ drm_trusted_payload_info_s read_input_data;\r
+ drm_trusted_read_decrypt_resp_data_s read_output_data;\r
+ unsigned char out_file_path[256]={0};\r
+ unsigned char *out_buffer = NULL;\r
+ FILE *fp_out=NULL;\r
+ int ret = -1;\r
+ unsigned int written_size = 0;\r
+\r
+ /* Allocate memory for Out Buffer */\r
+ out_buffer = (unsigned char*)malloc(MAX_OUT_BUFFER_LEN);\r
+ if (!out_buffer) {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Memory Allocation Error!!!");\r
+ return;\r
+ }\r
+\r
+ memset(&read_input_data,0x0,sizeof(drm_trusted_payload_info_s));\r
+ memset(&read_output_data,0x0,sizeof(drm_trusted_read_decrypt_resp_data_s));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter Output file name along with path where decrypted Data can be stored");\r
+ scanf("%s",out_file_path);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Output decrypted file=%s",out_file_path);\r
+\r
+ fp_out = fopen((const char*)out_file_path,"w+b");\r
+ if(NULL == fp_out){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("fopen failed:error=%s",strerror(errno));\r
+ goto ErrorExit;\r
+ }\r
+\r
+ /* Actually exact plain text length should be used.\r
+ * Plain text length can be obtained using drm_get_file_type */\r
+ read_input_data.payload_data = out_buffer;\r
+ read_input_data.payload_data_len = (unsigned int)MAX_OUT_BUFFER_LEN;\r
+ ret = drm_trusted_read_decrypt_session(pHandle,&read_input_data,\r
+ &read_output_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x Actual read_size=%u "\r
+ "Requested payload_data_len=%u",\r
+ ret,read_output_data.read_size,read_input_data.payload_data_len);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_read_decrypt_session Failed!!, ret=0x%x", ret);\r
+ }\r
+\r
+ if(read_output_data.read_size > 0){\r
+ written_size= fwrite(read_input_data.payload_data,1,\r
+ read_output_data.read_size,fp_out);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Actual written_size=%u "\r
+ "Requested written size=%u",\r
+ written_size,read_output_data.read_size);\r
+ }\r
+ fclose(fp_out);\r
+\r
+ ErrorExit:\r
+ if (out_buffer)\r
+ free(out_buffer);\r
+}\r
+\r
+void _handle_stream_drm_content(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_file_type_e file_type)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p, file_type=%d",pHandle,file_type);\r
+\r
+ drm_trusted_payload_info_s read_input_data;\r
+ drm_trusted_read_decrypt_resp_data_s read_output_data;\r
+ int ret = -1;\r
+\r
+ memset(&read_input_data,0x0,sizeof(drm_trusted_payload_info_s));\r
+ memset(&read_output_data,0x0,sizeof(drm_trusted_read_decrypt_resp_data_s));\r
+\r
+ switch(file_type)\r
+ {\r
+ case DRM_TRUSTED_TYPE_PLAYREADY:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("PlayReady Content");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Extract PayloadData,PayloadDataSize,ReplicatedData,ReplicatedDataSize & ObjectOffset From ASF parser application for EACH Payload");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("For testing purpose, currently it is hard-coded");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("These data are taken from 1st payload of jazz_AAC_V4AES.pya");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("As seen from corresponding clear file jazz_AAC.asf, Output decrypted buffer should be");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("0x20 0x00 0x20 0x00 0x00 0x80 0x0E");\r
+ unsigned char expected_output[] = {0x20, 0x00, 0x20, 0x00, 0x00, 0x80, 0x0E};\r
+\r
+ unsigned char PayloadData[] = {0xE5, 0x08, 0x6E, 0xAE, 0x61, 0xDF, 0x49};\r
+ unsigned int PayloadDataSize = sizeof(PayloadData) / sizeof(PayloadData[0]);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Actual Replicated data is last 8 bytes of Replicated Data as seen from ASF viewer");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Thus ReplicatedDataSize will be 8 bytes");\r
+ unsigned char ReplicatedData[] = {0x14, 0x45, 0x0F, 0x0A, 0x28, 0x15, 0xBF, 0x42};\r
+ unsigned int ReplicatedDataSize = sizeof(ReplicatedData) / sizeof(ReplicatedData[0]);\r
+\r
+ /* Start Decryption */\r
+ drm_trusted_print_buffer("Before:InputBuffer:",PayloadData,PayloadDataSize);\r
+ read_input_data.media_offset = 0;\r
+ read_input_data.payload_data = PayloadData;\r
+ read_input_data.payload_data_len = PayloadDataSize;\r
+ read_input_data.payload_iv = ReplicatedData;\r
+ read_input_data.payload_iv_len = ReplicatedDataSize;\r
+\r
+ ret = drm_trusted_read_decrypt_session(pHandle,&read_input_data,\r
+ &read_output_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x Actual read_size=%u "\r
+ "Requested payload_data_len=%u",\r
+ ret,read_output_data.read_size,read_input_data.payload_data_len);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_read_decrypt_session Failed!!, ret=0x%x", ret);\r
+ }\r
+ drm_trusted_print_buffer("After:OutputBuffer:",read_input_data.payload_data,read_input_data.payload_data_len);\r
+\r
+ if(0 == memcmp(read_input_data.payload_data,expected_output,read_input_data.payload_data_len)){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Decrypt is successful for jazz_AAC_V4AES.pya");\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_TYPE_DIVX:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DivX Content");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Hard-coded testing is not available for DivX Content");\r
+ }\r
+ break;\r
+\r
+ default:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "Unknown file_type=%d",file_type);\r
+\r
+ }\r
+}\r
+\r
+void _handle_read_data(DRM_DECRYPT_HANDLE pHandle,\r
+ drm_trusted_file_type_e file_type)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p, file_type=%d",pHandle,file_type);\r
+ switch(file_type)\r
+ {\r
+ case DRM_TRUSTED_TYPE_OMA_V1:\r
+ case DRM_TRUSTED_TYPE_OMA_V2:\r
+ case DRM_TRUSTED_TYPE_PLAYREADY_ENVELOPE:\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Container Based DRM file");\r
+ _handle_container_drm_content(pHandle,file_type);\r
+ break;\r
+\r
+ case DRM_TRUSTED_TYPE_PLAYREADY:\r
+ case DRM_TRUSTED_TYPE_DIVX:\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Stream Based DRM file");\r
+ _handle_stream_drm_content(pHandle,file_type);\r
+ break;\r
+\r
+ default:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "Unknown file_type=%d",file_type);\r
+ }\r
+}\r
+\r
+void _render_drm_content(drm_trusted_file_type_e file_type)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_seek_decrypt_info_s seek_input_data;\r
+ drm_trusted_tell_decrypt_resp_data_s tell_output_data;\r
+ drm_trusted_set_consumption_state_info_s state_input_data;\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+ drm_trusted_permission_type_e perm_type;\r
+ char file_path[256]={0};\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter DRM content name along with path");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Use jazz_AAC_V4AES.pya file if PlayReady decryption need to be tested");\r
+ scanf("%s",file_path);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("file_path received=%s",file_path);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter permission type");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_NONE",DRM_TRUSTED_PERMISSION_TYPE_NONE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_ANY",DRM_TRUSTED_PERMISSION_TYPE_ANY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_PLAY",DRM_TRUSTED_PERMISSION_TYPE_PLAY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_COLLABORATIVE_PLAY",DRM_TRUSTED_PERMISSION_TYPE_COLLABORATIVE_PLAY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_DISPLAY",DRM_TRUSTED_PERMISSION_TYPE_DISPLAY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_EXECUTE",DRM_TRUSTED_PERMISSION_TYPE_EXECUTE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_PRINT",DRM_TRUSTED_PERMISSION_TYPE_PRINT);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_EXPORT_COPY",DRM_TRUSTED_PERMISSION_TYPE_EXPORT_COPY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_EXPORT_MOVE",DRM_TRUSTED_PERMISSION_TYPE_EXPORT_MOVE);\r
+ scanf("%d", (int*)&perm_type);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("perm_type = %d file_path=%s",perm_type,file_path);\r
+\r
+ /* memset the structures */\r
+ memset(&open_input_data,0x0,sizeof(drm_trusted_open_decrypt_info_s));\r
+ memset(&open_output_data,0x0,sizeof(drm_trusted_open_decrypt_resp_data_s));\r
+ memset(&seek_input_data,0x0,sizeof( drm_trusted_seek_decrypt_info_s));\r
+ memset(&tell_output_data,0x0,sizeof(drm_trusted_tell_decrypt_resp_data_s));\r
+ memset(&state_input_data,0x0,sizeof(drm_trusted_set_consumption_state_info_s));\r
+\r
+ /* Enter Appropriate Inputs */\r
+ memcpy(open_input_data.filePath,file_path,strlen(file_path));\r
+ open_input_data.file_type = file_type;\r
+ open_input_data.permission = perm_type;\r
+ open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_open_decrypt_session Failed!!, ret=0x%x", ret);\r
+ return;\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("result_code = 0x%x",open_output_data.result_code);\r
+\r
+ /* Just for testing seek & tell APIs */\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_END; /* Set cursor to end */\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_seek_decrypt_session(pHandle,&seek_input_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_seek_decrypt_session Failed!!, ret=0x%x", ret);\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_tell_decrypt_session(pHandle,&tell_output_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_tell_decrypt_session Failed!!, ret=0x%x", ret);\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("file-size = %u",tell_output_data.offset);\r
+\r
+ seek_input_data.offset = 0;\r
+ seek_input_data.seek_mode = DRM_SEEK_SET; /* Again set cursor to beginning */\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_seek_decrypt_session(pHandle,&seek_input_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_seek_decrypt_session Failed!!, ret=0x%x", ret);\r
+ }\r
+\r
+ /* Before Read, Appropriate state MUST be SET */\r
+ state_input_data.state = DRM_CONSUMPTION_STARTED;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_set_decrypt_state(pHandle,&state_input_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_set_decrypt_state Failed!!, ret=0x%x", ret);\r
+ goto Err;\r
+ }\r
+\r
+ /* Handle READ / DECRYPT operation */\r
+ _handle_read_data(pHandle,file_type);\r
+\r
+ /* When rendering is stopped */\r
+ state_input_data.state = DRM_CONSUMPTION_STOPPED;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_set_decrypt_state(pHandle,&state_input_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_set_decrypt_state Failed!!, ret=0x%x", ret);\r
+ goto Err;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_close_decrypt_session Failed!!, ret=0x%x", ret);\r
+ return;\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SUCCESS");\r
+ return;\r
+\r
+Err:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Failed, ret=0x%x", ret);\r
+ drm_trusted_close_decrypt_session(&pHandle);\r
+}\r
+\r
+void _render_drm_oma_progressive_download_content(void)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Progressive Download scenario");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Hard-coded testing is not available for Progressive Download scenario");\r
+}\r
+\r
+void _render_drm_piff_content(void)\r
+{\r
+ /* Initialize variables & structures */\r
+ drm_trusted_open_decrypt_info_s open_input_data;\r
+ drm_trusted_open_decrypt_resp_data_s open_output_data;\r
+ drm_trusted_set_consumption_state_info_s state_input_data;\r
+\r
+ drm_trusted_payload_info_s read_input_data;\r
+ drm_trusted_read_decrypt_resp_data_s read_output_data;\r
+\r
+ memset(&read_input_data,0x0,sizeof(drm_trusted_payload_info_s));\r
+ memset(&read_output_data,0x0,sizeof(drm_trusted_read_decrypt_resp_data_s));\r
+\r
+ DRM_DECRYPT_HANDLE pHandle = NULL;\r
+ int ret = -1;\r
+ drm_trusted_permission_type_e perm_type;\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter permission type");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_NONE",DRM_TRUSTED_PERMISSION_TYPE_NONE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_ANY",DRM_TRUSTED_PERMISSION_TYPE_ANY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_PLAY",DRM_TRUSTED_PERMISSION_TYPE_PLAY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_COLLABORATIVE_PLAY",DRM_TRUSTED_PERMISSION_TYPE_COLLABORATIVE_PLAY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_DISPLAY",DRM_TRUSTED_PERMISSION_TYPE_DISPLAY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_EXECUTE",DRM_TRUSTED_PERMISSION_TYPE_EXECUTE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_PRINT",DRM_TRUSTED_PERMISSION_TYPE_PRINT);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_EXPORT_COPY",DRM_TRUSTED_PERMISSION_TYPE_EXPORT_COPY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_PERMISSION_TYPE_EXPORT_MOVE",DRM_TRUSTED_PERMISSION_TYPE_EXPORT_MOVE);\r
+ scanf("%d", (int*)&perm_type);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("perm_type = %d",perm_type);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Sample Content => SuperSpeedway_720_230.ismv");\r
+\r
+ /* 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.".>.\r
+ * <.D.A.T.A.>.\r
+ * <.P.R.O.T.E.C.T.I.N.F.O.>.\r
+ * <.K.E.Y.L.E.N.>.1.6.<./.K.E.Y.L.E.N.>.\r
+ * <.A.L.G.I.D.>.A.E.S.C.T.R.<./.A.L.G.I.D.>.\r
+ * <./.P.R.O.T.E.C.T.I.N.F.O.>.\r
+ * <.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.>.\r
+ * <.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.>.\r
+ * <.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>.\r
+ * <.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.>.\r
+ * <./.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>.\r
+ * <.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.>.\r
+ * <.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.>.\r
+ * <./.D.A.T.A.>.\r
+ * <./.W.R.M.H.E.A.D.E.R.>... */\r
+\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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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};\r
+\r
+ /* Enter Appropriate Inputs */\r
+ open_input_data.file_type = DRM_TRUSTED_TYPE_PIFF;\r
+ open_input_data.permission = perm_type;\r
+ open_input_data.operation_callback.callback = test_drm_trusted_operation_cb;\r
+ open_input_data.lic_header.header = ContentHeader;\r
+ open_input_data.lic_header.header_len = sizeof(ContentHeader);\r
+\r
+ /* Open Decrypt Session*/\r
+ ret = drm_trusted_open_decrypt_session(&open_input_data,&open_output_data,\r
+ &pHandle);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_open_decrypt_session Failed!!, ret=0x%x", ret);\r
+ return;\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("result_code = 0x%x",open_output_data.result_code);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Extract Payload and IV information and pass it through PIFF payload info");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Sample Payload - Encrypted");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("0xE8,0xC6,0xF8,0x49,0xF3,0x0E,0x52,0xFB,0xC5,0xFA,0xF1");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Corresponding Decrypted Payload");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("0x88,0x80,0x40,0x01,0x71,0xA3,0x7F,0xD9,0xEF,0xA7,0xF2");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Sample IV");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("0xF4,0xB3,0x10,0x77,0x75,0x3F,0x69,0x94");\r
+\r
+ unsigned char PayLoadData[] = {0xE8,0xC6,0xF8,0x49,0xF3,0x0E,0x52,0xFB,0xC5,0xFA,0xF1};\r
+ unsigned char InitVect[] = {0xF4,0xB3,0x10,0x77,0x75,0x3F,0x69,0x94};\r
+ unsigned char expected_output[] = {0x88,0x80,0x40,0x01,0x71,0xA3,0x7F,0xD9,0xEF,0xA7,0xF2};\r
+\r
+ /* Before Read, Appropriate state MUST be SET */\r
+ state_input_data.state = DRM_CONSUMPTION_STARTED;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_set_decrypt_state(pHandle,&state_input_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_set_decrypt_state Failed!!, ret=0x%x", ret);\r
+ goto Err;\r
+ }\r
+\r
+ /* Start Decryption */\r
+ read_input_data.media_offset = 0;\r
+ read_input_data.payload_data = PayLoadData;\r
+ read_input_data.payload_data_len = sizeof(PayLoadData)/sizeof(PayLoadData[0]);\r
+ read_input_data.payload_iv = InitVect;\r
+ read_input_data.payload_iv_len = sizeof(InitVect)/sizeof(InitVect[0]);\r
+ drm_trusted_print_buffer("Before:InputBuffer:",read_input_data.payload_data,read_input_data.payload_data_len);\r
+\r
+ ret = drm_trusted_read_decrypt_session(pHandle,&read_input_data,\r
+ &read_output_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x Actual read_size=%u "\r
+ "Requested payload_data_len=%u",\r
+ ret,read_output_data.read_size,read_input_data.payload_data_len);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_read_decrypt_session Failed!!, ret=0x%x", ret);\r
+ }\r
+ drm_trusted_print_buffer("After:OutputBuffer:",read_input_data.payload_data,read_input_data.payload_data_len);\r
+\r
+ if(0 == memcmp(read_input_data.payload_data,expected_output,read_input_data.payload_data_len)){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Decrypt is successful for SuperSpeedway_720_230.ismv");\r
+ }\r
+\r
+ /* When rendering is stopped */\r
+ state_input_data.state = DRM_CONSUMPTION_STOPPED;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_set_decrypt_state(pHandle,&state_input_data);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_set_decrypt_state Failed!!, ret=0x%x", ret);\r
+ goto Err;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+ ret = drm_trusted_close_decrypt_session(&pHandle);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_close_decrypt_session Failed!!, ret=0x%x", ret);\r
+ return;\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("pHandle = %p",pHandle);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SUCCESS");\r
+ return;\r
+\r
+Err:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Failed, ret=0x%x", ret);\r
+ drm_trusted_close_decrypt_session(&pHandle);\r
+}\r
+\r
+\r
+void test_consume_content(void)\r
+{\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Start");\r
+ drm_trusted_file_type_e file_type = DRM_TRUSTED_TYPE_UNDEFINED;\r
+\r
+ /* Enter simulation information */\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter the file_type");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Application can know file_type by calling"\r
+ "drm_get_file_type");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_OMA_V1 \n",DRM_TRUSTED_TYPE_OMA_V1);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_OMA_V2 \n",DRM_TRUSTED_TYPE_OMA_V2);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_PLAYREADY \n",DRM_TRUSTED_TYPE_PLAYREADY);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_PLAYREADY_ENVELOPE \n",DRM_TRUSTED_TYPE_PLAYREADY_ENVELOPE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_DIVX \n",DRM_TRUSTED_TYPE_DIVX);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Application can know about OMA DRM Progressive download"\r
+ "when browser download OMA DD (Download descriptor)"\r
+ "In DD, there is field progressiveDownloadFlag"\r
+ "if progressiveDownloadFlag = true it means"\r
+ "the content MUST be rendering in progressive download mode.");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_OMA_PD \n",DRM_TRUSTED_TYPE_OMA_PD);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Application can know about PIFF / Smooth Streaming"\r
+ "when browser download Manifest file");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TYPE_PIFF \n",DRM_TRUSTED_TYPE_PIFF);\r
+\r
+ scanf("%d", (int*)&file_type);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("file_type received=%d",file_type);\r
+\r
+ switch(file_type){\r
+ case DRM_TRUSTED_TYPE_OMA_V1:\r
+ case DRM_TRUSTED_TYPE_OMA_V2:\r
+ case DRM_TRUSTED_TYPE_PLAYREADY:\r
+ case DRM_TRUSTED_TYPE_PLAYREADY_ENVELOPE:\r
+ case DRM_TRUSTED_TYPE_DIVX:\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Handle file based rendering");\r
+ _render_drm_content(file_type);\r
+ break;\r
+\r
+ case DRM_TRUSTED_TYPE_OMA_PD:\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Handle OMA DRM Progressive download rendering");\r
+ _render_drm_oma_progressive_download_content();\r
+ break;\r
+\r
+ case DRM_TRUSTED_TYPE_PIFF:\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Handle OMA DRM Progressive download rendering");\r
+ _render_drm_piff_content();\r
+ break;\r
+\r
+ default:\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("UnKnown file_type=%d",file_type);\r
+ return;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Completed");\r
+}\r
+\r
+void test_convert(char* SourceDMfilePath, char* DestDCFfilepath)\r
+{\r
+ DRM_TRUSTED_CONVERT_HANDLE hConvert;\r
+ drm_trusted_opn_conv_info_s input;\r
+ drm_trusted_write_conv_info_s write_input;\r
+ drm_trusted_write_conv_resp_s output;\r
+\r
+ FILE *fp = NULL;\r
+ int FileSize=0;\r
+ unsigned char *buffer = NULL;\r
+ struct stat statbuf;\r
+ int readed_size = 0;\r
+ int ret = -1;\r
+\r
+ /* memset the structures */\r
+ memset(&hConvert, 0x0, sizeof(DRM_TRUSTED_CONVERT_HANDLE));\r
+ memset(&input, 0x0, sizeof(drm_trusted_opn_conv_info_s));\r
+ memset(&output, 0x0, sizeof(drm_trusted_write_conv_resp_s));\r
+ memset(&write_input, 0x0, sizeof(drm_trusted_opn_conv_info_s));\r
+ memset(&statbuf, 0x0, sizeof(struct stat));\r
+\r
+ memcpy(input.filePath,DestDCFfilepath,strlen(DestDCFfilepath));\r
+\r
+ input.install_RO = DRM_TRUSTED_FALSE;\r
+\r
+ ret = drm_trusted_open_convert(&input,&hConvert);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("drm_trusted_open_convert:ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_open_convert Failed!!, ret=0x%x", ret);\r
+ return;\r
+ }\r
+\r
+ fp = fopen(SourceDMfilePath, "r");\r
+ if (fp == NULL){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("fopen error:error=%s",strerror(errno));\r
+ goto err;\r
+ }\r
+\r
+ if(stat(SourceDMfilePath, &statbuf) == 0 ){\r
+ FileSize = (unsigned int)statbuf.st_size;\r
+ }else{\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("stat failed:error = %s",strerror(errno));\r
+ goto err;\r
+ }\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("FileSize=%d",FileSize);\r
+\r
+ if(0 == FileSize){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("%s is empty",SourceDMfilePath);\r
+ goto err;\r
+ }\r
+\r
+ buffer = (unsigned char *)malloc(FileSize + 1);\r
+ if(!buffer){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("malloc failed:error=%s",strerror(errno));\r
+ goto err;\r
+ }\r
+ memset(buffer, 0x0, FileSize+1);\r
+ readed_size = fread(buffer,1,FileSize,fp);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("read_size=%d FileSize=%d",readed_size,FileSize);\r
+ if(ferror(fp)){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("fread failed:error=%s",strerror(errno));\r
+ goto err;\r
+ }\r
+\r
+ buffer[FileSize] = '\0';\r
+ write_input.data_len = readed_size;\r
+ write_input.data = buffer;\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("data_len=%d",write_input.data_len);\r
+\r
+ ret = drm_trusted_write_convert(&write_input,&output,hConvert);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("drm_trusted_write_convert:ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_write_convert Failed!!, ret=0x%x", ret);\r
+ goto err;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("bytes written=%u filesize=%d",output.write_size,FileSize);\r
+ if((unsigned int)FileSize != output.write_size){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Data is not written successfully");\r
+ goto err;\r
+ }\r
+\r
+ ret = drm_trusted_close_convert(&hConvert);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("drm_trusted_close_convert:ret = 0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS != ret){\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "drm_trusted_close_convert Failed!!, ret=0x%x", ret);\r
+ hConvert = NULL;\r
+ goto err;\r
+ }\r
+\r
+ fclose(fp);\r
+ free(buffer);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SUCCESS");\r
+ return;\r
+\r
+err:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Failed");\r
+ if(hConvert) drm_trusted_close_convert(&hConvert);\r
+ if(fp) fclose(fp);\r
+ if(buffer) free(buffer);\r
+ return;\r
+}\r
+\r
+int test_case(int option)\r
+{\r
+ char filePath[300] = {0,};\r
+ char distfilePath[300] = {0,};\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("option=[%d]", option);\r
+\r
+ switch (option) {\r
+ case DRM_TRUSTED_CLIENT_TEST_NONE:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_CLIENT_TEST_NONE start");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_CLIENT_TEST_NONE completed");\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_CLIENT_TEST_handle_request:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_CLIENT_TEST_handle_request start");\r
+ drm_trusted_request_type_e request_type = DRM_TRUSTED_REQ_TYPE_NONE;\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter the request type to be processed");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK",DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK",DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING",DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_MASTER_RESET",DRM_TRUSTED_REQ_TYPE_MASTER_RESET);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT",DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB",DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT",DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_REMOVE_RO",DRM_TRUSTED_REQ_TYPE_REMOVE_RO);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO",DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL",DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE",DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO",DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE",DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE",DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG(" %d ==> DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE",DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE);\r
+ scanf("%d", (int*)&request_type);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("request_type received=%d",request_type);\r
+\r
+ switch(request_type) {\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_UPDATE_SECURE_CLK:\r
+ {\r
+ struct tm* tmst = NULL;\r
+ long int delta = 0, newtime = 0, oldtime = 0;\r
+ int ret = -1;\r
+ drm_trusted_update_sec_clk_info_s upd_clk_info = { 0, };\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter delta sec \n");\r
+ scanf("%ld",&delta);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("delta = %ld \n",delta);\r
+\r
+ oldtime = (long int)time(NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Old Local Time = %ld = %s \n",oldtime,ctime(&oldtime));\r
+\r
+ newtime = oldtime + delta;\r
+ tmst = localtime(&newtime);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("New Local Time = %ld = %s \n",newtime,asctime(tmst));\r
+\r
+ upd_clk_info.before = oldtime;\r
+ upd_clk_info.after = newtime;\r
+\r
+ ret = drm_trusted_handle_request(request_type,\r
+ (void *) &upd_clk_info, NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Update Secure Clock Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "Update Secure Clock Failed!!, ret=0x%x", ret);\r
+ }\r
+\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SET_SECURE_CLK:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Set Secure Clock!!");\r
+ struct tm* tmst = NULL;\r
+ long int delta = 0, locatime = 0, securetime = 0;\r
+ int ret = -1;\r
+ drm_trusted_set_sec_clk_info_s sec_clk_info;\r
+ memset(&sec_clk_info, 0x00, sizeof(drm_trusted_set_sec_clk_info_s));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter delta sec \n");\r
+ scanf("%ld",&delta);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("delta = %ld \n",delta);\r
+\r
+ locatime = (long int)time(NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Current Local Time = %ld = %s \n",locatime,ctime(&locatime));\r
+\r
+ securetime = locatime + delta;\r
+ tmst = localtime(&securetime);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Current Secure Time = %ld = %s \n",\r
+ securetime, asctime(tmst));\r
+\r
+ memcpy(&sec_clk_info.secure_time, tmst, sizeof(struct tm));\r
+ sec_clk_info.source_type = DRM_TRUSTED_TS_NITZ;\r
+\r
+ ret = drm_trusted_handle_request(request_type,\r
+ (void *) &sec_clk_info, NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Set Secure Clock Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "Set Secure Clock Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SET_TRANSACTION_TRACKING:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_set_transaction_trk_info_s trk_info;\r
+ int value = 0;\r
+\r
+ memset(&trk_info, 0x00, sizeof(drm_trusted_set_transaction_trk_info_s));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter 1 for tracking ON and 0 for OFF");\r
+ scanf("%d", &value);\r
+\r
+ if (1 == value) {\r
+ trk_info.tracking_on = DRM_TRUSTED_TRUE;\r
+ } else if (0 == value) {\r
+ trk_info.tracking_on = DRM_TRUSTED_FALSE;\r
+ } else {\r
+ trk_info.tracking_on = DRM_TRUSTED_UNKNOWN;\r
+ }\r
+\r
+ ret = drm_trusted_handle_request(request_type,\r
+ (void *) &trk_info, NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Set Transaction Tracking Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION(\r
+ "Set Transaction Tracking Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_MASTER_RESET:\r
+ {\r
+ int ret = -1;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_REQ_TYPE_MASTER_RESET");\r
+ ret = drm_trusted_handle_request(request_type,NULL,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("MASTER RESET Success");\r
+ }else{\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("MASTER RESET FAILED: ret=0x%x", ret);\r
+ }\r
+ }\r
+ break;\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT:\r
+ {\r
+ int ret = -1;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_REQ_TYPE_VERIFY_ENCRYPTED_CERT");\r
+ ret = drm_trusted_handle_request(request_type,NULL,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x",ret);\r
+\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("verifying encrypted certificate Success");\r
+ }else{\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("verifying encrypted certificate FAILED: ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB:\r
+ {\r
+ int ret = -1;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_REQ_TYPE_CREATE_INIT_DB");\r
+ ret = drm_trusted_handle_request(request_type,NULL,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("CREATE_INIT_DB Success");\r
+ }else{\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("CREATE_INIT_DB FAILED: ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT:\r
+ {\r
+ int ret = -1;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_REQ_TYPE_REINSTALL_CERT");\r
+ ret = drm_trusted_handle_request(request_type,NULL,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("REINSTALL_CERT Success");\r
+ }else{\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("REINSTALL_CERT FAILED: ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_REMOVE_RO:\r
+ {\r
+ int ret = -1;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_REQ_TYPE_REMOVE_RO");\r
+ drm_trusted_remove_ro_info_s remove_ro_info;\r
+ memset(&remove_ro_info, 0x00, sizeof(drm_trusted_remove_ro_info_s));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter the file path");\r
+ scanf("%s",remove_ro_info.filePath);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("file path=%s",remove_ro_info.filePath);\r
+ ret = drm_trusted_handle_request(request_type,(void *)&remove_ro_info, NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("REMOVE_RO Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("REMOVE_RO Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO:\r
+ {\r
+ int ret = -1;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_REQ_TYPE_REMOVE_ALL_RO");\r
+\r
+ ret = drm_trusted_handle_request(request_type,NULL,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x",ret);\r
+ if(DRM_TRUSTED_RETURN_SUCCESS == ret){\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("REMOVE_ALL_RO Success");\r
+ }else{\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("REMOVE_ALL_RO FAILED: ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_GO_RIGHTS_URL:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_go_rights_url_info_s rights_url_info;\r
+ memset(&rights_url_info, 0x00, sizeof(drm_trusted_go_rights_url_info_s));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter the file path");\r
+ scanf("%s",rights_url_info.file_path);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter=%d => DRM_ROURL_METHOD_ROPAYLOAD",DRM_ROURL_METHOD_ROPAYLOAD);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter=%d => DRM_ROURL_METHOD_SILENT",DRM_ROURL_METHOD_SILENT);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter the RO URL Type");\r
+ scanf("%d",(int*)&(rights_url_info.rourl_type));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("file_path=%s rourl_type=%d",rights_url_info.file_path,rights_url_info.rourl_type);\r
+ ret = drm_trusted_handle_request(request_type,(void *)&rights_url_info, NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("GO_RIGHTS_URL Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("GO_RIGHTS_URL Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_PD_SET_DOWNLOAD_COMPLETE:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_pd_set_dld_comp_info_s download_cmp_info;\r
+ memset(&download_cmp_info, 0x00, sizeof(drm_trusted_pd_set_dld_comp_info_s));\r
+\r
+ ret = drm_trusted_handle_request(request_type,(void *)&download_cmp_info, NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("PD_SET_DOWNLOAD_COMPLETE Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("PD_SET_DOWNLOAD_COMPLETE Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_PD_GET_PARSE_STATUS_INFO:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_pd_parse_status_info_s info_status;\r
+ drm_trusted_pd_parse_status_resp_s resp_status;\r
+ memset(&info_status, 0x00, sizeof(drm_trusted_pd_parse_status_info_s));\r
+ memset(&resp_status, 0x00, sizeof(drm_trusted_pd_parse_status_resp_s));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter the file path");\r
+ scanf("%s",info_status.file_path);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("file_path=%s",info_status.file_path);\r
+\r
+ ret = drm_trusted_handle_request(request_type,(void *)&info_status, (void *)&resp_status);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("PD_GET_PARSE_STATUS_INFO Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("PD_GET_PARSE_STATUS_INFO Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_PIFF_GET_LICENSE:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_piff_get_license_info_s license_info;\r
+\r
+ /* Sample Content => SuperSpeedway_720_230.ismv */\r
+\r
+ /* 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.".>.\r
+ * <.D.A.T.A.>.\r
+ * <.P.R.O.T.E.C.T.I.N.F.O.>.\r
+ * <.K.E.Y.L.E.N.>.1.6.<./.K.E.Y.L.E.N.>.\r
+ * <.A.L.G.I.D.>.A.E.S.C.T.R.<./.A.L.G.I.D.>.\r
+ * <./.P.R.O.T.E.C.T.I.N.F.O.>.\r
+ * <.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.>.\r
+ * <.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.>.\r
+ * <.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>.\r
+ * <.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.>.\r
+ * <./.C.U.S.T.O.M.A.T.T.R.I.B.U.T.E.S.>.\r
+ * <.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.>.\r
+ * <.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.>.\r
+ * <./.D.A.T.A.>.\r
+ * <./.W.R.M.H.E.A.D.E.R.>... */\r
+\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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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,\r
+ 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};\r
+\r
+ memset(&license_info, 0x00, sizeof(drm_trusted_piff_get_license_info_s));\r
+\r
+ license_info.lic_header.header = (unsigned char*)ContentHeader;\r
+ license_info.lic_header.header_len = sizeof(ContentHeader);\r
+ ret = drm_trusted_handle_request(request_type,(void *)&license_info,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("PIFF_GET_LICENSE Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("PIFF_GET_LICENSE Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_sapps_decrypt_package_info_s package_info;\r
+\r
+ memset(&package_info, 0x00, sizeof(drm_trusted_sapps_decrypt_package_info_s));\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter Samsung Apps DRM File Path");\r
+ scanf("%s",package_info.sadcf_filepath);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter Decrypted File Path");\r
+ scanf("%s",package_info.decrypt_filepath);\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SamsungAppsDRMFilePath=%s",package_info.sadcf_filepath);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Decrypted-FilePath=%s",package_info.decrypt_filepath);\r
+\r
+ ret = drm_trusted_handle_request(request_type,(void *)&package_info,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SAPPS_DECRYPT_PACKAGE Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("SAPPS_DECRYPT_PACKAGE Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_CONSUME_LICENSE:\r
+ {\r
+ int ret = -1;\r
+ drm_trusted_sapps_consume_license_info_s cons_license_info;\r
+\r
+ memset(&cons_license_info, 0x00, sizeof(drm_trusted_sapps_consume_license_info_s));\r
+ ret = drm_trusted_handle_request(request_type,(void *)&cons_license_info,NULL);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("ret=0x%x", ret);\r
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SAPPS_CONSUME_LICENSE Success!!");\r
+ } else {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("SAPPS_CONSUME_LICENSE Failed!!, ret=0x%x", ret);\r
+ }\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Test-environment is not available:"\r
+ "DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_PURCHASE_REQUEST");\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Test-environment is not available:"\r
+ "DRM_TRUSTED_REQ_TYPE_SAPPS_GENERATE_LICENSE_REQUEST");\r
+ break;\r
+ }\r
+\r
+ default:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Invalid option!!");\r
+ break;\r
+ }\r
+\r
+ }\r
+\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_CLIENT_TEST_consume_content:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_CLIENT_TEST_consume_content");\r
+ test_consume_content();\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_CLIENT_TEST_CONVERT:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Your choice is DRM_TRUSTED_CLIENT_TEST_CONVERT");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter complete Source file path");\r
+ scanf("%s", filePath);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter complete Destination file path");\r
+ scanf("%s", distfilePath);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("test_convert: sourcefile=%s destfile=%s",filePath,distfilePath);\r
+ test_convert(filePath,distfilePath);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("test_convert finishes");\r
+ break;\r
+ }\r
+\r
+ case DRM_TRUSTED_CLIENT_TEST_MAX:\r
+ {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("DRM_TRUSTED_CLIENT_TEST_MAX");\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SUCCESS");\r
+ return 0;\r
+ }\r
+\r
+ default:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("Wrong choice=%d",option);\r
+ goto ERR;\r
+ }\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("SUCCESS");\r
+ return 1;\r
+\r
+ERR:\r
+ DRM_TRUSTED_CLIENT_TEST_EXCEPTION("test_case:Error:Exit from DRM CLIENT Test utility");\r
+ return 0;\r
+}\r
+\r
+int main(int argc, char* argv[])\r
+{\r
+ int pid = getpid();\r
+ int choice = DRM_TRUSTED_CLIENT_TEST_NONE;\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("main:pid=[%d]", pid);\r
+\r
+ do {\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("choice=%d -> DRM_TRUSTED_CLIENT_TEST_NONE",DRM_TRUSTED_CLIENT_TEST_NONE);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("choice=%d -> DRM_TRUSTED_CLIENT_TEST_handle_request",DRM_TRUSTED_CLIENT_TEST_handle_request);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("choice=%d -> DRM_TRUSTED_CLIENT_TEST_consume_content",DRM_TRUSTED_CLIENT_TEST_consume_content);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("choice=%d -> DRM_TRUSTED_CLIENT_TEST_CONVERT",DRM_TRUSTED_CLIENT_TEST_CONVERT);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("choice=%d -> Exit from TEST Script",DRM_TRUSTED_CLIENT_TEST_MAX);\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Enter Your choice:1 to %d:Use choice no-%d to exit the test-program",DRM_TRUSTED_CLIENT_TEST_MAX, DRM_TRUSTED_CLIENT_TEST_MAX);\r
+ scanf("%3d", &choice);\r
+ } while (1 == test_case(choice));\r
+\r
+ DRM_TRUSTED_CLIENT_TEST_LOG("Exiting process=[%d] from main", pid);\r
+ return 0;\r
+}\r