|
3 | 3 | It provides basic functions for the UEFI network stack. |
4 | 4 |
|
5 | 5 | Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR> |
| 6 | +Copyright (c) Microsoft Corporation |
6 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent |
7 | 8 |
|
8 | 9 | **/ |
@@ -539,8 +540,6 @@ extern EFI_IPv4_ADDRESS mZeroIp4Addr; |
539 | 540 | #define TICKS_PER_MS 10000U |
540 | 541 | #define TICKS_PER_SECOND 10000000U |
541 | 542 |
|
542 | | -#define NET_RANDOM(Seed) ((UINT32) ((UINT32) (Seed) * 1103515245UL + 12345) % 4294967295UL) |
543 | | - |
544 | 543 | /** |
545 | 544 | Extract a UINT32 from a byte stream. |
546 | 545 |
|
@@ -580,19 +579,40 @@ NetPutUint32 ( |
580 | 579 | ); |
581 | 580 |
|
582 | 581 | /** |
583 | | - Initialize a random seed using current time and monotonic count. |
| 582 | + Generate a Random output data given a length. |
584 | 583 |
|
585 | | - Get current time and monotonic count first. Then initialize a random seed |
586 | | - based on some basic mathematics operation on the hour, day, minute, second, |
587 | | - nanosecond and year of the current time and the monotonic count value. |
| 584 | + @param[out] Output - The buffer to store the generated random data. |
| 585 | + @param[in] OutputLength - The length of the output buffer. |
588 | 586 |
|
589 | | - @return The random seed initialized with current time. |
| 587 | + @retval EFI_SUCCESS On Success |
| 588 | + @retval EFI_INVALID_PARAMETER Pointer is null or size is zero |
| 589 | + @retval EFI_NOT_FOUND RNG protocol not found |
| 590 | + @retval Others Error from RngProtocol->GetRNG() |
590 | 591 |
|
| 592 | + @return Status code |
591 | 593 | **/ |
592 | | -UINT32 |
| 594 | +EFI_STATUS |
593 | 595 | EFIAPI |
594 | | -NetRandomInitSeed ( |
595 | | - VOID |
| 596 | +PseudoRandom ( |
| 597 | + OUT VOID *Output, |
| 598 | + IN UINTN OutputLength |
| 599 | + ); |
| 600 | + |
| 601 | +/** |
| 602 | + Generate a 32-bit pseudo-random number. |
| 603 | +
|
| 604 | + @param[out] Output - The buffer to store the generated random number. |
| 605 | +
|
| 606 | + @retval EFI_SUCCESS On Success |
| 607 | + @retval EFI_NOT_FOUND RNG protocol not found |
| 608 | + @retval Others Error from RngProtocol->GetRNG() |
| 609 | +
|
| 610 | + @return Status code |
| 611 | +**/ |
| 612 | +EFI_STATUS |
| 613 | +EFIAPI |
| 614 | +PseudoRandomU32 ( |
| 615 | + OUT UINT32 *Output |
596 | 616 | ); |
597 | 617 |
|
598 | 618 | #define NET_LIST_USER_STRUCT(Entry, Type, Field) \ |
|
0 commit comments