summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-05-09 04:06:58 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-05-09 04:06:58 +0000
commitf812c2259ac27f26f29c7e11a9acbacb45ceb386 (patch)
tree1e9ffc1a1356dfd11087c936d7582acb22842fb1
parent5be1d046ef90b8b29f90b85d5bdff37e352df55f (diff)
downloadedk2-f812c2259ac27f26f29c7e11a9acbacb45ceb386.zip
edk2-f812c2259ac27f26f29c7e11a9acbacb45ceb386.tar.gz
edk2-f812c2259ac27f26f29c7e11a9acbacb45ceb386.tar.bz2
Sync patches r13691, r13703, r13704, r13909, r13957, r14039, r14079, r14082, r14115, r14165, r14256, r14259, r14294 adn r14296 from main trunk.
1. Should pass in bytes of string buffer to UnicodeSPrint() rather than Unicode string length. 2. Check the return code from CoreLocateDevicePath() in MdeModulePkg/Core/Dxe/Image/Image.c CoreLoadImageCommon(). 3. Fix the memory leak issue and enhance the check for CoreReadImageFile return. 4. MdeModulePkg: eliminate all implicit library dependencies for all modules in MdeModulePkg on PcdLib. 5. SecurityPkg update: a. Correct the counter-based hash algorithm according to UEFI spec. b. Check the reserverd bit in variable attribute. c. Return EFI_OUT_OF_RESOURCE instead of EFI_SECURITY_VIOLATION if there is not enough speace to store the public key. d. Fix a bug when deleting a non-existent time-based auth variable, we store the certificate into cert DB incorrectly. e. Fix a bug that time-based auth variable can't been updated again after append operation. 6. Fix several RFC compliance issues in DHCP6 driver as below. a. Client must ignore any Advertise message that includes a Status Code option containing the value NoAddrsAvail. b. The elapsed-time should start from the current DHCP transaction. c. Client should not change any information about addresses the client has recorded in the IA but not included in the IA from the server. d. Client need to update to handle the error status code UnspecFail/UseMulticast/NotOnLink/NoBinding in the Reply message from server. e. When the client receives a Reply message in response to a Renew/ Rebind message, the client examines each IA independently. For each IA in the original Renew/ Rebind message, the client sends a Renew/ Rebind if the IA is not in the Reply message. f. Client should uses network byte order in IANA T1/T2 option 7. Client should discard any addresses for which the preferred lifetime is greater than the valid lifetime. 7. Fix infinite loop bug in secure boot UI driver. 8. Fix a bug in snp driver binding Start() that it may return incorrect status code. 9. Fix a bug that IsSignatureFoundInDatabase() incorrectly computes CertCount. 10.Fix several bugs in the implementation of converting SAS/SASEX device path node from/to text. 11.Add transit bit check for detecting partial response in iSCSI stack. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010.SR1@14331 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c4
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf1
-rw-r--r--MdeModulePkg/Bus/Pci/IdeBusPei/IdeBusPei.inf3
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.inf1
-rw-r--r--MdeModulePkg/Core/Dxe/Image/Image.c17
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain.inf3
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf3
-rw-r--r--MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf1
-rw-r--r--MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h1
-rw-r--r--MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf1
-rw-r--r--MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf3
-rw-r--r--MdeModulePkg/Universal/DebugSupportDxe/Ia32/DebugSupport.h1
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c100
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c36
-rw-r--r--MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf3
-rw-r--r--MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf1
-rw-r--r--MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf1
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c10
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c4
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/Snp.c21
-rw-r--r--MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.h1
-rw-r--r--MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf3
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Expression.c2
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf1
-rw-r--r--MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf4
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf1
-rw-r--r--MdePkg/Library/UefiDebugLibConOut/DebugLib.c4
-rw-r--r--MdePkg/Library/UefiDebugLibStdErr/DebugLib.c4
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c6
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h4
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Io.c194
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c148
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h7
-rw-r--r--NetworkPkg/IScsiDxe/IScsiProto.c2
-rw-r--r--SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c2
-rw-r--r--SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c16
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c20
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c7
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h7
-rw-r--r--SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c2
40 files changed, 453 insertions, 197 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
index 7d4f33d..7317767 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
@@ -1,7 +1,7 @@
/** @file
Dynamically update the pages.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, 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
@@ -1191,7 +1191,7 @@ GetLegacyBootOptionVar (
}
for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]);
+ UnicodeSPrint (StrTemp, sizeof (StrTemp), L"Boot%04x", OrderBuffer[Index]);
OptionBuffer = BdsLibGetVariableAndSize (
StrTemp,
&gEfiGlobalVariableGuid,
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
index 7f4a668..9c79bb8 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
@@ -58,6 +58,7 @@
DebugLib
TimerLib
ReportStatusCodeLib
+ PcdLib
[Protocols]
gEfiAtaPassThruProtocolGuid # BY_START
diff --git a/MdeModulePkg/Bus/Pci/IdeBusPei/IdeBusPei.inf b/MdeModulePkg/Bus/Pci/IdeBusPei/IdeBusPei.inf
index f28124c..11f60f2 100644
--- a/MdeModulePkg/Bus/Pci/IdeBusPei/IdeBusPei.inf
+++ b/MdeModulePkg/Bus/Pci/IdeBusPei/IdeBusPei.inf
@@ -4,7 +4,7 @@
# for Atapi CD ROM device.
#
# This module discovers CDROM devices in Legacy and native mode and installs block IO ppis for them.
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions
@@ -51,6 +51,7 @@
TimerLib
PeiServicesTablePointerLib
MemoryAllocationLib
+ PcdLib
[Ppis]
gPeiAtaControllerPpiGuid # PPI ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 32f6e3e..e8e3252 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -92,6 +92,7 @@
TimerLib
DxeServicesLib
DebugAgentLib
+ PcdLib
[Guids]
gEfiEventMemoryMapChangeGuid ## CONSUMES ## Event
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index a3cffce..8a3e869 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -389,7 +389,10 @@ GetPeCoffImageFixLoadingAssignedAddress(
if (EFI_ERROR (Status)) {
return Status;
}
-
+ if (Size != sizeof (EFI_IMAGE_SECTION_HEADER)) {
+ return EFI_NOT_FOUND;
+ }
+
Status = EFI_NOT_FOUND;
if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
@@ -1079,7 +1082,10 @@ CoreLoadImageCommon (
if (SourceBuffer != NULL) {
FHand.Source = SourceBuffer;
FHand.SourceSize = SourceSize;
- CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, &HandleFilePath, &DeviceHandle);
+ Status = CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, &HandleFilePath, &DeviceHandle);
+ if (EFI_ERROR (Status)) {
+ DeviceHandle = NULL;
+ }
if (SourceSize > 0) {
Status = EFI_SUCCESS;
} else {
@@ -1125,11 +1131,9 @@ CoreLoadImageCommon (
}
}
- if (Status == EFI_ALREADY_STARTED) {
+ if (EFI_ERROR (Status)) {
Image = NULL;
goto Done;
- } else if (EFI_ERROR (Status)) {
- return Status;
}
if (gSecurity2 != NULL) {
@@ -1191,7 +1195,8 @@ CoreLoadImageCommon (
//
Image = AllocateZeroPool (sizeof(LOADED_IMAGE_PRIVATE_DATA));
if (Image == NULL) {
- return EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
}
//
diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf
index fb4bd6b..2cf9df7 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.inf
+++ b/MdeModulePkg/Core/Pei/PeiMain.inf
@@ -4,7 +4,7 @@
# 2) Dispatch PEIM from discovered FV.
# 3) Handoff control to DxeIpl to load DXE core and enter DXE phase.
#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2012, 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
@@ -67,6 +67,7 @@
CacheMaintenanceLib
PeCoffLib
PeiServicesTablePointerLib
+ PcdLib
[Guids]
gPeiAprioriFileNameGuid ## CONSUMES ## GUID
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
index d5a9c68..6af4f65 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
@@ -1,7 +1,7 @@
## @file
# This module provide an SMM CIS compliant implementation of SMM IPL.
#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2012, 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
@@ -48,6 +48,7 @@
UefiLib
UefiRuntimeLib
DxeServicesLib
+ PcdLib
[Protocols]
gEfiSmmBase2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
index 9cb8781..89424ac 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
@@ -48,7 +48,6 @@
MemoryAllocationLib
PcdLib
HobLib
- PcdLib
[Protocols]
gEfiAcpiTableProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h
index a9b724d..f5ca606 100644
--- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h
@@ -25,7 +25,6 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/S3BootScriptLib.h>
-#include <Library/PcdLib.h>
#include <Library/SmbusLib.h>
#include <IndustryStandard/SmBus.h>
/**
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
index 9a2cf96..e3fdb3a 100644
--- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
+++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
@@ -38,7 +38,6 @@
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
- PcdLib
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
MemoryAllocationLib
diff --git a/MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf b/MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
index e745eb4..572a520 100644
--- a/MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
+++ b/MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
@@ -6,7 +6,7 @@
# provides debug-agent to periodically gain control during operation of the machine to
# check for asynchronous commands form the host.
#
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2012, 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
@@ -72,7 +72,6 @@
DebugLib
[LibraryClasses.IA32]
- PcdLib
BaseLib
[LibraryClasses.X64]
diff --git a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/DebugSupport.h b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/DebugSupport.h
index 50944e6..7f7d8e5 100644
--- a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/DebugSupport.h
+++ b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/DebugSupport.h
@@ -26,7 +26,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
-#include <Library/PcdLib.h>
#define NUM_IDT_ENTRIES 0x78
#define SYSTEM_TIMER_VECTOR 0x68
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
index d94e149..f96bea1 100644
--- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
+++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
@@ -1,7 +1,7 @@
/** @file
DevicePathFromText protocol as defined in the UEFI 2.0 specification.
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -1636,6 +1636,7 @@ DevPathFromTextSAS (
CHAR16 *DriveBayStr;
CHAR16 *ReservedStr;
UINT16 Info;
+ UINT16 Uint16;
SAS_DEVICE_PATH *Sas;
AddressStr = GetNextParamStr (&TextDeviceNode);
@@ -1646,7 +1647,6 @@ DevPathFromTextSAS (
ConnectStr = GetNextParamStr (&TextDeviceNode);
DriveBayStr = GetNextParamStr (&TextDeviceNode);
ReservedStr = GetNextParamStr (&TextDeviceNode);
- Info = 0x0000;
Sas = (SAS_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
@@ -1657,25 +1657,51 @@ DevPathFromTextSAS (
Strtoi64 (AddressStr, &Sas->SasAddress);
Strtoi64 (LunStr, &Sas->Lun);
Sas->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
- if (StrCmp (SASSATAStr, L"NoTopology") != 0) {
- if (StrCmp (DriveBayStr, L"0") == 0) {
- Info |= 0x0001;
+
+ if (StrCmp (SASSATAStr, L"NoTopology") == 0) {
+ Info = 0x0;
+
+ } else if ((StrCmp (SASSATAStr, L"SATA") == 0) || (StrCmp (SASSATAStr, L"SAS") == 0)) {
+
+ Uint16 = (UINT16) Strtoi (DriveBayStr);
+ if (Uint16 == 0) {
+ Info = 0x1;
} else {
- Info |= 0x0002;
- Info = (UINT16) (Info | (Strtoi (DriveBayStr) << 8));
+ Info = (UINT16) (0x2 | ((Uint16 - 1) << 8));
}
if (StrCmp (SASSATAStr, L"SATA") == 0) {
- Info |= 0x0010;
+ Info |= BIT4;
}
+ //
+ // Location is an integer between 0 and 1 or else
+ // the keyword Internal (0) or External (1).
+ //
if (StrCmp (LocationStr, L"External") == 0) {
- Info |= 0x0020;
+ Uint16 = 1;
+ } else if (StrCmp (LocationStr, L"Internal") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0);
}
+ Info |= (Uint16 << 5);
+ //
+ // Connect is an integer between 0 and 3 or else
+ // the keyword Direct (0) or Expanded (1).
+ //
if (StrCmp (ConnectStr, L"Expanded") == 0) {
- Info |= 0x0040;
+ Uint16 = 1;
+ } else if (StrCmp (ConnectStr, L"Direct") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1));
}
+ Info |= (Uint16 << 6);
+
+ } else {
+ Info = (UINT16) Strtoi (SASSATAStr);
}
Sas->DeviceTopology = Info;
@@ -1705,6 +1731,9 @@ DevPathFromTextSasEx (
CHAR16 *ConnectStr;
CHAR16 *DriveBayStr;
UINT16 Info;
+ UINT16 Uint16;
+ UINT64 SasAddress;
+ UINT64 Lun;
SASEX_DEVICE_PATH *SasEx;
AddressStr = GetNextParamStr (&TextDeviceNode);
@@ -1714,37 +1743,62 @@ DevPathFromTextSasEx (
LocationStr = GetNextParamStr (&TextDeviceNode);
ConnectStr = GetNextParamStr (&TextDeviceNode);
DriveBayStr = GetNextParamStr (&TextDeviceNode);
- Info = 0x0000;
SasEx = (SASEX_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_SASEX_DP,
(UINT16) sizeof (SASEX_DEVICE_PATH)
);
- Strtoi64 (AddressStr, (UINT64 *) &SasEx->SasAddress);
- Strtoi64 (LunStr, (UINT64 *) &SasEx->Lun);
- *(UINT64 *) &SasEx->SasAddress = SwapBytes64 (*(UINT64 *) &SasEx->SasAddress);
- *(UINT64 *) &SasEx->Lun = SwapBytes64 (*(UINT64 *) &SasEx->Lun);
+ Strtoi64 (AddressStr, &SasAddress);
+ Strtoi64 (LunStr, &Lun);
+ WriteUnaligned64 ((UINT64 *) &SasEx->SasAddress, SwapBytes64 (SasAddress));
+ WriteUnaligned64 ((UINT64 *) &SasEx->Lun, SwapBytes64 (Lun));
SasEx->RelativeTargetPort = (UINT16) Strtoi (RTPStr);
- if (StrCmp (SASSATAStr, L"NoTopology") != 0) {
- if (StrCmp (DriveBayStr, L"0") == 0) {
- Info |= 0x0001;
+
+ if (StrCmp (SASSATAStr, L"NoTopology") == 0) {
+ Info = 0x0;
+
+ } else if ((StrCmp (SASSATAStr, L"SATA") == 0) || (StrCmp (SASSATAStr, L"SAS") == 0)) {
+
+ Uint16 = (UINT16) Strtoi (DriveBayStr);
+ if (Uint16 == 0) {
+ Info = 0x1;
} else {
- Info |= 0x0002;
- Info = (UINT16) (Info | (Strtoi (DriveBayStr) << 8));
+ Info = (UINT16) (0x2 | ((Uint16 - 1) << 8));
}
if (StrCmp (SASSATAStr, L"SATA") == 0) {
- Info |= 0x0010;
+ Info |= BIT4;
}
+ //
+ // Location is an integer between 0 and 1 or else
+ // the keyword Internal (0) or External (1).
+ //
if (StrCmp (LocationStr, L"External") == 0) {
- Info |= 0x0020;
+ Uint16 = 1;
+ } else if (StrCmp (LocationStr, L"Internal") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (LocationStr) & BIT0);
}
+ Info |= (Uint16 << 5);
+ //
+ // Connect is an integer between 0 and 3 or else
+ // the keyword Direct (0) or Expanded (1).
+ //
if (StrCmp (ConnectStr, L"Expanded") == 0) {
- Info |= 0x0040;
+ Uint16 = 1;
+ } else if (StrCmp (ConnectStr, L"Direct") == 0) {
+ Uint16 = 0;
+ } else {
+ Uint16 = ((UINT16) Strtoi (ConnectStr) & (BIT0 | BIT1));
}
+ Info |= (Uint16 << 6);
+
+ } else {
+ Info = (UINT16) Strtoi (SASSATAStr);
}
SasEx->DeviceTopology = Info;
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
index 1f90f64..3d9d7c7 100644
--- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
+++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
@@ -1,7 +1,7 @@
/** @file
DevicePathToText protocol as defined in the UEFI 2.0 specification.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -234,23 +234,26 @@ DevPathToTextVendor (
((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort
);
Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);
- if ((Info & 0x0f) == 0) {
+ if (((Info & 0x0f) == 0) && ((Info & BIT7) == 0)) {
CatPrint (Str, L"NoTopology,0,0,0,");
- } else if (((Info & 0x0f) == 1) || ((Info & 0x0f) == 2)) {
+ } else if (((Info & 0x0f) <= 2) && ((Info & BIT7) == 0)) {
CatPrint (
Str,
L"%s,%s,%s,",
- ((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",
- ((Info & (0x1 << 5)) != 0) ? L"External" : L"Internal",
- ((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"
+ ((Info & BIT4) != 0) ? L"SATA" : L"SAS",
+ ((Info & BIT5) != 0) ? L"External" : L"Internal",
+ ((Info & BIT6) != 0) ? L"Expanded" : L"Direct"
);
if ((Info & 0x0f) == 1) {
CatPrint (Str, L"0,");
} else {
- CatPrint (Str, L"0x%x,", (Info >> 8) & 0xff);
+ //
+ // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
+ //
+ CatPrint (Str, L"0x%x,", ((Info >> 8) & 0xff) + 1);
}
} else {
- CatPrint (Str, L"0,0,0,0,");
+ CatPrint (Str, L"0x%x,0,0,0,", Info);
}
CatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);
@@ -689,23 +692,26 @@ DevPathToTextSasEx (
}
CatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);
- if ((SasEx->DeviceTopology & 0x0f) == 0) {
+ if (((SasEx->DeviceTopology & 0x0f) == 0) && ((SasEx->DeviceTopology & BIT7) == 0)) {
CatPrint (Str, L"NoTopology,0,0,0");
- } else if (((SasEx->DeviceTopology & 0x0f) == 1) || ((SasEx->DeviceTopology & 0x0f) == 2)) {
+ } else if (((SasEx->DeviceTopology & 0x0f) <= 2) && ((SasEx->DeviceTopology & BIT7) == 0)) {
CatPrint (
Str,
L"%s,%s,%s,",
- ((SasEx->DeviceTopology & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",
- ((SasEx->DeviceTopology & (0x1 << 5)) != 0) ? L"External" : L"Internal",
- ((SasEx->DeviceTopology & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"
+ ((SasEx->DeviceTopology & BIT4) != 0) ? L"SATA" : L"SAS",
+ ((SasEx->DeviceTopology & BIT5) != 0) ? L"External" : L"Internal",
+ ((SasEx->DeviceTopology & BIT6) != 0) ? L"Expanded" : L"Direct"
);
if ((SasEx->DeviceTopology & 0x0f) == 1) {
CatPrint (Str, L"0");
} else {
- CatPrint (Str, L"0x%x", (SasEx->DeviceTopology >> 8) & 0xff);
+ //
+ // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
+ //
+ CatPrint (Str, L"0x%x", ((SasEx->DeviceTopology >> 8) & 0xff) + 1);
}
} else {
- CatPrint (Str, L"0,0,0,0");
+ CatPrint (Str, L"0x%x,0,0,0", SasEx->DeviceTopology);
}
CatPrint (Str, L")");
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
index 72420d7..f60ab28 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -3,7 +3,7 @@
# which provides fault tolerant write capability for block devices.
# Its implementation depends on the full functionality FVB protocol that support read, write/erase flash access.
#
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2012, 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
@@ -46,6 +46,7 @@
UefiDriverEntryPoint
DebugLib
UefiLib
+ PcdLib
[Guids]
gEfiSystemNvDataFvGuid ## CONSUMES ## FV Signature of Working Space Header
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
index 20c43cf..c39f84c 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
@@ -49,6 +49,7 @@
UefiDriverEntryPoint
DebugLib
UefiLib
+ PcdLib
[Guids]
gEfiSystemNvDataFvGuid ## CONSUMES ## FV Signature of Working Space Header
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf
index 1432cc3..a0dda05 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf
@@ -45,7 +45,6 @@
DebugLib
DxeServicesTableLib
UefiDriverEntryPoint
- PcdLib
[Protocols]
gEfiFaultTolerantWriteProtocolGuid ## ALWAYS_PRODUCES
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
index 74ab8b8..702f4f4 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
@@ -1,7 +1,7 @@
/** @file
Helper functions for configuring or getting the parameters relating to iSCSI.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, 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
@@ -94,7 +94,7 @@ IScsiParseIsIdFromString (
if (StrLen (IsIdStr) != 6) {
UnicodeSPrint (
PortString,
- (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
+ (UINTN) sizeof (PortString),
L"Error! Input is incorrect, please input 6 hex numbers!\n"
);
@@ -700,7 +700,7 @@ IScsiFormCallback (
ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));
ASSERT (ConfigFormEntry != NULL);
- UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);
+ UnicodeSPrint (PortString, (UINTN) sizeof (PortString), L"Port %s", ConfigFormEntry->MacString);
DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;
HiiSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString, NULL);
@@ -1034,13 +1034,13 @@ IScsiConfigUpdateForm (
//
// Compose the Port string and create a new EFI_STRING_ID.
//
- UnicodeSPrint (PortString, 128, L"Port %s", ConfigFormEntry->MacString);
+ UnicodeSPrint (PortString, sizeof (PortString), L"Port %s", ConfigFormEntry->MacString);
ConfigFormEntry->PortTitleToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);
//
// Compose the help string of this port and create a new EFI_STRING_ID.
//
- UnicodeSPrint (PortString, 128, L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);
+ UnicodeSPrint (PortString, sizeof (PortString), L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);
ConfigFormEntry->PortTitleHelpToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);
InsertTailList (&mIScsiConfigFormList, &ConfigFormEntry->Link);
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
index b1f250b..aff036b 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
@@ -1,7 +1,7 @@
/** @file
The implementation of iSCSI protocol based on RFC3720.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -742,7 +742,7 @@ IScsiProcessLoginRsp (
NetbufQueAppend (&Conn->RspQue, Pdu);
Conn->PartialRspRcvd = Continue;
- if (Continue) {
+ if ((!Transit) || Continue) {
//
// It's a partial response, have to wait for another or more Request/Response
// conversations to get the full response.
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
index f1fea0c..177d0a9 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
@@ -1,7 +1,7 @@
/** @file
Implementation of driver entry point and driver binding protocol.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -258,7 +258,7 @@ Done:
device to start.
@retval EFI_SUCCESS This driver is added to ControllerHandle
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
+ @retval EFI_DEVICE_ERROR This driver could not be started due to a device error
@retval other This driver does not support this device
**/
@@ -698,11 +698,11 @@ SimpleNetworkDriverStart (
return Status;
}
- Status = mPciIo->FreeBuffer (
- mPciIo,
- SNP_MEM_PAGES (4096),
- Snp->Cpb
- );
+ mPciIo->FreeBuffer (
+ mPciIo,
+ SNP_MEM_PAGES (4096),
+ Snp->Cpb
+ );
Error_DeleteSNP:
@@ -726,6 +726,13 @@ NiiError:
Controller
);
+ //
+ // If we got here that means we are in error state.
+ //
+ if (!EFI_ERROR (Status)) {
+ Status = EFI_DEVICE_ERROR;
+ }
+
return Status;
}
diff --git a/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.h b/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.h
index 1317702..c82f296 100644
--- a/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.h
+++ b/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.h
@@ -24,7 +24,6 @@
#include <Library/BaseLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
#include <Library/HobLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
diff --git a/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf b/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
index 023772c..6c4d9e6 100644
--- a/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
@@ -2,7 +2,7 @@
# Report Status Code Router Driver which produces Report Stataus Code Handler Protocol
# and Status Code Runtime Protocol.
#
-# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2012, 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
@@ -44,7 +44,6 @@
UefiBootServicesTableLib
UefiDriverEntryPoint
HobLib
- PcdLib
DebugLib
BaseLib
SynchronizationLib
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 976608f..a4e0c02 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -1071,7 +1071,7 @@ IfrToString (
CopyMem (TmpBuf, Value.Buffer, Value.BufferLen * sizeof (CHAR16));
PrintFormat = L"%s";
}
- UnicodeSPrint (Buffer, MAXIMUM_VALUE_CHARACTERS, PrintFormat, Value.Buffer);
+ UnicodeSPrint (Buffer, sizeof (Buffer), PrintFormat, Value.Buffer);
String = Buffer;
FreePool (TmpBuf);
FreePool (Value.Buffer);
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
index 0d008d0..2a4cda4 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
@@ -58,6 +58,7 @@
PrintLib
HiiLib
DevicePathLib
+ PcdLib
[Guids]
gEfiIfrTianoGuid ## CONSUMES ## GUID
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
index 19ceb3d..0b12464 100644
--- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
@@ -2,7 +2,7 @@
# Emulation Variable for EFI_RUNTIME_SERVICES.
#
# This module provides three EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2012, 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
@@ -49,7 +49,7 @@
MemoryAllocationLib
BaseMemoryLib
HobLib
-
+ PcdLib
[Protocols]
gEfiVariableArchProtocolGuid ## PRODUCES
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
index 11009c2..e2c5d9c 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf
@@ -62,6 +62,7 @@
DebugLib
DxeServicesTableLib
HobLib
+ PcdLib
[Protocols]
gEfiSmmFirmwareVolumeBlockProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
index ce4b324..e0ac471 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
@@ -1,7 +1,7 @@
/** @file
UEFI Debug Library that sends messages to the Console Output Device in the EFI System Table.
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2012, 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
@@ -120,7 +120,7 @@ DebugAssert (
//
UnicodeSPrintAsciiFormat (
Buffer,
- MAX_DEBUG_MESSAGE_LENGTH,
+ sizeof (Buffer),
"ASSERT %a(%d): %a\n",
FileName,
LineNumber,
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
index 73c7204..a0aa873 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
@@ -1,7 +1,7 @@
/** @file
UEFI Debug Lib that sends messages to the Standard Error Device in the EFI System Table.
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2012, 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
@@ -121,7 +121,7 @@ DebugAssert (
//
UnicodeSPrintAsciiFormat (
Buffer,
- MAX_DEBUG_MESSAGE_LENGTH,
+ sizeof (Buffer),
"ASSERT %a(%d): %a\n",
FileName,
LineNumber,
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
index 934c03e..d8c0ad0 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
@@ -104,12 +104,6 @@ EfiDhcp6Start (
Instance->UdpSts = EFI_ALREADY_STARTED;
//
- // Need to clear initial time to make sure that elapsed-time
- // is set to 0 for first Solicit.
- //
- Instance->StartTime = 0;
-
- //
// Send the solicit message to start S.A.R.R process.
//
Status = Dhcp6SendSolicitMsg (Instance);
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
index 71b16b1..e3e7553 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
@@ -249,6 +249,10 @@ struct _DHCP6_INSTANCE {
volatile EFI_STATUS UdpSts;
BOOLEAN InDestroy;
BOOLEAN MediaPresent;
+ //
+ // StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315,
+ // the elapsed-time is amount of time since the client began its current DHCP transaction.
+ //
UINT64 StartTime;
};
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
index 7f79167..1da31dc 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
@@ -593,6 +593,14 @@ Dhcp6UpdateIaInfo (
if (Instance->Config->IaDescriptor.Type == Dhcp6OptIana) {
T1 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 8)));
T2 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 12)));
+ //
+ // Refer to RFC3155 Chapter 22.4. If a client receives an IA_NA with T1 greater than T2,
+ // and both T1 and T2 are greater than 0, the client discards the IA_NA option and processes
+ // the remainder of the message as though the server had not included the invalid IA_NA option.
+ //
+ if (T1 > T2 && T2 > 0) {
+ return EFI_DEVICE_ERROR;
+ }
IaInnerOpt = Option + 16;
IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 2))) - 12);
} else {
@@ -697,7 +705,7 @@ Dhcp6SeekStsOption (
&Instance->Config->IaDescriptor
);
if (*Option == NULL) {
- return EFI_DEVICE_ERROR;
+ return EFI_SUCCESS;
}
//
@@ -949,7 +957,8 @@ Dhcp6SendSolicitMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
//
@@ -987,6 +996,10 @@ Dhcp6SendSolicitMsg (
// Dhcp6selecting.
//
Instance->IaCb.Ia->State = Dhcp6Selecting;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1133,7 +1146,8 @@ Dhcp6SendRequestMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
//
@@ -1171,6 +1185,10 @@ Dhcp6SendRequestMsg (
// Dhcp6requesting.
//
Instance->IaCb.Ia->State = Dhcp6Requesting;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1282,7 +1300,7 @@ Dhcp6SendDeclineMsg (
ServerId->Duid
);
- Cursor = Dhcp6AppendIaOption (Cursor, DecIa, 0, 0);
+ Cursor = Dhcp6AppendIaOption (Cursor, DecIa, 0, 0, Packet->Dhcp6.Header.MessageType);
//
// Determine the size/length of packet.
@@ -1305,6 +1323,10 @@ Dhcp6SendDeclineMsg (
// Dhcp6declining.
//
Instance->IaCb.Ia->State = Dhcp6Declining;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1415,7 +1437,7 @@ Dhcp6SendReleaseMsg (
&Elapsed
);
- Cursor = Dhcp6AppendIaOption (Cursor, RelIa, 0, 0);
+ Cursor = Dhcp6AppendIaOption (Cursor, RelIa, 0, 0, Packet->Dhcp6.Header.MessageType);
//
// Determine the size/length of packet
@@ -1540,7 +1562,8 @@ Dhcp6SendRenewRebindMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
if (!RebindRequest) {
@@ -1612,6 +1635,10 @@ Dhcp6SendRenewRebindMsg (
//
Instance->IaCb.Ia->State = State;
Instance->IaCb.LeaseTime = (RebindRequest) ? Instance->IaCb.T2 : Instance->IaCb.T1;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1844,6 +1871,11 @@ Dhcp6SendInfoRequestMsg (
//
Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
+
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
//
// Send info-request packet with no state.
@@ -1941,7 +1973,8 @@ Dhcp6SendConfirmMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
//
@@ -1978,6 +2011,10 @@ Dhcp6SendConfirmMsg (
// Dhcp6Confirming.
//
Instance->IaCb.Ia->State = Dhcp6Confirming;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -2020,6 +2057,8 @@ Dhcp6HandleReplyMsg (
ASSERT (Instance->IaCb.Ia != NULL);
ASSERT (Packet != NULL);
+ Status = EFI_SUCCESS;
+
if (Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply) {
return EFI_DEVICE_ERROR;
}
@@ -2056,7 +2095,7 @@ Dhcp6HandleReplyMsg (
&Instance->Config->IaDescriptor
);
if (Option == NULL) {
- return EFI_DEVICE_ERROR;
+ return EFI_SUCCESS;
}
}
@@ -2070,19 +2109,6 @@ Dhcp6HandleReplyMsg (
}
//
- // Dequeue the sent packet from retransmit list since reply received.
- //
- Status = Dhcp6DequeueRetry (
- Instance,
- Packet->Dhcp6.Header.TransactionId,
- FALSE
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
// When receive a valid reply packet in response to a decline/release packet,
// the client considers the decline/release event completed regardless of the
// status code.
@@ -2115,7 +2141,8 @@ Dhcp6HandleReplyMsg (
//
Instance->StartTime = 0;
- return EFI_SUCCESS;
+ Status = EFI_SUCCESS;
+ goto ON_EXIT;
}
//
@@ -2132,55 +2159,63 @@ Dhcp6HandleReplyMsg (
if (!EFI_ERROR (Status)) {
//
- // Reset start time for next exchange.
- //
- Instance->StartTime = 0;
-
- //
// No status code or no error status code means succeed to reply.
//
Status = Dhcp6UpdateIaInfo (Instance, Packet);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Reset start time for next exchange.
+ //
+ Instance->StartTime = 0;
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Set bound state and store the reply packet.
- //
- if (Instance->IaCb.Ia->ReplyPacket != NULL) {
- FreePool (Instance->IaCb.Ia->ReplyPacket);
- }
+ //
+ // Set bound state and store the reply packet.
+ //
+ if (Instance->IaCb.Ia->ReplyPacket != NULL) {
+ FreePool (Instance->IaCb.Ia->ReplyPacket);
+ }
- Instance->IaCb.Ia->ReplyPacket = AllocateZeroPool (Packet->Size);
+ Instance->IaCb.Ia->ReplyPacket = AllocateZeroPool (Packet->Size);
- if (Instance->IaCb.Ia->ReplyPacket == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
+ if (Instance->IaCb.Ia->ReplyPacket == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ON_EXIT;
+ }
- CopyMem (Instance->IaCb.Ia->ReplyPacket, Packet, Packet->Size);
+ CopyMem (Instance->IaCb.Ia->ReplyPacket, Packet, Packet->Size);
- Instance->IaCb.Ia->State = Dhcp6Bound;
+ Instance->IaCb.Ia->State = Dhcp6Bound;
- //
- // For sync, set the success flag out of polling in start/renewrebind.
- //
- Instance->UdpSts = EFI_SUCCESS;
+ //
+ // For sync, set the success flag out of polling in start/renewrebind.
+ //
+ Instance->UdpSts = EFI_SUCCESS;
- //
- // Maybe this is a new round DHCP process due to some reason, such as NotOnLink
- // ReplyMsg for ConfirmMsg should triger new round to acquire new address. In that
- // case, clear old address.ValidLifetime and append to new address. Therefore, DHCP
- // consumers can be notified to flush old address.
- //
- Dhcp6AppendCacheIa (Instance);
+ //
+ // Maybe this is a new round DHCP process due to some reason, such as NotOnLink
+ // ReplyMsg for ConfirmMsg should triger new round to acquire new address. In that
+ // case, clear old address.ValidLifetime and append to new address. Therefore, DHCP
+ // consumers can be notified to flush old address.
+ //
+ Dhcp6AppendCacheIa (Instance);
- //
- // For async, signal the Ia event to inform Ia infomation update.
- //
- if (Instance->Config->IaInfoEvent != NULL) {
- gBS->SignalEvent (Instance->Config->IaInfoEvent);
+ //
+ // For async, signal the Ia event to inform Ia infomation update.
+ //
+ if (Instance->Config->IaInfoEvent != NULL) {
+ gBS->SignalEvent (Instance->Config->IaInfoEvent);
+ }
+ } else if (Status == EFI_NOT_FOUND) {
+ //
+ // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message,
+ // the client sends a Renew or Rebind if the IA is not in the Reply message.
+ // Return EFI_SUCCESS so we can continue to restart the Renew/Rebind process.
+ //
+ return EFI_SUCCESS;
}
+
+ goto ON_EXIT;
+
} else if (Option != NULL) {
//
// Any error status code option is found.
@@ -2226,6 +2261,19 @@ Dhcp6HandleReplyMsg (
}
break;
+ case Dhcp6StsNoBinding:
+ if (Instance->IaCb.Ia->State == Dhcp6Renewing || Instance->IaCb.Ia->State == Dhcp6Rebinding) {
+ //
+ // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client
+ // sends a Request message if the IA contained a Status Code option with the NoBinding status.
+ //
+ Status = Dhcp6SendRequestMsg(Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+ break;
+
default:
//
// The other status code, just restart solicitation.
@@ -2235,6 +2283,18 @@ Dhcp6HandleReplyMsg (
}
return EFI_SUCCESS;
+
+ON_EXIT:
+
+ if (!EFI_ERROR(Status)) {
+ Status = Dhcp6DequeueRetry (
+ Instance,
+ Packet->Dhcp6.Header.TransactionId,
+ FALSE
+ );
+ }
+
+ return Status;
}
@@ -2378,17 +2438,13 @@ Dhcp6HandleAdvertiseMsg (
// display the associated status message to the user.
// See the details in the section-17.1.3 of rfc-3315.
//
- Option = Dhcp6SeekOption(
- Packet->Dhcp6.Option,
- Packet->Length - 4,
- Dhcp6OptStatusCode
+ Status = Dhcp6SeekStsOption (
+ Instance,
+ Packet,
+ &Option
);
-
- if (Option != NULL) {
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 4)));
- if (StsCode != Dhcp6StsSuccess) {
- return EFI_DEVICE_ERROR;
- }
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
}
//
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
index 4c32028..32247c9 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
@@ -647,6 +647,75 @@ Dhcp6AppendOption (
return Buf;
}
+/**
+ Append the appointed IA Address option to Buf, and move Buf to the end.
+
+ @param[in, out] Buf The pointer to the position to append.
+ @param[in] IaAddr The pointer to the IA Address.
+ @param[in] MessageType Message type of DHCP6 package.
+
+ @return Buf The position to append the next option.
+
+**/
+UINT8 *
+Dhcp6AppendIaAddrOption (
+ IN OUT UINT8 *Buf,
+ IN EFI_DHCP6_IA_ADDRESS *IaAddr,
+ IN UINT32 MessageType
+)
+{
+
+ // The format of the IA Address option is:
+ //
+ // 0 1 2 3
+ // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | OPTION_IAADDR | option-len |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | |
+ // | IPv6 address |
+ // | |
+ // | |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | preferred-lifetime |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | valid-lifetime |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // . .
+ // . IAaddr-options .
+ // . .
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ //
+ // Fill the value of Ia Address option type
+ //
+ WriteUnaligned16 ((UINT16 *) Buf, HTONS (Dhcp6OptIaAddr));
+ Buf += 2;
+
+ WriteUnaligned16 ((UINT16 *) Buf, HTONS (sizeof (EFI_DHCP6_IA_ADDRESS)));
+ Buf += 2;
+
+ CopyMem (Buf, &IaAddr->IpAddress, sizeof(EFI_IPv6_ADDRESS));
+ Buf += sizeof(EFI_IPv6_ADDRESS);
+
+ //
+ // Fill the value of preferred-lifetime and valid-lifetime.
+ // According to RFC3315 Chapter 18.1.2, the preferred-lifetime and valid-lifetime fields
+ // should set to 0 when initiate a Confirm message.
+ //
+ if (MessageType != Dhcp6MsgConfirm) {
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->PreferredLifetime));
+ }
+ Buf += 4;
+
+ if (MessageType != Dhcp6MsgConfirm) {
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->ValidLifetime));
+ }
+ Buf += 4;
+
+ return Buf;
+}
+
/**
Append the appointed Ia option to Buf, and move Buf to the end.
@@ -655,6 +724,7 @@ Dhcp6AppendOption (
@param[in] Ia The pointer to the Ia.
@param[in] T1 The time of T1.
@param[in] T2 The time of T2.
+ @param[in] MessageType Message type of DHCP6 package.
@return Buf The position to append the next Ia option.
@@ -664,13 +734,13 @@ Dhcp6AppendIaOption (
IN OUT UINT8 *Buf,
IN EFI_DHCP6_IA *Ia,
IN UINT32 T1,
- IN UINT32 T2
+ IN UINT32 T2,
+ IN UINT32 MessageType
)
{
UINT8 *AddrOpt;
UINT16 *Len;
UINTN Index;
- UINT16 Length;
//
// The format of IA_NA and IA_TA option:
@@ -713,9 +783,9 @@ Dhcp6AppendIaOption (
// Fill the value of t1 and t2 if iana, keep it 0xffffffff if no specified.
//
if (Ia->Descriptor.Type == Dhcp6OptIana) {
- WriteUnaligned32 ((UINT32 *) Buf, ((T1 != 0) ? T1 : 0xffffffff));
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T1 != 0) ? T1 : 0xffffffff));
Buf += 4;
- WriteUnaligned32 ((UINT32 *) Buf, ((T2 != 0) ? T2 : 0xffffffff));
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T2 != 0) ? T2 : 0xffffffff));
Buf += 4;
}
@@ -723,15 +793,8 @@ Dhcp6AppendIaOption (
// Fill all the addresses belong to the Ia
//
for (Index = 0; Index < Ia->IaAddressCount; Index++) {
-
- AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS);
- Length = HTONS ((UINT16) sizeof (EFI_DHCP6_IA_ADDRESS));
- Buf = Dhcp6AppendOption (
- Buf,
- HTONS (Dhcp6OptIaAddr),
- Length,
- AddrOpt
- );
+ AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS);
+ Buf = Dhcp6AppendIaAddrOption (Buf, (EFI_DHCP6_IA_ADDRESS *) AddrOpt, MessageType);
}
//
@@ -827,7 +890,7 @@ SetElapsedTime (
//
// Sentinel value of 0 means that this is the first DHCP packet that we are
- // sending and that we need to initialize the value. First DHCP Solicit
+ // sending and that we need to initialize the value. First DHCP message
// gets 0 elapsed-time. Otherwise, calculate based on StartTime.
//
if (Instance->StartTime == 0) {
@@ -934,10 +997,39 @@ Dhcp6SeekIaOption (
return Option;
}
+/**
+ Check whether the incoming IPv6 address in IaAddr is one of the maintained
+ addresses in the IA control blcok.
+
+ @param[in] IaAddr The pointer to the IA Address to be checked.
+ @param[in] CurrentIa The pointer to the IA in IA control block.
+
+ @retval TRUE Yes, this Address is already in IA control block.
+ @retval FALSE No, this Address is NOT in IA control block.
+
+**/
+BOOLEAN
+Dhcp6AddrIsInCurrentIa (
+ IN EFI_DHCP6_IA_ADDRESS *IaAddr,
+ IN EFI_DHCP6_IA *CurrentIa
+ )
+{
+ UINT32 Index;
+
+ ASSERT (IaAddr != NULL && CurrentIa != NULL);
+
+ for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) {
+ if (EFI_IP6_EQUAL(&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
/**
Parse the address option and update the address infomation.
+ @param[in] CurrentIa The pointer to the Ia Address in control blcok.
@param[in] IaInnerOpt The pointer to the buffer.
@param[in] IaInnerLen The length to parse.
@param[out] AddrNum The number of addresses.
@@ -946,6 +1038,7 @@ Dhcp6SeekIaOption (
**/
VOID
Dhcp6ParseAddrOption (
+ IN EFI_DHCP6_IA *CurrentIa,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
OUT UINT32 *AddrNum,
@@ -956,6 +1049,8 @@ Dhcp6ParseAddrOption (
UINT16 DataLen;
UINT16 OpCode;
UINT32 ValidLt;
+ UINT32 PreferredLt;
+ EFI_DHCP6_IA_ADDRESS *IaAddr;
//
// The format of the IA Address option:
@@ -992,19 +1087,21 @@ Dhcp6ParseAddrOption (
while (Cursor < IaInnerOpt + IaInnerLen) {
//
- // Count the Ia address option with non-0 valid time.
+ // Refer to RFC3315 Chapter 18.1.8, we need to update lifetimes for any addresses in the IA option
+ // that the client already has recorded in the IA, and discard the Ia address option with 0 valid time.
//
OpCode = ReadUnaligned16 ((UINT16 *) Cursor);
- ValidLt = ReadUnaligned32 ((UINT32 *) (Cursor + 24));
- if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt != 0) {
-
+ PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 20)));
+ ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 24)));
+ IaAddr = (EFI_DHCP6_IA_ADDRESS *) (Cursor + 4);
+ if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt >= PreferredLt &&
+ (Dhcp6AddrIsInCurrentIa(IaAddr, CurrentIa) || ValidLt !=0)) {
if (AddrBuf != NULL) {
- CopyMem (AddrBuf, Cursor + 4, sizeof (EFI_DHCP6_IA_ADDRESS));
- AddrBuf->PreferredLifetime = NTOHL (AddrBuf->PreferredLifetime);
- AddrBuf->ValidLifetime = NTOHL (AddrBuf->ValidLifetime);
+ CopyMem (AddrBuf, IaAddr, sizeof (EFI_DHCP6_IA_ADDRESS));
+ AddrBuf->PreferredLifetime = PreferredLt;
+ AddrBuf->ValidLifetime = ValidLt;
AddrBuf = (EFI_DHCP6_IA_ADDRESS *) ((UINT8 *) AddrBuf + sizeof (EFI_DHCP6_IA_ADDRESS));
}
-
(*AddrNum)++;
}
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *) (Cursor + 2)));
@@ -1025,6 +1122,7 @@ Dhcp6ParseAddrOption (
@retval EFI_NOT_FOUND No valid IA option is found.
@retval EFI_SUCCESS Create an IA control block successfully.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
+ @retval EFI_DEVICE_ERROR An unexpected error.
**/
EFI_STATUS
@@ -1041,14 +1139,14 @@ Dhcp6GenerateIaCb (
EFI_DHCP6_IA *Ia;
if (Instance->IaCb.Ia == NULL) {
- return EFI_NOT_FOUND;
+ return EFI_DEVICE_ERROR;
}
//
// Calculate the number of addresses for this Ia, excluding the addresses with
// the value 0 of valid lifetime.
//
- Dhcp6ParseAddrOption (IaInnerOpt, IaInnerLen, &AddrNum, NULL);
+ Dhcp6ParseAddrOption (Instance->IaCb.Ia, IaInnerOpt, IaInnerLen, &AddrNum, NULL);
if (AddrNum == 0) {
return EFI_NOT_FOUND;
@@ -1070,7 +1168,7 @@ Dhcp6GenerateIaCb (
Ia->State = Instance->IaCb.Ia->State;
Ia->IaAddressCount = AddrNum;
CopyMem (&Ia->Descriptor, &Instance->Config->IaDescriptor, sizeof (EFI_DHCP6_IA_DESCRIPTOR));
- Dhcp6ParseAddrOption (IaInnerOpt, IaInnerLen, &AddrNum, Ia->IaAddress);
+ Dhcp6ParseAddrOption (Instance->IaCb.Ia, IaInnerOpt, IaInnerLen, &AddrNum, Ia->IaAddress);
//
// Free original IA resource.
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
index 2a44d00..8c3151e 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
@@ -192,6 +192,7 @@ Dhcp6AppendOption (
@param[in] Ia The pointer to the Ia.
@param[in] T1 The time of T1.
@param[in] T2 The time of T2.
+ @param[in] MessageType Message type of DHCP6 package.
@return Buf The position to append the next Ia option.
@@ -201,7 +202,8 @@ Dhcp6AppendIaOption (
IN OUT UINT8 *Buf,
IN EFI_DHCP6_IA *Ia,
IN UINT32 T1,
- IN UINT32 T2
+ IN UINT32 T2,
+ IN UINT32 MessageType
);
/**
@@ -274,6 +276,7 @@ Dhcp6SeekIaOption (
/**
Parse the address option and update the address info.
+ @param[in] CurrentIa The pointer to the Ia Address in control blcok.
@param[in] IaInnerOpt The pointer to the buffer.
@param[in] IaInnerLen The length to parse.
@param[out] AddrNum The number of addresses.
@@ -282,6 +285,7 @@ Dhcp6SeekIaOption (
**/
VOID
Dhcp6ParseAddrOption (
+ IN EFI_DHCP6_IA *CurrentIa,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
OUT UINT32 *AddrNum,
@@ -300,6 +304,7 @@ Dhcp6ParseAddrOption (
@retval EFI_NOT_FOUND No valid IA option is found.
@retval EFI_SUCCESS Create an IA control block successfully.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
+ @retval EFI_DEVICE_ERROR An unexpected error.
**/
EFI_STATUS
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c b/NetworkPkg/IScsiDxe/IScsiProto.c
index 3dabb00..d5e0994 100644
--- a/NetworkPkg/IScsiDxe/IScsiProto.c
+++ b/NetworkPkg/IScsiDxe/IScsiProto.c
@@ -975,7 +975,7 @@ IScsiProcessLoginRsp (
NetbufQueAppend (&Conn->RspQue, Pdu);
Conn->PartialRspRcvd = Continue;
- if (Continue) {
+ if ((!Transit) || Continue) {
//
// It is a partial response; must wait for another or more Request/Response
// conversations to get the full response.
diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
index 2e522c9..5bc29cf 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
@@ -837,7 +837,7 @@ IsSignatureFoundInDatabase (
//
CertList = (EFI_SIGNATURE_LIST *) Data;
while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {
- CertCount = (CertList->SignatureListSize - CertList->SignatureHeaderSize) / CertList->SignatureSize;
+ CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
if ((CertList->SignatureSize == sizeof(EFI_SIGNATURE_DATA) - 1 + SignatureSize) && (CompareGuid(&CertList->SignatureType, CertType))) {
for (Index = 0; Index < CertCount; Index++) {
diff --git a/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c b/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
index 44845b0..3414cd2 100644
--- a/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
+++ b/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
@@ -8,7 +8,7 @@
ExecutePendingTpmRequest() will receive untrusted input and do validation.
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -1010,13 +1010,6 @@ ExecutePendingTpmRequest (
UINTN DataSize;
BOOLEAN RequestConfirmed;
- if (TcgPpData->PPRequest == PHYSICAL_PRESENCE_NO_ACTION) {
- //
- // No operation request
- //
- return;
- }
-
if (!HaveValidTpmRequest(TcgPpData, &RequestConfirmed)) {
//
// Invalid operation request.
@@ -1165,6 +1158,13 @@ TcgPhysicalPresenceLibProcessRequest (
DEBUG ((EFI_D_INFO, "[TPM] Flags=%x, PPRequest=%x\n", TcgPpData.Flags, TcgPpData.PPRequest));
+ if (TcgPpData.PPRequest == PHYSICAL_PRESENCE_NO_ACTION) {
+ //
+ // No operation request
+ //
+ return;
+ }
+
Status = GetTpmCapability (TcgProtocol, &LifetimeLock, &CmdEnable);
if (EFI_ERROR (Status)) {
return ;
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
index d83c5b0..1d953da 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
@@ -519,7 +519,9 @@ VerifyCounterBasedPayload (
EFI_CERT_BLOCK_RSA_2048_SHA256 *CertBlock;
UINT8 Digest[SHA256_DIGEST_SIZE];
VOID *Rsa;
-
+ UINTN PayloadSize;
+
+ PayloadSize = DataSize - AUTHINFO_SIZE;
Rsa = NULL;
CertData = NULL;
CertBlock = NULL;
@@ -551,7 +553,14 @@ VerifyCounterBasedPayload (
if (!Status) {
goto Done;
}
- Status = Sha256Update (mHashCtx, Data + AUTHINFO_SIZE, (UINTN) (DataSize - AUTHINFO_SIZE));
+ Status = Sha256Update (mHashCtx, Data + AUTHINFO_SIZE, PayloadSize);
+ if (!Status) {
+ goto Done;
+ }
+ //
+ // Hash Size.
+ //
+ Status = Sha256Update (mHashCtx, &PayloadSize, sizeof (UINTN));
if (!Status) {
goto Done;
}
@@ -1092,6 +1101,7 @@ ProcessVarWithKek (
@return EFI_INVALID_PARAMETER Invalid parameter.
@return EFI_WRITE_PROTECTED Variable is write-protected and needs authentication with
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
+ @return EFI_OUT_OF_RESOURCES The Database to save the public key is full.
@return EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
set, but the AuthInfo does NOT pass the validation
check carried out by the firmware.
@@ -1246,7 +1256,7 @@ ProcessVariable (
//
KeyIndex = AddPubKeyInStore (PubKey);
if (KeyIndex == 0) {
- return EFI_SECURITY_VIOLATION;
+ return EFI_OUT_OF_RESOURCES;
}
}
@@ -2163,13 +2173,13 @@ VerifyTimeBasedPayload (
//
// Delete signer's certificates when delete the common authenticated variable.
//
- if ((PayloadSize == 0) && (Variable->CurrPtr != NULL)) {
+ if ((PayloadSize == 0) && (Variable->CurrPtr != NULL) && ((Attributes & EFI_VARIABLE_APPEND_WRITE) == 0)) {
Status = DeleteCertsFromDb (VariableName, VendorGuid);
if (EFI_ERROR (Status)) {
VerifyStatus = FALSE;
goto Exit;
}
- } else if (Variable->CurrPtr == NULL) {
+ } else if (Variable->CurrPtr == NULL && PayloadSize != 0) {
//
// Insert signer's certificates when adding a new common authenticated variable.
//
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
index 93aed4c..32138c1 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
@@ -2302,6 +2302,13 @@ VariableServiceSetVariable (
}
//
+ // Check for reserverd bit in variable attribute.
+ //
+ if ((Attributes & (~EFI_VARIABLE_ATTRIBUTES_MASK)) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
// Make sure if runtime bit is set, boot service bit is set also.
//
if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
index 14a0744..563485f 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
@@ -43,6 +43,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/HardwareErrorVariable.h>
#define VARIABLE_RECLAIM_THRESHOLD (1024)
+#define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE | \
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | \
+ EFI_VARIABLE_RUNTIME_ACCESS | \
+ EFI_VARIABLE_HARDWARE_ERROR_RECORD | \
+ EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \
+ EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
+ EFI_VARIABLE_APPEND_WRITE)
///
/// The size of a 3 character ISO639 language code.
diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
index 7df6885..51da86b 100644
--- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
+++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
@@ -1707,6 +1707,8 @@ UpdateDeletePage (
//
// The signature type is not supported in current implementation.
//
+ ItemDataSize -= CertList->SignatureListSize;
+ CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);
continue;
}