<?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="aes3_v1_0_F7_Cube">

    <About>AES: Advanced Encryption Standard</About>
    
    <RefParameter Name="Algorithm" Comment="Data encryption type" DefaultValue="CRYP_AES_ECB" Type="list" Group="Algorithm">
        <Description>AES Data encryption types list</Description>
        <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_GMAC" Comment="AES GCM GMAC" Semaphore="Semaphore_CRYP_Coding_AESGCM$IpInstance"/>
        <PossibleValue Value="CRYP_AES_CCM" Comment="AES CCM" Semaphore="Semaphore_CRYP_Coding_AESCCM$IpInstance"/>
    </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="KeySize" DefaultValue="CRYP_KEYSIZE_128B" Name="KeySize" Type="list" Group="Parameters">
        <Description>Key size selection: 128 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_256B</Description>
        <PossibleValue Comment="128b" Value="CRYP_KEYSIZE_128B" Semaphore="Semaphore_CRYP_KEYSIZE_128B$IpInstance"/>
        <PossibleValue Comment="256b" Value="CRYP_KEYSIZE_256B" Semaphore="Semaphore_CRYP_KEYSIZE_256B$IpInstance"/>
    </RefParameter>


    <RefParameter Name="pKey" Comment="Encryption/Decryption key" ArraySize="4" ArrayTypeElement="uint32_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_128B$IpInstance)"/>
        <Description>Encryption/Decryption key</Description>
    </RefParameter>
    <RefParameter Name="pKey" Comment="Encryption/Decryption key" ArraySize="8" ArrayTypeElement="uint32_t;16" Type="Array" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_KEYSIZE_256B$IpInstance)"/>
        <Description>Encryption/Decryption key</Description>
    </RefParameter>

    <RefParameter Comment="Initialization vector" ArraySize="4" ArrayTypeElement="uint32_t;16" Name="pInitVect" Type="Array" Separator=" " Group="Parameters" DefaultValue="00000000 00000000 00000000 00000000">
        <Condition Diagnostic="" Expression="((Semaphore_CRYP_Coding_AESCBC$IpInstance)|(Semaphore_CRYP_Coding_AESCTR$IpInstance)|(Semaphore_CRYP_Coding_AESGCM$IpInstance))"/>
        <Description>Initialization Vector used for CTR, CBC,GCM GMAC, CMAC (and CCM when applicable) modes</Description>
    </RefParameter>
    <RefParameter Comment="Initialization vector" Name="pInitVect" Type="list" Group="Parameters" DefaultValue="null" Visible="false">
        <Condition Diagnostic="" Expression="(Semaphore_CRYP_Coding_AESECB$IpInstance)|(Semaphore_CRYP_Coding_AES_CCM$IpInstance)"/>
        <Description>Initialization Vector used for CTR, CBC,GCM GMAC, CMAC (and CCM when applicable) modes</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(Additional Authentication Data)" 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>The size of header buffer in word</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>

    <RefParameter Comment="Key and IV configuration skip" DefaultValue="CRYP_KEYIVCONFIG_ALWAYS" Name="KeyIVConfigSkip" Type="List" Group="Parameters">
        <Description> CRYP peripheral Key and IV configuration skip, to config Key and Initialization Vector only once and to skip configuration for consecutive processings. This parameter can be a value of @ref CRYP_Configuration_Skip</Description>
        <PossibleValue Comment="Always" Value="CRYP_KEYIVCONFIG_ALWAYS"/>
        <PossibleValue Comment="Once" Value="CRYP_KEYIVCONFIG_ONCE"/>
    </RefParameter>

    <RefMode Name="AES_Activate" HalMode ="AES">
        <ConfigForMode>AES_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"/>
        <Parameter Name="KeyIVConfigSkip"/>
    </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>
