Skip to contentSkip to conversation

FAILED: patch "[PATCH] sunrpc: use constant time memory comparison for mac" failed to apply to 4.4-stable tree

PATCH [email protected] 1 participant 1 message Jul 25, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 15a8b93fd5690de017ce665382ea45e5d61811a4 Mon Sep 17 00:00:00 2001

From: "Jason A. Donenfeld" <[email protected]>
Date: Sat, 10 Jun 2017 04:59:07 +0200
Subject: [PATCH] sunrpc: use constant time memory comparison for mac

Otherwise, we enable a MAC forgery via timing attack.

net/sunrpc/auth_gss/gss_krb5_crypto.c +2 -1
index fb39284ec174..12649c9fedab 100644
@@ -34,6 +34,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+#include <crypto/algapi.h>
 #include <crypto/hash.h>
 #include <crypto/skcipher.h>
 #include <linux/err.h>
@@ -927,7 +928,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf,
 	if (ret)
 		goto out_err;
 
-	if (memcmp(pkt_hmac, our_hmac, kctx->gk5e->cksumlength) != 0) {
+	if (crypto_memneq(pkt_hmac, our_hmac, kctx->gk5e->cksumlength) != 0) {
 		ret = GSS_S_BAD_SIG;
 		goto out_err;
 	}