audk/MdeModulePkg/Library
Hao Wu bd42d976d5 MdeModulePkg/DxeNetLib: Fix negative value left shift
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=698

Within function NetRandomInitSeed(), left shift a negative value is used
in:
"~Time.Hour << 24"

which involves undefined behavior.

Since Time.Hour is of type UINT8 (range from 0 to 23), hence ~Time.Hour
will be a negative value (of type int, signed).

According to the C11 spec, Section 6.5.7:
> 4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
>   bits are filled with zeros. If E1 has an unsigned type, the value
>   of the result is E1 * 2^E2 , reduced modulo one more than the
>   maximum value representable in the result type. If E1 has a signed
>   type and nonnegative value, and E1 * 2^E2 is representable in the
>   result type, then that is the resulting value; otherwise, the
>   behavior is undefined.

This commit will remove the '~' operator before 'Time.Hour', since it
seems like an implementation choice for generating the seed.

Cc: Steven Shi <steven.shi@intel.com>
Cc: Qin Long <qin.long@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
2017-09-29 16:14:17 +08:00
..
AuthVariableLibNull
BaseIpmiLibNull
BasePlatformHookLibNull
BaseResetSystemLibNull
BaseSerialPortLib16550
BaseSortLib
BootLogoLib MdeModulePkg/BootLogoLib: Remove invalid if judgments 2016-11-11 12:55:46 +08:00
BootMaintenanceManagerUiLib MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp 2017-07-27 10:47:19 +08:00
BootManagerUiLib MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp 2017-07-27 10:47:15 +08:00
BrotliCustomDecompressLib MdeModulePkg BrotliLib: Fix the regression logic issue in loop 2017-04-14 10:28:59 +08:00
CpuExceptionHandlerLibNull MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext() 2017-04-07 09:43:40 +08:00
CustomizedDisplayLib MdeModulePkg/Library: Fix typos in comments and variables 2016-10-27 09:11:19 +08:00
DebugAgentLibNull MdeModulePkg/Library: Fix typos in comments and variables 2016-10-27 09:11:19 +08:00
DeviceManagerUiLib MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue 2017-04-21 13:06:54 +08:00
DxeCapsuleLibFmp MdeModulePkg/DxeCapsuleLibFmp: Fix build failure 2017-03-20 10:26:59 +08:00
DxeCapsuleLibNull MdeModulePkg/DxeCapsuleLibNull: Add ProcessCapsules() interface. 2016-11-08 22:36:58 +08:00
DxeCoreMemoryAllocationLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
DxeCorePerformanceLib MdeModulePkg PerformanceLib: Fix GCC build failure caused by cfb0aba 2017-02-24 16:33:26 +08:00
DxeCrc32GuidedSectionExtractLib MdeModulePkg/Library: Fix typos in comments and variables 2016-10-27 09:11:19 +08:00
DxeDebugPrintErrorLevelLib MdeModulePkg/Library: Fix typos in comments and variables 2016-10-27 09:11:19 +08:00
DxeDpcLib
DxeFileExplorerProtocol
DxeHttpLib MdeModulePkg/DxeHttpLib: Fix spelling typo in EFI_HTTP_STATUS_CODE 2017-08-02 15:31:21 +08:00
DxeIpIoLib MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLib 2017-08-23 09:17:28 +08:00
DxeIpmiLibIpmiProtocol
DxeNetLib MdeModulePkg/DxeNetLib: Fix negative value left shift 2017-09-29 16:14:17 +08:00
DxePerformanceLib
DxePrintLibPrint2Protocol MdeModulePkg/PrintLib: Fix possible negative value left shift 2017-09-29 16:14:17 +08:00
DxeReportStatusCodeLib
DxeSecurityManagementLib
DxeSmmPerformanceLib
DxeTcpIoLib MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLib 2017-08-23 09:17:28 +08:00
DxeUdpIoLib MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLib 2017-08-23 09:17:28 +08:00
FileExplorerLib MdeModulePkg: Refine type cast for pointer subtraction 2017-03-06 14:14:09 +08:00
FmpAuthenticationLibNull MdeModulePkg/FmpAuthenticationLibNull: Add NULL instance FMP. 2016-11-08 22:36:55 +08:00
FrameBufferBltLib MdeModulePkg/FrameBufferBltLib: Use dynamic allocated line buffer 2017-01-24 15:06:39 +08:00
LockBoxNullLib
LzmaCustomDecompressLib MdeModulePkg LzmaDecompressLib: Update LZMA to new 16.04 version 2016-11-03 10:21:19 +08:00
NonDiscoverableDeviceRegistrationLib MdeModulePkg: Update NonDiscoverableDeviceRegistrationLib file header format 2017-07-26 09:00:25 +08:00
OemHookStatusCodeLibNull
PciHostBridgeLibNull
PeiCrc32GuidedSectionExtractLib MdeModulePkg/Library: Fix typos in comments and variables 2016-10-27 09:11:19 +08:00
PeiDebugPrintHobLib
PeiDxeDebugLibReportStatusCode
PeiIpmiLibIpmiPpi
PeiPerformanceLib
PeiRecoveryLibNull
PeiReportStatusCodeLib
PeiS3LibNull
PiDxeS3BootScriptLib MdeModulePkg: Update PiDxeS3BootScriptLib Internal function name 2017-09-13 15:02:08 +08:00
PiSmmCoreMemoryAllocationLib MdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issue 2017-08-01 17:44:02 +08:00
PiSmmCoreSmmServicesTableLib
PlatformBootManagerLibNull
PlatformHookLibSerialPortPpi
PlatformVarCleanupLib MdeModulePkg/PlatVarCleanupLib: Add lib destructor for unclosed event 2017-03-13 09:15:40 +08:00
RuntimeDxeReportStatusCodeLib
SmmCorePerformanceLib MdeModulePkg PerformanceLib: Fix GCC build failure caused by cfb0aba 2017-02-24 16:33:26 +08:00
SmmCorePlatformHookLibNull
SmmIpmiLibSmmIpmiProtocol
SmmLockBoxLib MdeModulePkg SmmLockBoxDxeLib: Get SmmCommRegion for COMM buffer 2017-07-26 16:05:51 +08:00
SmmMemoryAllocationProfileLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
SmmPerformanceLib
SmmReportStatusCodeLib MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SmmSmiHandlerProfileLib MdeModulePkg/SmiHandlerProfile: Add Context support in Unregister 2017-03-13 16:04:12 +08:00
TpmMeasurementLibNull
UefiBootManagerLib MdeModulePkg/UefiBootManagerLib: Generate boot description for SD/eMMC 2017-09-06 09:52:17 +08:00
UefiHiiLib MdeModulePkg/UefiHiiLib: Validate question with bit fields 2017-09-21 16:17:41 +08:00
UefiHiiServicesLib
UefiMemoryAllocationProfileLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
UefiSortLib
VarCheckHiiLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
VarCheckLib
VarCheckPcdLib
VarCheckUefiLib