| 613 | } |
| 614 | |
| 615 | EFI_STATUS |
| 616 | VerifyFfsFile ( |
| 617 | IN EFI_FFS_FILE_HEADER *FfsHeader |
| 618 | ) |
| 619 | /*++ |
| 620 | |
| 621 | Routine Description: |
| 622 | |
| 623 | Verify the current pointer points to a FFS file header. |
| 624 | |
| 625 | Arguments: |
| 626 | |
| 627 | FfsHeader Pointer to an alleged FFS file. |
| 628 | |
| 629 | Returns: |
| 630 | |
| 631 | EFI_SUCCESS The Ffs header is valid. |
| 632 | EFI_NOT_FOUND This "file" is the beginning of free space. |
| 633 | EFI_VOLUME_CORRUPTED The Ffs header is not valid. |
| 634 | EFI_ABORTED The erase polarity is not known. |
| 635 | |
| 636 | --*/ |
| 637 | { |
| 638 | BOOLEAN ErasePolarity; |
| 639 | EFI_STATUS Status; |
| 640 | EFI_FFS_FILE_HEADER2 BlankHeader; |
| 641 | UINT8 Checksum; |
| 642 | UINT32 FileLength; |
| 643 | UINT8 SavedChecksum; |
| 644 | UINT8 SavedState; |
| 645 | UINT8 FileGuidString[80]; |
| 646 | UINT32 FfsHeaderSize; |
| 647 | |
| 648 | // |
| 649 | // Verify library has been initialized. |
| 650 | // |
| 651 | if (mFvHeader == NULL || mFvLength == 0) { |
| 652 | return EFI_ABORTED; |
| 653 | } |
| 654 | // |
| 655 | // Verify FV header |
| 656 | // |
| 657 | Status = VerifyFv (mFvHeader); |
| 658 | if (EFI_ERROR (Status)) { |
| 659 | return EFI_ABORTED; |
| 660 | } |
| 661 | // |
| 662 | // Get the erase polarity. |
| 663 | // |
| 664 | Status = GetErasePolarity (&ErasePolarity); |
| 665 | if (EFI_ERROR (Status)) { |
| 666 | return EFI_ABORTED; |
| 667 | } |
| 668 | |
| 669 | FfsHeaderSize = GetFfsHeaderLength(FfsHeader); |
| 670 | // |
| 671 | // Check if we have free space |
| 672 | // |
no test coverage detected