<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<IP xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance"
    ns0:schemaLocation="http://mcd.rou.st.com/modules.php?name=mcu ../../../../../../../doc/V4/Development/Specifications/db/IP_Modes.xsd"
    xmlns="http://mcd.rou.st.com/modules.php?name=mcu"
    DBVersion="V4.0"
    IPType="service"
    IpGroup="Security"
    Name="CRYP"
    Version="cryp1_v1_0_EVO1_Cube">

    <RefParameter Name="Algorithm" Comment="Data encryption algorithm" DefaultValue="CRYP_TDES_ECB" Type="list" Group="Algorithm">
        <Description>AES/TDES Data encryption types list</Description>
        <PossibleValue Value="CRYP_TDES_ECB" Comment="TDES ECB" Semaphore="Semaphore_CRYP_Coding_TDESECB$IpInstance"/>
        <PossibleValue Value="CRYP_TDES_CBC" Comment="TDES CBC" Semaphore="Semaphore_CRYP_Coding_TDESCBC$IpInstance"/>
        <PossibleValue Value="CRYP_DES_ECB" Comment="DES ECB" Semaphore="Semaphore_CRYP_Coding_DESECB$IpInstance"/>
        <PossibleValue Value="CRYP_DES_CBC" Comment="DES CBC" Semaphore="Semaphore_CRYP_Coding_DESCBC$IpInstance"/>
        <PossibleValue Value="CRYP_AES_ECB" Comment="AES ECB" Semaphore="Semaphore_CRYP_Coding_AESECB$IpInstance"/>
        <PossibleValue Value="CRYP_AES_CBC" Comment="AES CBC" Semaphore="Semaphore_CRYP_Coding_AESCBC$IpInstance"/>
        <PossibleValue Value="CRYP_AES_CTR" Comment="AES CTR" Semaphore="Semaphore_CRYP_Coding_AESCTR$IpInstance"/>
<!--
        <PossibleValue Value="CRYP_AES_GCM" Comment="AES GCM" Semaphore="Semaphore_CRYP_Coding_AESGCM$IpInstance"/>
        <PossibleValue Value="CRYP_AES_CCM" Comment="AES CCM" Semaphore="Semaphore_CRYP_Coding_AESCCM$IpInstance"/>
-->
    </RefParameter>

    <RefParameter Name="DataType" Comment="Data type" DefaultValue="CRYP_DATATYPE_32B" Type="list" Group="Parameters">
        <Description>AES/TDES data type selection: 32-bit data, 16-bit data, 8-bit data or 1-bit string.&lt;br&gt;This parameter can be a value of @ref CRYP_Data_Type.&lt;br&gt;Possible values are:&lt;br&gt; CRYP_DATATYPE_32B&lt;br&gt; CRYP_DATATYPE_16B&lt;br&gt; CRYP_DATATYPE_8B&lt;br&gt; CRYP_DATATYPE_1B</Description>
        <PossibleValue Comment="32b" Value="CRYP_DATATYPE_32B"/>
        <PossibleValue Comment="16b" Value="CRYP_DATATYPE_16B"/>
        <PossibleValue Comment="8b" Value="CRYP_DATATYPE_8B"/>
        <PossibleValue Comment="1b" Value="CRYP_DATATYPE_1B"/>
    </RefParameter>

    <RefParameter Name="KeySize" Comment="Key size" DefaultValue="CRYP_KEYSIZE_128B" Type="list" Group="Parameters">
        <Condition Diagnostic="" Expression="((Semaphore_CRYP_Coding_AESGCM$IpInstance)|(Semaphore_CRYP_Coding_AESCCM$IpInstance)|(Semaphore_CRYP_Coding_AESCBC$IpInstance)|(Semaphore_CRYP_Coding_AESECB$IpInstance)|(Semaphore_CRYP_Coding_AESCTR$IpInstance))"/>
        <Description>Used only in AES mode: 128, 192 or 256 bit key length.&lt;br&gt;This parameter can be a value of @ref CRYP_Key_Size.&lt;br&gt;Possible values are:&lt;br&gt; CRYP_KEYSIZE_128B&lt;br&gt; CRYP_KEYSIZE_192B&lt;br&gt; CRYP_KEYSIZE_256B</Description>
        <PossibleValue Comment="128b" Value="CRYP_KEYSIZE_128B" Semaphore="Semaphore_CRYP_KEYSIZE_128B$IpInstance"/>
        <PossibleValue Comment="192b" Value="CRYP_KEYSIZE_192B" Semaphore="Semaphore_CRYP_KEYSIZE_192B$IpInstance"/>
        <PossibleValue Comment="256b" Value="CRYP_KEYSIZE_256B" Semaphore="Semaphore_CRYP_KEYSIZE_256B$IpInstance"/>
    </RefParameter>
    <RefParameter Name="KeySize" Comment="Key size" DefaultValue="null" Type="list" Group="Parameters" Visible="false">
        <Description>Fixed value for TDES and DES modes: 24 and 8 bytes</Description>
    </RefParameter>
    
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" Type="Array" ArraySize="4" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_128B$IpInstance)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" Type="Array" ArraySize="6" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_192B$IpInstance)|(Semaphore_CRYP_Coding_TDESECB$IpInstance)|(Semaphore_CRYP_Coding_TDESCBC$IpInstance)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" Type="Array" ArraySize="8" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_256B$IpInstance)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" Type="Array" ArraySize="2" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000">
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    
    <RefParameter Name="pInitVect" Comment="Initialization vector" Type="Array" ArraySize="2" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000">
        <Condition Diagnostic="" Expression="((Semaphore_CRYP_Coding_DESCBC$IpInstance)|(Semaphore_CRYP_Coding_TDESCBC$IpInstance))"/>
        <Description>Initialization vector (IV) is an arbitrary number that can be used along with a secret key for data encryption.&lt;br&gt;It is used also as initialization counter in CTR mode</Description>
    </RefParameter>
    <RefParameter Name="pInitVect" Comment="Initial Counter Block (ICB)" Type="Array" ArraySize="4" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000002">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_AESGCM$IpInstance)"/>
        <Description>A 16-byte Initial Counter Block (ICB), composed of two distinct fields:&lt;br&gt; – The initialization vector (IV): a 96-bit value that must be unique for each execution of the mode under a given key. Note that the GCM standard supports IV that are shorter than 96-bit, but in this case strict rules apply.&lt;br&gt;– The counter: a 32-bit big-endian integer that is incremented each time a block has been processed. According to NIST specification, the counter value is 0x2 when processing the first block of payload.</Description>
    </RefParameter>
    <RefParameter Name="pInitVect" Comment="Initialization vector" Type="Array" ArraySize="4" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_AESCTR$IpInstance)|(Semaphore_CRYP_Coding_AESCBC$IpInstance)"/>
        <Description>Initialization vector (IV) is an arbitrary number that can be used along with a secret key for data encryption.&lt;br&gt;It is used also as initialization counter in CTR mode</Description>
    </RefParameter>
    <RefParameter Name="pInitVect" Comment="Initialization vector" Type="list" Group="Parameters" DefaultValue="null" Visible="false">
        <Description>Not used</Description>
    </RefParameter>

<!--
    <RefParameter Name="Header" Comment="Header" Group="Parameters" Type="Array" Separator=" " ArraySize="1" ArrayTypeElement="uint32_t;16" DefaultValue="00000000" Visible="false">
        <Condition Diagnostic="" Expression="Semaphore_CRYP_Coding_AESGCM$IpInstance"/>
        <Description>The header also known as Additional Authentication Data is used for authentication</Description>
    </RefParameter>
    <RefParameter Name="Header" Comment="Header(B1)" Group="Parameters" Type="Array" Separator=" " ArraySize="4" ArrayTypeElement="uint32_t;16" DefaultValue="00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="Semaphore_CRYP_Coding_AESCCM$IpInstance"/>
        <Description>The header, also named B1 is used for authentication and composed of the associated data length and Associated Data.</Description>
    </RefParameter>
    <RefParameter Name="Header" Comment="Header" Group="Parameters" Type="list" DefaultValue="null" Visible="false">
        <Description>Not used.</Description>
    </RefParameter>

    <RefParameter Name="HeaderInput" Comment="Header" Group="Parameters" Type="StringRW"  DefaultValue="0">
        <Condition Diagnostic="" Expression="Semaphore_CRYP_Coding_AESGCM$IpInstance"/>
        <Description>The header, also known as Additional Authentication Data in GCM mode is used as first part of the message just after the Initial Counter Block (ICB), and precede the plain text message.&lt;br&gt; Input format: hexadecimal (ex: 0123456789abcdef)</Description>
    </RefParameter>
    <RefParameter Name="HeaderInput" Comment="Header input" Group="Parameters" Type="list" DefaultValue="null" Visible="false">
        <Description>Not used.</Description>
    </RefParameter>

    <RefParameter Name="HeaderSize" Comment="Header size" Group="Parameters" DefaultValue="0" Max="4294967295" Min="0" Type="String">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_AESGCM$IpInstance)"/>
        <Description>Header size in bytes</Description>
    </RefParameter>
    <RefParameter Name="HeaderSize" Comment="ALen" Group="Parameters" DefaultValue="4" Min="4" Max="4294967295" Type="integer" NoCheckOpt="false">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_AESCCM$IpInstance)"/>
        <Description>Lenght of 16-bytes blocks (B) associated to the Associated Data (A), part of CBC-MAC mode Counter</Description>
    </RefParameter>
    <RefParameter Name="HeaderSize" Comment="Header size" Group="Parameters" Type="list" DefaultValue="null" Visible="false">
        <Description>Not used</Description>
    </RefParameter>
    
    <RefParameter Name="B0" Comment="B0" Type="Array" ArraySize="4" ArrayTypeElement="uint32_t;16" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="Semaphore_CRYP_Coding_AESCCM$IpInstance"/>
        <Description>One 16-byte first authentication block, part of CBC-MAC mode Counter</Description>
    </RefParameter>
    <RefParameter Name="B0" Comment="B0" Group="Parameters" Type="list" DefaultValue="null" Visible="false">
        <Description>Not used</Description>
    </RefParameter>
-->
    
    <RefParameter Comment="Data width unit" DefaultValue="" Name="DataWidthUnit" Type="List" Group="Parameters">
        <Description> Data With Unit.By default, size unit is word</Description>
        <PossibleValue Comment="Word" Value="CRYP_DATAWIDTHUNIT_WORD"/>
        <PossibleValue Comment="Byte" Value="CRYP_DATAWIDTHUNIT_BYTE"/>
    </RefParameter>
    
    <RefMode Name="CRYP_Activate" HalMode ="CRYP">
        <ConfigForMode>CRYP_Init</ConfigForMode>
        <Parameter Name="Algorithm"/>
        <Parameter Name="DataType"/>
        <Parameter Name="KeySize"/>
        <Parameter Name="pKey"/>
        <Parameter Name="pInitVect"/>
<!--        <Parameter Name="HeaderSize"/>
        <Parameter Name="HeaderInput"/>
        <Parameter Name="Header"/>
        <Parameter Name="B0"/>
-->        <Parameter Name="DataWidthUnit"/>
    </RefMode>

    <ModeLogicOperator Name="OR">
		<Mode Name="CRYP_State" UserName="Activated">
			<ModeLogicOperator Name="XOR">
				<Mode Name="CRYP_Activate" UserName="Activated">
					<SignalLogicalOp Name="AND">
						<Signal Name="VS_CRYP" />
					</SignalLogicalOp>
					<Semaphore>S_CRYP</Semaphore>
				</Mode>
			</ModeLogicOperator>
		</Mode>
	</ModeLogicOperator>
    
    <!-- RefSignal for CRYP -->
    <RefSignal Name="VS_CRYP" Virtual="true"/>

</IP>
