]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ah: use crypto_memneq to check the ICV
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 3 May 2017 14:57:57 +0000 (16:57 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 19 May 2017 12:30:50 +0000 (14:30 +0200)
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv4/ah4.c
net/ipv6/ah6.c

index 22377c8ff14b72292caa5c2f72898fc60dcfa576..207350b30f8874cfe71973997b503a6444a3fab8 100644 (file)
@@ -1,5 +1,6 @@
 #define pr_fmt(fmt) "IPsec: " fmt
 
+#include <crypto/algapi.h>
 #include <crypto/hash.h>
 #include <linux/err.h>
 #include <linux/module.h>
@@ -277,7 +278,7 @@ static void ah_input_done(struct crypto_async_request *base, int err)
        auth_data = ah_tmp_auth(work_iph, ihl);
        icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
 
-       err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG: 0;
+       err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
        if (err)
                goto out;
 
@@ -413,7 +414,7 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
                goto out_free;
        }
 
-       err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG: 0;
+       err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
        if (err)
                goto out_free;
 
index dda6035e3b8480d9f2640f99f15f19e54b4f6b02..ac747b13a8dc27656f5dfe8cb81c3bab68197035 100644 (file)
@@ -25,6 +25,7 @@
 
 #define pr_fmt(fmt) "IPv6: " fmt
 
+#include <crypto/algapi.h>
 #include <crypto/hash.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -481,7 +482,7 @@ static void ah6_input_done(struct crypto_async_request *base, int err)
        auth_data = ah_tmp_auth(work_iph, hdr_len);
        icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
 
-       err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
+       err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
        if (err)
                goto out;
 
@@ -627,7 +628,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
                goto out_free;
        }
 
-       err = memcmp(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
+       err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
        if (err)
                goto out_free;