public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero
@ 2017-02-20  3:02 Hao Wu
  2017-02-20  3:08 ` Wu, Jiaxin
  2017-02-20  3:29 ` Fu, Siyuan
  0 siblings, 2 replies; 3+ messages in thread
From: Hao Wu @ 2017-02-20  3:02 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Wu Jiaxin, Siyuan Fu

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 NetworkPkg/IpSecDxe/Ikev2/Utility.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index c365532..2ca7f3c 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -2,7 +2,7 @@
   The Common operations used by IKE Exchange Process.
 
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -2627,6 +2627,8 @@ Ikev2ChildSaParseSaPayload (
 
   @retval EFI_SUCCESS            The operation complete successfully.
   @retval EFI_INVALID_PARAMETER  If NumFragments is zero.
+                                 If the authentication algorithm given by HashAlgId
+                                 cannot be found.
   @retval EFI_OUT_OF_RESOURCES   If the required resource can't be allocated.
   @retval Others                 The operation is failed.
 
@@ -2663,6 +2665,10 @@ Ikev2SaGenerateKey (
   LocalFragments[2].Data = NULL;
 
   AuthKeyLength = IpSecGetHmacDigestLength (HashAlgId);
+  if (AuthKeyLength == 0) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   DigestSize    = AuthKeyLength;
   Digest        = AllocateZeroPool (AuthKeyLength);
 
-- 
1.9.5.msysgit.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero
  2017-02-20  3:02 [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero Hao Wu
@ 2017-02-20  3:08 ` Wu, Jiaxin
  2017-02-20  3:29 ` Fu, Siyuan
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jiaxin @ 2017-02-20  3:08 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Wu, Hao A, Fu, Siyuan

Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

Thanks,
Jiaxin

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Hao Wu
> Sent: Monday, February 20, 2017 11:03 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>;
> Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible
> divide by zero
> 
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  NetworkPkg/IpSecDxe/Ikev2/Utility.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> index c365532..2ca7f3c 100644
> --- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> +++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
> @@ -2,7 +2,7 @@
>    The Common operations used by IKE Exchange Process.
> 
>    (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
> -  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -2627,6 +2627,8 @@ Ikev2ChildSaParseSaPayload (
> 
>    @retval EFI_SUCCESS            The operation complete successfully.
>    @retval EFI_INVALID_PARAMETER  If NumFragments is zero.
> +                                 If the authentication algorithm given by HashAlgId
> +                                 cannot be found.
>    @retval EFI_OUT_OF_RESOURCES   If the required resource can't be
> allocated.
>    @retval Others                 The operation is failed.
> 
> @@ -2663,6 +2665,10 @@ Ikev2SaGenerateKey (
>    LocalFragments[2].Data = NULL;
> 
>    AuthKeyLength = IpSecGetHmacDigestLength (HashAlgId);
> +  if (AuthKeyLength == 0) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
>    DigestSize    = AuthKeyLength;
>    Digest        = AllocateZeroPool (AuthKeyLength);
> 
> --
> 1.9.5.msysgit.0
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero
  2017-02-20  3:02 [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero Hao Wu
  2017-02-20  3:08 ` Wu, Jiaxin
@ 2017-02-20  3:29 ` Fu, Siyuan
  1 sibling, 0 replies; 3+ messages in thread
From: Fu, Siyuan @ 2017-02-20  3:29 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Wu, Jiaxin

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>


-----Original Message-----
From: Wu, Hao A 
Sent: 2017年2月20日 11:03
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>
Subject: [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 NetworkPkg/IpSecDxe/Ikev2/Utility.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index c365532..2ca7f3c 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -2,7 +2,7 @@
   The Common operations used by IKE Exchange Process.
 
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -2627,6 +2627,8 @@ Ikev2ChildSaParseSaPayload (
 
   @retval EFI_SUCCESS            The operation complete successfully.
   @retval EFI_INVALID_PARAMETER  If NumFragments is zero.
+                                 If the authentication algorithm given by HashAlgId
+                                 cannot be found.
   @retval EFI_OUT_OF_RESOURCES   If the required resource can't be allocated.
   @retval Others                 The operation is failed.
 
@@ -2663,6 +2665,10 @@ Ikev2SaGenerateKey (
   LocalFragments[2].Data = NULL;
 
   AuthKeyLength = IpSecGetHmacDigestLength (HashAlgId);
+  if (AuthKeyLength == 0) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   DigestSize    = AuthKeyLength;
   Digest        = AllocateZeroPool (AuthKeyLength);
 
--
1.9.5.msysgit.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-20  3:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-20  3:02 [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero Hao Wu
2017-02-20  3:08 ` Wu, Jiaxin
2017-02-20  3:29 ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox