Fix one wrong offset which is passed into DES weak key checking in TdesInit().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.l...@intel.com>
CC: Jiaxin Wu <jiaxin...@intel.com>
---
 CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c 
b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c
index f89094a..8025a49 100644
--- a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c
+++ b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c
@@ -1,9 +1,9 @@
 /** @file
   TDES Wrapper Implementation over OpenSSL.
 
-Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2015, 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
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -88,22 +88,22 @@ TdesInit (
     CopyMem (KeySchedule + 1, KeySchedule, sizeof (DES_key_schedule));
     CopyMem (KeySchedule + 2, KeySchedule, sizeof (DES_key_schedule));
     return TRUE;
   }
 
-  if (DES_is_weak_key ((const_DES_cblock *) Key + 8) == 1) {
+  if (DES_is_weak_key ((const_DES_cblock *) (Key + 8)) == 1) {
     return FALSE;
   }
 
   DES_set_key_unchecked ((const_DES_cblock *) (Key + 8), KeySchedule + 1);
 
   if (KeyLength == 128) {
     CopyMem (KeySchedule + 2, KeySchedule, sizeof (DES_key_schedule));
     return TRUE;
   }
 
-  if (DES_is_weak_key ((const_DES_cblock *) Key + 16) == 1) {
+  if (DES_is_weak_key ((const_DES_cblock *) (Key + 16)) == 1) {
     return FALSE;
   }
 
   DES_set_key_unchecked ((const_DES_cblock *) (Key + 16), KeySchedule + 2);
 
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to