RFC 4868

Using HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512 with IPsec
Standards Track
May 2007
Abstract: Specifies the use of HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512 as integrity algorithms within IPsec ESP and AH. These algorithms replace HMAC-MD5 and HMAC-SHA-1 in 3GPP NDS/IP (TS 33.210) for modern deployments.
Canonical source: https://www.rfc-editor.org/rfc/rfc4868  |  IETF Datatracker

1. Introduction

▶

HMAC (Hash-based Message Authentication Code) combined with SHA-2 family hash functions provides strong integrity protection for IPsec packets. This RFC defines how to use HMAC-SHA-256-128, HMAC-SHA-384-192, and HMAC-SHA-512-256 as ESP/AH integrity algorithms.

In 3GPP networks, HMAC-SHA-256-128 is the recommended integrity algorithm for IPsec on NDS/IP interfaces (Ze, Zb, Zd) protecting Diameter, GTP-C, and other core signaling.

2. Algorithm Parameters

▶
Algorithm HMAC Output Truncation ICV Length Key Length
HMAC-SHA-256-128 256 bits 128 bits 16 bytes 32 bytes
HMAC-SHA-384-192 384 bits 192 bits 24 bytes 48 bytes
HMAC-SHA-512-256 512 bits 256 bits 32 bytes 64 bytes

3. HMAC Construction

▶

HMAC computes a nested hash: H(K ⊕ opad || H(K ⊕ ipad || M)). The output is truncated to the specified ICV length. Truncation provides adequate security while reducing packet overhead.

  Key (K)                    Message (M)
|                           |
v                           |
K ⊕ ipad                     |
|                           |
+---------> H( (K ⊕ ipad) || M )
|
v
inner_hash
|
K ⊕ opad             |
|                   |
+---------> H( (K ⊕ opad) || inner_hash )
|
v
HMAC output
|
Truncate to ICV length
|
v
ICV (appended to ESP/AH packet)

4. Security Considerations

▶
  • HMAC-SHA-256-128 provides 128-bit security against forgery — sufficient for current requirements
  • Key length should match the hash output size — shorter keys reduce security
  • Truncation to 128 bits is considered safe for HMAC-SHA-256 (birthday bound is 2^64 for forgery)
  • These algorithms replace HMAC-MD5-96 and HMAC-SHA-1-96 which have reduced security margins