<?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="AES"
    Version="aes1_v1_0_Cube">

    <About>AES: Advanced Encryption Standard</About>

    <RefParameter Name="Data encryption types list" Comment="Data encryption type" DefaultValue="AESECB" Type="list" Group="Algorithm">
        <Description>AES Data encryption types list</Description>
        <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 Comment="Data type" DefaultValue="CRYP_DATATYPE_32B" Name="DataType" Type="list" Group="Parameters">
        <Description>AES 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 Comment="Encryption/Decryption key" ArraySize="16" ArrayTypeElement="uint8_t;16" Name="pKey" Type="Array" Separator=" " Group="Parameters" DefaultValue="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00">
        <Description>Encryption/Decryption key</Description>
    </RefParameter>

    <RefParameter Comment="Initialization vector" ArraySize="16" ArrayTypeElement="uint8_t;16" Name="pInitVect" 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 in CBC mode, used also for 32-bit counter initialization in CTR mode</Description>
    </RefParameter>
    <RefParameter Comment="Initialization vector" Name="pInitVect" Type="list" Group="Parameters" DefaultValue="null" Visible="false">
        <Condition Diagnostic="" Expression="Semaphore_CRYP_Coding_AESECB"/>    
        <Description>Initialization Vector in CBC mode</Description>
    </RefParameter>

    <RefMode Name="AES_Activate" HalMode ="AES">
    <ConfigForMode>AES_Init</ConfigForMode>
        <Parameter Name="Data encryption types list"/>
        <Parameter Name="DataType"/>
        <Parameter Name="pKey"/>
        <Parameter Name="pInitVect"/>
    </RefMode>

    <ModeLogicOperator Name="OR">
          <Mode Name="AES_State" UserName="Activated">
              <ModeLogicOperator Name="XOR">
                  <Mode Name="AES_Activate" UserName="Activated">
                      <SignalLogicalOp Name="AND">
                          <Signal Name="VS_AES" />
                      </SignalLogicalOp>
                      <Semaphore>S_AES</Semaphore>
                  </Mode>
              </ModeLogicOperator>
          </Mode>
      </ModeLogicOperator>
    
    <!-- RefSignal for AES -->
    <RefSignal Name="VS_AES" Virtual="true"/>
        
</IP>
