1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-- Copyright (c) 2014, STMicroelectronics International N.V. --> 4<!-- All rights reserved. --> 5<!-- Copyright (c) 2020, Linaro Limited --> 6<!-- --> 7<!-- Redistribution and use in source and binary forms, with or without --> 8<!-- modification, are permitted provided that the following conditions are met: --> 9<!-- --> 10<!-- 1. Redistributions of source code must retain the above copyright notice, --> 11<!-- this list of conditions and the following disclaimer. --> 12<!-- --> 13<!-- 2. Redistributions in binary form must reproduce the above copyright notice, --> 14<!-- this list of conditions and the following disclaimer in the documentation --> 15<!-- and/or other materials provided with the distribution. --> 16<!-- --> 17<!-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" --> 18<!-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE --> 19<!-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE --> 20<!-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE --> 21<!-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR --> 22<!-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF --> 23<!-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS --> 24<!-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN --> 25<!-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) --> 26<!-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE --> 27<!-- POSSIBILITY OF SUCH DAMAGE. --> 28 29<xsl:stylesheet version="1.0" 30xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 31 32<xsl:output method="text"/> 33<xsl:strip-space elements="*"/> 34<xsl:param name="target"/> 35 36<xsl:template match="package"> 37<xsl:text> 38/* 39 * Copyright (c) 2014, STMicroelectronics International N.V. 40 * 41 * This program is free software; you can redistribute it and/or modify 42 * it under the terms of the GNU General Public License Version 2 as 43 * published by the Free Software Foundation. 44 * 45 * This program is distributed in the hope that it will be useful, 46 * but WITHOUT ANY WARRANTY; without even the implied warranty of 47 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 48 * GNU General Public License for more details. 49 * 50 * You should have received a copy of the GNU General Public License along 51 * with this program; if not, write to the Free Software Foundation, Inc., 52 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 53 */ 54 55 56#include "xml_crypto_api.h" 57 58</xsl:text> 59<xsl:for-each select="initial-state/scenario"> 60/*<xsl:value-of select="substring(substring-after(./@name, '('), 0, 9)" />*/ 61static void xtest_tee_<xsl:value-of select="position()+50000" />(ADBG_Case_t *c) 62{ 63 declare_local_vars 64 65<xsl:for-each select="./preamble/call/operation"> 66 <xsl:apply-templates select="."></xsl:apply-templates> 67</xsl:for-each> 68<xsl:for-each select="./body/call/operation|./body/call/observations/operation"> 69 <xsl:apply-templates select="."></xsl:apply-templates> 70</xsl:for-each> 71<xsl:for-each select="./verification/call/operation"> 72 <xsl:apply-templates select="."></xsl:apply-templates> 73</xsl:for-each> 74<xsl:for-each select="./postamble/call/operation"> 75 <xsl:apply-templates select="."></xsl:apply-templates> 76</xsl:for-each> 77<xsl:if test="position()=last()"><xsl:text> 78 crypto_reset();</xsl:text></xsl:if> 79} 80</xsl:for-each> 81 82<xsl:for-each select="initial-state/scenario"> 83<xsl:variable name="position" select="position()+50000" /> 84ADBG_CASE_DEFINE(gp, <xsl:value-of select="$position" />, xtest_tee_<xsl:value-of select="$position" /><xsl:text>, "</xsl:text><xsl:value-of select="substring(substring-after(./@name, '('), 0, 9)" /><xsl:text>");</xsl:text> 85</xsl:for-each> 86</xsl:template> 87 88<xsl:template match="operation"> 89<xsl:choose> 90<!--Call an operation with ADBG_EXPECT() macro.--> 91<xsl:when test="(contains(./argument[last()]/parameter/@name, 'xpected'))"> ADBG_EXPECT_TEEC_RESULT(c, <xsl:for-each select="./argument"><xsl:if test="position()=last()"><xsl:apply-templates select="value"></xsl:apply-templates></xsl:if></xsl:for-each>, <xsl:apply-templates select="./@name"></xsl:apply-templates><xsl:for-each select="./argument/value"><xsl:if test="position()>1 and not(position()=last())">, </xsl:if><xsl:if test="not(position()=last())"><xsl:apply-templates select="."></xsl:apply-templates></xsl:if> 92 </xsl:for-each>)); 93</xsl:when> 94<xsl:otherwise> 95<xsl:text> </xsl:text><xsl:apply-templates select="./@name"></xsl:apply-templates><xsl:for-each select="./argument"><xsl:if test="position()>1">, </xsl:if> 96 <xsl:apply-templates select="./value"></xsl:apply-templates> 97</xsl:for-each>); 98</xsl:otherwise> 99</xsl:choose> 100</xsl:template> 101 102<xsl:template match="value"> 103<xsl:choose> 104<xsl:when test="(contains(./@name, 'UUID'))"><xsl:text>&</xsl:text><xsl:value-of select="./@name" /> 105</xsl:when> 106<xsl:when test="(contains(../type/@name, 'ALL_ATTRIBUTE_VALUES'))"><xsl:value-of select="./@name" /><xsl:text>, sizeof(</xsl:text><xsl:value-of select="./@name" /><xsl:text>)</xsl:text> 107</xsl:when> 108<xsl:when test="(../type/@name='ALL_TEE_NAMES' and ./@name='NULL')"><xsl:text>xtest_tee_name</xsl:text> </xsl:when> 109<xsl:when test="(../type/@name='ALL_TEE_OBJECT_HANDLES' and ./@name='NULL')"><xsl:text>OBJECT_HANDLE_NULL</xsl:text> </xsl:when> 110<xsl:otherwise> 111<!--xsl:text>&</xsl:text--><xsl:value-of select="./@name" /> 112</xsl:otherwise> 113</xsl:choose> 114</xsl:template> 115 116<xsl:template match="parameter"> 117 <xsl:value-of select="./@name" /> 118</xsl:template> 119 120<xsl:template match="@name"> 121<xsl:choose> 122<xsl:when test="(contains(., 'Invoke'))"><xsl:value-of select="." /><xsl:text>(c, </xsl:text> </xsl:when> 123<xsl:when test="(contains(., 'Macro'))"><xsl:value-of select="." /><xsl:text>(c, </xsl:text> </xsl:when> 124<xsl:when test="(contains(., 'Check'))"><xsl:value-of select="." /><xsl:text>(c, </xsl:text> </xsl:when> 125<xsl:when test="(contains(., '_flag'))"><xsl:value-of select="." /><xsl:text>(</xsl:text> </xsl:when> 126<xsl:when test="(contains(., 'add_attribute'))"><xsl:value-of select="." /><xsl:text>(</xsl:text> </xsl:when> 127<xsl:otherwise> 128<xsl:text>TEEC_</xsl:text><xsl:value-of select="." /><xsl:text>(</xsl:text> 129</xsl:otherwise> 130</xsl:choose> 131</xsl:template> 132 133</xsl:stylesheet> 134