Internet Engineering Task Force | A. Malhotra |
Internet-Draft | S. Goldberg |
Intended status: Standards Track | Boston University |
Expires: January 9, 2017 | July 8, 2016 |
Message Authentication Codes for the Network Time Protocol
draft-aanchal4-ntp-mac-00
The Network Time Protocol (NTP) RFC 5905 [RFC5905] uses a message authentication code (MAC) to cryptographically authenticate its UDP packets. Currently, NTP packets are authenticated by appending a 128-bit key to the NTP data, and hashing the result with MD5 to obtain a 128-bit tag. However, as discussed in [BCK] and [RFC6151], this not a secure MAC. As such, this draft considers different secure MAC algorithms for use with NTP, and evaluates their performance. Given the security concerns, we also suggest deprecating the use of MD5 as defined in [RFC5905] for authenticating NTP packets.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 9, 2017.
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
NTP uses a message authentication code (MAC) to authenticate its packets. Currently, NTP packets are authenticated by appending a 128-bit key to the NTP data, and hashing the result with MD5 to obtain a 128-bit tag. However, as discussed in [BCK] and [RFC6151], this not a secure MAC. As such, this draft considers different secure MAC algorithms for use with NTP, and evaluates their performance. Given the security concerns, we also suggest deprecating the use of MD5 as defined in [RFC5905] for authenticating NTP packets.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
We consider five diverse MAC algorithms, which encompass hash-based HMAC-MD5 and HMAC-SHA224 [RFC2104], block cipher-based CMAC-AES [RFC4493], and universal hashing-based Galois MAC (GMAC) [RFC4543] and Poly1305(ChaCha20) as in section 2.6 of [RFC7539]. For completeness we also benchmark the legacy MD5(key||message) from [RFC5905].
Algorithm | Input Key Length (Bytes) | Output Tag Length (Bytes) | Security Level (bits) |
---|---|---|---|
legacy MD5 | 16 | 16 | NA |
HMAC-MD5 | 16 | 16 | NA |
HMAC-SHA224 | 16 | 28 | 112 |
CMAC(AES) | 16 | 16 | 128 |
GMAC(AES) | 16 | 16 | 128 |
Poly1305(ChaCha20) | 32 | 16 | 128 |
The choice of algorithms evaluated here is motivated, in part, by standardization and availablity of open source implementation. Four out of five algorithms are at least available in the OpenSSL library and are standardized. The Poly1305(ChaCha20) algorithm is implemented in LibreSSL, a fork of OpenSSL and also in BoringSSL, Google's implementation of OpenSSL.
In order to accurately compute the time, NTP ideally requires MAC algorithms to have a constant computational latency. However, this is generally not possible, since latency depends on the CPU load, temperature, and other uncontrollable factors. Instead, a MAC algorithm that requires fewer clock cycles for computation is prefered over one that requires more clock cycles, as this directly translates to a reduction in jitter (i.e., the variance of the latency for computing the MAC).
Throughput is another important consideration. NTP servers may have to deal with thousands of client requests per second. A study [NIST] on the usage analysis of NIST's NTP stratum 1 servers shows these servers caters to 28,000 requests/second on an average, per server.
Most of the Internet is served by stratum 2 and stratum 3 servers, some of which are part of voluntary NTP pool. These machines may be running old hardware. So we benchmark performance on a range of software and hardware platforms.
The NTP header is 48 bytes long. We therefore consider the latency and throughput for several secure message authentication code (MAC) algorithms when computed over 48-byte messages.
We customize the in-built speed utility of OpenSSL-1.0.2g (03 May 2016) version to compute the latency and throughput for each MAC as shown in the tables below. OpenSSL, however, does not implement stream-cipher ChaCha20-based Poly1305 MAC algorithm. To speed test this MAC, we use LibreSSL 2.3.1, a fork of OpenSSL implementation. OpenSSL and LibreSSL are the most widely used cryptographic libraries and are used by the current NTP implementations.
Since the introduction of New Instruction (NI) set for hardware support in Intel chips, certain MACs like CMAC and GMAC have performance advantage on such machines. Based on this, we perform two different benchmarks once with AES-NI enabled and the other time disabled on an x86_64, Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz with one core CPU.
This table shows throughput in terms of number of 48-byte NTP payload processed per second.
Algorithm | with AES-NI | without AES-NI |
---|---|---|
legacy MD5 | 3118K | 3165K |
HMAC-MD5 | 2742K | 2749K |
HMAC-SHA224 | 1265K | 1267K |
CMAC(AES) | 7567K | 4388K |
GMAC(AES) | 16612K | 4627K |
Poly1305(ChaCha20) | 2598K | 2398K |
This table shows latency in terms of number of CPU cycles per byte (cpb) when processing a 48-byte NTP payload.
Algorithm | with AES-NI | without AES-NI |
---|---|---|
legacy MD5 | 16.03 | 15.7 |
HMAC-MD5 | 18.2 | 18.1 |
HMAC-SHA224 | 39.4 | 39 |
CMAC(AES) | 6.6 | 11.3 |
GMAC(AES) | 3.009 | 10.8 |
Poly1305(ChaCha20) | 14.4 | 15 |
TODO: Test on other types of hardware.
We suggest that use of GMAC(AES) because it has the best latency and throughput performance.
The MD5 (key||message) "message authentication code" specified in [RFC5905] is vulnerable to length extension attacks, and uses the insecure MD5 hash function, and therefore should be deprecated.
The output of HMAC-SHA224 is 28 bytes, but we truncate it to 16 bytes as in section 4 of [RFC7630] to fit into the NTP packet. As noted in section 6 of [RFC2104] it is safe to truncate the output of MACs as long as the truncated length is greater than 80-bits and not less than half the length of the hash output.
TO DO: Not finished yet. Following factors will be considered for security comparison.
The authors wish to acknowledge useful discussions with Harlan Stenn, Mayank Varia, Daniel Franke, Ethan Heilman, and Leen Alshenibr.
[BCK] | Bellare, M., Canetti, R. and H. Krawczyk, "Keyed Hash Functions and Message Authentication", in Proceedings of Crypto'96, 1996. |
[NIST] | Sherman, J. and J. Levine, "Usage Analysis of the NIST Internet Time Service", in Journal of Research of the National Institute of Standards and Technology, 2016. |