<?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_Cube">

    <RefParameter Name="Algorithm" Comment="Data encryption type" DefaultValue="TDESECB" Type="list" Group="Algorithm">
        <Description>AES/TDES Data encryption types list</Description>
        <PossibleValue Value="TDESECB" Comment="TDES ECB" Semaphore="Semaphore_CRYP_Coding_TDESECB"/>
        <PossibleValue Value="TDESCBC" Comment="TDES CBC" Semaphore="Semaphore_CRYP_Coding_TDESCBC"/>
        <PossibleValue Value="DESECB" Comment="DES ECB" Semaphore="Semaphore_CRYP_Coding_DESECB"/>
        <PossibleValue Value="DESCBC" Comment="DES CBC" Semaphore="Semaphore_CRYP_Coding_DESCBC"/>
        <PossibleValue Value="AESECB" Comment="AES ECB" Semaphore="Semaphore_CRYP_Coding_AESECB"/>
        <PossibleValue Value="AESCBC" Comment="AES CBC" Semaphore="Semaphore_CRYP_Coding_AESCBC"/>
        <PossibleValue Value="AESCTR" Comment="AES CTR" Semaphore="Semaphore_CRYP_Coding_AESCTR"/>
    </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_AESCBC)|(Semaphore_CRYP_Coding_AESECB)|(Semaphore_CRYP_Coding_AESCTR))"/>
        <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"/>
        <PossibleValue Comment="192b" Value="CRYP_KEYSIZE_192B" Semaphore="Semaphore_CRYP_KEYSIZE_192B"/>
        <PossibleValue Comment="256b" Value="CRYP_KEYSIZE_256B" Semaphore="Semaphore_CRYP_KEYSIZE_256B"/>
    </RefParameter>
    <RefParameter Name="KeySize" Comment="Key size" DefaultValue="null" Type="list" Group="Parameters" Visible="false">
        <Condition Diagnostic="" Expression="((Semaphore_CRYP_Coding_DESECB)|(Semaphore_CRYP_Coding_DESCCB)|(Semaphore_CRYP_Coding_TDESECB)|(Semaphore_CRYP_Coding_TDESCBC))"/>
        <Description>Used only in AES mode only : 128, 192 or 256 bit key length.</Description>
    </RefParameter>

    <RefParameter Name="pKey" Comment="Encryption/Decryption key" ArraySize="16" ArrayTypeElement="uint8_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_128B)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" ArraySize="24" ArrayTypeElement="uint8_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_192B)|(Semaphore_CRYP_Coding_TDESECB)|(Semaphore_CRYP_Coding_TDESCBC)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" ArraySize="32" ArrayTypeElement="uint8_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_256B)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" ArraySize="8" ArrayTypeElement="uint8_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_DESECB)|(Semaphore_CRYP_Coding_DESCBC)"/>
        <Description>pKey is the key used for Encryption/Decryption</Description>
    </RefParameter>

    <RefParameter Name="pInitVect" Comment="Initialization vector" ArraySize="16" ArrayTypeElement="uint8_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00">
        <Condition Diagnostic="" Expression="((Semaphore_CRYP_Coding_AESCBC)|(Semaphore_CRYP_Coding_AESCTR))"/>
        <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" ArraySize="8" ArrayTypeElement="uint8_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_DESCBC)|(Semaphore_CRYP_Coding_TDESCBC)"/>
        <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">
        <Condition Diagnostic="" Expression="((Semaphore_CRYP_Coding_DESECB)|(Semaphore_CRYP_Coding_TDESECB)|(Semaphore_CRYP_Coding_AESECB))"/>
        <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>

    <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"/>
    </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>
