]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolRead.c
IntelFrameworkModulePkg FwVolDxe: Return correct AuthStatus for FvReadFile
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / FirmwareVolume / FwVolDxe / FwVolRead.c
CommitLineData
c2df8e13 1/** @file\r
2 Implements functions to read firmware file.\r
3\r
37136e06 4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
c2df8e13 5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions\r
8 of the BSD License which accompanies this distribution. The\r
9 full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#include "FwVolDriver.h"\r
18\r
5eddabfc
SZ
19/**\r
20Required Alignment Alignment Value in FFS Alignment Value in\r
21(bytes) Attributes Field Firmware Volume Interfaces\r
221 0 0\r
2316 1 4\r
24128 2 7\r
25512 3 9\r
261 KB 4 10\r
274 KB 5 12\r
2832 KB 6 15\r
2964 KB 7 16\r
30**/\r
31UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};\r
c2df8e13 32\r
33/**\r
34 Convert the FFS File Attributes to FV File Attributes.\r
35\r
36 @param FfsAttributes The attributes of UINT8 type.\r
37\r
38 @return The attributes of EFI_FV_FILE_ATTRIBUTES\r
39\r
40**/\r
41EFI_FV_FILE_ATTRIBUTES\r
42FfsAttributes2FvFileAttributes (\r
43 IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes\r
44 )\r
45{\r
5eddabfc
SZ
46 UINT8 DataAlignment;\r
47 EFI_FV_FILE_ATTRIBUTES FileAttribute;\r
48\r
49 DataAlignment = (UINT8) ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);\r
50 ASSERT (DataAlignment < 8);\r
51\r
52 FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment];\r
53\r
54 if ((FfsAttributes & FFS_ATTRIB_FIXED) == FFS_ATTRIB_FIXED) {\r
55 FileAttribute |= EFI_FV_FILE_ATTRIB_FIXED;\r
56 }\r
57\r
58 return FileAttribute;\r
c2df8e13 59}\r
60\r
61/**\r
62 Given the input key, search for the next matching file in the volume.\r
63\r
64 @param This Indicates the calling context.\r
65 @param Key Key is a pointer to a caller allocated\r
66 buffer that contains implementation specific\r
67 data that is used to track where to begin\r
68 the search for the next file. The size of\r
69 the buffer must be at least This->KeySize\r
70 bytes long. To reinitialize the search and\r
71 begin from the beginning of the firmware\r
72 volume, the entire buffer must be cleared to\r
73 zero. Other than clearing the buffer to\r
74 initiate a new search, the caller must not\r
75 modify the data in the buffer between calls\r
76 to GetNextFile().\r
77 @param FileType FileType is a pointer to a caller allocated\r
78 EFI_FV_FILETYPE. The GetNextFile() API can\r
79 filter it's search for files based on the\r
80 value of *FileType input. A *FileType input\r
81 of 0 causes GetNextFile() to search for\r
82 files of all types. If a file is found, the\r
83 file's type is returned in *FileType.\r
84 *FileType is not modified if no file is\r
85 found.\r
86 @param NameGuid NameGuid is a pointer to a caller allocated\r
87 EFI_GUID. If a file is found, the file's\r
88 name is returned in *NameGuid. *NameGuid is\r
89 not modified if no file is found.\r
90 @param Attributes Attributes is a pointer to a caller\r
91 allocated EFI_FV_FILE_ATTRIBUTES. If a file\r
92 is found, the file's attributes are returned\r
93 in *Attributes. *Attributes is not modified\r
94 if no file is found.\r
95 @param Size Size is a pointer to a caller allocated\r
96 UINTN. If a file is found, the file's size\r
97 is returned in *Size. *Size is not modified\r
98 if no file is found.\r
99\r
100 @retval EFI_SUCCESS Successfully find the file.\r
101 @retval EFI_DEVICE_ERROR Device error.\r
102 @retval EFI_ACCESS_DENIED Fv could not read.\r
103 @retval EFI_NOT_FOUND No matching file found.\r
104 @retval EFI_INVALID_PARAMETER Invalid parameter\r
105\r
106**/\r
107EFI_STATUS\r
108EFIAPI\r
109FvGetNextFile (\r
110 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
111 IN OUT VOID *Key,\r
112 IN OUT EFI_FV_FILETYPE *FileType,\r
113 OUT EFI_GUID *NameGuid,\r
114 OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r
115 OUT UINTN *Size\r
116 )\r
117{\r
118 EFI_STATUS Status;\r
119 FV_DEVICE *FvDevice;\r
120 EFI_FV_ATTRIBUTES FvAttributes;\r
121 EFI_FFS_FILE_HEADER *FfsFileHeader;\r
122 UINTN *KeyValue;\r
123 LIST_ENTRY *Link;\r
124 FFS_FILE_LIST_ENTRY *FfsFileEntry;\r
c2df8e13 125\r
126 FvDevice = FV_DEVICE_FROM_THIS (This);\r
127\r
128 Status = This->GetVolumeAttributes (This, &FvAttributes);\r
129 if (EFI_ERROR (Status)) {\r
130 return Status;\r
131 }\r
132\r
133 KeyValue = (UINTN *) Key;\r
134 FfsFileHeader = NULL;\r
135\r
136 //\r
137 // Check if read operation is enabled\r
138 //\r
139 if ((FvAttributes & EFI_FV2_READ_STATUS) == 0) {\r
140 return EFI_ACCESS_DENIED;\r
141 }\r
142\r
143 if (*FileType > EFI_FV_FILETYPE_SMM_CORE) {\r
144 //\r
145 // File type needs to be in 0 - 0x0D\r
146 //\r
147 return EFI_NOT_FOUND;\r
148 }\r
149\r
150 do {\r
151 if (*KeyValue == 0) {\r
152 //\r
153 // Search for 1st matching file\r
154 //\r
155 Link = &FvDevice->FfsFileListHeader;\r
156 if (Link->ForwardLink == &FvDevice->FfsFileListHeader) {\r
157 return EFI_NOT_FOUND;\r
158 }\r
159\r
160 FfsFileEntry = (FFS_FILE_LIST_ENTRY *) Link->ForwardLink;\r
161 FfsFileHeader = (EFI_FFS_FILE_HEADER *) FfsFileEntry->FfsHeader;\r
162\r
163 //\r
164 // remember the key\r
165 //\r
166 *KeyValue = (UINTN) FfsFileEntry;\r
167\r
168 //\r
169 // we ignore pad files\r
170 //\r
171 if (FfsFileHeader->Type == EFI_FV_FILETYPE_FFS_PAD) {\r
172 continue;\r
173 }\r
174\r
175 if (*FileType == 0) {\r
176 break;\r
177 }\r
178\r
179 if (*FileType == FfsFileHeader->Type) {\r
180 break;\r
181 }\r
182\r
183 } else {\r
184 //\r
185 // Getting link from last Ffs\r
186 //\r
187 Link = (LIST_ENTRY *) (*KeyValue);\r
188 if (Link->ForwardLink == &FvDevice->FfsFileListHeader) {\r
189 return EFI_NOT_FOUND;\r
190 }\r
191\r
192 FfsFileEntry = (FFS_FILE_LIST_ENTRY *) Link->ForwardLink;\r
193 FfsFileHeader = (EFI_FFS_FILE_HEADER *) FfsFileEntry->FfsHeader;\r
194\r
195 //\r
196 // remember the key\r
197 //\r
198 *KeyValue = (UINTN) FfsFileEntry;\r
199\r
200 //\r
201 // we ignore pad files\r
202 //\r
203 if (FfsFileHeader->Type == EFI_FV_FILETYPE_FFS_PAD) {\r
204 continue;\r
205 }\r
206\r
207 if (*FileType == EFI_FV_FILETYPE_ALL) {\r
208 break;\r
209 }\r
210\r
211 if (*FileType == FfsFileHeader->Type) {\r
212 break;\r
213 }\r
214 }\r
215 } while (Link->ForwardLink != &FvDevice->FfsFileListHeader);\r
216\r
217 //\r
218 // Cache this file entry\r
219 //\r
220 FvDevice->CurrentFfsFile = FfsFileEntry;\r
221\r
222 *FileType = FfsFileHeader->Type;\r
223 CopyGuid (NameGuid, &FfsFileHeader->Name);\r
224 *Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);\r
5eddabfc
SZ
225 if ((FvDevice->FwVolHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
226 *Attributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
227 }\r
c2df8e13 228\r
c2df8e13 229 //\r
230 // we need to substract the header size\r
231 //\r
23491d5c
SZ
232 if (IS_FFS_FILE2 (FfsFileHeader)) {\r
233 *Size = FFS_FILE2_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER2);\r
234 } else {\r
235 *Size = FFS_FILE_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER);\r
236 }\r
c2df8e13 237\r
238 if (CompareGuid (&gEfiFirmwareVolumeTopFileGuid, NameGuid)) {\r
239 //\r
240 // specially deal with VTF file\r
241 //\r
242 UINT8 *SrcPtr;\r
243 UINT32 Tmp;\r
244\r
23491d5c
SZ
245 if (IS_FFS_FILE2 (FfsFileHeader)) {\r
246 SrcPtr = ((UINT8 *) FfsFileHeader) + sizeof (EFI_FFS_FILE_HEADER2);\r
247 } else {\r
248 SrcPtr = ((UINT8 *) FfsFileHeader) + sizeof (EFI_FFS_FILE_HEADER);\r
249 }\r
c2df8e13 250\r
251 while (*Size >= 4) {\r
252 Tmp = *(UINT32 *) SrcPtr;\r
253 if (Tmp == 0) {\r
254 SrcPtr += 4;\r
255 (*Size) -= 4;\r
256 } else {\r
257 break;\r
258 }\r
259 }\r
260 }\r
261\r
262 return EFI_SUCCESS;\r
263}\r
264\r
265/**\r
266 Locates a file in the firmware volume and\r
267 copies it to the supplied buffer.\r
268\r
269 @param This Indicates the calling context.\r
270 @param NameGuid Pointer to an EFI_GUID, which is the\r
271 filename.\r
272 @param Buffer Buffer is a pointer to pointer to a buffer\r
273 in which the file or section contents or are\r
274 returned.\r
275 @param BufferSize BufferSize is a pointer to caller allocated\r
276 UINTN. On input *BufferSize indicates the\r
277 size in bytes of the memory region pointed\r
278 to by Buffer. On output, *BufferSize\r
279 contains the number of bytes required to\r
280 read the file.\r
281 @param FoundType FoundType is a pointer to a caller allocated\r
282 EFI_FV_FILETYPE that on successful return\r
283 from Read() contains the type of file read.\r
284 This output reflects the file type\r
285 irrespective of the value of the SectionType\r
286 input.\r
287 @param FileAttributes FileAttributes is a pointer to a caller\r
288 allocated EFI_FV_FILE_ATTRIBUTES. On\r
289 successful return from Read(),\r
290 *FileAttributes contains the attributes of\r
291 the file read.\r
292 @param AuthenticationStatus AuthenticationStatus is a pointer to a\r
293 caller allocated UINTN in which the\r
294 authentication status is returned.\r
295\r
296 @retval EFI_SUCCESS Successfully read to memory buffer.\r
297 @retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.\r
298 @retval EFI_NOT_FOUND Not found.\r
299 @retval EFI_DEVICE_ERROR Device error.\r
300 @retval EFI_ACCESS_DENIED Could not read.\r
301 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
302 @retval EFI_OUT_OF_RESOURCES Not enough buffer to be allocated.\r
303\r
304**/\r
305EFI_STATUS\r
306EFIAPI\r
307FvReadFile (\r
308 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
309 IN CONST EFI_GUID *NameGuid,\r
310 IN OUT VOID **Buffer,\r
311 IN OUT UINTN *BufferSize,\r
312 OUT EFI_FV_FILETYPE *FoundType,\r
313 OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,\r
314 OUT UINT32 *AuthenticationStatus\r
315 )\r
316{\r
317 EFI_STATUS Status;\r
318 FV_DEVICE *FvDevice;\r
319 UINTN Key;\r
320 EFI_GUID SearchNameGuid;\r
321 EFI_FV_ATTRIBUTES FvAttributes;\r
322 EFI_FV_FILETYPE LocalFoundType;\r
323 EFI_FV_FILE_ATTRIBUTES LocalAttributes;\r
324 UINTN FileSize;\r
325 UINT8 *SrcPtr;\r
326 FFS_FILE_LIST_ENTRY *FfsFileEntry;\r
327 EFI_FFS_FILE_HEADER *FfsHeader;\r
328 UINT8 *FileBuffer;\r
329\r
330 if (NULL == This || NULL == NameGuid) {\r
331 return EFI_INVALID_PARAMETER;\r
332 }\r
333\r
334 FvDevice = FV_DEVICE_FROM_THIS (This);\r
335\r
336 Status = This->GetVolumeAttributes (This, &FvAttributes);\r
337 if (EFI_ERROR (Status)) {\r
338 return Status;\r
339 }\r
340 //\r
341 // First check to see that FV is enabled for reads...\r
342 //\r
343 if (0 == (FvAttributes & EFI_FV2_READ_STATUS)) {\r
344 return EFI_ACCESS_DENIED;\r
345 }\r
346\r
347 FfsHeader = NULL;\r
348\r
349 //\r
350 // Check if the file was read last time.\r
351 //\r
352 FfsFileEntry = FvDevice->CurrentFfsFile;\r
353\r
354 if (FfsFileEntry != NULL) {\r
355 FfsHeader = (EFI_FFS_FILE_HEADER *) FfsFileEntry->FfsHeader;\r
356 }\r
357\r
358 if ((FfsFileEntry == NULL) || (!CompareGuid (&FfsHeader->Name, NameGuid))) {\r
359 //\r
360 // If not match or no file cached, search this file\r
361 //\r
362 Key = 0;\r
363 do {\r
364 LocalFoundType = 0;\r
365 Status = This->GetNextFile (\r
366 This,\r
367 &Key,\r
368 &LocalFoundType,\r
369 &SearchNameGuid,\r
370 &LocalAttributes,\r
371 &FileSize\r
372 );\r
373 if (EFI_ERROR (Status)) {\r
374 return EFI_NOT_FOUND;\r
375 }\r
376 } while (!CompareGuid (&SearchNameGuid, NameGuid));\r
377\r
378 //\r
379 // Get file entry\r
380 //\r
381 FfsFileEntry = (FFS_FILE_LIST_ENTRY *) Key;\r
382\r
383 //\r
384 // Update the cache\r
385 //\r
386 FvDevice->CurrentFfsFile = FfsFileEntry;\r
387\r
388 FfsHeader = (EFI_FFS_FILE_HEADER *) FfsFileEntry->FfsHeader;\r
389\r
390 } else {\r
391 //\r
392 // Get File Size of the cached file\r
393 //\r
23491d5c
SZ
394 if (IS_FFS_FILE2 (FfsHeader)) {\r
395 FileSize = FFS_FILE2_SIZE (FfsHeader) - sizeof (EFI_FFS_FILE_HEADER2);\r
396 } else {\r
397 FileSize = FFS_FILE_SIZE (FfsHeader) - sizeof (EFI_FFS_FILE_HEADER);\r
398 }\r
c2df8e13 399 }\r
400 //\r
401 // Get file info\r
402 //\r
403 *FoundType = FfsHeader->Type;\r
404 *FileAttributes = FfsAttributes2FvFileAttributes (FfsHeader->Attributes);\r
5eddabfc
SZ
405 if ((FvDevice->FwVolHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
406 *FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
407 }\r
37136e06
SZ
408 //\r
409 // Inherit the authentication status.\r
410 //\r
411 *AuthenticationStatus = FvDevice->AuthenticationStatus;\r
c2df8e13 412\r
413 //\r
414 // If Buffer is NULL, we only want to get some information\r
415 //\r
416 if (Buffer == NULL) {\r
417 *BufferSize = FileSize;\r
418 return EFI_SUCCESS;\r
419 }\r
420\r
23491d5c
SZ
421 if (IS_FFS_FILE2 (FfsHeader)) {\r
422 SrcPtr = ((UINT8 *) FfsHeader) + sizeof (EFI_FFS_FILE_HEADER2);\r
423 } else {\r
424 SrcPtr = ((UINT8 *) FfsHeader) + sizeof (EFI_FFS_FILE_HEADER);\r
425 }\r
c2df8e13 426\r
427 if (CompareGuid (&gEfiFirmwareVolumeTopFileGuid, NameGuid)) {\r
428 //\r
429 // specially deal with VTF file\r
430 //\r
431 UINT32 Tmp;\r
432\r
433 while (FileSize >= 4) {\r
434 Tmp = *(UINT32 *) SrcPtr;\r
435 if (Tmp == 0) {\r
436 SrcPtr += 4;\r
437 FileSize -= 4;\r
438 } else {\r
439 break;\r
440 }\r
441 }\r
442 }\r
443 //\r
444 // If we drop out of the above loop, we've found the correct file header...\r
445 //\r
446 if (*Buffer == NULL) {\r
447 FileBuffer = AllocateCopyPool (FileSize, SrcPtr);\r
448 if (FileBuffer == NULL) {\r
449 return EFI_OUT_OF_RESOURCES;\r
450 }\r
451\r
452 *BufferSize = FileSize;\r
453 *Buffer = FileBuffer;\r
454\r
455 return EFI_SUCCESS;\r
456 }\r
457 //\r
458 // If the user's buffer is smaller than the file size, then copy as much\r
459 // as we can and return an appropriate status.\r
460 //\r
461 if (FileSize > *BufferSize) {\r
462 CopyMem (*Buffer, SrcPtr, *BufferSize);\r
463 *BufferSize = FileSize;\r
464 return EFI_WARN_BUFFER_TOO_SMALL;\r
465 }\r
466 //\r
467 // User's buffer size is ok, so copy the entire file to their buffer.\r
468 //\r
469 *BufferSize = FileSize;\r
470 CopyMem (*Buffer, SrcPtr, *BufferSize);\r
471\r
472 return EFI_SUCCESS;\r
473}\r
474\r
475/**\r
476 Locates a section in a given FFS File and\r
477 copies it to the supplied buffer (not including section header).\r
478\r
479 @param This Indicates the calling context.\r
480 @param NameGuid Pointer to an EFI_GUID, which is the\r
481 filename.\r
482 @param SectionType Indicates the section type to return.\r
483 @param SectionInstance Indicates which instance of sections with a\r
484 type of SectionType to return.\r
485 @param Buffer Buffer is a pointer to pointer to a buffer\r
486 in which the file or section contents or are\r
487 returned.\r
488 @param BufferSize BufferSize is a pointer to caller allocated\r
489 UINTN.\r
490 @param AuthenticationStatus AuthenticationStatus is a pointer to a\r
491 caller allocated UINT32 in which the\r
492 authentication status is returned.\r
493\r
494 @retval EFI_SUCCESS Successfully read the file section into\r
495 buffer.\r
496 @retval EFI_WARN_BUFFER_TOO_SMALL Buffer too small.\r
497 @retval EFI_NOT_FOUND Section not found.\r
498 @retval EFI_DEVICE_ERROR Device error.\r
499 @retval EFI_ACCESS_DENIED Could not read.\r
500 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
501\r
502**/\r
503EFI_STATUS\r
504EFIAPI\r
505FvReadFileSection (\r
506 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
507 IN CONST EFI_GUID *NameGuid,\r
508 IN EFI_SECTION_TYPE SectionType,\r
509 IN UINTN SectionInstance,\r
510 IN OUT VOID **Buffer,\r
511 IN OUT UINTN *BufferSize,\r
512 OUT UINT32 *AuthenticationStatus\r
513 )\r
514{\r
515 EFI_STATUS Status;\r
0c3a1db4 516 FV_DEVICE *FvDevice;\r
c2df8e13 517 EFI_FV_ATTRIBUTES FvAttributes;\r
518 EFI_FV_FILETYPE FileType;\r
519 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
520 UINTN FileSize;\r
521 UINT8 *FileBuffer;\r
522 EFI_SECTION_EXTRACTION_PROTOCOL *Sep;\r
523 UINTN StreamHandle;\r
524\r
525 if (NULL == This || NULL == NameGuid || Buffer == NULL) {\r
526 return EFI_INVALID_PARAMETER;\r
527 }\r
528\r
0c3a1db4
SZ
529 FvDevice = FV_DEVICE_FROM_THIS (This);\r
530\r
c2df8e13 531 Status = This->GetVolumeAttributes (This, &FvAttributes);\r
532 if (EFI_ERROR (Status)) {\r
533 return Status;\r
534 }\r
535 //\r
536 // First check to see that FV is enabled for reads...\r
537 //\r
538 if (0 == (FvAttributes & EFI_FV2_READ_STATUS)) {\r
539 return EFI_ACCESS_DENIED;\r
540 }\r
541 //\r
542 // Read the whole file into buffer\r
543 //\r
544 FileBuffer = NULL;\r
545 Status = This->ReadFile (\r
546 This,\r
547 NameGuid,\r
548 (VOID **) &FileBuffer,\r
549 &FileSize,\r
550 &FileType,\r
551 &FileAttributes,\r
552 AuthenticationStatus\r
553 );\r
554\r
555 if (EFI_ERROR (Status)) {\r
556 return Status;\r
557 }\r
558 //\r
559 // Check to see that the file actually HAS sections before we go any further.\r
560 //\r
561 if (FileType == EFI_FV_FILETYPE_RAW) {\r
562 FreePool (FileBuffer);\r
563 return EFI_NOT_FOUND;\r
564 }\r
565 //\r
566 // Located the protocol\r
567 //\r
568 Status = gBS->LocateProtocol (\r
569 &gEfiSectionExtractionProtocolGuid,\r
570 NULL,\r
571 (VOID **) &Sep\r
572 );\r
573 if (EFI_ERROR (Status)) {\r
574 FreePool (FileBuffer);\r
575 return Status;\r
576 }\r
577\r
578 Status = Sep->OpenSectionStream (\r
579 Sep,\r
580 FileSize,\r
581 FileBuffer,\r
582 &StreamHandle\r
583 );\r
584\r
585 if (EFI_ERROR (Status)) {\r
586 FreePool (FileBuffer);\r
587 return Status;\r
588 }\r
589\r
590 if (SectionType == 0) {\r
591 //\r
592 // We need the whole section stream\r
593 //\r
594 Status = Sep->GetSection (\r
595 Sep,\r
596 StreamHandle,\r
597 NULL,\r
598 NULL,\r
599 0,\r
600 Buffer,\r
601 BufferSize,\r
602 AuthenticationStatus\r
603 );\r
604 } else {\r
605 Status = Sep->GetSection (\r
606 Sep,\r
607 StreamHandle,\r
608 &SectionType,\r
609 NULL,\r
610 SectionInstance,\r
611 Buffer,\r
612 BufferSize,\r
613 AuthenticationStatus\r
614 );\r
615 }\r
0c3a1db4
SZ
616\r
617 if (!EFI_ERROR (Status)) {\r
618 //\r
619 // Inherit the authentication status.\r
620 //\r
621 *AuthenticationStatus |= FvDevice->AuthenticationStatus;\r
622 }\r
623\r
c2df8e13 624 //\r
625 // Handle AuthenticationStatus if necessary\r
626 //\r
627 Sep->CloseSectionStream (Sep, StreamHandle);\r
628\r
629 FreePool (FileBuffer);\r
630\r
631 return Status;\r
632}\r