home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_i / draft-ietf-ipsec-new-esp-00.txt < prev    next >
Text File  |  1997-03-28  |  40KB  |  971 lines

  1.  
  2.  
  3. Network Working Group                             Stephen Kent, BBN Corp
  4. Internet Draft                           Randall Atkinson, @Home Network
  5. draft-ietf-ipsec-new-esp-00.txt                            26 March 1997
  6. Expire in six months
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                 IP Encapsulating Security Payload (ESP)
  13.  
  14.  
  15.  
  16.  
  17. Status of This Memo
  18.  
  19.    This document is an Internet Draft. Internet Drafts are working
  20.    documents of the Internet Engineering Task Force (IETF), its Areas,
  21.    and its working groups. Note that other groups may also distribute
  22.    working documents as Internet Drafts.
  23.  
  24.    Internet Drafts are draft documents valid for a maximum of 6 months.
  25.    Internet Drafts may be updated, replaced, or obsoleted by other
  26.    documents at any time. It is not appropriate to use Internet Drafts
  27.    as reference material or to cite them other than as "work in
  28.    progress".
  29.  
  30.    This particular Internet Draft is a product of the IETF's IPng and
  31.    IPsec working groups. It is intended that a future version of this
  32.    draft be submitted to the IPng Area Directors and the IESG for
  33.    possible publication as a standards-track protocol.
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Kent, Atkinson                                                  [Page 1]
  59.  
  60.  
  61.  
  62. Internet Draft              IP Encapsulating               26 March 1997
  63.                          Security Payload (ESP)
  64.  
  65.  
  66. Table of Contents
  67.  
  68.    1. Introduction......................................................3
  69.    2. Encapsulating Security Payload Packet Format......................4
  70.       2.1  Security Parameters Index....................................4
  71.       2.2  Sequence Number .............................................5
  72.       2.3  Initialization Vector........................................5
  73.       2.4  Payload Data.................................................5
  74.       2.5  Padding (for encryption).....................................6
  75.       2.6  Pad Length...................................................6
  76.       2.7  Next Header..................................................6
  77.       2.8  Authentication Data..........................................6
  78.    3. Encapsulating Security Protocol Processing........................7
  79.       3.1  ESP Header Location..........................................7
  80.       3.2  Outbound Packet Processing...................................9
  81.          3.2.1  Security Association Lookup.............................9
  82.          3.2.2  Anti-replay Service.....................................9
  83.          3.2.3  Packet Encryption.......................................9
  84.             3.2.3.1 Scope of Encryption.................................9
  85.             3.2.3.2 Encryption Algorithms..............................10
  86.          3.2.4  Integrity Check Value Calculation......................10
  87.             3.2.4.1  Scope of Authentication Protection................10
  88.             3.2.4.2  Authentication Padding............................10
  89.             3.2.4.3  Authentication Algorithms.........................11
  90.          3.2.5  Fragmentation..........................................11
  91.       3.3  Inbound Packet Processing...................................11
  92.          3.3.1  Pre-ESP Processing Overview............................11
  93.          3.3.2  Security Association Lookup............................11
  94.          3.3.3  Anti-replay Service....................................12
  95.          3.3.4  Integrity Check Value Verification.....................13
  96.          3.3.5  Packet Decryption......................................13
  97.    4. Conformance Requirements.........................................14
  98.    5. Security Considerations..........................................14
  99.    Acknowledgements....................................................14
  100.    References..........................................................15
  101.    Disclaimer..........................................................17
  102.    Author Information..................................................17
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115. Kent, Atkinson                                                  [Page 2]
  116.  
  117.  
  118.  
  119. Internet Draft              IP Encapsulating               26 March 1997
  120.                          Security Payload (ESP)
  121.  
  122.  
  123. 1.  Introduction
  124.  
  125.    The Encapsulating Security Payload (ESP) header is designed to
  126.    provide a mix of optional security services in IPv4 and IPv6.  ESP
  127.    may be applied alone, in combination with the IP Authentication
  128.    Header (AH) [KA97b], or in a nested fashion, e.g., through the use of
  129.    tunnel mode (see below).  Security services can be provided between a
  130.    pair of communicating hosts, between a pair of communicating security
  131.    gateways, or between a security gateway and a host.  For more details
  132.    on how to use ESP and AH in various network environments, see
  133.    "Security Architecture for the Internet Protocol" [KA97a].
  134.  
  135.    The ESP header is inserted after the IP header and before the upper
  136.    layer protocol header (transport mode) or the encapsulated IP header
  137.    (tunnel mode).  These modes are described in more detail below.
  138.  
  139.    ESP is used to provide confidentiality, data origin authentication,
  140.    connectionless integrity, anti-replay service (a form of sequence
  141.    integrity), and limited traffic flow confidentiality.  The set of
  142.    services provided depends on options selected at the time of Security
  143.    Association establishment and the implementation placement.
  144.    Confidentiality may be selected independent of all other services.
  145.    Data origin authentication and connectionless integrity are joint
  146.    services (hereafter referred to jointly as "authentication),
  147.    independent of confidentiality.  An anti-replay service may be
  148.    selected only if data origin authentication is selected, but it is
  149.    independent of confidentiality.  Traffic flow confidentiality depends
  150.    on confidentiality, and requires selection of tunnel mode.
  151.  
  152.    It is assumed that the reader is familiar with the terms and concepts
  153.    described in the document "Security Architecture for the Internet
  154.    Protocol" [KA97a].  In particular, the reader should be familiar with
  155.    the definitions of security services offered by ESP (and by AH), the
  156.    concept of Security Associations, the different key management
  157.    options available for ESP (and AH), and the ways in which ESP can be
  158.    used in conjunction with the Authentication Header (AH).
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172. Kent, Atkinson                                                  [Page 3]
  173.  
  174.  
  175.  
  176. Internet Draft              IP Encapsulating               26 March 1997
  177.                          Security Payload (ESP)
  178.  
  179.  
  180. 2.  Encapsulating Security Payload Packet Format
  181.  
  182.    +---------------+---------------+---------------+---------------+ ----
  183.    |          Security Parameters Index (SPI), (32 bits)           | ^
  184.    +---------------+---------------+---------------+---------------+ |
  185.    |                   Sequence Number (32 bits)                   | |
  186.    +---------------+---------------+---------------+---------------+ Auth/
  187.    |               Initialization Vector (variable)                | Integrity
  188.    +                                                               + Coverage
  189.    |                                                               | |
  190.    +---------------+---------------+---------------+---------------+ |  -----
  191.    |                    Payload Data (variable)                    | |    ^
  192.    -                                                               - |    |
  193.    |                                                               | |    |
  194.    +               +---------------+---------------+---------------+ | Confid.
  195.    |               |     Padding (0-255 bytes)                     | | Coverage
  196.    +---------------+               +---------------+---------------+ |    |
  197.    |                               | Pad Length(8) | Next Header(8)| v    v
  198.    +---------------+---------------+---------------+---------------+ --------
  199.    |                 Authentication Data (variable)                |
  200.    -                                                               -
  201.    |                                                               |
  202.    +---------------+---------------+---------------+---------------+
  203.     1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
  204.  
  205.    The following subsections define the fields in the header format.
  206.    "Optional" means that the field is omitted if the option is not
  207.    selected, i.e., it is present in neither the packet as transmitted nor
  208.    as formatted for computation of an ICV.  Whether or not an option is
  209.    selected is defined as part of Security Association (SA)
  210.    establishment.  Thus the format of ESP packets for a given SA is
  211.    fixed, for the duration of the SA.  In contrast, "mandatory"
  212.    fields are always present in the ESP packet format, for all SAs.
  213.  
  214. 2.1  Security Parameters Index
  215.  
  216.    The SPI is an arbitrary 32-bit value identifying the Security
  217.    Association for this datagram (relative to the destination IP address
  218.    contained in the IP header with which this security header is
  219.    associated).  The set of SPI values in the range 1 through 255 are
  220.    reserved by the Internet Assigned Numbers Authority (IANA) for future
  221.    use; a reserved SPI value will not normally be assigned by IANA
  222.    unless the use of the assigned SPI value is specified in an RFC.  A
  223.    value of zero indicates that no Security Association exists.  (Note
  224.    that the SPI is similar to the SAID used in other security protocols.
  225.    The name has been changed because the semantics used here are not
  226.    exactly the same as those used in other security protocols.)
  227.  
  228.  
  229. Kent, Atkinson                                                  [Page 4]
  230.  
  231.  
  232.  
  233. Internet Draft              IP Encapsulating               26 March 1997
  234.                          Security Payload (ESP)
  235.  
  236.  
  237.    ***Under what circumstances will a zero SPI be employed?  Is this
  238.    ***vestigial, or is there still a use for a zero SPI?  Is it a SKIP
  239.    ***support feature of some sort?
  240.  
  241.    The SPI field is mandatory, and its value is ordinarily selected by
  242.    the destination system upon establishment of an SA (see "Security
  243.    Architecture for the Internet Protocol" for more details.)
  244.  
  245. 2.2  Sequence Number
  246.  
  247.    This unsigned 32-bit field contains a monotonically increasing
  248.    counter value (sequence number).  The counter is initialized to 1
  249.    when an SA is established.  The Sequence Number must never be allowed
  250.    to cycle; thus, it MUST be reset (by establishing a new SA and thus a
  251.    new key) prior to the transmission of 2^32-1 packets on an SA.
  252.  
  253.    The Sequence Number is optional.  It is only included if the anti-
  254.    replay service is selected as a security service for the SA.  Since
  255.    the anti-replay service requires selection of the authentication
  256.    service as well, the Sequence Number MUST not be present in the
  257.    absence of the Authentication Data field (described below.)
  258.  
  259. 2.3  Initialization Vector
  260.  
  261.    This is a variable-length field used only when an explicit IV is
  262.    required by the selected encryption algorithm, mode or device.  The
  263.    length of the IV is dependent upon the choice of encryption
  264.    algorithm, and is established during SA negotiation.  The IV field is
  265.    optional, but all implementations must be capable of generating and
  266.    processing this field if they support algorithms or devices that
  267.    require an explicit IV.
  268.  
  269. 2.4  Payload Data
  270.  
  271.    Payload Data is a variable-length field containing data described by
  272.    the Next Header field. This field is an integral number of bytes in
  273.    length.  The Payload Data field is mandatory.
  274.  
  275.    ***We have a potential IPv6 alignment problem here, that may have
  276.    ***been present for some time.  Ignoring the presence or absence of an
  277.    ***iv, the payload data will not be aligned on an 8-byte boundary if
  278.    ***the Sequence Number is omitted.  This may cause a problem for
  279.    ***efficient crypto data transfer.   If the IV is present,  and the
  280.    ***Sequence Number is omitted, the same problem arises, starting with
  281.    ***the IV, unless the IV is of a compensating size.  The decryption
  282.    ***process can fix the problem for higher layer protocols, because the
  283.    ***output buffer from decryption is usually distinct from the input
  284.  
  285.  
  286. Kent, Atkinson                                                  [Page 5]
  287.  
  288.  
  289.  
  290. Internet Draft              IP Encapsulating               26 March 1997
  291.                          Security Payload (ESP)
  292.  
  293.  
  294.    ***buffer, but that still causes potential problems for transfer of
  295.    ***data to the crypto module. Also, if encryption is not employed,
  296.    ***this becomes a potential problem for authentication data being
  297.    ***passed up.  We could solve this by adding an optional alignment
  298.    ***field to the ESP header, when required for IPv6.  What do people think?
  299.  
  300. 2.5  Padding (for Encryption)
  301.  
  302.    If the confidentiality service has been selected, the Padding field
  303.    is used to fill the Payload Data to a multiple of the blocksize
  304.    required by the encryption algorithm.  This blocksize requirement is
  305.    a parameter of the algorithm negotiated during SA establishment.
  306.  
  307.    If encryption has not been selected, the Padding field is used to
  308.    align the Next Header field so that the last bit of that field ends
  309.    on a 32-bit boundary.
  310.  
  311.    The Padding bytes SHOULD be initialized with random data and they are
  312.    transmitted. The transmitter can add 0-255 bytes of padding.  Padding
  313.    beyond that required for encryption algorithm blocksize alignment may
  314.    be used to conceal the actual length of the payload, in support of
  315.    traffic flow confidentiality.  However, inclusion of such additional
  316.    padding has adverse bandwidth implications and thus its use should be
  317.    undertaken with care.  The Padding field is optional, but all
  318.    implementations MUST support generation and consumption of padding.
  319.  
  320. 2.6  Pad Length
  321.  
  322.    The Pad Length field indicates the number of pad bytes immediately
  323.    preceding it. The range of valid values is 0-255, where a value of
  324.    zero indicates that the byte immediately preceding the pad length
  325.    field is the last byte of the payload.  The Pad Length field is
  326.    mandatory.
  327.  
  328. 2.7  Next Header
  329.  
  330.    The Next Header is an 8-bit field that identifies the type of data
  331.    contained in the Payload Data field, e.g., an extension header in
  332.    IPv6 or an upper layer protocol identifier.  The value of this field
  333.    is chosen from the set of IP Protocol Numbers defined in the most
  334.    recent "Assigned Numbers" [STD-2] RFC from the Internet Assigned
  335.    Numbers Authority (IANA).  The Next Header field is mandatory.
  336.  
  337. 2.8  Authentication Data
  338.  
  339.    The Authentication Data is a variable-length field containing an
  340.    Integrity Check Value (ICV) computed over the ESP packet minus the
  341.  
  342.  
  343. Kent, Atkinson                                                  [Page 6]
  344.  
  345.  
  346.  
  347. Internet Draft              IP Encapsulating               26 March 1997
  348.                          Security Payload (ESP)
  349.  
  350.  
  351.    Authentication Data.  The length of the field depends upon the
  352.    authentication function selected.  The mandatory-to-implement
  353.    authentication algorithms, HMAC with MD5 or SHA-1, both yield 96-bit
  354.    ICVs because of the truncation convention adopted for use in IPsec.
  355.    The Authentication Data field is optional.
  356.  
  357. 3.  Encapsulating Security Protocol Processing
  358.  
  359.    3.1 ESP Header Location
  360.  
  361.    Like AH, ESP may be employed in two ways: transport mode or tunnel
  362.    mode.  The former mode is applicable only to host implementations and
  363.    provides protection for upper layer protocols, but not the IP header.
  364.    In this mode, ESP is inserted after the IP header and before an upper
  365.    layer protocol, e.g., TCP, UDP, ICMP, etc.  In the context of IPv4,
  366.    this translates to placing ESP after the IP header (and any options
  367.    that it contains), but before the upper layer protocol.  (Note that
  368.    the term "transport" mode should not be misconstrued as restricting
  369.    its use to TCP and UDP. For example, an ICMP message MAY be sent
  370.    using either "transport" mode or "tunnel" mode.)  The following
  371.    diagram illustrates ESP transport mode positioning for a typical IPv4
  372.    packet, on a "before and after" basis. (The "ESP trailer" encompasses
  373.    any Padding, plus the Pad Length, and Next Header fields.)
  374.  
  375.                  BEFORE APPLYING ESP
  376.             ----------------------------
  377.       IPv4  |orig IP hdr  |     |      |
  378.             |(any options)| TCP | Data |
  379.             ----------------------------
  380.  
  381.                  AFTER APPLYING ESP
  382.             -------------------------------------------------
  383.       IPv4  |orig IP hdr  |     |     |      |   ESP   | ESP|
  384.             |(any options)| ESP | TCP | Data | Trailer |Auth|
  385.             -------------------------------------------------
  386.                                 |<----- encrypted ---->|
  387.                           |<------ authenticated ----->|
  388.  
  389.  
  390.    In the IPv6 context, ESP is viewed as an end-to-end payload, and thus
  391.    should appear after hop-by-hop, routing, and fragmentation extension
  392.    headers.  The destination options extension header(s) could appear
  393.    either before or after the ESP header depending on the semantics
  394.    desired.  However, since ESP protects only fields after the ESP
  395.    header, it generally may be desirable to place the destination
  396.    options header(s) after the ESP header.  The following diagram
  397.    illustrates ESP transport mode positioning for a typical IPv6 packet.
  398.  
  399.  
  400. Kent, Atkinson                                                  [Page 7]
  401.  
  402.  
  403.  
  404. Internet Draft              IP Encapsulating               26 March 1997
  405.                          Security Payload (ESP)
  406.  
  407.  
  408.                      BEFORE APPLYING ESP
  409.             ---------------------------------------
  410.       IPv6  |             | ext hdrs |     |      |
  411.             | orig IP hdr |if present| TCP | Data |
  412.             ---------------------------------------
  413.  
  414.  
  415.                      AFTER APPLYING ESP
  416.             ---------------------------------------------------------
  417.       IPv6  | orig |hxh,rtg,frag|dest|   |dest|   |    | ESP   | ESP|
  418.             |IP hdr|if present**|opt*|ESP|opt*|TCP|Data|Trailer|Auth|
  419.             ---------------------------------------------------------
  420.                                          |<---- encrypted ---->|
  421.                                      |<---- authenticated ---->|
  422.  
  423.                 * = if present, could be before AH, after AH, or both
  424.                ** = hop by hop, routing, fragmentation headers
  425.  
  426.    Tunnel mode ESP may be employed in either hosts or security gateways.
  427.    When ESP is implemented in a security gateway (to protect subscriber
  428.    transit traffic), tunnel mode must be used.  In tunnel mode, the
  429.    "inner" IP header carries the ultimate source and destination
  430.    addresses, while an "outer" IP header may contain distinct IP
  431.    addresses, e.g., addresses of security gateways.  In tunnel mode, ESP
  432.    protects the entire inner IP packet, including the entire inner IP
  433.    header. The position of ESP in tunnel mode, relative to the outer IP
  434.    header, is the same as for ESP in transport mode.  The following
  435.    diagram illustrates ESP tunnel mode positioning for typical IPv4 and
  436.    IPv6 packets.
  437.  
  438.             -----------------------------------------------------------
  439.       IPv4  | new IP hdr* |     | orig IP hdr*  |   |    | ESP   | ESP|
  440.             |(any options)| ESP | (any options) |TCP|Data|Trailer|Auth|
  441.             -----------------------------------------------------------
  442.                                 |<--------- encrypted ---------->|
  443.                           |<----------- authenticated ---------->|
  444.  
  445.             ---------------------------------------------------------------
  446.       IPv6  | new* | ext hdrs*|   | orig*| ext hdrs*|   |    | ESP   | ESP|
  447.             |IP hdr|if present|ESP|IP hdr|if present|TCP|Data|Trailer|Auth|
  448.             ---------------------------------------------------------------
  449.                                   |<---------- encrypted ----------->|
  450.                               |<----------- authenticated ---------->|
  451.  
  452.                * = construction of outer IP hdr/extensions and modification
  453.                       of inner IP hdr/extensions is discussed below.
  454.  
  455.  
  456.  
  457. Kent, Atkinson                                                  [Page 8]
  458.  
  459.  
  460.  
  461. Internet Draft              IP Encapsulating               26 March 1997
  462.                          Security Payload (ESP)
  463.  
  464.  
  465. 3.2  Outbound Packet Processing
  466.  
  467.    In transport mode, the transmitter encapsulates the upper layer
  468.    protocol information in the ESP header/trailer, and retains the
  469.    specified IP header (and any IP extension headers in the IPv6
  470.    context).  In tunnel mode, the outer and inner IP header/extensions
  471.    can be inter-related in a variety of ways.  The construction of the
  472.    outer IP header/extensions during the encapsulation process is
  473.    described in the document, "Security Architecture for the Internet
  474.    Protocol".
  475.  
  476. 3.2.1  Security Association Lookup
  477.  
  478.    ESP is applied to an outbound packet only after an IPsec
  479.    implementation determines that the packet is associated with an SA
  480.    that calls for ESP processing.  The process of determining what, if
  481.    any, IPsec processing is applied to outbound traffic is described in
  482.    the document, "Security Architecture for the Internet Protocol".
  483.  
  484. 3.2.2  Anti-replay Service
  485.  
  486.    If the anti-replay service has been selected for this SA, the
  487.    transmitter increments the Sequence Number for this SA, checks to
  488.    ensure that the counter has not cycled, and inserts the new value
  489.    into the Sequence Number field.  A transmitter MUST NOT send a packet
  490.    on an SA if doing so would cause the Sequence Number to cycle.
  491.  
  492.    As mentioned in section 2.2, the anti-replay service requires the
  493.    selection of the authentication services thus the Sequence Number
  494.    field MUST NOT be present in the absence of the Authentication Data
  495.    field (described below.)
  496.  
  497. 3.2.3  Packet Encryption
  498.  
  499. 3.2.3.1 Scope of Encryption
  500.  
  501.    In transport mode, if encryption has been selected, the transmitter
  502.    encapsulates the original upper layer protocol information into the
  503.    ESP payload field, adds any necessary padding, and encrypts the
  504.    result (Payload Data, Padding, Pad Length, and Next Header) using the
  505.    key, encryption algorithm, and algorithm mode indicated by the SA.
  506.    In tunnel mode, the transmitter encapsulates and encrypts the the
  507.    entire original IP datagram (plus the Padding, Pad Length, and Next
  508.    Header).
  509.  
  510.    If both encryption and authentication have been selected, encryption
  511.    is performed first, before the authentication and the encryption does
  512.  
  513.  
  514. Kent, Atkinson                                                  [Page 9]
  515.  
  516.  
  517.  
  518. Internet Draft              IP Encapsulating               26 March 1997
  519.                          Security Payload (ESP)
  520.  
  521.  
  522.    not encompass the Authentication Data field.  This order of
  523.    processing facilitates rapid detection and rejection of replayed or
  524.    bogus packets by the receiver, prior to decrypting the packet, hence
  525.    potentially reducing the impact of denial of service attacks.  It
  526.    also allows for the possibility of parallel processing of packets at
  527.    the receiver, i.e., decryption can take place in parallel with
  528.    authentication.  Note that since the Authentication Data is not
  529.    protected by encryption, a keyed authentication algorithm must be
  530.    employed to compute the ICV.
  531.  
  532. 3.2.3.2 Encryption Algorithms
  533.  
  534.    If confidentiality is selected, the encryption algorithm employed is
  535.    specified by the SA.  ESP is designed for use with symmetric
  536.    encryption algorithms.  Because IP packets may arrive out of order,
  537.    each packet must carry either an explicit Initialization Vector (IV)
  538.    that allows the receiver to establish cryptographic synchronization
  539.    for decryption, or data derived from the packet header must suffice
  540.    to generate an IV at the receiver.  Since ESP makes provision for
  541.    padding of the plaintext, encryption algorithms employed with ESP may
  542.    exhibit either block or stream mode characteristics.
  543.  
  544.    At the time of writing, one mandatory-to-implement encryption
  545.    algorithm and mode has been defined for ESP.  It is based on the Data
  546.    Encryption Standard (DES) [NIST77] in Cipher Block Chaining Mode
  547.    [NIST80].  Details of use of this mode are contained in [need a new
  548.    I-D with DES-CBC and implicit IV generation, but no overlap with this
  549.    document].
  550.  
  551. 3.2.4  Integrity Check Value Calculation
  552.  
  553. 3.2.4.1  Scope of Authentication Protection
  554.  
  555.    If authentication is selected for the SA, the transmitter computes
  556.    the ICV over the ESP packet minus the Authentication Data.  Thus the
  557.    SPI, Sequence Number (if present), Initialization Vector (if
  558.    present), Payload Data, Padding (if present), Pad Length, and Next
  559.    Header are all encompassed by the ICV computation.  If encryption has
  560.    been selected, the last 4 fields will be in ciphertext form.
  561.  
  562. 3.2.4.2  Authentication Padding
  563.  
  564.    For some authentication algorithms, the byte string over which the
  565.    ICV computation is performed must be a multiple of a blocksize
  566.    specified by the algorithm.  If the length of this byte string does
  567.    not match the blocksize requirements for the algorithm, implicit
  568.    padding MUST be appended to the end of the ESP packet, prior to ICV
  569.  
  570.  
  571. Kent, Atkinson                                                 [Page 10]
  572.  
  573.  
  574.  
  575. Internet Draft              IP Encapsulating               26 March 1997
  576.                          Security Payload (ESP)
  577.  
  578.  
  579.    computation.  The padding octets MUST have a value of zero.  The
  580.    blocksize (and hence the length of the padding) is specified by the
  581.    algorithm specification.  This padding is not transmitted with the
  582.    packet.
  583.  
  584. 3.2.4.3  Authentication Algorithms
  585.  
  586.    The authentication algorithm employed for the ICV computation is
  587.    specified by the SA.  For point-to-point communication, suitable
  588.    authentication algorithms include keyed Message Authentication Codes
  589.    (MACs) based on symmetric encryption algorithms (e.g., DES) or on
  590.    one-way hash functions (e.g., MD5 or SHA-1).  For multicast
  591.    communication, one-way hash algorithms combined with asymmetric
  592.    signature algorithms are suitable.  As of this writing, the
  593.    mandatory-to-implement authentication algorithms are based on the
  594.    former class, i.e.,  HMAC [KBC97] with SHA-1 [SHA] or HMAC with MD5
  595.    [Riv92].  The output of the HMAC computation is truncated to (the
  596.    leftmost) 96 bits.  Other algorithms, possibly with different ICV
  597.    lengths, MAY be supported.
  598.  
  599. 3.2.5  Fragmentation
  600.  
  601.    If necessary, fragmentation is performed after ESP processing within
  602.    an IPsec implementation.  However, an IP packet to which ESP has been
  603.    applied may itself be fragmented by routers en route, including
  604.    security gateways that may apply AH or ESP (tunnel mode) to the
  605.    already-protected packet or fragments.
  606.  
  607. 3.3  Inbound Packet Processing
  608.  
  609. 3.3.1  Pre-ESP Processing Overview
  610.  
  611.    If required, reassembly is performed prior to ESP processing.
  612.  
  613. 3.3.2  Security Association Lookup
  614.  
  615.    Upon receipt of a (reassembled) packet containing an ESP Header, the
  616.    receiver determines the appropriate (unidirectional) SA, based on the
  617.    destination IP address and the SPI.  (This process is described in
  618.    more detail in the document, "Security Architecture for the Internet
  619.    Protocol".)  The SA indicates whether the Sequence Number,
  620.    Initialization Vector, and Authentication Data fields should be
  621.    present, and it will specify the algorithms and keys to be employed
  622.    for decryption and ICV computations (if applicable).
  623.  
  624.    If no valid Security Association exists for this session (for
  625.    example, the receiver has no key), the receiver MUST discard the
  626.  
  627.  
  628. Kent, Atkinson                                                 [Page 11]
  629.  
  630.  
  631.  
  632. Internet Draft              IP Encapsulating               26 March 1997
  633.                          Security Payload (ESP)
  634.  
  635.  
  636.    packet and the failure MUST be recorded in an audit log.  The log
  637.    entry MUST include the SPI value, date/time, Source Address,
  638.    Destination Address, and (in IPv6) the cleartext Flow ID.  The log
  639.    entry MAY also include other identifying data.  There is no
  640.    requirement for the receiver to transmit any message to the purported
  641.    transmitter in response to receipt of such packets (because of the
  642.    potential to induce denial of service via such actions).
  643.  
  644. 3.3.3  Anti-replay Service
  645.  
  646.    If the anti-replay service has been selected for this SA, the
  647.    receiver MUST verify that the packet contains a Sequence Number value
  648.    that does not duplicate the Sequence Number of any other packet
  649.    received during the life of this SA.  This SHOULD be the first AH
  650.    check applied to a packet after it has been matched to an SA, to
  651.    speed rejection of duplicate packets.
  652.  
  653.    Duplicates are rejected through the use of a sliding receive window.
  654.    (How the window is implemented is a local matter, but the following
  655.    text describes the functionality that the implementation must
  656.    exhibit.)  The default window size is 32 and all AH implementations
  657.    MUST support this window size.  A larger window size MAY be
  658.    established during SA negotiation.  If a larger window size is
  659.    negotiated it MUST be a multiple of 32.
  660.  
  661.    The "right" edge of the window represents the highest, validated
  662.    Reply Protection value received on this SA.  Packets that contain
  663.    Sequence Numbers lower than the "left" edge of the window are
  664.    rejected.  Packets falling within the window are checked against a
  665.    list of received packets within the window.  An efficient means for
  666.    performing this check, based on the use of a bit mask, is described
  667.    in [KA97a].
  668.  
  669.    If the received packet falls within the window, then the receiver
  670.    proceeds to ICV verification.  If the ICV validation fails, the
  671.    receiver MUST discard the received IP datagram as invalid and MUST
  672.    record the authentication failure in an audit log.  If such a failure
  673.    occurs, the log entry MUST include the SPI value, date/time received,
  674.    Sending Address, Destination Address, and (in IPv6) Flow ID.  The log
  675.    data MAY also include other information about the failed packet.  The
  676.    window is updated only if the ICV verification succeeds.
  677.  
  678.    DISCUSSION:
  679.  
  680.       Note that if the packet is either inside the window and new, or
  681.       outside the window on the "right" side, the receiver MUST
  682.       authenticate the Sequence Number before updating the Sequence
  683.  
  684.  
  685. Kent, Atkinson                                                 [Page 12]
  686.  
  687.  
  688.  
  689. Internet Draft              IP Encapsulating               26 March 1997
  690.                          Security Payload (ESP)
  691.  
  692.  
  693.       Number window data.
  694.  
  695. 3.3.4  Integrity Check Value Verification
  696.  
  697.    If authentication has been selected, the receiver computes the ICV
  698.    over the ESP packet minus the Authentication Data using the specified
  699.    authentication algorithm and verifies that it is the same as the ICV
  700.    included in the Authentication Data field of the packet.  Details of
  701.    the computation are provided below.
  702.  
  703.    If the computed and received ICV's match, then the datagram is valid,
  704.    and it is accepted.  If the test fails, then the receiver MUST
  705.    discard the received IP datagram as invalid and MUST record the
  706.    authentication failure in an audit log. The log data MUST include the
  707.    SPI value, date/time received, Source Address, Destination Address,
  708.    and (in IPv6) the clear-text Flow ID.  The log data MAY also include
  709.    other information about the failed packet.
  710.  
  711.    DISCUSSION:
  712.  
  713.       Begin by removing and saving the ICV value (Authentication Data
  714.       field).  Next check the overall length of the ESP packet minus the
  715.       Authentication Data.  If implicit padding is required, based on
  716.       the blocksize of the authentication algorithm, append zero-filled
  717.       bytes to the end of the ESP packet directly after the Next Header
  718.       field.  Perform the ICV computation and compare the result with
  719.       the received value.  (If a digital signature and one-way hash are
  720.       used for the ICV computation, the matching process is more complex
  721.       and will be described in the algorithm specification.)
  722.  
  723.  
  724. 3.3.5  Packet Decryption
  725.  
  726.    If data confidentiality was selected, the receiver decrypts the ESP
  727.    Payload Data, Padding, Pad Length, and Next Header using the session
  728.    key that has been established for this traffic.  If an explicit IV is
  729.    present, it is input to the decryption algorithm as per the algorithm
  730.    specification.  If an implicit IV is employed, a local version of the
  731.    IV is constructed and input to the decryption algorithm as per the
  732.    algorithm specification.  (Decryption may take place in parallel with
  733.    authentication, but care must be taken to avoid possible race
  734.    conditions with regard to packet access and reconstruction of the
  735.    decrypted packet.)
  736.  
  737.    After decryption, the original IP datagram is reconstructed and
  738.    processed per the normal IP protocol specification.  The exact steps
  739.    for reconstructing the original datagram depend on the mode (tunnel
  740.  
  741.  
  742. Kent, Atkinson                                                 [Page 13]
  743.  
  744.  
  745.  
  746. Internet Draft              IP Encapsulating               26 March 1997
  747.                          Security Payload (ESP)
  748.  
  749.  
  750.    vs transport) and are described in the document, "Security
  751.    Architecture for the Internet Protocol."
  752.  
  753.    Note that there are two ways in which the decryption can "fail".  The
  754.    selected SA may not be correct or the encrypted ESP packet could be
  755.    corrupted.  (The latter case would be detected if authentication is
  756.    selected for the SA, as would tampering with the SPI.  However, an SA
  757.    mismatch might still occur due to tampering with the IP Destination
  758.    Address.)  In either case, the erroneous result of the decryption
  759.    operation (an invalid IP datagram or transport-layer frame) will not
  760.    necessarily be detected by IPsec, and is the responsibility of later
  761.    protocol processing.
  762.  
  763. 4.  Conformance Requirements
  764.  
  765.    Implementations that claim conformance or compliance with this
  766.    specification MUST implement the ESP syntax and processing described
  767.    here and MUST comply with all requirements of the "Security
  768.    Architecture for the Internet Protocol."  Note that support for
  769.    manual key distribution is required, but its use is inconsistent with
  770.    anti-replay service, and thus a compliant implementation must not
  771.    negotiate this service in conjunction with SAs that are manually
  772.    keyed.  A compliant ESP implementation MUST support the following
  773.    mandatory-to-implement algorithms (specified in [KBC97] and in [need
  774.    a new I-D with DES-CBC and implicit IV generation, but no overlap
  775.    with this document].
  776.  
  777.              - DES in CBC mode
  778.              - HMAC with MD5
  779.              - HMAC with SHA-1
  780.  
  781. 5.  Security Considerations
  782.  
  783.    Security is central to the design of this protocol, and this security
  784.    considerations permeate the specification.  Additional security-
  785.    relevant aspects of using IPsec protocol are discussed in the
  786.    document, "Security Architecture for the Internet Protocol".
  787.  
  788.  
  789. Acknowledgements
  790.  
  791.    Many of the concepts embodied in this specification were derived from
  792.    or influenced by the US Government's SP3 security protocol, ISO/IEC's
  793.    NLSP, or from the proposed swIPe security protocol.  [SDNS89, ISO92
  794.    IB93].
  795.  
  796.    For over 2 years, this document has evolved through multiple versions
  797.  
  798.  
  799. Kent, Atkinson                                                 [Page 14]
  800.  
  801.  
  802.  
  803. Internet Draft              IP Encapsulating               26 March 1997
  804.                          Security Payload (ESP)
  805.  
  806.  
  807.    and iterations.  During this time, many people have contributed
  808.    significant ideas and energy to the process and the documents
  809.    themselves.  The authors would like to thank the members of the IPSEC
  810.    and IPng working groups, with special mention of the efforts of (in
  811.    alphabetic order): Steve Bellovin, Steve Deering, Phil Karn, Perry
  812.    Metzger, David Mihelcic, Hilarie Orman, and William Simpson.  In
  813.    addition, Charlie Lynn, Karen Seo, and Nina Yuan provided extensive
  814.    help in the review and editing of this version of the specification.
  815.  
  816. References
  817.  
  818.    [Bel89]   Steven M. Bellovin, "Security Problems in the TCP/IP
  819.              Protocol Suite", ACM Computer Communications Review, Vol.
  820.              19, No. 2, March 1989.
  821.  
  822.    [CERT95]  Computer Emergency Response Team (CERT), "IP Spoofing
  823.              Attacks and Hijacked Terminal Connections", CA-95:01,
  824.              January 1995.  Available via anonymous ftp from
  825.              info.cert.org.
  826.  
  827.    [DH95]    Steve Deering & Robert Hinden, Internet Protocol Version 6
  828.              (Ipv6)  Specification, RFC 1883, December 1995.
  829.  
  830.    [IB93]    John Ioannidis & Matt Blaze, "Architecture and
  831.              Implementation of Network-layer Security Under Unix",
  832.              Proceedings of the USENIX Security Symposium, Santa Clara,
  833.              CA, October 1993.
  834.  
  835.    [ISO92]   ISO/IEC JTC1/SC6, Network Layer Security Protocol, ISO-IEC
  836.              DIS 11577, International Standards Organisation, Geneva,
  837.              Switzerland, 29 November 1992.
  838.  
  839.    [KBC97]   Hugo Krawczyk, Mihir Bellare, and Ran Canetti, "HMAC:
  840.              Keyed-Hashing for Message Authentication", RFC-2104,
  841.              February 1997.
  842.  
  843.    [Ken91]   Steve Kent, "US DoD Security Options for the Internet
  844.              Protocol (IPSO)", RFC-1108, November 1991.
  845.  
  846.    [KA97a]   Steve Kent, Randall Atkinson, "Security Architecture for
  847.              the Internet Protocol", Internet Draft, ?? 1997.
  848.  
  849.    [KA97b]   Steve Kent, Randall Atkinson, "IP Authentication Header",
  850.              Internet Draft, March 1997.
  851.  
  852.    [MS95]    Perry Metzger & W.A. Simpson, "The ESP DES-CBC Transform",
  853.              RFC-1829, August 1995.
  854.  
  855.  
  856. Kent, Atkinson                                                 [Page 15]
  857.  
  858.  
  859.  
  860. Internet Draft              IP Encapsulating               26 March 1997
  861.                          Security Payload (ESP)
  862.  
  863.  
  864.    [NIST77]  US National Bureau of Standards, "Data Encryption
  865.              Standard", Federal Information Processing Standard (FIPS)
  866.              Publication 46, January 1977.
  867.  
  868.    [NIST80]  US National Bureau of Standards, "DES Modes of Operation"
  869.              Federal Information Processing Standard (FIPS) Publication
  870.              81, December 1980.
  871.  
  872.    [NIST81]  US National Bureau of Standards, "Guidelines for
  873.              Implementing and Using the Data Encryption Standard",
  874.              Federal Information Processing Standard (FIPS) Publication
  875.              74, April 1981.
  876.  
  877.    [NIST88]  US National Bureau of Standards, "Data Encryption
  878.              Standard", Federal Information Processing Standard (FIPS)
  879.              Publication 46-1, January 1988.
  880.  
  881.    [Riv92]   Ronald Rivest, MD5 Digest Algorithm, RFC-1321, April 1992.
  882.  
  883.    [SHA]     NIST, FIPS PUB 180-1: Secure Hash Standard, April 1995
  884.  
  885.    [STD-2]   J. Reynolds and J. Postel, "Assigned Numbers", STD-2, 20
  886.              October 1994.
  887.  
  888.    [Sch94]   Bruce Schneier, Applied Cryptography, John Wiley & Sons,
  889.              New York, NY, 1994. ISBN 0-471-59756-2
  890.  
  891.    [SDNS89]  SDNS Secure Data Network System, Security Protocol 3, SP3,
  892.              Document SDN.301, Revision 1.5, 15 May 1989, as published
  893.              in NIST Publication NIST-IR-90-4250, February 1990.
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913. Kent, Atkinson                                                 [Page 16]
  914.  
  915.  
  916.  
  917. Internet Draft              IP Encapsulating               26 March 1997
  918.                          Security Payload (ESP)
  919.  
  920.  
  921. Disclaimer
  922.  
  923.    The views and specification here are those of the authors and are not
  924.    necessarily those of their employers.  The authors and their
  925.    employers specifically disclaim responsibility for any problems
  926.    arising from correct or incorrect implementation or use of this
  927.    specification.
  928.  
  929.  
  930.  
  931. Author Information
  932.  
  933.    Stephen Kent
  934.    BBN Corporation
  935.    70 Fawcett Street
  936.    Cambridge, MA  02140
  937.    USA
  938.    Telephone: +1 (617) 873-3988
  939.  
  940.    Randall Atkinson <rja@inet.org>
  941.    @Home Network
  942.    385 Ravendale Drive
  943.    Mountain View, CA 94043
  944.    USA
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970. Kent, Atkinson                                                 [Page 17]
  971.