﻿<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes"?>
<!-- generate a table of contents -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<?rfc compact="no" ?>
<!-- do start each main section on a new page -->



<rfc category="info" docName="draft-iplir-protocol-01" ipr="trust200902">

    <front>
        <title abbrev="Abbreviated Title">
            IPlir network layer security protocol
        </title>

        <author fullname="Davletshina Alexandra" initials="A." role="editor" surname="Davletshina">
            <organization>InfoTeCS</organization>
            <address>
                <postal>
                    <street>2B stroenie 1, ul. Otradnaya </street>
                    <city>Moscow</city>
                    <code>127273</code>
                    <country>Russian Federation</country>
                </postal>
                <phone>+7 (495) 737-61-92</phone>
                <email>Aleksandra.Davletshina@infotecs.ru</email>
            </address>
        </author>
		
		<author fullname="Urivskiy Alexey" initials="A." surname="Urivskiy">
            <organization>InfoTeCS</organization>
            <address>
                <postal>
                    <street>2B stroenie 1, ul. Otradnaya </street>
                    <city>Moscow</city>
                    <code>127273</code>
                    <country>Russian Federation</country>
                </postal>
                <phone>+7 (495) 737-61-92</phone>
                <email>urivskiy@infotecs.ru</email>
            </address>
        </author>
		
		<author fullname="Rybkin Andrey" initials="A." surname="Rybkin">
            <organization>InfoTeCS</organization>
            <address>
                <postal>
                    <street>2B stroenie 1, ul. Otradnaya </street>
                    <city>Moscow</city>
                    <code>127273</code>
                    <country>Russian Federation</country>
                </postal>
                <phone>+7 (495) 737-61-92</phone>
                <email>Andrey.Rybkin@infotecs.ru</email>
            </address>
        </author>
		
		<author fullname="Tychina Leonid" initials="L." surname="Tychina">
            <organization>InfoTeCS</organization>
            <address>
                <postal>
                    <street>2B stroenie 1, ul. Otradnaya </street>
                    <city>Moscow</city>
                    <code>127273</code>
                    <country>Russian Federation</country>
                </postal>
                <phone>+7 (495) 737-61-92</phone>
                <email>tychina@infotecs.ru</email>
            </address>
        </author>
		
		<author fullname="Parshin Ilia" initials="I." surname="Parshin">
            <organization>InfoTeCS</organization>
            <address>
                <postal>
                    <street>2B stroenie 1, ul. Otradnaya </street>
                    <city>Moscow</city>
                    <code>127273</code>
                    <country>Russian Federation</country>
                </postal>
                <phone>+7 (495) 737-61-92</phone>
                <email>Parshin.Ilia@infotecs.ru</email>
            </address>
        </author>
        

        <date year="2022" />
        <!--если не указываем число и месяц, они подставляются автоматически-->
        <area>General</area>
        <!--как в rfc7748-->
        <workgroup>Network Working Group</workgroup>
        <keyword>list of keywords</keyword>

        <abstract>
            <t>
                This document specifies the IPlir network layer security protocol. It 
				describes how to provide a set of security services for traffic over 
				public and corporate networks using the TCP/IP stack.
            </t>        
        </abstract>
    </front>


    <middle>
        <section title="Introduction" anchor="Introduction">
			<section title="Scope" anchor="Scope">
				<t>
					The IPlir protocol may be used to protect IP packets during their 
					transmission via communication channels. IP packet protection means 
					ensuring integrity and authenticity of the data source of the packets 
					with an option of also ensuring their confidentiality. For this purpose, 
					when IPlir is applied, encapsulation of source IP packets, calculation 
					of message authentication codes for the encapsulated packets and service 
					information along with optional packet encryption are used. In addition, 
					the IPlir protocol allows for protection against replay attacks based on 
					the use of counter values and/or timestamps.
				</t>
				<t>
					The IPlir protocol can be used to create Virtual Private Networks at the 
					3rd (network) layer of the basic ISO OSI reference model. Data is 
					protected during transfer of IP packets between any two hosts supporting 
					the IPlir protocol, including options of data exchange between two end 
					hosts, an end host and a security gateway, and two security gateways. 
					All protection mechanisms are implemented without establishing a 
					connection (in terms of network) between the two interacting hosts.
				</t>
				<t>
					This document is not a Security Architecture for the Internet; it 
					addresses security only at the network layer, provided through the 
					use of a combination of cryptographic and protocol security mechanisms.
				</t>
				<t>
					This document does not have IETF consensus and does not imply IETF 
					support for IPlir.
				</t>
			</section>
			<section title="Audience" anchor="Audience">
				<t>
					The target audience for this document is primarily individuals who 
					implement this network layer security technology or who architect 
					systems that will use this technology. Technically adept users of this 
					technology (end users or system administrators) also are part of the 
					target audience.  
				</t>
				<t>
					This document assumes that the reader is familiar with the Internet 
					Protocol (IP), related networking technology, and general information 
					system security terms and concepts.
				</t>
			</section>          
        </section>

        <section title="Conventions Used in This Document">
            <t>
                The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", 
				"SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this 
				document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> 
				<xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
            </t>
        </section>
        
        <section title="Definitions and Notations" anchor="Terms">
			<section title="Definitions" anchor="Definitions">
				<t>
					This document uses the following terms and definitions:
				<list style="empty">
					<t>AEAD: Authenticated Encryption with Associated Data,</t>
					<t>cryptographic suite: a set of cryptographic algorithms and 
						parameters used in the IPlir,</t>
					<t>CTR mode: a block cipher mode of operation when a cipher key 
						stream is applied to plaintext data under a specific law,</t>
					<t>derived key: a key derived from the shared secret (original 
						key) and random and/or fixed mutually known data,</t>
					<t>end-to-end MAC: MAC implemented between the source and destination hosts,</t>
					<t>exchange key: a key known only to the specified pair of hosts 
						used to derive keys,</t>
					<t>host (network host): a network device with a unique ID and IPlir support,</t>
					<t>initializing value: a value transmitted over the communication 
						channel and used in defining the starting point of a symmetric 
						cryptographic technique,</t>
					<t>IP packet (network packet): a logically indivisible data block at 
						the network layer of the basic ISO OSI reference model relating to the IP,</t>
					<t>IPlir message: the data contained in the IPlir packet body,</t>
					<t>IPlir operation mode: one of the three IPlir operating modes: 
						transport, light tunnel, and tunnel,</t>
					<t>IPlir packet: an IP packet protected by IPlir,</t>
					<t>IPlir packets reception policy: a set of rules for processing incoming 
						IPlir packets,</t>
					<t>key: a sequence of symbols that controls the operation of a 
						cryptographic transformation,</t>
					<t>key system: a set of keys, their deployment and management subsystems,</t>
					<t>MAC (message authentication code): a fixed-length string of bits 
						(tag) computed by applying a symmetric cryptographic technique to the 
						message and appended to that message in order to provide its integrity 
						and authenticity of the data source,</t>
					<t>network host context: the information necessary to process/create IPlir 
						packets from/to the network host logically related to the given one,</t>
					<t>security policy: a set of rules for IP traffic processing by the network host,</t>
					<t>sender host: the host creating an IPlir packet from a source IP packet,</t>
					<t>source IP packet: an IP packet before it was protected by the IPlir,</t>
					<t>symmetric cryptographic technique: a cryptographic technique that uses 
						the same key for both the originator’s and recipient’s transformation,</t>
					<t>recipient host: the host recovering the source IP packet from an IPlir packet,</t>
					<t>routing of IPlir packets: a function of forwarding IPlir packets by a 
						network host during reception of IPlir packets addressed to this network 
						host from the IP perspective, but for which it is not the recipient host,</t>
					<t>transit MAC: MAC implemented between two neighbor hosts in a packet 
						transfer chain,</t>
					<t>transit host: the host implementing the function of routing IPlir packets.</t>
				</list>
				</t>
			</section>
			<section title="Notations" anchor="Notations">
				<t>
					The following notations are used in this document:
				</t>
				<texttable align="left" style="none">
				<ttcol align="left"></ttcol>
				<ttcol align="left"></ttcol>
				
				<c>V^{*}</c>
				<c>a set of all finite length binary strings, including an empty string</c>
				
				<c>|x|</c>
				<c>the length (number of components) of the string x \in V^{*}</c>
				
				<c>V_s</c>
				<c>a set of all binary strings with a length of s, where s is a non-negative integer; 
					numbering of substrings and components is right-to-left, starting with zero</c>
				
				<c>x||y</c>
				<c>concatenation of binary strings x and y from V^{*}, i.e., a string from V_{|x|+|y|}, 
					wherein the left substring from V_{|x|} is the same as string x, and the right 
					substring from V_{|y|} is the same as string y</c>
					
				<c>0^r</c>
				<c>a binary string consisting of r zeros</c>
				
				<c>LSB_s(x)</c>
				<c>truncation of binary string x with a length of m, m &gt;= s, to a binary string 
					with a length of s according to the following rule: 
					LSB_s(x_{m-1} || ... || x_1 || x_0) = x_{s-1} || ... || x_1 || x_0, xi \in V_1, 
					i = 0,1,…,m-1</c>
					
				<c>IntToVec_s(x)</c>
				<c>representation of the ring element x \in Z_{2^s} as a binary string 
					with a length of s: for x = x_0 + 2 * x_1 + ... + 2^{s-1} * x_{s-1}, 
					where x_i \in V_1, i = 0,1,…,s-1, the following equation is true 
					IntToVec_s(x) = x_{s-1} || ... || x_1 || x_0</c>
					
				<c>CharToByte(c)</c>
				<c>representation of the c symbol as a binary string of length 8 calculated 
					according to the following rule: CharToByte(c) = 0 || IntToVec_7(ASCII(c)), 
					where ASCII(c) \in Z_{2^7} is the ASCII representation of the c symbol</c>
					
				<c>StrToVec_s(string)</c>
				<c>representation of the string of symbols string = 'c_{m-1}c_{m-2}...c_0' consisting 
					of m symbols as a binary string with a length of s, s &gt;= 8*m according to 
					the following rule: StrToVec_s('c_{m-1}c_{m-2}...c_0') = 
					0^{s-8*m} || CharToByte(c_{m-1}) || CharToByte(c_{m-2}) || ... || CharToByte(c_0)</c>
				
				<c>K_ENC</c>
				<c>packet encryption key. The length of the value is determined by the used cryptographic 
					suite</c>
					
				<c>K_MAC</c>
				<c>packet end-to-end MAC key. The length of the value is determined by the used 
					cryptographic suite</c>
					
				<c>K_AEAD</c>
				<c>packet encryption and end-to-end MAC key. The length of the value is determined 
					by the used cryptographic suite</c>
					
				<c>K_TMAC</c>
				<c>packet transit MAC key. The length of the value is determined by the used 
					cryptographic suite</c>
				
				<c>Version</c>
				<c>IPlir header version. This document describes the IPlir header of Version = 1. 
					The field length is 8 bit</c>
				
				<c>CS</c>
				<c>cryptographic suite identifier determining the contents of cryptographic mechanisms 
					and their parameters used to create the IPlir packet. The field length is 8 bit</c>
				
				<c>T</c>
				<c>the transit MAC field flag. If T = 1, the IPlir trailer contains fields 
					TransitIdentifier, TransitIntegrityCheckValue and TransitInitValue, otherwise 
					the fields are absent. When calculating and checking the end-to-end MAC (ICV) 
					insert the T field has to be set to 0. The field length is 1 bit</c>
					
				<c>D</c>
				<c>the DestinationIdentifier field flag. If D = 1, the header contains the 
					DestinationIdentifier field, otherwise the field is absent. The destination 
					host identifier is required for routing of IPlir packets. The field length is 
					1 bit</c>
					
				<c>ExtID</c>
				<c>the flag of extended network host identifiers. If ExtID = 0, all the network 
					host identifiers (the SourceIdentifier field and, if available, 
					DestinationIdentifier and TransitIdentifier fields) are 32 bits long. 
					If ExtID = 1, all the network host identifiers are 64 bits long. 
					The field length is 1 bit</c>
					
				<c>ExtSN</c>
				<c>the packet extended sequence number flag. If ExtSN=0, the packet SequenceNumber 
					field is 32 bits long. If ExtSN = 1, the SequenceNumber field is 64 bits long. 
					The field length is 1 bit</c>
					
				<c>DAR</c>
				<c>the flag of disabling the anti-replay mechanism. The use of the flag is regulated 
					by security policies. The field length is 1 bit</c>
					
				<c>R1</c>
				<c>the field reserved for future use. When IPlir header is generated, the field must 
					contain all zeros. The receiving end must not analyze the field content. 
					The field length is 3 bits</c>
					
				<c>KN</c>
				<c>the number of the exchange key used to encrypt and calculate the end-to-end MAC, 
					but not the transit MAC. The field length is 4 bits</c>
				
				<c>TKN</c>
				<c>the number of the exchange key used to calculate the transit MAC. 
					If the transit MAC is not used, i.e., T = 0, the field value should be 0. 
					When calculating and checking the end-to-end MAC (ICV), the TKN field must be 
					filled with zeros. The field length is 4 bits</c>
					
				<c>Timestamp</c>
				<c>packet send time. The field contains the send time value based on the astronomical 
					clock of the sender host in the POSIX time format less 0x40000000 seconds. 
					The estimated overflow time is the year 2140. The field length is 32 bits</c>
					
				<c>SourceIdentifier</c>
				<c>the source host identifier used by the destination host to identify the IPlir 
					packet sender and the related context of the sender host for packet processing. 
					The field length is 32 bits with ExtID = 0, or 64 bits with ExtID = 1</c>
				
				<c>DestinationIdentifier</c>
				<c>the destination host identifier required for routing of IPlir packets. 
					The field is available, if D = 0. The field length is 32 bits with ExtID = 0, 
					or 64 bits with ExtID = 1</c>
					
				<c>SequenceNumber</c>
				<c>the packet sequence number; an unsigned integer. The field length is 32 bits 
					with ExtSN = 0, or 64 bits with ExtSN = 1</c>
					
				<c>InitValue (IV)</c>
				<c>an end-to-end initializing value that can be used to execute encryption 
					operations and calculate an end-to-end MAC, as well as to derive keys for 
					these operations. The field length is determined by the used cryptographic suite</c>
					
				<c>Type, Length, Value</c>
				<c>(type, length, value) tuples enabling transmission of additional information 
					within the IPlir packet. Type is the type of the value in the Value field. 
					The field length is 8 bit. Length is the byte length of the Value field. 
					The field length is 8 bit. Value is random data of the Type type</c>
					
				<c>PayloadData</c>
				<c>a variable-length field containing the source IP packet or its part, 
					depending on the IPlir operation mode</c>
					
				<c>Staffing</c>
				<c>a (network) filler to make the length of the IPlir suitable for more efficient 
					providing of the IPlir message processing. The Staffing field contains a sequence 
					of integers in a binary form: the first byte contains digit 1, the second one 
					contains 2, etc. The value length is determined by the SL field value, if SL is 
					absent (S = 0) or has the value 0, there is no Staffing field</c>
					
				<c>SL</c>
				<c>the number of bytes in the Staffing field. The field is available, if S = 1. 
					The field length is 8 bit</c>
					
				<c>Mode</c>
				<c>the mode in which the IPlir packet was generated in. The field length is 2 bits</c>
				
				<c>TLV</c>
				<c>Type, Length and Value field flag. If TLV = 1, the IPlir body begins with tuples 
					(Type, Length, Value), otherwise there are no tuples. The field length is 1 bit</c>
				
				<c>S</c>
				<c>the SL field flag. If S = 1, the IPlir body contains the SL field, otherwise this 
					field is absent. The field length is 1 bit</c>
					
				<c>R2</c>
				<c>the field reserved for future use. When an IPlir message is generated, the field 
					must contain all zeros. The receiving end must not analyze the field content. 
					The field length is 4 bits</c>
					
				<c>NextHeader</c>
				<c>the source IP packet protocol number. The field length is 8 bit</c>
				
				<c>IntegrityCheckValue (ICV)</c>
				<c>an end-to-end MAC calculated for the data from the IPlir message start and to the 
					NextHeader field inclusive. The field length is determined by the used 
					cryptographic suite</c>
					
				<c>TransitIdentifier</c>
				<c>the identifier of the transit host that routed the IPlir packet last. 
					Each transit host updates the field value with its identifier. 
					The field is available, if T = 1. The field length is 32 bits with ExtID = 0, 
					or 64 bits with ExtID = 1</c>
					
				<c>TransitInitValue (TIV)</c>
				<c>the transit initializing value used to calculate a transit MAC and derive keys 
					for packet transit MAC. The field is available, if T = 1. The field length is 
					determined by the used cryptographic suite</c>
					
				<c>TransitIntegrityCheckValue (TICV)</c>
				<c>a transit MAC calculated for the data from the IPlir message start and to the 
					TransitInitValue field inclusive. The field is available, if T = 1. 
					The field length is determined by the used cryptographic suite</c>
				</texttable>
			</section>   
        </section>
		
		<section title="System overview" anchor="System">
			<section title="IPlir packet contents" anchor="Packet">
			<t>
				The IPlir packet structure is shown in Figure 1. 

				<figure align="left" title="IPlir packet structure">
				<artwork align="center">
+------------+------------+--------------------+
| IP header  | UDP header | IPlir message      |
+------------+------------+--------------------+
				</artwork>
				</figure>
			</t>
			<t>
				The IP header is the header of a standard IP packet.
			</t>
			<t>
				The UDP header is a standard UDP header only existing when additional encapsulation of 
				the IPlir message in a UDP message is used. The IPlir protocol uses UDP destination port 
				number 55777 as a default port.
			</t>
			<t>
				The IPlir message is the main part of the IPlir packet that includes protected data from 
				the source IP packet and plaintext data required for IPlir packet processing.
			</t>
			</section>
			
			<section title="IPlir message content" anchor="Message">
			<t>
				The IPlir message contains:
				<list style="symbols">
				<t>IPlir header containing plaintext information related to encapsulation and protection 
					of the source IP packet;</t>
				<t>IPlir body containing information the encryption of which is optional;</t>
				<t>IPlir trailer containing MACs, the transit host identifier, and the transit initializing value.</t>
				</list>
			</t>
			<t>
				The IPlir message structure is shown in Figure 2.
				
				<figure align="left" title="IPlir message structure">
				<artwork align="left">
+---+---------------+---------------+---------------+---------------+
|   |       0       |       1       |       2       |       3       |
+---+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Bit|7|6|5|4|3|2|1|0|7|6|5|4|3|2|1|0|7|6|5|4|3|2|1|0|7|6|5|4|3|2|1|0|
+---+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   |               |               | | |E|E| |     |       |       |
| I |               |               | | |x|x|D|     |       |       |
| P |    Version    |      CS       |T|D|t|t|A| R1  |  KN   |  TKN  |
| l |               |               | | |I|S|R|     |       |       |
| i |               |               | | |D|N| |     |       |       |
| r +---------------+---------------+-+-+-+-+-+-----+-------+-------+
|   |   Timestamp                                                   |
|   +---------------------------------------------------------------+
| h |   SourceIdentifier                                            |
| e +---------------------------------------------------------------+
| a |   DestinationIdentifier                                       |
| d +---------------------------------------------------------------+
| e |   SequenceNumber                                              |
| r +---------------------------------------------------------------+
|   |   InitValue                                                   |
+---+---------------+---------------+-------------------------------+
|   |   Type_1      |   Length_1    |   Value_1 (Length_1 byte)     |
|   +---------------+---------------+-------------------------------+
| I |   ...                                                         |
| P +---------------+---------------+-------------------------------+
| l |   Type_n      |   Length_n    |   Value_n (Length_n byte)     |
| i +---------------+---------------+-------------------------------+
| r |   PayloadData                                                 |
|   +---------------------------------------------------------------+
| b |   Staffing                                                    |
| o |               +---------------+---+-+-+-------+---------------+
| d |               |               | M |T| |       |               |
| y |               |      SL       | o |L|S|  R2   |  NextHeader   |
|   |               |               | d |V| |       |               |
|   |               |               | e | | |       |               |
+---+---------------+---------------+---+-+-+-------+---------------+
|  t|   IntegrityCheckValue (ICV)                                   |
|I r+---------------------------------------------------------------+
|P a|   TransitIdentifier                                           |
|l i+---------------------------------------------------------------+
|i l|   TransitInitValue                                            |
|r e+---------------------------------------------------------------+
|  r|   TransitIntegrityCheckValue (TICV)                           |
+---+---------------------------------------------------------------+
				</artwork>
				</figure>
			</t>
			<t>
				The IPlir message fields have a big-endian order of bytes. The numbering is left-to-right, 
				the lead bytes have lower numbers. Numbering of bits inside bytes is right-to-left, the high 
				bits have higher numbers.
			</t>
			</section>
			
			<section title="Tuples (type, length, value)" anchor="Tuples">
			<t>
				Tuples (Type, Length, Value) enable transmission of additional information within the IPlir 
				message. The TLV field value indicates whether there are tuples. If its value is 1, there 
				is one or more tuples in the beginning of the IPlir body. 
			</t>
			<t>
				The Value field of any tuple should be divisible by 8 bits. The Length field indicates 
				the Value field length in bytes.
			</t>
			<t>
				Permissible Type field values for the tuples are provided in Table 1.
			</t>	
			<texttable align="left" style="all" title="Type Field Values for Tuples">
			<ttcol align="center">Type value</ttcol>
			<ttcol align="center">Description</ttcol>
			
			<c>0</c>
			<c>the last tuple in the IPlir message; can be used by the vendor for its own needs</c>
			
			<c>1</c>
			<c>a pair of IPv4 addresses</c>
			
			<c>2</c>
			<c>a pair of IPv6 addresses</c>
			
			<c>3-128</c>
			<c>not in use</c>
			
			<c>129-254</c>
			<c>can be used by the vendor for its own needs</c>
			
			<c>255</c>
			<c>not in use</c>
			</texttable>
			<t>
				The last tuple in the message is always type 0. The length of this tuple should be chosen so 
				as to ensure effective IPlir message processing.
			</t>
			
				<section title="Pair of IPv4 addresses" anchor="IPv4">
				<t>
					The Value field of the tuple of this type contains a pair of IPv4 addresses. The sender’s 
					address comes first, followed by the recipient’s address. The addresses are transmitted 
					in the network byte order. 
				</t>
				<t>
					The main function of the tuple of this type is to preserve the IPv4 addresses from 
					the source IP packet in the “Light tunnel” mode.
				</t>
				<t>
					The tuple structure is shown in Figure 3.
				</t>
				<figure align="left" title="Type = 1 Tuple Structure">
				<artwork align="left">
+------+--------------+--------------+--------------+--------------+
|Bytes |      0       |      1       |      2       |      3       |
+------+--------------+--------------+--------------+--------------+
|      |              |              |Sender IPv4   |              |
|      |   Type = 1   |  Length = 8  |address, byte |     ...      |
|      |              |              |No.1 (MSB)    |              |
|      +--------------+--------------+--------------+--------------+
| TLV  |              |Sender IPv4   |Recipient IPv4|              |
|      |     ...      |address, byte |address, byte |     ...      |
| area |              |No.4 (LSB)    |No.1 (MSB)    |              |
|      +--------------+--------------+--------------+--------------+
|      |              |Recipient IPv4|              |              |
|      |     ...      |address, byte |  Not in use  |  Not in use  |
|      |              |No.4 (LSB)    |              |              |
+------+--------------+--------------+--------------+--------------+
				</artwork>
				</figure>
				<t>
					Note: Bytes labeled “not in use” contain information related to the following tuple.
				</t>
				</section>
				
				<section title="Pair of IPv6 addresses" anchor="IPv6">
				<t>
					The Value field of the tuple of this type contains a pair of IPv6 addresses. 
					The sender’s address comes first, followed by the recipient’s address. 
					The addresses are transmitted in the network byte order. 
				</t>
				<t>
					The main function of the tuple of this type is to preserve the IPv6 addresses 
					from the source IP packet in the “Light tunnel” mode.
				</t>
				<t>
					The tuple structure is shown in Figure 4.
				</t>
				<figure align="left" title="Type = 2 Tuple Structure">
				<artwork align="left">
+------+--------------+--------------+--------------+--------------+
|Bytes |      0       |      1       |      2       |      3       |
+------+--------------+--------------+--------------+--------------+
|      |              |              |Sender IPv6   |              |
|      |   Type = 2   |  Length = 32 |address, byte |     ...      |
|      |              |              |No.1 (MSB)    |              |
|      +--------------+--------------+--------------+--------------+
|      |                            ...                            |
|      +--------------+--------------+--------------+--------------+
| TLV  |              |Sender IPv6   |Recipient IPv6|              |
|      |     ...      |address, byte |address, byte |     ...      |
| area |              |No.16 (LSB)   |No.1 (MSB)    |              |
|      +--------------+--------------+--------------+--------------+
|      |                            ...                            |
|      +--------------+--------------+--------------+--------------+
|      |              |Recipient IPv6|              |              |
|      |     ...      |address, byte |  Not in use  |  Not in use  |
|      |              |No.16 (LSB)   |              |              |
+------+--------------+--------------+--------------+--------------+
				</artwork>
				</figure>
				<t>
					Note: Bytes labeled “not in use” contain information related to the following tuple.
				</t>
				</section>
			</section>
			
			<section title="IPlir packet structure and IPlir header location" anchor="Mode">
			<t>
				The IPlir protocol can operate in three modes: transport, tunnel, and light tunnel. 
				The transport and light tunnel modes ensure protection of the data generated by protocols 
				above the IP level in the basic ISO OSI reference model, in particular, by the transport 
				layer. The tunnel mode ensures protection of the entire source IP packet.
			</t>
			<t>
				The receiving end determines what mode the packet was sent in based on the Mode field value. 
				Possible field values are shown in Table 2.
			</t>
			<texttable align="left" style="all" title="Table 2 – Mode Field Values">
			<ttcol align="center">Mode field value</ttcol>
			<ttcol align="center">Mode description</ttcol>
			
			<c>0</c>
			<c>transport mode</c>
			
			<c>1</c>
			<c>light tunnel mode (“light tunnel”)</c>
			
			<c>2</c>
			<c>tunnel mode (“tunnel” mode)</c>
			
			<c>3</c>
			<c>reserved for future needs</c>
			</texttable>
			
				<section title="Transport mode" anchor="Transport">
				<t>
					In the transport mode, the IPlir header and (Type, Length, Value)-tupples follow the 
					IP header and precede the header of the next layer (e.g., TCP, UDP, ICMP, etc.). 
					In the IPv4 context, it means that the IPlir header is located after the IP header, 
					including all options in the source IP packet, but before the header of the next level 
					protocol. 
				</t>
				<t>
					Figure 5 shows an example of IP packet protection using the IPlir in the transport mode.
				</t>
				<figure align="left" title="IP Packet Protection Using IPlir in the Transport Mode">
				<artwork align="left">
+-------------------------+     +--------------------------+
|    Source IP packet     |     |       IPlir packet       |
|  +-------------------+  |     |  +--------------------+  |
|  |     IP header     |----------&gt;|     IP header      |  |
|  +-------------------+  |     |  +--------------------+  |
|  |  IP packet data   |-----+  |  |    IPlir header    |  |
|  +-------------------+  |  |  |  +--------------------+  |
+-------------------------+  |  |  |     IPlir body     |  |
                             |  |  | +----------------+ |  |
                             +------&gt;| IP packet data | |  |
                                |  | +----------------+ |  |
                                |  +--------------------+  |
                                |  |    IPlir trailer   |  |
                                |  +--------------------+  |
                                +--------------------------+				
				</artwork>
				</figure>
				<t>
					In the IPv6 context, the IPlir header is addressed to the destination endpoint. 
					Therefore, it should be placed after the Hop-by-hop, Routing, and Fragmentation extension headers. 
					The Destination Options extension headers can be located before, after, or on both sides of the 
					IPlir header, depending on the required semantics. However, since the IPlir protocol can ensure 
					privacy of only the fields following the IPlir header, the recipient options should follow 
					the IPlir header.
				</t>
				</section>
				
				<section title="Light tunnel" anchor="Light">
				<t>
					Location of the IPlir header and (Type, Length, Value)-tuples in the light tunnel mode is the 
					same as in the transport mode, except that the set of tuples in the IPlir body must include 
					type 1 tuple (two IPv4 addresses) or type 2 tuple (two IPv6 addresses), wherein the sender 
					and recipient’s addresses from the IP header of the source IP packet. The tuple type is 
					dictated by the version of the IP header of the source IP packet. 
				</t>
				<t>
					The recipient host can restore the initial IP addresses from the available tuple Value field.
				</t>
				<t>
					Unlike the transport mode, the light tunnel mode makes it possible to change addresses in the IPlir packet IP header.
				</t>
				<t>
					Figure 6 shows an example of IP packet protection using the IPlir in the light tunnel mode. 
				</t>
				<figure align="left" title="IP Packet Protection Using IPlir in the Light Tunnel Mode">
				<artwork align="left">
+--------------------------+     +------------------------------+
|     Source IP packet     |     |         IPlir packet         |
|  +--------------------+  |     |  +------------------------+  |
|  |     IP header      |  |     |  |       IP header        |  |
|  | +----------------+ |  |     |  | +--------------------+ |  |
|  | |   Source IP    | |  |     |  | |     Source IP      | |  |
|  | +----------------+ |----------&gt;| +--------------------+-------+
|  | | Destination IP | |  |     |  | |   Destination IP   | |  |  |
|  | +----------------+ |  |     |  | +--------------------+ |  |  |
|  +--------------------+  |     |  +------------------------+  |  |
|  |   IP packet data   |-----+  |  |      IPlir header      |  |  |
|  +--------------------+  |  |  |  +------------------------+  |  |
+--------------------------+  |  |  |       IPlir body       |  |  |
                              |  |  | +--------------------+ |  |  |
                              |  |  | |        TLV         | |  |  |
                              |  |  | | +----------------+ | |  |  |
                              |  |  | | |   Source IP    | | |  |  |
                              |  |  | | +----------------+&lt;--------+
                              |  |  | | | Destination IP | | |  |
                              |  |  | | +----------------+ | |  |
                              |  |  | +--------------------+ |  |
                              +------&gt;|   IP packet data   | |  |
                                 |  | +--------------------+ |  |
                                 |  +------------------------+  |
                                 |  |      IPlir trailer     |  |
                                 |  +------------------------+  |
                                 +------------------------------+				
				</artwork>
				</figure>
				</section>
				
				<section title="Tunnel mode" anchor="Tunnel">
				<t>
					Unlike the other modes, the tunnel mode protects the entire source IP packet, including its IP header. 
				</t>
				<t>
					In the tunnel mode, a new IP header is generated with its contents based on the destination host 
					context and the source host IP routing table, followed by the IPlir header and tuples (Type, Length, Value). 
					This is followed by the source IP packet.
				</t>
				<t>
					Versions of the source and new IP headers can be different. It means that IPv6 packets can be 
					transmitted via the IPv4 protocol and vice versa.
				</t>
				<t>
					Figure 7 shows an example of IP packet protection using the IPlir in the tunnel mode.  
				</t>
				<figure align="left" title="IP Packet Protection Using IPlir in the Tunnel Mode">
				<artwork align="left">
+-------------------------+      +--------------------------+
|    Source IP packet     |      |       IPlir packet       |
|  +-------------------+  |      |  +--------------------+  |
|  |     IP header     |-------+ |  |     IP header      |  |
|  +-------------------+  |    | |  +--------------------+  |
|  |  IP packet data   |----+  | |  |    IPlir header    |  |
|  +-------------------+  | |  | |  +--------------------+  |
+-------------------------+ |  | |  |     IPlir body     |  |
                            |  | |  | +----------------+ |  |
                            |  +-----&gt;|   IP header    | |  |
                            |    |  | +----------------+ |  |
                            +--------&gt;| IP packet data | |  |
                                 |  | +----------------+ |  |
                                 |  +--------------------+  |
                                 |  |    IPlir trailer   |  |
                                 |  +--------------------+  |
                                 +--------------------------+				
				</artwork>
				</figure>
				</section>
			</section>	
        </section>
		
		<section title="Security Considerations" anchor="Security">
		<t>
			Possible values of function arguments in the algorithms above are limited by whether 
			they can be used as conversion input parameters.
		</t>
		
			<section title="Encryption and MAC" anchor="Encryption">
			<t>
				To ensure packet confidentiality, the IPlir protocol provides for a possibility to 
				encrypt it using a symmetric cryptographic technique. Packet encryption in IPlir is 
				recommended, but not required. Encryption can be disabled by selecting a separate 
				cryptographic suite clearly indicating that there is no encryption. In case of encryption, 
				it is applied between the sender and recipient hosts regardless of the transfer network 
				topology and existence of intermediate hosts.
			</t>
			<t>
				To ensure packet integrity and authenticity of the data source, the IPlir protocol allows for MAC. 
				Packet MAC can be end-to-end and transit. End-to-end MAC is applied between the sender and 
				recipient hosts, and is mandatory. Transit MAC is applied between two neighbor hosts 
				in a packet transfer chain, and is optional.
			</t>
			<t>
				To ensure both confidentiality, and integrity and authenticity of the data source of the packet 
				at the same time, either separate encryption and MAC algorithms may be used, or AEAD algorithms 
				to encrypt and calculate MAC simultaneously.
			</t>			
			</section>
			
			<section title="Cryptographic keys" anchor="Key">
			<t>
				It is implied that there is a key system that provides the interacting hosts with necessary 
				exchange keys and controls their synchronization. Keys can be managed manually or automatically.
			</t>
			<t>
				The exchange keys required to process a specific packet with all their mandatory attributes 
				(meta data) are available when packet processing starts.
			</t>
			<t>
				Correct functioning of the IPlir protocol requires a host numbering system where each host 
				is assigned a unique identifier. Each exchange key related to the specific pair of hosts is 
				indexed with the corresponding pair of their identifiers. Key systems where several exchange 
				keys (not more than 16) exist simultaneously for the two hosts can be used. To make it possible, 
				each exchange key in the IPlir protocol is additionally indexed with an integer value between 
				0 and 15 (inclusive)  located in the KN or TKN field of the IPlir message and allowing to 
				unambiguously determine the exchange key for the two hosts.
			</t>
			<t>
				The peculiarity of IPlir is that unique packet encryption, end-to-end MAC and transit MAC keys 
				used in the corresponding cryptographic algorithms are derived for each IP packet based on the exchange keys. 
				The packet encryption, end-to-end MAC, and transit MAC keys derived for the same IP packet should be different, 
				except when AEAD algorithms are used, where one packet encryption and end-to-end MAC key is used 
				for encryption and end-to-end MAC of the packet.
			</t>
			<t>
				The exchange key used to derive packet encryption and end-to-end MAC keys (or packet encryption and 
				end-to-end MAC key) is determined by the KN field value of the IPlir message and identifiers of the 
				sender and recipient hosts. The exchange key used to derive the packet transit MAC key is determined 
				by the TKN field value of the IPlir message and identifiers of the interacting (transit) hosts.
			</t>
			<t>
				Exchange key types and methods to derive packet protection keys from them are determined by the cryptographic suite.
			</t>
			<t>
				For any unique key used in the IPlir protocol at any time it should be impossible to calculate it 
				from the other keys, except for calculation of derived keys for packet protection from 
				a specific exchange key.
			</t>
			<t>
				The maximum quantity of material that can be processed using the same key should be determined considering 
				theoretical limits arising from the use of particular cryptographic algorithms and practical limitations 
				arising during IPlir implementation. 
			</t>
			<t>
				The maximum number of keys (packet encryption, end-to-end MAC, transit MAC keys or packet encryption and 
				end-to-end MAC keys) derived from one exchange key should be determined considering theoretical limits 
				arising from the use of particular cryptographic algorithms and practical limitations arising during 
				IPlir implementation.
			</t>
			<t>
				When the allowed limit for a specific key is reached, the interacting parties should stop using it. 
				For protection of further interactions, the parties should use a key for which the allowed limit has 
				not been achieved, e.g., a new key.
			</t>			
			</section>
			
			<section title="Cryptographic suites" anchor="Suites">
			<t>
				The cryptographic algorithms and parameters used in the IPlir protocol make up a cryptographic suite 
				designated by its CS number in the CS field of each IPlir message. There can be up to 256 different 
				cryptographic suites in total. 
			</t>
			<t>
				Permissible CS field values are provided in Table 3:
			</t>
			<texttable align="left" style="all" title="Permissible CS Field Values">
			<ttcol align="center">CS value</ttcol>
			<ttcol align="center">Description</ttcol>
			
			<c>0</c>
			<c>not in use</c>
			
			<c>1</c>
			<c>MAGMA-MGM cryptographic suite </c>
			
			<c>2</c>
			<c>KUZN-CTR-CMAC cryptographic suite </c>
			
			<c>3-128</c>
			<c>not in use</c>
			
			<c>129</c>
			<c>AES-128-GCM cryptographic suite</c>
			
			<c>130-131</c>
			<c>can be used by the vendor for its own needs</c>
			
			<c>132</c>
			<c>AES-256-CTR-CMAC cryptographic suite</c>
			
			<c>133</c>
			<c>can be used by the vendor for its own needs</c>
			
			<c>134</c>
			<c>AES-256-CFB-CMAC cryptographic suite</c>
			
			<c>135-254</c>
			<c>can be used by the vendor for its own needs</c>
			
			<c>255</c>
			<c>Not in use</c>
			</texttable>
			<t>
				The list of main mechanisms and parameters defined and/or described in the cryptographic suite 
				is shown in Table 4:
			</t>
			<texttable align="left" style="all" title="Main Mechanisms And Parameters In The Cryptographic Suite">
			<ttcol align="center">Parameter</ttcol>
			<ttcol align="center">Description</ttcol>
			<ttcol align="center">Purpose</ttcol>
			
			<c>EncAlg</c>
			<c>encryption algorithm</c>
			<c>the algorithm is used to encrypt the packet</c>
			
			<c>MACAlg</c>
			<c>end-to-end MAC algorithm</c>
			<c>the algorithm is used to calculate packet end-to-end MAC</c>
			
			<c>TMACAlg</c>
			<c>transit MAC algorithm</c>
			<c>the algorithm is used to calculate packet transit MAC</c>
			
			<c>MACLen</c>
			<c>end-to-end MAC length</c>
			<c></c>
			
			<c>TMACLen</c>
			<c>transit MAC length</c>
			<c></c>
				
			<c>IVLen</c>
			<c>end-to-end initializing value length</c>
			<c>the initializing value can be used for packet encryption, end-to-end MAC, 
				and derivation of packet encryption keys and packet end-to-end MAC keys 
				(or packet encryption and end-to-end MAC keys)</c>
			
			<c>TIVLen</c>
			<c>transit initializing value length</c>
			<c>the initializing value can be used for packet transit MAC and derivation of packet transit MAC keys</c>
			
			<c>KDAlg</c>
			<c>algorithms of deriving packet protection keys from exchange keys</c>
			<c>the algorithms are used to derive packet encryption keys and packet end-to-end MAC keys 
				(or packet encryption and end-to-end MAC keys), and to derive packet transit MAC keys</c>
			</texttable>
			<t>
				All necessary parameters should be included in the cryptographic suite description. 
				Interpretation of values of specific cryptographic suite parameters is determined by the 
				cryptographic suite. If any parameter in the cryptographic suite is inapplicable or must be ignored, 
				it should be specified clearly.
			</t>
			
				<section title="MAGMA-MGM cryptographic suite: CS = 1" anchor="MGM">
				<t>
					MAGMA-MGM Cryptographic Suite Description:
				</t>
				<texttable align="left" style="all">
				<ttcol align="center">Parameter</ttcol>
				<ttcol align="center">Value</ttcol>
			
				<c>EncAlg</c>
				<c>GOST R 34.12–2015 (Magma) [RFC8891] in the MGM mode [RFC9058]   </c>
			
				<c>MACAlg</c>
				<c>GOST R 34.12–2015 (Magma) [RFC8891] in the MGM mode [RFC9058]   </c>
			
				<c>TMACAlg</c>
				<c>GOST R 34.12–2015 (Magma) [RFC8891] in the MGM mode [RFC9058]   </c>
			
				<c>MACLen</c>
				<c>32 bits</c>
			
				<c>TMACLen</c>
				<c>32 bits</c>
				
				<c>IVLen</c>
				<c>64 bits</c>
			
				<c>TIVLen</c>
				<c>64 bits</c>
			
				<c>KDAlg</c>
				<c>see the description below </c>
				</texttable>
				
					<section title="Exchange keys" anchor="KeyMGM">
					<t>
						For each pair of interacting hosts, there is a single exchange key with a length of 
						256 bits used for deriving of packet encryption and end-to-end MAC keys, as well as 
						packet transit MAC keys.
					</t>
					<t>
						There may be several exchange keys for a pair of interacting hosts. The KN field value of the IPlir message 
						(for derivation of packet encryption and end-to-end MAC keys) or the TKN field value of the IPlir message 
						(for derivation of packet transit MAC keys) is used to determine a specific single exchange key.
					</t>
					</section>
					
					<section title="Requirements for initializing values" anchor="IVMGM">
					<t>
						The end-to-end initializing value InitValue in the InitValue field of the IPlir message should have a 
						length of 64 bits and be unique for each IPlir packet the encryption and end-to-end MAC of which are 
						implemented by the same sender host using the same single exchange key.
					</t>
					<t>
						The transit initializing value TransitInitValue in the TransitInitValue field of the IPlir message should 
						have a length of 64 bits and be unique for each IPlir packet the transit MAC of which is implemented by 
						the same (transit) host using the same single exchange key.
					</t>
					</section>
					
					<section title="Key derivation algorithms" anchor="KDFMGM">
					<t>
						The packet encryption and end-to-end MAC key K_AEAD of-256 bit length is calculated as follows:
					</t>
					<t>
						K_AEAD = K_1 || K_2 || K_3 || K_4,
					</t>
					<t>
						where each value of K_i \in V_64, i = 1,2,3,4 is calculated as per GOST R 34.12–2015 (Magma) [RFC8891] 
						in the CMAC mode, as per GOST R 34.13–2015 [GOST3413-2015], wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified sender and recipient hosts, and the KN field 
							value of the IPlir message is used as the key,</t>
						<t>a binary string as shown below is used as the data: IntToVec_8(i)||Label||aL||IV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('AEAD'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>IV_KDF = InitValue, where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = SourceIdentifier, where SourceIdentifier is initialized by the SourceIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the InitValue, 
								SequenceNumber and SourceIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 256,</t>
							</list>
						</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The packet transit MAC key K_TMAC of 256-bit length is calculated as follows:
					</t>
					<t>
						K_TMAC = K_1 || K_2 || K_3 || K_4,
					</t>
					<t>
						where each value of K_i \in V_64, i = 1,2,3,4 is calculated as per GOST 34.12-2018 GOST R 34.12–2015 (Magma) [RFC8891] 
						in the CMAC mode, as per GOST R 34.13–2015 [GOST3413-2015], wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified (transit) hosts the IPlir packet passes through and the 
							TKN field value of the IPlir message is used as the key,</t>
						<t>a binary string as shown below is used as the data: IntToVec_8(i)||Label||aL||TIV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('TMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>TIV_KDF = TransitInitValue, where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = TransitIdentifier, where TransitIdentifier is initialized by the TransitIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the TransitInitValue, 
								SequenceNumber and TransitIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 256,</t>
							</list>
						</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					</section>
					
					<section title="Encryption and MAC algorithms" anchor="EncMGM">
					<t>
						Encryption of the IPlir body and calculation of the end-to-end MAC ICV in the IntegrityCheckValue field of the IPlir 
						message are implemented according to the GOST R 34.12–2015 (Magma) [RFC8891] in the MGM mode [RFC9058], wherein
						<list style="symbols">
						<t>the packet encryption and end-to-end MAC key K_AEAD is used as the key,</t>
						<t>data in the IPlir header fields in the order of their appearance in the IPlir message are used as associated authenticated data protected by MAC,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the value of IV_AEAD \in V_63 is used as a unique vector:
							<list style="none">
							<t>IV_AEAD = LSB_63(InitValue),</t>
							<t>where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							</list>
						</t>
						<t>the MAC length s is 32 bits.</t>
						</list>
					</t>
					<t>
						The diagram of encryption and end-to-end MAC is shown in Figure 8.
					</t>
					<figure align="left" title="Diagram of Encryption and End-to-End MAC Using the MAGMA-MGM Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+   
                |           IPlir header            |  
                |                ...                | 
                |   +---------------------------+   |  
           +--------|     SourceIdentifier      |   |  
           |    |   +---------------------------+   |  
           |    |                ...                |--------+  
           |    |   +---------------------------+   |        |
           +--------|      SequenceNumber       |   |        |
           |    |   +---------------------------+   |        |
           +--------|        InitValue          |---------+  |
           |    |   +---------------------------+   |     |  |
           |    +-----------------------------------+     |  |
           |    |            IPlir body             |--+  |  |  
           |    +-----------------------------------+  |  |  |
           |    |           IPlir trailer           |  |  |  |
           |    |                ...                |  |  |  |
           |    +-----------------------------------+  |  |  |   
           |                                           |  |  |
           v                                           v  v  v
+---------------------------------+            +-------------------+
| KDF based on GOST R 34.12-2015  |  +------+  | GOST R 34.12-2015 |
| (Magma) [RFC8891] in the CMAC   |-&gt;|K_AEAD|-&gt;| (Magma) [RFC8891] |
|       mode according to         |  +------+  | in the MGM mode   |
|GOST R 34.13-2015 [GOST3413-2015]|            |    [RFC9058]      |
+---------------------------------+            +-------------------+
                 ^                                      |    |      
                 |                                      |    |
     +-----------------------+                          |    |
     | Exchange keys between |                          |    |
     | source and destination|                          |    |
     |        hosts          |                          |    |
     +-----------------------+                          |    |
                                                        |    |
                +-----------------------------------+   |    |
                |           IPlir header            |   |    |
                |                ...                |   |    |
                |   +---------------------------+   |   |    |
                |   |     SourceIdentifier      |   |   |    | 
                |   +---------------------------+   |   |    |
                |                ...                |   |    |
                |   +---------------------------+   |   |    |
                |   |      SequenceNumber       |   |   |    |
                |   +---------------------------+   |   |    |
                |   |        InitValue          |   |   |    |
                |   +---------------------------+   |   |    |
                +-----------------------------------+   |    |
                |       Encrypted IPlir body        |&lt;--+    |  
                +-----------------------------------+        |
                |           IPlir trailer           |        |
                |   +---------------------------+   |        |
                |   |     InterityCheckValue    |&lt;-----------+
                |   +---------------------------+   |
                |                ...                |  
                +-----------------------------------+     		
					</artwork>
					</figure>
					<t>
						Calculation of the transit MAC TICV in the TransitIntegrityCheckValue field of the 
						IPlir message is implemented according to the GOST R 34.12–2015 (Magma) [RFC8891] 
						in the MGM mode  [RFC9058], wherein
						<list style="symbols">
						<t>the packet transit MAC key K_TMAC is used as the key,</t>
						<t>data in the IPlir header fields, the encrypted IPlir body and IntegrityCheckValue, TransitIdentifier, 
							TransitInitValue fields data in the order of their appearance in the IPlir message are used as associated 
							authenticated data protected by MAC,</t>
						<t>plaintext is an empty string,</t>
						<t>the value of TIV_AEAD \in V_63 is used as a unique vector:
							<list style="none">
							<t>TIV_AEAD = LSB_63(TransitInitValue),</t>
							<t>where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							</list>
						</t>
						<t>the MAC length s is 32 bits.</t>
						</list>
					</t>
					<t>
						The diagram of transit MAC is shown in Figure 9. The “null” value means an empty binary string.
					</t>
					<figure align="left" title="Diagram of Transit MAC Using the MAGMA-MGM Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+--+   
                |           IPlir header            |  |
                |                ...                |  |
                |   +---------------------------+   |  |
           +--------|      SequenceNumber       |   |  |
           |    |   +---------------------------+   |  |
           |    |                ...                |  |
           |    +-----------------------------------+  |
           |    |        Encrypted IPlir body       |  |-------+
           |    +-----------------------------------+  |       |
           |    |           IPlir trailer           |  |       |
           |    |                ...                |  |       |
           |    |   +---------------------------+   |  |       |
           +--------|     TransitIdentifier     |   |  |       |
           |    |   +---------------------------+   |  |       |
           +--------|                           |   |  |       |
           |    |   |     TransitInitValue      |   |  |       |
           |    | +-|                           |   |  |       |
           |    | | +---------------------------+---|--+       |
           |    | |              ...                |          |
           |    +-|---------------------------------+          |   
           |      |                                            |
           |      +--------------------------------------+     |
           |                           +------+          |     |
           |                           | null |----+     |     |
           |                           +------+    |     |     |
           v                                       v     v     v
+---------------------------------+            +-------------------+
| KDF based on GOST R 34.12-2015  |  +------+  | GOST R 34.12-2015 |
| (Magma) [RFC8891] in the CMAC   |-&gt;|K_TMAC|-&gt;| (Magma) [RFC8891] |
|       mode according to         |  +------+  | in the MGM mode   |
|GOST R 34.13-2015 [GOST3413-2015]|            |    [RFC9058]      |
+---------------------------------+            +-------------------+
                 ^                                    |      |
                 |                                    v      |
     +-----------------------+                    +------+   |
     | Exchange keys between |                    | null |   |
     |     transit hosts     |                    +------+   |
     +-----------------------+                               |
                                                             |
                +-----------------------------------+        |
                |           IPlir header            |        |
                |                ...                |        |
                |   +---------------------------+   |        |
                |   |      SequenceNumber       |   |        |
                |   +---------------------------+   |        |
                |                ...                |        |
                +-----------------------------------+        |
                |        Encrypted IPlir body       |        |
                +-----------------------------------+        |
                |           IPlir trailer           |        |
                |                ...                |        |
                |   +---------------------------+   |        |
                |   |     TransitIdentifier     |   |        |
                |   +---------------------------+   |        |
                |   |                           |   |        |
                |   |     TransitInitValue      |   |        |
                |   |                           |   |        |
                |   +---------------------------+   |        |
                |   | TransitInterityCheckValue |&lt;-----------+
                |   +---------------------------+   |                 
                +-----------------------------------+         		
					</artwork>
					</figure>
					</section>
				
				</section>
				
								<section title="KUZN-CTR-CMAC cryptographic suite: CS=2" anchor="KUZN">
				<t>
					AES-256-CTR-CMAC Cryptographic Suite Description:
				</t>
				<texttable align="left" style="all">
				<ttcol align="center">Parameter</ttcol>
				<ttcol align="center">Value</ttcol>
			
				<c>EncAlg</c>
				<c>GOST R 34.12-2015 (Kuznyechik) [RFC7801] in the CTR mode [GOST3413-2015]</c>
			
				<c>MACAlg</c>
				<c>GOST R 34.12-2015 (Kuznyechik) [RFC7801] in the CMAC mode [GOST3413-2015]</c>
			
				<c>TMACAlg</c>
				<c>GOST R 34.12-2015 (Kuznyechik) [RFC7801] in the CMAC mode [GOST3413-2015]</c>
			
				<c>MACLen</c>
				<c>64 bits</c>
			
				<c>TMACLen</c>
				<c>64 bits</c>
				
				<c>IVLen</c>
				<c>64 bits</c>
			
				<c>TIVLen</c>
				<c>64 bits</c>
			
				<c>KDAlg</c>
				<c>see the description below </c>
				</texttable>
				
					<section title="Exchange keys" anchor="KeyKUZN">
					<t>
						For each pair of interacting hosts, there is a single exchange key with a length of 256 bits 
						designed for derivation of packet encryption keys, end-to-end MAC keys, and transit MAC keys.
					</t>
					<t>
						There may be several exchange keys for a pair of interacting hosts. The KN field value of the 
						IPlir message (for derivation of packet encryption keys and packet end-to-end MAC keys) or the 
						TKN field value of the IPlir message (for derivation of packet transit MAC keys) is used to 
						determine a specific single exchange key.
					</t>
					</section>
					
					<section title="Requirements for initializing values" anchor="IVKUZN">
					<t>
						The end-to-end initializing value InitValue in the InitValue field of the IPlir message should 
						have a length of 64 bits and be unique for each IPlir packet the encryption and end-to-end MAC 
						of which are implemented by the same sender host using the same single exchange key.
					</t>
					<t>
						The transit initializing value TransitInitValue in the TransitInitValue field of the IPlir 
						message should have a length of 64 bits and be unique for each IPlir packet the transit MAC 
						of which is implemented by the same (transit) host using the same single exchange key.
					</t>
					</section>
					
					<section title="Key derivation algorithms" anchor="KDFKUZN">
					<t>
						The packet encryption key K_ENC of 256-bit length and the packet end-to-end MAC key K_MAC of 
						256-bit length are calculated as follows:
					</t>
					<t>
						K_ENC = K_1 || K_2,
					</t>
					<t>
						K_MAC = K_3 || K_4,
					</t>
					<t>
						where each value of K_i \in V_128, i = 1,2,3,4 is calculated as per GOST R 34.12-2015 
						(Kuznyechik) [RFC7801] in the CMAC mode [GOST3413-2015], wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified sender and recipient hosts, 
							and the KN field value of the IPlir message is used as the key,</t>
						<t>a binary string as shown below is used as the data: IntToVec_8(i)||Label||aL||IV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('ENCMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>IV_KDF = InitValue, where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = SourceIdentifier, where SourceIdentifier is initialized by the SourceIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the InitValue, 
								SequenceNumber and SourceIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 512,</t>
							</list>
						</t>
						<t>the MAC length s is 128 bits.</t>
						</list>
					</t>
					<t>
						The packet transit MAC key K_TMAC of 256-bit length is calculated as follows:
					</t>
					<t>
						K_TMAC = K_1 || K_2,
					</t>
					<t>
						where each value of K_i \in V_128, i = 1,2 is calculated as per GOST R 34.12-2015 
						(Kuznyechik) [RFC7801] in the CMAC mode [GOST3413-2015], wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified (transit) hosts the IPlir 
							packet passes through and the TKN field value of the IPlir message is used as the key,</t>
						<t>a binary string as shown below is used as the data: IntToVec_8(i)||Label||aL||TIV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('TMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>TIV_KDF = TransitInitValue, where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = TransitIdentifier, where TransitIdentifier is initialized by the TransitIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the TransitInitValue, 
								SequenceNumber and TransitIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 256,</t>
							</list>
						</t>
						<t>the MAC length s is 128 bits.</t>
						</list>
					</t>
					</section>
					
					<section title="Encryption and MAC algorithms" anchor="EncKUZN">
					<t>
						The IPlir body is encrypted according to the GOST R 34.12-2015 
						(Kuznyechik) [RFC7801] in the CTR mode [GOST3413-2015], wherein
						<list style="symbols">
						<t>the packet encryption key K_ENC is used as the key,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the value of IV_ENC \in V_64 is used as the initializing value:
							<list style="none">
							<t>IV_ENC = InitValue,</t>
							<t>where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							</list>
						</t>
						<t>the s key stream block length is 128 bits.</t>
						</list>
					</t>
					<t>
						Calculation of the end-to-end MAC ICV in the IntegrityCheckValue field of the IPlir message is implemented 
						according to the GOST R 34.12-2015 (Kuznyechik) [RFC7801] in the CMAC mode [GOST3413-2015], wherein
						<list style="symbols">
						<t>the packet end-to-end MAC key K_MAC is used as the key,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of encryption and end-to-end MAC is shown in Figure 10.
					</t>
					<figure align="left" title="Diagram of Encryption and End-to-End MAC Using the KUZN-CTR-CMAC Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+   
                |           IPlir header            |  
                |                ...                | 
                |   +---------------------------+   |  
           +--------|     SourceIdentifier      |   |  
           |    |   +---------------------------+   |  
           |    |                ...                |   
           |    |   +---------------------------+   |        
           +--------|      SequenceNumber       |   |        
           |    |   +---------------------------+   |        
           +--------|        InitValue          |----------+  
           |    |   +---------------------------+   |      |  
           |    +-----------------------------------+      |  
           |    |            IPlir body             |--+   |    
           |    +-----------------------------------+  |   |  
           |    |           IPlir trailer           |  |   |  
           |    |                ...                |  |   |  
           |    +-----------------------------------+  |   |     
           |                                           |   |  
           v                                           v   v  
+---------------------------------+  +------+  +-------------------+
| KDF based on GOST R 34.12-2015  |-&gt;|K_ENC |-&gt;| GOST R 34.12-2015 |
| (Kuznyechik) [RFC7801] in the   |  +------+  |   (Kuznyechik)    |
|     CMAC mode according to      |            | [RFC7801] in the  |
|GOST R 34.13-2015 [GOST3413-2015]|  +------+  |     CTR mode      |
|                                 |-&gt;|K_MAC |  |  [GOST3413-2015]  |
+---------------------------------+  +------+  +-------------------+
            ^                            |               |          
            |                            v               |    
+-----------------------+       +-------------------+    |    
| Exchange keys between |       | GOST R 34.12-2015 |    |    
| source and destination|   +---|   (Kuznyechik)    |    |    
|        hosts          |   |   | [RFC7801] in the  |    | 
+-----------------------+   |   |     CMAC mode     |    |
                            |   |  [GOST3413-2015]  |    |
                            |   +-------------------+    |
    +-----------------------+             ^              |
    |                                     |              |
    |   +---------------------------------+              |
    |   |                                                |    
    |   |   +---+-----------------------------------+    |    
    |   |   |   |           IPlir header            |    |    
    |   |   |   |                ...                |    |    
    |   |   |   |   +---------------------------+   |    |    
    |   |   |   |   |     SourceIdentifier      |   |    |     
    |   |   |   |   +---------------------------+   |    |    
    |   |   |   |                ...                |    |    
    |   +---|   |   +---------------------------+   |    |    
    |       |   |   |      SequenceNumber       |   |    |    
    |       |   |   +---------------------------+   |    |    
    |       |   |   |        InitValue          |   |    |    
    |       |   |   +---------------------------+   |    |    
    |       |   +-----------------------------------+    |    
    |       |   |       Encrypted IPlir body        |&lt;---+      
    |       +---+-----------------------------------+        
    |           |           IPlir trailer           |        
    |           |   +---------------------------+   |        
    +--------------&gt;|     InterityCheckValue    |   |         
                |   +---------------------------+   |
                |                ...                |  
                +-----------------------------------+     		
					</artwork>
					</figure>
					<t>
						Calculation of the transit MAC TICV in the TransitIntegrityCheckValue field of the 
						IPlir message is implemented according to the GOST R 34.12-2015 (Kuznyechik) [RFC7801] 
						in the CMAC mode [GOST3413-2015], wherein
						<list style="symbols">
						<t>the packet transit MAC key K_TMAC is used as the key,</t>
						<t>data in the IPlir header fields, the encrypted IPlir body and IntegrityCheckValue, TransitIdentifier, 
							TransitInitValue fields data in the order of their appearance in the IPlir message are used as associated 
							authenticated data protected by MAC,</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of transit MAC is shown in Figure 11. 
					</t>
					<figure align="left" title="Diagram of Transit MAC Using the KUZN-CTR-CMAC Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+--+   
                |           IPlir header            |  |
                |                ...                |  |
                |   +---------------------------+   |  | 
           +--------|      SequenceNumber       |   |  |
           |    |   +---------------------------+   |  |
           |    |                ...                |  |
           |    +-----------------------------------+  |
           |    |        Encrypted IPlir body       |  |---+
           |    +-----------------------------------+  |   |
           |    |           IPlir trailer           |  |   |
           |    |                ...                |  |   |
           |    |   +---------------------------+   |  |   |
           +--------|     TransitIdentifier     |   |  |   |
           |    |   +---------------------------+   |  |   |
           +--------|                           |   |  |   |
           |    |   |     TransitInitValue      |   |  |   |
           |    |   |                           |   |  |   |
           |    |   +---------------------------+---|--+   |
           |    |                ...                |      |
           |    +-----------------------------------+      |   
           |                                               |
           v                                               v
+---------------------------------+            +-------------------+
| KDF based on GOST R 34.12-2015  |  +------+  | GOST R 34.12-2015 |
| (Kuznyechik) [RFC7801] in the   |-&gt;|K_TMAC|-&gt;|   (Kuznyechik)    |
|     CMAC mode according to      |  +------+  | [RFC7801] in the  |
|GOST R 34.13-2015 [GOST3413-2015]|            |     CMAC mode     |
+---------------------------------+            |  [GOST3413-2015]  +
                 ^                             +-------------------+
                 |                                       |
                 |                                       |
     +-----------------------+                           |
     | Exchange keys between |                           |
     |     transit hosts     |                           |
     +-----------------------+                           |
                                                         |
                +-----------------------------------+    |
                |           IPlir header            |    |
                |                ...                |    |
                |   +---------------------------+   |    |
                |   |      SequenceNumber       |   |    |
                |   +---------------------------+   |    |
                |                ...                |    |
                +-----------------------------------+    |
                |        Encrypted IPlir body       |    |
                +-----------------------------------+    |
                |           IPlir trailer           |    |
                |                ...                |    |
                |   +---------------------------+   |    |
                |   |     TransitIdentifier     |   |    |
                |   +---------------------------+   |    |
                |   |                           |   |    |
                |   |     TransitInitValue      |   |    |
                |   |                           |   |    |
                |   +---------------------------+   |    |
                |   | TransitInterityCheckValue |&lt;-------+
                |   +---------------------------+   |                 
                +-----------------------------------+         		
					</artwork>
					</figure>
					</section>
				
				</section>
				
				<section title="AES-128-GCM cryptographic suite: CS = 129" anchor="GCM">
				<t>
					AES-128-GCM Cryptographic Suite Description:
				</t>
				<texttable align="left" style="all">
				<ttcol align="center">Parameter</ttcol>
				<ttcol align="center">Value</ttcol>
			
				<c>EncAlg</c>
				<c>AES-128 [NIST.FIPS.197] in the GCM mode [NIST.SP.800-38d]</c>
			
				<c>MACAlg</c>
				<c>AES-128 [NIST.FIPS.197] in the GCM mode [NIST.SP.800-38d]</c>
			
				<c>TMACAlg</c>
				<c>AES-128 [NIST.FIPS.197] in the GCM mode [NIST.SP.800-38d]</c>
			
				<c>MACLen</c>
				<c>64 bits</c>
			
				<c>TMACLen</c>
				<c>64 bits</c>
				
				<c>IVLen</c>
				<c>96 bits</c>
			
				<c>TIVLen</c>
				<c>96 bits</c>
			
				<c>KDAlg</c>
				<c>see the description below </c>
				</texttable>
				
					<section title="Exchange keys" anchor="KeyGCM">
					<t>
						For each pair of interacting hosts, there is a single exchange key with a length of 
						128 bits used for deriving of packet encryption and end-to-end MAC keys, as well as 
						packet transit MAC keys.
					</t>
					<t>
						There may be several exchange keys for a pair of interacting hosts. The KN field value of the IPlir message 
						(for derivation of packet encryption and end-to-end MAC keys) or the TKN field value of the IPlir message 
						(for derivation of packet transit MAC keys) is used to determine a specific single exchange key.
					</t>
					</section>
					
					<section title="Requirements for initializing values" anchor="IVGCM">
					<t>
						The end-to-end initializing value InitValue in the InitValue field of the IPlir message should have a 
						length of 96 bits and be unique for each IPlir packet the encryption and end-to-end MAC of which are 
						implemented by the same sender host using the same single exchange key.
					</t>
					<t>
						The transit initializing value TransitInitValue in the TransitInitValue field of the IPlir message should 
						have a length of 96 bits and be unique for each IPlir packet the transit MAC of which is implemented by 
						the same (transit) host using the same single exchange key.
					</t>
					</section>
					
					<section title="Key derivation algorithms" anchor="KDFGCM">
					<t>
						The packet encryption and end-to-end MAC key K_AEAD of-256 bit length is calculated as follows:
					</t>
					<t>
						K_AEAD = K_1,
					</t>
					<t>
						where value of K_1 \in V_128 is calculated as per KDF in Counter Mode [NIST.SP.800-108] using AES-128 
						[NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b] as the PRF, wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified sender and recipient hosts, and the KN field 
							value of the IPlir message is used as the key for the PRF,</t>
						<t>a binary string as shown below is used as the input data for the PRF: IntToVec_8(i)||Label||aL||IV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('AEAD'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>IV_KDF = InitValue, where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = SourceIdentifier, where SourceIdentifier is initialized by the SourceIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the InitValue, 
								SequenceNumber and SourceIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_8(OutputBitLength), where OutputBitLength = 128,</t>
							</list>
						</t>
						<t>the PRF output length is 128 bits.</t>
						</list>
					</t>
					<t>
						The packet transit MAC key K_TMAC of 128-bit length is calculated as follows:
					</t>
					<t>
						K_TMAC = K_1,
					</t>
					<t>
						where value of K_1 \in V_128 is calculated as per KDF in Counter Mode [NIST.SP.800-108] using AES-128 
						[NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b] as the PRF, wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified (transit) hosts the IPlir packet passes through and the 
							TKN field value of the IPlir message is used as the key for the PRF,</t>
						<t>a binary string as shown below is used as the input data for the PRF: IntToVec_8(i)||Label||aL||TIV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('TMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>TIV_KDF = TransitInitValue, where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = TransitIdentifier, where TransitIdentifier is initialized by the TransitIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the TransitInitValue, 
								SequenceNumber and TransitIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_8(OutputBitLength), where OutputBitLength = 128,</t>
							</list>
						</t>
						<t>the PRF output length is 128 bits.</t>
						</list>
					</t>
					</section>
					
					<section title="Encryption and MAC algorithms" anchor="EncGCM">
					<t>
						Encryption of the IPlir body and calculation of the end-to-end MAC ICV in the IntegrityCheckValue field of the IPlir 
						message are implemented according to the AES-128 [NIST.FIPS.197] in the GCM mode [NIST.SP.800-38d], wherein
						<list style="symbols">
						<t>the packet encryption and end-to-end MAC key K_AEAD is used as the key,</t>
						<t>data in the IPlir header fields in the order of their appearance in the IPlir message are used as associated authenticated data protected by MAC,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the value of IV_AEAD \in V_96 is used as a unique vector:
							<list style="none">
							<t>IV_AEAD = InitValue,</t>
							<t>where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							</list>
						</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of encryption and end-to-end MAC is shown in Figure 12.
					</t>
					<figure align="left" title="Figure 12 – Diagram of Encryption and End-to-End MAC Using the AES-128-GCM Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+   
                |           IPlir header            |  
                |                ...                | 
                |   +---------------------------+   |  
           +--------|     SourceIdentifier      |   |  
           |    |   +---------------------------+   |  
           |    |                ...                |--------+  
           |    |   +---------------------------+   |        |
           +--------|      SequenceNumber       |   |        |
           |    |   +---------------------------+   |        |
           +--------|        InitValue          |---------+  |
           |    |   +---------------------------+   |     |  |
           |    +-----------------------------------+     |  |
           |    |            IPlir body             |--+  |  |  
           |    +-----------------------------------+  |  |  |
           |    |           IPlir trailer           |  |  |  |
           |    |                ...                |  |  |  |
           |    +-----------------------------------+  |  |  |   
           |                                           |  |  |
           v                                           v  v  v
+---------------------------------+            +-------------------+
|     KDF in Counter Mode         |  +------+  |      AES-128      |
|   [NIST.SP.800-108] based on    |-&gt;|K_AEAD|-&gt;|  [NIST.FIPS.197]  |
| AES-128 [NIST.FIPS.197] in the  |  +------+  |  in the GCM mode  |
|   CMAC mode [NIST.SP.800-38b]   |            | [NIST.SP.800-38d] |
+---------------------------------+            +-------------------+
                 ^                                      |    |      
                 |                                      |    |
     +-----------------------+                          |    |
     | Exchange keys between |                          |    |
     | source and destination|                          |    |
     |        hosts          |                          |    |
     +-----------------------+                          |    |
                                                        |    |
                +-----------------------------------+   |    |
                |           IPlir header            |   |    |
                |                ...                |   |    |
                |   +---------------------------+   |   |    |
                |   |     SourceIdentifier      |   |   |    | 
                |   +---------------------------+   |   |    |
                |                ...                |   |    |
                |   +---------------------------+   |   |    |
                |   |      SequenceNumber       |   |   |    |
                |   +---------------------------+   |   |    |
                |   |        InitValue          |   |   |    |
                |   +---------------------------+   |   |    |
                +-----------------------------------+   |    |
                |       Encrypted IPlir body        |&lt;--+    |  
                +-----------------------------------+        |
                |           IPlir trailer           |        |
                |   +---------------------------+   |        |
                |   |     InterityCheckValue    |&lt;-----------+
                |   +---------------------------+   |
                |                ...                |  
                +-----------------------------------+     		
					</artwork>
					</figure>
					<t>
						Calculation of the transit MAC TICV in the TransitIntegrityCheckValue field of the 
						IPlir message is implemented according to the AES-128 [NIST.FIPS.197] in the GCM mode [NIST.SP.800-38d], wherein
						<list style="symbols">
						<t>the packet transit MAC key K_TMAC is used as the key,</t>
						<t>data in the IPlir header fields, the encrypted IPlir body and IntegrityCheckValue, TransitIdentifier, 
							TransitInitValue fields data in the order of their appearance in the IPlir message are used as associated 
							authenticated data protected by MAC,</t>
						<t>plaintext is an empty string,</t>
						<t>the value of TIV_AEAD \in V_96 is used as a unique vector:
							<list style="none">
							<t>TIV_AEAD = TransitInitValue,</t>
							<t>where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							</list>
						</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of transit MAC is shown in Figure 13. The “null” value means an empty binary string.
					</t>
					<figure align="left" title="Figure 13 – Diagram of Transit MAC Using the AES-128-GCM Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+--+   
                |           IPlir header            |  |
                |                ...                |  |
                |   +---------------------------+   |  |
           +--------|      SequenceNumber       |   |  |
           |    |   +---------------------------+   |  |
           |    |                ...                |  |
           |    +-----------------------------------+  |
           |    |        Encrypted IPlir body       |  |-------+
           |    +-----------------------------------+  |       |
           |    |           IPlir trailer           |  |       |
           |    |                ...                |  |       |
           |    |   +---------------------------+   |  |       |
           +--------|     TransitIdentifier     |   |  |       |
           |    |   +---------------------------+   |  |       |
           +--------|                           |   |  |       |
           |    |   |     TransitInitValue      |   |  |       |
           |    | +-|                           |   |  |       |
           |    | | +---------------------------+---|--+       |
           |    | |              ...                |          |
           |    +-|---------------------------------+          |   
           |      |                                            |
           |      +--------------------------------------+     |
           |                           +------+          |     |
           |                           | null |----+     |     |
           |                           +------+    |     |     |
           v                                       v     v     v
+---------------------------------+            +-------------------+
|     KDF in Counter Mode         |  +------+  |      AES-128      |
|   [NIST.SP.800-108] based on    |-&gt;|K_TMAC|-&gt;|  [NIST.FIPS.197]  |
| AES-128 [NIST.FIPS.197] in the  |  +------+  |  in the GCM mode  |
|   CMAC mode [NIST.SP.800-38b]   |            | [NIST.SP.800-38d] |
+---------------------------------+            +-------------------+
                 ^                                    |      |
                 |                                    v      |
     +-----------------------+                    +------+   |
     | Exchange keys between |                    | null |   |
     |     transit hosts     |                    +------+   |
     +-----------------------+                               |
                                                             |
                +-----------------------------------+        |
                |           IPlir header            |        |
                |                ...                |        |
                |   +---------------------------+   |        |
                |   |      SequenceNumber       |   |        |
                |   +---------------------------+   |        |
                |                ...                |        |
                +-----------------------------------+        |
                |        Encrypted IPlir body       |        |
                +-----------------------------------+        |
                |           IPlir trailer           |        |
                |                ...                |        |
                |   +---------------------------+   |        |
                |   |     TransitIdentifier     |   |        |
                |   +---------------------------+   |        |
                |   |                           |   |        |
                |   |     TransitInitValue      |   |        |
                |   |                           |   |        |
                |   +---------------------------+   |        |
                |   | TransitInterityCheckValue |&lt;-----------+
                |   +---------------------------+   |                 
                +-----------------------------------+         		
					</artwork>
					</figure>
					</section>
				
				</section>
				
				<section title="AES-256-CTR-CMAC cryptographic suite: CS = 132" anchor="AESCTRCMAC">
				<t>
					AES-256-CTR-CMAC Cryptographic Suite Description:
				</t>
				<texttable align="left" style="all">
				<ttcol align="center">Parameter</ttcol>
				<ttcol align="center">Value</ttcol>
			
				<c>EncAlg</c>
				<c>AES-256 [NIST.FIPS.197] in the CTR mode [NIST.SP.800-38a]</c>
			
				<c>MACAlg</c>
				<c>AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b]</c>
			
				<c>TMACAlg</c>
				<c>AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b]</c>
			
				<c>MACLen</c>
				<c>64 bits</c>
			
				<c>TMACLen</c>
				<c>64 bits</c>
				
				<c>IVLen</c>
				<c>64 bits</c>
			
				<c>TIVLen</c>
				<c>64 bits</c>
			
				<c>KDAlg</c>
				<c>see the description below </c>
				</texttable>
				
					<section title="Exchange keys" anchor="KeyAESCTRCMAC">
					<t>
						For each pair of interacting hosts, there is a single exchange key with a length of 256 bits 
						designed for derivation of packet encryption keys, end-to-end MAC keys, and transit MAC keys.
					</t>
					<t>
						There may be several exchange keys for a pair of interacting hosts. The KN field value of the 
						IPlir message (for derivation of packet encryption keys and packet end-to-end MAC keys) or the 
						TKN field value of the IPlir message (for derivation of packet transit MAC keys) is used to 
						determine a specific single exchange key.
					</t>
					</section>
					
					<section title="Requirements for initializing values" anchor="IVAESCTRCMAC">
					<t>
						The end-to-end initializing value InitValue in the InitValue field of the IPlir message should 
						have a length of 64 bits and be unique for each IPlir packet the encryption and end-to-end MAC 
						of which are implemented by the same sender host using the same single exchange key.
					</t>
					<t>
						The transit initializing value TransitInitValue in the TransitInitValue field of the IPlir 
						message should have a length of 64 bits and be unique for each IPlir packet the transit MAC 
						of which is implemented by the same (transit) host using the same single exchange key.
					</t>
					</section>
					
					<section title="Key derivation algorithms" anchor="KDFAESCTRCMAC">
					<t>
						The packet encryption key K_ENC of 256-bit length and the packet end-to-end MAC key K_MAC of 
						256-bit length are calculated as follows:
					</t>
					<t>
						K_ENC = K_1 || K_2,
					</t>
					<t>
						K_MAC = K_3 || K_4,
					</t>
					<t>
						where each value of K_i \in V_128, i = 1,2,3,4 is calculated as per KDF in Counter Mode [NIST.SP.800-108] using AES-256 
						[NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b] as the PRF, wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified sender and recipient hosts, and the KN field 
							value of the IPlir message is used as the key for the PRF,</t>
						<t>a binary string as shown below is used as the input data for the PRF: IntToVec_8(i)||Label||aL||IV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('ENCMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>IV_KDF = InitValue, where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = SourceIdentifier, where SourceIdentifier is initialized by the SourceIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the InitValue, 
								SequenceNumber and SourceIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_8(OutputBitLength), where OutputBitLength = 512,</t>
							</list>
						</t>
						<t>the PRF output length is 128 bits.</t>
						</list>
					</t>
					<t>
						The packet transit MAC key K_TMAC of 256-bit length is calculated as follows:
					</t>
					<t>
						K_TMAC = K_1 || K_2,
					</t>
					<t>
						where each value of K_i \in V_128, i = 1,2 is calculated as per KDF in Counter Mode [NIST.SP.800-108] using AES-256 
						[NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b] as the PRF, wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified (transit) hosts the IPlir packet passes through and the 
							TKN field value of the IPlir message is used as the key for the PRF,</t>
						<t>a binary string as shown below is used as the input data for the PRF: IntToVec_8(i)||Label||aL||TIV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('TMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>TIV_KDF = TransitInitValue, where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = TransitIdentifier, where TransitIdentifier is initialized by the TransitIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the TransitInitValue, 
								SequenceNumber and TransitIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 256,</t>
							</list>
						</t>
						<t>the PRF output length is 128 bits.</t>
						</list>
					</t>
					</section>
					
					<section title="Encryption and MAC algorithms" anchor="EncAESCTRCMAC">
					<t>
						The IPlir body is encrypted according to the AES-256 [NIST.FIPS.197] in the CTR mode [NIST.SP.800-38a], wherein
						<list style="symbols">
						<t>the packet encryption key K_ENC is used as the key,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the values of T_1, T_2, ... , T_n \in V_128 are used as counters in CTR mode:
							<list style="none">
							<t>T_i = InitValue || IntToVec_64(i), i = 1, 2, ... , n,</t>
							<t>where InitValue is initialized by the InitValue field value of the IPlir message.</t>
							</list>
						</t>
						</list>
					</t>
					<t>
						Calculation of the end-to-end MAC ICV in the IntegrityCheckValue field of the IPlir message is implemented 
						according to the AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b], wherein
						<list style="symbols">
						<t>the packet end-to-end MAC key K_MAC is used as the key,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of encryption and end-to-end MAC is shown in Figure 14.
					</t>
					<figure align="left" title="Figure 14 – Diagram of Encryption and End-to-End MAC Using the AES-256-CTR-CMAC Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+   
                |           IPlir header            |  
                |                ...                | 
                |   +---------------------------+   |  
           +--------|     SourceIdentifier      |   |  
           |    |   +---------------------------+   |  
           |    |                ...                |   
           |    |   +---------------------------+   |        
           +--------|      SequenceNumber       |   |        
           |    |   +---------------------------+   |        
           +--------|        InitValue          |----------+  
           |    |   +---------------------------+   |      |  
           |    +-----------------------------------+      |  
           |    |            IPlir body             |--+   |    
           |    +-----------------------------------+  |   |  
           |    |           IPlir trailer           |  |   |  
           |    |                ...                |  |   |  
           |    +-----------------------------------+  |   |     
           |                                           |   |  
           v                                           v   v  
+---------------------------------+  +------+  +-------------------+
|     KDF in Counter Mode         |-&gt;|K_ENC |-&gt;|      AES-256      |
|   [NIST.SP.800-108] based on    |  +------+  |  [NIST.FIPS.197]  |
| AES-256 [NIST.FIPS.197] in the  |            |  in the CTR mode  |
|   CMAC mode [NIST.SP.800-38b]   |  +------+  | [NIST.SP.800-38a] |
|                                 |-&gt;|K_MAC |  |                   |
+---------------------------------+  +------+  +-------------------+
            ^                            |               |          
            |                            v               |    
+-----------------------+       +-------------------+    |    
| Exchange keys between |       |      AES-256      |    |    
| source and destination|   +---|  [NIST.FIPS.197]  |    |    
|        hosts          |   |   | in the CMAC mode  |    | 
+-----------------------+   |   | [NIST.SP.800-38b] |    |
                            |   +-------------------+    |
    +-----------------------+             ^              |
    |                                     |              |
    |   +---------------------------------+              |
    |   |                                                |    
    |   |   +---+-----------------------------------+    |    
    |   |   |   |           IPlir header            |    |    
    |   |   |   |                ...                |    |    
    |   |   |   |   +---------------------------+   |    |    
    |   |   |   |   |     SourceIdentifier      |   |    |     
    |   |   |   |   +---------------------------+   |    |    
    |   |   |   |                ...                |    |    
    |   +---|   |   +---------------------------+   |    |    
    |       |   |   |      SequenceNumber       |   |    |    
    |       |   |   +---------------------------+   |    |    
    |       |   |   |        InitValue          |   |    |    
    |       |   |   +---------------------------+   |    |    
    |       |   +-----------------------------------+    |    
    |       |   |       Encrypted IPlir body        |&lt;---+      
    |       +---+-----------------------------------+        
    |           |           IPlir trailer           |        
    |           |   +---------------------------+   |        
    +--------------&gt;|     InterityCheckValue    |   |         
                |   +---------------------------+   |
                |                ...                |  
                +-----------------------------------+     		
					</artwork>
					</figure>
					<t>
						Calculation of the transit MAC TICV in the TransitIntegrityCheckValue field of the 
						IPlir message is implemented according to the AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b], wherein
						<list style="symbols">
						<t>the packet transit MAC key K_TMAC is used as the key,</t>
						<t>data in the IPlir header fields, the encrypted IPlir body and IntegrityCheckValue, TransitIdentifier, 
							TransitInitValue fields data in the order of their appearance in the IPlir message are used as associated 
							authenticated data protected by MAC,</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of transit MAC is shown in Figure 15. 
					</t>
					<figure align="left" title="Figure 15 – Diagram of Transit MAC Using the AES-256-CTR-CMAC Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+--+   
                |           IPlir header            |  |
                |                ...                |  |
                |   +---------------------------+   |  |
           +--------|      SequenceNumber       |   |  |
           |    |   +---------------------------+   |  |
           |    |                ...                |  |
           |    +-----------------------------------+  |
           |    |        Encrypted IPlir body       |  |---+
           |    +-----------------------------------+  |   |
           |    |           IPlir trailer           |  |   |
           |    |                ...                |  |   |
           |    |   +---------------------------+   |  |   |
           +--------|     TransitIdentifier     |   |  |   |
           |    |   +---------------------------+   |  |   |
           +--------|                           |   |  |   |
           |    |   |     TransitInitValue      |   |  |   |
           |    |   |                           |   |  |   |
           |    |   +---------------------------+---|--+   |
           |    |                ...                |      |
           |    +-----------------------------------+      |   
           |                                               |
           v                                               v
+---------------------------------+            +-------------------+
|     KDF in Counter Mode         |  +------+  |      AES-256      |
|   [NIST.SP.800-108] based on    |-&gt;|K_TMAC|-&gt;|  [NIST.FIPS.197]  |
| AES-256 [NIST.FIPS.197] in the  |  +------+  | in the CMAC mode  |
|   CMAC mode [NIST.SP.800-38b]   |            | [NIST.SP.800-38b] |
+---------------------------------+            +-------------------+
                 ^                                       |
                 |                                       |
     +-----------------------+                           |
     | Exchange keys between |                           |
     |     transit hosts     |                           |
     +-----------------------+                           |
                                                         |
                +-----------------------------------+    |
                |           IPlir header            |    |
                |                ...                |    |
                |   +---------------------------+   |    |
                |   |      SequenceNumber       |   |    |
                |   +---------------------------+   |    |
                |                ...                |    |
                +-----------------------------------+    |
                |        Encrypted IPlir body       |    |
                +-----------------------------------+    |
                |           IPlir trailer           |    |
                |                ...                |    |
                |   +---------------------------+   |    |
                |   |     TransitIdentifier     |   |    |
                |   +---------------------------+   |    |
                |   |                           |   |    |
                |   |     TransitInitValue      |   |    |
                |   |                           |   |    |
                |   +---------------------------+   |    |
                |   | TransitInterityCheckValue |&lt;-------+
                |   +---------------------------+   |                 
                +-----------------------------------+         		
					</artwork>
					</figure>
					</section>
				
				</section>

				<section title="AES-256-CFB-CMAC cryptographic suite: CS = 134" anchor="AESCFBCMAC">
				<t>
					AES-256-CTR-CMAC Cryptographic Suite Description:
				</t>
				<texttable align="left" style="all">
				<ttcol align="center">Parameter</ttcol>
				<ttcol align="center">Value</ttcol>
			
				<c>EncAlg</c>
				<c>AES-256 [NIST.FIPS.197] in the CFB mode [NIST.SP.800-38a]</c>
			
				<c>MACAlg</c>
				<c>AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b]</c>
			
				<c>TMACAlg</c>
				<c>AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b]</c>
			
				<c>MACLen</c>
				<c>64 bits</c>
			
				<c>TMACLen</c>
				<c>64 bits</c>
				
				<c>IVLen</c>
				<c>128 bits</c>
			
				<c>TIVLen</c>
				<c>64 bits</c>
			
				<c>KDAlg</c>
				<c>see the description below </c>
				</texttable>
				
					<section title="Exchange keys" anchor="KeyAESCFBCMAC">
					<t>
						For each pair of interacting hosts, there is a single exchange key with a length of 256 bits 
						designed for derivation of packet encryption keys, end-to-end MAC keys, and transit MAC keys.
					</t>
					<t>
						There may be several exchange keys for a pair of interacting hosts. The KN field value of the 
						IPlir message (for derivation of packet encryption keys and packet end-to-end MAC keys) or the 
						TKN field value of the IPlir message (for derivation of packet transit MAC keys) is used to 
						determine a specific single exchange key.
					</t>
					</section>
					
					<section title="Requirements for initializing values" anchor="IVAESCFBCMAC">
					<t>
						The end-to-end initializing value InitValue in the InitValue field of the IPlir message should 
						have a length of 128 bits and be unique for each IPlir packet the encryption and end-to-end MAC 
						of which are implemented by the same sender host using the same single exchange key.
					</t>
					<t>
						The transit initializing value TransitInitValue in the TransitInitValue field of the IPlir 
						message should have a length of 64 bits and be unique for each IPlir packet the transit MAC 
						of which is implemented by the same (transit) host using the same single exchange key.
					</t>
					</section>
					
					<section title="Key derivation algorithms" anchor="KDFAESCFBCMAC">
					<t>
						The packet encryption key K_ENC of 256-bit length and the packet end-to-end MAC key K_MAC of 
						256-bit length are calculated as follows:
					</t>
					<t>
						K_ENC = K_1 || K_2,
					</t>
					<t>
						K_MAC = K_3 || K_4,
					</t>
					<t>
						where each value of K_i \in V_128, i = 1,2,3,4 is calculated as per KDF in Counter Mode [NIST.SP.800-108] using AES-256 
						[NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b] as the PRF, wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified sender and recipient hosts, and the KN field 
							value of the IPlir message is used as the key for the PRF,</t>
						<t>a binary string as shown below is used as the input data for the PRF: IntToVec_8(i)||Label||aL||IV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('ENCMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>IV_KDF = InitValue, where InitValue is initialized by the InitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = SourceIdentifier, where SourceIdentifier is initialized by the SourceIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the InitValue, 
								SequenceNumber and SourceIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 512,</t>
							</list>
						</t>
						<t>the PRF output length is 128 bits.</t>
						</list>
					</t>
					<t>
						The packet transit MAC key K_TMAC of 256-bit length is calculated as follows:
					</t>
					<t>
						K_TMAC = K_1 || K_2,
					</t>
					<t>
						where each value of K_i \in V_128, i = 1,2 is calculated as per KDF in Counter Mode [NIST.SP.800-108] using AES-256 
						[NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b] as the PRF, wherein
						<list style="symbols">
						<t>the single exchange key corresponding to the specified (transit) hosts the IPlir packet passes through and the 
							TKN field value of the IPlir message is used as the key for the PRF,</t>
						<t>a binary string as shown below is used as the input data for the PRF: IntToVec_8(i)||Label||aL||TIV_KDF||SN||Node||cL||oL, where
							<list style="symbols">
							<t>Label = StrToVec_48('TMAC'),</t>
							<t>aL = IntToVec_8(LabelByteLength), where LabelByteLength = 6,</t>
							<t>TIV_KDF = TransitInitValue, where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
							<t>SN = SequenceNumber, where SequenceNumber is initialized by the SequenceNumber field value of the IPlir message,</t>
							<t>Node = TransitIdentifier, where TransitIdentifier is initialized by the TransitIdentifier field value of the IPlir message,</t>
							<t>cL = IntToVec_16(ContextByteLength), where ContextByteLength is the sum of byte lengths of the TransitInitValue, 
								SequenceNumber and TransitIdentifier fields of the IPlir message,</t>
							<t>oL = IntToVec_16(OutputBitLength), where OutputBitLength = 256,</t>
							</list>
						</t>
						<t>the PRF output length is 128 bits.</t>
						</list>
					</t>
					</section>
					
					<section title="Encryption and MAC algorithms" anchor="EncAESCFBCMAC">
					<t>
						The IPlir body is encrypted according to the AES-256 [NIST.FIPS.197] in the CFB mode [NIST.SP.800-38a], wherein
						<list style="symbols">
						<t>the packet encryption key K_ENC is used as the key,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the value of IV_ENC \in V_128 is used as the initializing value:
							<list style="none">
							<t>IV_ENC = InitValue,</t>
							<t>where InitValue is initialized by the InitValue field value of the IPlir message.</t>
							</list>
						</t>
						</list>
					</t>
					<t>
						Calculation of the end-to-end MAC ICV in the IntegrityCheckValue field of the IPlir message is implemented 
						according to the AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b], wherein
						<list style="symbols">
						<t>the packet end-to-end MAC key K_MAC is used as the key,</t>
						<t>data in the IPlir body fields in the order of their appearance in the IPlir message are used as plaintext,</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of encryption and end-to-end MAC is shown in Figure 16.
					</t>
					<figure align="left" title="Figure 16 – Diagram of Encryption and End-to-End MAC Using the AES-256-CFB-CMAC Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+   
                |           IPlir header            |  
                |                ...                | 
                |   +---------------------------+   |  
           +--------|     SourceIdentifier      |   |  
           |    |   +---------------------------+   |  
           |    |                ...                |   
           |    |   +---------------------------+   |        
           +--------|      SequenceNumber       |   |        
           |    |   +---------------------------+   |        
           +--------|        InitValue          |----------+  
           |    |   +---------------------------+   |      |  
           |    +-----------------------------------+      |  
           |    |            IPlir body             |--+   |    
           |    +-----------------------------------+  |   |  
           |    |           IPlir trailer           |  |   |  
           |    |                ...                |  |   |  
           |    +-----------------------------------+  |   |     
           |                                           |   |  
           v                                           v   v  
+---------------------------------+  +------+  +-------------------+
|     KDF in Counter Mode         |-&gt;|K_ENC |-&gt;|      AES-256      |
|   [NIST.SP.800-108] based on    |  +------+  |  [NIST.FIPS.197]  |
| AES-256 [NIST.FIPS.197] in the  |            |  in the CFB mode  |
|   CMAC mode [NIST.SP.800-38b]   |  +------+  | [NIST.SP.800-38a] |
|                                 |-&gt;|K_MAC |  |                   |
+---------------------------------+  +------+  +-------------------+
            ^                            |               |          
            |                            v               |    
+-----------------------+       +-------------------+    |    
| Exchange keys between |       |      AES-256      |    |    
| source and destination|   +---|  [NIST.FIPS.197]  |    |    
|        hosts          |   |   | in the CMAC mode  |    | 
+-----------------------+   |   | [NIST.SP.800-38b] |    |
                            |   +-------------------+    |
    +-----------------------+             ^              |
    |                                     |              |
    |   +---------------------------------+              |
    |   |                                                |    
    |   |   +---+-----------------------------------+    |    
    |   |   |   |           IPlir header            |    |    
    |   |   |   |                ...                |    |    
    |   |   |   |   +---------------------------+   |    |    
    |   |   |   |   |     SourceIdentifier      |   |    |     
    |   |   |   |   +---------------------------+   |    |    
    |   |   |   |                ...                |    |    
    |   +---|   |   +---------------------------+   |    |    
    |       |   |   |      SequenceNumber       |   |    |    
    |       |   |   +---------------------------+   |    |    
    |       |   |   |        InitValue          |   |    |    
    |       |   |   +---------------------------+   |    |    
    |       |   +-----------------------------------+    |    
    |       |   |       Encrypted IPlir body        |&lt;---+      
    |       +---+-----------------------------------+        
    |           |           IPlir trailer           |        
    |           |   +---------------------------+   |        
    +--------------&gt;|     InterityCheckValue    |   |         
                |   +---------------------------+   |
                |                ...                |  
                +-----------------------------------+     		
					</artwork>
					</figure>
					<t>
						Calculation of the transit MAC TICV in the TransitIntegrityCheckValue field of the 
						IPlir message is implemented according to the AES-256 [NIST.FIPS.197] in the CMAC mode [NIST.SP.800-38b], wherein
						<list style="symbols">
						<t>the packet transit MAC key K_TMAC is used as the key,</t>
						<t>data in the IPlir header fields, the encrypted IPlir body and IntegrityCheckValue, TransitIdentifier, 
							TransitInitValue fields data in the order of their appearance in the IPlir message are used as associated 
							authenticated data protected by MAC,</t>
						<t>the MAC length s is 64 bits.</t>
						</list>
					</t>
					<t>
						The diagram of transit MAC is shown in Figure 17. 
					</t>
					<figure align="left" title="Figure 17 – Diagram of Transit MAC Using the AES-256-CFB-CMAC Cryptographic Suite">
					<artwork align="left">
                +-----------------------------------+--+   
                |           IPlir header            |  |
                |                ...                |  |
                |   +---------------------------+   |  | 
           +--------|      SequenceNumber       |   |  |
           |    |   +---------------------------+   |  |
           |    |                ...                |  |
           |    +-----------------------------------+  |
           |    |        Encrypted IPlir body       |  |---+
           |    +-----------------------------------+  |   |
           |    |           IPlir trailer           |  |   |
           |    |                ...                |  |   |
           |    |   +---------------------------+   |  |   |
           +--------|     TransitIdentifier     |   |  |   |
           |    |   +---------------------------+   |  |   |
           +--------|                           |   |  |   |
           |    |   |     TransitInitValue      |   |  |   |
           |    |   |                           |   |  |   |
           |    |   +---------------------------+---|--+   |
           |    |                ...                |      |
           |    +-----------------------------------+      |   
           |                                               |
           v                                               v
+---------------------------------+            +-------------------+
|     KDF in Counter Mode         |  +------+  |      AES-256      |
|   [NIST.SP.800-108] based on    |-&gt;|K_TMAC|-&gt;|  [NIST.FIPS.197]  |
| AES-256 [NIST.FIPS.197] in the  |  +------+  | in the CMAC mode  |
|   CMAC mode [NIST.SP.800-38b]   |            | [NIST.SP.800-38b] |
+---------------------------------+            +-------------------+
                 ^                                       |
                 |                                       |
     +-----------------------+                           |
     | Exchange keys between |                           |
     |     transit hosts     |                           |
     +-----------------------+                           |
                                                         |
                +-----------------------------------+    |
                |           IPlir header            |    |
                |                ...                |    |
                |   +---------------------------+   |    |
                |   |      SequenceNumber       |   |    |
                |   +---------------------------+   |    |
                |                ...                |    |
                +-----------------------------------+    |
                |        Encrypted IPlir body       |    |
                +-----------------------------------+    |
                |           IPlir trailer           |    |
                |                ...                |    |
                |   +---------------------------+   |    |
                |   |     TransitIdentifier     |   |    |
                |   +---------------------------+   |    |
                |   |                           |   |    |
                |   |     TransitInitValue      |   |    |
                |   |                           |   |    |
                |   +---------------------------+   |    |
                |   | TransitInterityCheckValue |&lt;-------+
                |   +---------------------------+   |                 
                +-----------------------------------+         		
					</artwork>
					</figure>
					</section>
				
				</section>
					
			</section>
		
		</section>
		
		<section title="IPlir packet processing" anchor="Processing">
		<t>
			For cryptographic processing of network packets, the algorithms used and their application procedure 
			are determined by the cryptographic suite. 
		</t>
		<t>
			The cryptographic suite  for protection of the source IP packet is chosen depending on the corresponding 
			security policy of the sender host and the destination host context on the recipient end. The logic and 
			procedure of processing IPlir packets protected using a certain cryptographic suite depend on the IPlir 
			packet reception policy and the sender host context on the recipient end. The necessity and procedure of 
			using transit MAC are determined based on the sender host security policy and IPlir packet reception 
			policies of transit hosts and the recipient host.
		</t>
		<t>
			Depending on security policies and other requirements, protection of the recipient host or transit host 
			against replay of previously transmitted IPlir packets for reprocessing may be required. The IPlir protocol 
			makes it possible to arrange such protection by using counter values and/or timestamps, as well as by 
			tracking the history of their change on transit hosts and the recipient host. As an example, SequenceNumber, 
			InitValue, TransitInitValue field values can be used as counter values, Timestamp field values can be used as 
			timestamps. Description of specific mechanisms designed for protection against replay of previously transmitted 
			IPlir packets is beyond the scope of this document.
		</t>
		
			<section title="IP and IPlir packet fragmentation" anchor="Fragmentation">
			<t>
				When packing data in IP packets, the IP protocol can fragment (break down into fragments) messages of 
				the higher transport layer protocols UDP, TCP, etc. This processing results in several (linked) 
				IP packets, each called an IP fragment.
			</t>
			<t>
				The IPlir protocol in transport and light tunnel modes should only be applied to whole (non-fragmented) 
				IP packets, but not IP fragments. In the tunnel mode, the IPlir protocol can be applied to both whole IP 
				packets and IP fragments.
			</t>
			<t>
				In case of encapsulation in IPv4, the IPlir packet, just like any other IPv4 packet, can be fragmented 
				by routers during transmission. Before the IPlir packet is processed on the end of the recipient or 
				transit host, the IPlir packet must be defragmented.
			</t>
			</section>
			
			<section title="Source IP packet protection by the sender host" anchor="SenderHost">
			<t>
				If the sender host decides to protect a specific IP packet, an IPlir packet is created as follows.
				<list style="numbers">
				<t>The recipient and transit host contexts along with the applied security policy determine:
					<list style="symbols">
					<t>TIV_AEAD = LSB_63(TransitInitValue),</t>
					<t>where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
					</list>
				</t>
				<t>Based on the recipient and transit host contexts along with the cryptographic suite:
					<list style="symbols">
					<t>TIV_AEAD = LSB_63(TransitInitValue),</t>
					<t>where TransitInitValue is initialized by the TransitInitValue field value of the IPlir message,</t>
					</list>
				</t>
				<t>The IPlir packet fields are filled in considering the data from the source IP packet and the data generated previously.</t>
				<t>The IPlir body is encrypted (if required by the security policy) and the end-to-end MAC value 
					is calculated as prescribed by the cryptographic suite. The end-to-end MAC value is placed in the corresponding field 
					of the IPlir trailer.</t>
				<t>If transit integrity control is required, the corresponding fields and flags of the IPlir header and IPlir trailer 
					are filled in, the transit MAC value is calculated. The transit MAC value is placed in the corresponding field of the IPlir trailer.</t>
				<t>An IPlir packet is generated, wherein parts of the source IP packet are located according to the rules specified in Section 4.4.</t>
				</list>
			</t>
			</section>
			
			<section title="IPlir packet processing on the forward host" anchor="ForwardHost">
			<t>
				After receiving an IPlir packet, the transit host processes the IPlir packet as follows.
				<list style="numbers">
				<t>It checks whether the received IPlir packet corresponds to the IPlir packet reception policy. If the packet does not comply 
					with the policy, it is blocked.</t>
				<t>If the IPlir version in the IPlir header is not supported by the host, the packet is blocked.</t>
				<t>The IPlir packet is matched to the context of the sender host or the previous transit host. 
					If the context is not found or contains cryptographic suites not matching the set from the IPlir header, the packet is blocked.</t>
				<t>If the suite from the IPlir header does not imply transit MAC, the packet is blocked.</t>
				<t>Based on the context of the previous transit host and the IPlir header, the packet transit MAC key is derived. 
					The IPlir packet integrity is verified by checking the transit MAC. If the transit MAC is not correct, the packet is blocked.</t>
				<t>Based on the recipient host context, the next transit host is determined on the transit host 
					(or it is determined that the IPlir packet can be delivered to the recipient host directly). 
					If the context of the next transit host (or recipient host) is not found, the packet is blocked.</t>
				<t>If the found context contains cryptographic suites not matching the set from the IPlir header, the packet is blocked.</t>
				<t>Based on the context of the next transit host, IPlir header and IPlir trailer, 
					the packet transit MAC key and transit initializing value are generated. The necessary number of the packet 
					transit MAC key and the transit host identifier are established in the IPlir message. 
					The transit initializing value is located in the TransitInitValue field.</t>
				<t>The transit MAC value is calculated and placed in the corresponding field of the IPlir trailer.</t>
				<t>An IPlir packet is generated, wherein parts of the source IP packet are located according to the rules specified in Section 4.4.</t>
				</list>
			</t>
			<t>
				There may be cases when the security policies require a transit MAC to be added to the routed packet without checking 
				the previous value or, vice versa, the received IPlir packet integrity to be checked without calculating a new transit 
				MAC value, as well as cases when no transit protection is required. In this case:
				<list style="symbols">
				<t>If no integrity verification of the received transit IPlir packet is required, steps 3, 4, 5 of the algorithm are skipped,</t>
				<t>If no transit MAC calculation is required, steps 7, 8, 9 of the above algorithm are skipped,</t>
				<t>If transit protection is not required, steps 3, 4, 5, 7, 8, 9 of the above algorithm are skipped.</t>
				</list>
			</t>
			</section>
			
			<section title="Source IP packet recovery by the recipient host" anchor="RecipientHost">
			<t>
				After receiving the IPlir packet, the recipient host restores the source IP packet as follows.
				<list style="numbers">
				<t>It checks whether the received IPlir packet corresponds to the IPlir packet reception policy. If the packet does not 
					comply with the policy, it is blocked.</t>
				<t>If the IPlir version in the IPlir header is not supported by the host, the packet is blocked.</t>
				<t>The IPlir packet is matched to the context of the previous transit host. If the context is not 
					found or contains cryptographic suites not matching the set from the IPlir header, the packet is blocked.</t>
				<t>Based on the context of the previous transit host and the IPlir header, the packet transit MAC key is derived. 
					The IPlir packet integrity is verified by checking the transit MAC. If the transit MAC is not correct, the packet is blocked. </t>
				<t>The IPlir packet is matched to the context of the sender host. If the context is not found or contains cryptographic 
					suites not matching the suite from the IPlir header, the packet is blocked.</t>
				<t>Based on the context of the sender host and the IPlir header, the packet encryption key and packet end-to-end MAC key are derived.</t>
				<t>The end-to-end MAC is checked and, if the IPlir body was encrypted, the packet IPlir body is decrypted as 
					defined by the cryptographic suite. If the end-to-end MAC is not correct, the packet is blocked. </t>
				<t>The IP packet is restored according to the rules of Section 4.4. </t>
				</list>
			</t>
			<t>
				There may be cases when the security policies do not require transit MAC checking by the recipient host. 
				Then steps 3, 4 of the algorithm are skipped.
			</t>
			</section>	
		</section>
		
		<section anchor="IANACON" title="IANA Considerations">
            <t>
                This document has no IANA actions.
            </t>
        </section>

    </middle>


    <back>
        <references title="Normative References">
            <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7801.xml' ?>
            <?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8891.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9058.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml-nist/reference.NIST.SP.800-38a.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml-nist/reference.NIST.SP.800-38b.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml-nist/reference.NIST.SP.800-38d.xml' ?>
			<?rfc include='http://xml2rfc.tools.ietf.org/public/rfc/bibxml-nist/reference.NIST.SP.800-108.xml' ?>
			<reference anchor="NIST.FIPS.197" target="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf">
			<front>
				<title>Advanced encryption standard (AES)</title>
				<author fullname="NIST">
				</author>
				<date year="2001" month="November"/>
			</front>
			<seriesInfo name="NIST" value="NIST FIPS 197"/>
			<seriesInfo name="DOI" value="10.6028/NIST.FIPS.197"/>
			</reference>
        </references>
		<references title="Informative References">
			<reference anchor="GOST3413-2015">
			<front>
				<title>Information technology. Cryptographic data security. Modes of operation for block ciphers</title>
				<author initials="" surname="Federal Agency on Technical Regulating and Metrology">
				</author>
				<date year="2015"/>
			</front>
			<seriesInfo name="" value="GOST R 34.13-2015"/>
			</reference>
		</references>
    </back>
</rfc>
