TianoCore EDK2 master
Loading...
Searching...
No Matches
TlsAuthConfigImpl.c
Go to the documentation of this file.
1
10#include "TlsAuthConfigImpl.h"
11
12VOID *mStartOpCodeHandle = NULL;
13VOID *mEndOpCodeHandle = NULL;
14EFI_IFR_GUID_LABEL *mStartLabel = NULL;
15EFI_IFR_GUID_LABEL *mEndLabel = NULL;
16
17CHAR16 mTlsAuthConfigStorageName[] = L"TLS_AUTH_CONFIG_IFR_NVDATA";
18
19TLS_AUTH_CONFIG_PRIVATE_DATA *mTlsAuthPrivateData = NULL;
20
21HII_VENDOR_DEVICE_PATH mTlsAuthConfigHiiVendorDevicePath = {
22 {
23 {
26 {
27 (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
28 (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
29 }
30 },
31 TLS_AUTH_CONFIG_GUID
32 },
33 {
34 END_DEVICE_PATH_TYPE,
35 END_ENTIRE_DEVICE_PATH_SUBTYPE,
36 {
37 (UINT8)(END_DEVICE_PATH_LENGTH),
38 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
39 }
40 }
41};
42
43//
44// Possible DER-encoded certificate file suffixes, end with NULL pointer.
45//
46CHAR16 *mDerPemEncodedSuffix[] = {
47 L".cer",
48 L".der",
49 L".crt",
50 L".pem",
51 NULL
52};
53
63BOOLEAN
65 IN CONST CHAR16 *FileSuffix
66 )
67{
68 UINTN Index;
69
70 for (Index = 0; mDerPemEncodedSuffix[Index] != NULL; Index++) {
71 if (StrCmp (FileSuffix, mDerPemEncodedSuffix[Index]) == 0) {
72 return TRUE;
73 }
74 }
75
76 return FALSE;
77}
78
91 IN EFI_GUID *Guid,
92 IN CHAR16 *Buffer,
93 IN UINTN BufferSize
94 )
95{
96 return UnicodeSPrint (
97 Buffer,
98 BufferSize,
99 L"%g",
100 Guid
101 );
102}
103
122 IN CHAR16 *VariableName,
123 IN EFI_GUID *VendorGuid,
124 IN UINT16 LabelNumber,
125 IN EFI_FORM_ID FormId,
126 IN EFI_QUESTION_ID QuestionIdBase
127 )
128{
129 EFI_STATUS Status;
130 UINT32 Index;
131 UINTN CertCount;
132 UINTN GuidIndex;
133 VOID *StartOpCodeHandle;
134 VOID *EndOpCodeHandle;
135 EFI_IFR_GUID_LABEL *StartLabel;
136 EFI_IFR_GUID_LABEL *EndLabel;
137 UINTN DataSize;
138 UINT8 *Data;
139 EFI_SIGNATURE_LIST *CertList;
140 EFI_SIGNATURE_DATA *Cert;
141 UINT32 ItemDataSize;
142 CHAR16 *GuidStr;
143 EFI_STRING_ID GuidID;
144 EFI_STRING_ID Help;
145
146 Data = NULL;
147 CertList = NULL;
148 Cert = NULL;
149 GuidStr = NULL;
150 StartOpCodeHandle = NULL;
151 EndOpCodeHandle = NULL;
152
153 //
154 // Initialize the container for dynamic opcodes.
155 //
156 StartOpCodeHandle = HiiAllocateOpCodeHandle ();
157 if (StartOpCodeHandle == NULL) {
158 Status = EFI_OUT_OF_RESOURCES;
159 goto ON_EXIT;
160 }
161
162 EndOpCodeHandle = HiiAllocateOpCodeHandle ();
163 if (EndOpCodeHandle == NULL) {
164 Status = EFI_OUT_OF_RESOURCES;
165 goto ON_EXIT;
166 }
167
168 //
169 // Create Hii Extend Label OpCode.
170 //
172 StartOpCodeHandle,
173 &gEfiIfrTianoGuid,
174 NULL,
175 sizeof (EFI_IFR_GUID_LABEL)
176 );
178 StartLabel->Number = LabelNumber;
179
181 EndOpCodeHandle,
182 &gEfiIfrTianoGuid,
183 NULL,
184 sizeof (EFI_IFR_GUID_LABEL)
185 );
187 EndLabel->Number = LABEL_END;
188
189 //
190 // Read Variable.
191 //
192 DataSize = 0;
193 Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, Data);
194 if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
195 goto ON_EXIT;
196 }
197
198 Data = (UINT8 *)AllocateZeroPool (DataSize);
199 if (Data == NULL) {
200 Status = EFI_OUT_OF_RESOURCES;
201 goto ON_EXIT;
202 }
203
204 Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, Data);
205 if (EFI_ERROR (Status)) {
206 goto ON_EXIT;
207 }
208
209 GuidStr = AllocateZeroPool (100);
210 if (GuidStr == NULL) {
211 Status = EFI_OUT_OF_RESOURCES;
212 goto ON_EXIT;
213 }
214
215 //
216 // Enumerate all data.
217 //
218 ItemDataSize = (UINT32)DataSize;
219 CertList = (EFI_SIGNATURE_LIST *)Data;
220 GuidIndex = 0;
221
222 while ((ItemDataSize > 0) && (ItemDataSize >= CertList->SignatureListSize)) {
223 if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
224 Help = STRING_TOKEN (STR_CERT_TYPE_PCKS_GUID);
225 } else {
226 //
227 // The signature type is not supported in current implementation.
228 //
229 ItemDataSize -= CertList->SignatureListSize;
230 CertList = (EFI_SIGNATURE_LIST *)((UINT8 *)CertList + CertList->SignatureListSize);
231 continue;
232 }
233
234 CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
235 for (Index = 0; Index < CertCount; Index++) {
236 Cert = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList
237 + sizeof (EFI_SIGNATURE_LIST)
238 + CertList->SignatureHeaderSize
239 + Index * CertList->SignatureSize);
240 //
241 // Display GUID and help
242 //
243 GuidToString (&Cert->SignatureOwner, GuidStr, 100);
244 GuidID = HiiSetString (Private->RegisteredHandle, 0, GuidStr, NULL);
246 StartOpCodeHandle,
247 (EFI_QUESTION_ID)(QuestionIdBase + GuidIndex++),
248 0,
249 0,
250 GuidID,
251 Help,
252 EFI_IFR_FLAG_CALLBACK,
253 0,
254 NULL
255 );
256 }
257
258 ItemDataSize -= CertList->SignatureListSize;
259 CertList = (EFI_SIGNATURE_LIST *)((UINT8 *)CertList + CertList->SignatureListSize);
260 }
261
262ON_EXIT:
264 Private->RegisteredHandle,
265 &gTlsAuthConfigGuid,
266 FormId,
267 StartOpCodeHandle,
268 EndOpCodeHandle
269 );
270
271 if (StartOpCodeHandle != NULL) {
272 HiiFreeOpCodeHandle (StartOpCodeHandle);
273 }
274
275 if (EndOpCodeHandle != NULL) {
276 HiiFreeOpCodeHandle (EndOpCodeHandle);
277 }
278
279 if (Data != NULL) {
280 FreePool (Data);
281 }
282
283 if (GuidStr != NULL) {
284 FreePool (GuidStr);
285 }
286
287 return EFI_SUCCESS;
288}
289
308 IN CHAR16 *VariableName,
309 IN EFI_GUID *VendorGuid,
310 IN UINT16 LabelNumber,
311 IN EFI_FORM_ID FormId,
312 IN EFI_QUESTION_ID QuestionIdBase,
313 IN UINTN DeleteIndex
314 )
315{
316 EFI_STATUS Status;
317 UINTN DataSize;
318 UINT8 *Data;
319 UINT8 *OldData;
320 UINT32 Attr;
321 UINT32 Index;
322 EFI_SIGNATURE_LIST *CertList;
323 EFI_SIGNATURE_LIST *NewCertList;
324 EFI_SIGNATURE_DATA *Cert;
325 UINTN CertCount;
326 UINT32 Offset;
327 BOOLEAN IsItemFound;
328 UINT32 ItemDataSize;
329 UINTN GuidIndex;
330
331 Data = NULL;
332 OldData = NULL;
333 CertList = NULL;
334 Cert = NULL;
335 Attr = 0;
336
337 //
338 // Get original signature list data.
339 //
340 DataSize = 0;
341 Status = gRT->GetVariable (VariableName, VendorGuid, NULL, &DataSize, NULL);
342 if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
343 goto ON_EXIT;
344 }
345
346 OldData = (UINT8 *)AllocateZeroPool (DataSize);
347 if (OldData == NULL) {
348 Status = EFI_OUT_OF_RESOURCES;
349 goto ON_EXIT;
350 }
351
352 Status = gRT->GetVariable (VariableName, VendorGuid, &Attr, &DataSize, OldData);
353 if (EFI_ERROR (Status)) {
354 goto ON_EXIT;
355 }
356
357 //
358 // Allocate space for new variable.
359 //
360 Data = (UINT8 *)AllocateZeroPool (DataSize);
361 if (Data == NULL) {
362 Status = EFI_OUT_OF_RESOURCES;
363 goto ON_EXIT;
364 }
365
366 //
367 // Enumerate all data and erasing the target item.
368 //
369 IsItemFound = FALSE;
370 ItemDataSize = (UINT32)DataSize;
371 CertList = (EFI_SIGNATURE_LIST *)OldData;
372 Offset = 0;
373 GuidIndex = 0;
374 while ((ItemDataSize > 0) && (ItemDataSize >= CertList->SignatureListSize)) {
375 if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
376 //
377 // Copy EFI_SIGNATURE_LIST header then calculate the signature count in this list.
378 //
379 CopyMem (Data + Offset, CertList, (sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize));
380 NewCertList = (EFI_SIGNATURE_LIST *)(Data + Offset);
381 Offset += (sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
382 Cert = (EFI_SIGNATURE_DATA *)((UINT8 *)CertList + sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
383 CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
384 for (Index = 0; Index < CertCount; Index++) {
385 if (GuidIndex == DeleteIndex) {
386 //
387 // Find it! Skip it!
388 //
389 NewCertList->SignatureListSize -= CertList->SignatureSize;
390 IsItemFound = TRUE;
391 } else {
392 //
393 // This item doesn't match. Copy it to the Data buffer.
394 //
395 CopyMem (Data + Offset, (UINT8 *)(Cert), CertList->SignatureSize);
396 Offset += CertList->SignatureSize;
397 }
398
399 GuidIndex++;
400 Cert = (EFI_SIGNATURE_DATA *)((UINT8 *)Cert + CertList->SignatureSize);
401 }
402 } else {
403 //
404 // This List doesn't match. Just copy it to the Data buffer.
405 //
406 CopyMem (Data + Offset, (UINT8 *)(CertList), CertList->SignatureListSize);
407 Offset += CertList->SignatureListSize;
408 }
409
410 ItemDataSize -= CertList->SignatureListSize;
411 CertList = (EFI_SIGNATURE_LIST *)((UINT8 *)CertList + CertList->SignatureListSize);
412 }
413
414 if (!IsItemFound) {
415 //
416 // Doesn't find the signature Item!
417 //
418 Status = EFI_NOT_FOUND;
419 goto ON_EXIT;
420 }
421
422 //
423 // Delete the EFI_SIGNATURE_LIST header if there is no signature in the list.
424 //
425 ItemDataSize = Offset;
426 CertList = (EFI_SIGNATURE_LIST *)Data;
427 Offset = 0;
428 ZeroMem (OldData, ItemDataSize);
429 while ((ItemDataSize > 0) && (ItemDataSize >= CertList->SignatureListSize)) {
430 CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) - CertList->SignatureHeaderSize) / CertList->SignatureSize;
431 DEBUG ((DEBUG_INFO, " CertCount = %x\n", CertCount));
432 if (CertCount != 0) {
433 CopyMem (OldData + Offset, (UINT8 *)(CertList), CertList->SignatureListSize);
434 Offset += CertList->SignatureListSize;
435 }
436
437 ItemDataSize -= CertList->SignatureListSize;
438 CertList = (EFI_SIGNATURE_LIST *)((UINT8 *)CertList + CertList->SignatureListSize);
439 }
440
441 DataSize = Offset;
442
443 Status = gRT->SetVariable (
444 VariableName,
445 VendorGuid,
446 Attr,
447 DataSize,
448 OldData
449 );
450 if (EFI_ERROR (Status)) {
451 DEBUG ((DEBUG_ERROR, "Failed to set variable, Status = %r\n", Status));
452 goto ON_EXIT;
453 }
454
455ON_EXIT:
456 if (Data != NULL) {
457 FreePool (Data);
458 }
459
460 if (OldData != NULL) {
461 FreePool (OldData);
462 }
463
464 return UpdateDeletePage (
465 Private,
466 VariableName,
467 VendorGuid,
468 LabelNumber,
469 FormId,
470 QuestionIdBase
471 );
472}
473
480VOID
483 )
484{
485 if (Private->FileContext->FHandle != NULL) {
486 Private->FileContext->FHandle->Close (Private->FileContext->FHandle);
487 Private->FileContext->FHandle = NULL;
488 if (Private->FileContext->FileName != NULL) {
489 FreePool (Private->FileContext->FileName);
490 Private->FileContext->FileName = NULL;
491 }
492 }
493}
494
513 IN EFI_FILE_HANDLE FileHandle,
514 IN OUT VOID **BufferPtr,
515 OUT UINTN *FileSize,
516 IN UINTN AddtionAllocateSize
517 )
518
519{
520 UINTN BufferSize;
521 UINT64 SourceFileSize;
522 VOID *Buffer;
523 EFI_STATUS Status;
524
525 if ((FileHandle == NULL) || (FileSize == NULL)) {
526 return EFI_INVALID_PARAMETER;
527 }
528
529 Buffer = NULL;
530
531 //
532 // Get the file size
533 //
534 Status = FileHandle->SetPosition (FileHandle, (UINT64)-1);
535 if (EFI_ERROR (Status)) {
536 goto ON_EXIT;
537 }
538
539 Status = FileHandle->GetPosition (FileHandle, &SourceFileSize);
540 if (EFI_ERROR (Status)) {
541 goto ON_EXIT;
542 }
543
544 Status = FileHandle->SetPosition (FileHandle, 0);
545 if (EFI_ERROR (Status)) {
546 goto ON_EXIT;
547 }
548
549 BufferSize = (UINTN)SourceFileSize + AddtionAllocateSize;
550 Buffer = AllocateZeroPool (BufferSize);
551 if (Buffer == NULL) {
552 return EFI_OUT_OF_RESOURCES;
553 }
554
555 BufferSize = (UINTN)SourceFileSize;
556 *FileSize = BufferSize;
557
558 Status = FileHandle->Read (FileHandle, &BufferSize, Buffer);
559 if (EFI_ERROR (Status) || (BufferSize != *FileSize)) {
560 FreePool (Buffer);
561 Buffer = NULL;
562 Status = EFI_BAD_BUFFER_SIZE;
563 goto ON_EXIT;
564 }
565
566ON_EXIT:
567
568 *BufferPtr = Buffer;
569 return Status;
570}
571
580CHAR16 *
581EFIAPI
584 )
585{
587 DevPath,
588 FALSE,
589 TRUE
590 );
591}
592
604CHAR16 *
606 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
607 )
608{
609 CHAR16 *String;
610 CHAR16 *MatchString;
611 CHAR16 *LastMatch;
612 CHAR16 *FileName;
613 UINTN Length;
614
615 ASSERT (DevicePath != NULL);
616
617 String = DevicePathToStr (DevicePath);
618 MatchString = String;
619 LastMatch = String;
620 FileName = NULL;
621
622 while (MatchString != NULL) {
623 LastMatch = MatchString + 1;
624 MatchString = StrStr (LastMatch, L"\\");
625 }
626
627 Length = StrLen (LastMatch);
628 FileName = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), LastMatch);
629 if (FileName != NULL) {
630 *(FileName + Length) = 0;
631 }
632
633 FreePool (String);
634
635 return FileName;
636}
637
651 IN CHAR16 *VariableName
652 )
653{
654 EFI_STATUS Status;
655 UINTN X509DataSize;
656 VOID *X509Data;
657 EFI_SIGNATURE_LIST *CACert;
658 EFI_SIGNATURE_DATA *CACertData;
659 VOID *Data;
660 UINTN DataSize;
661 UINTN SigDataSize;
662 UINT32 Attr;
663
664 X509DataSize = 0;
665 SigDataSize = 0;
666 DataSize = 0;
667 X509Data = NULL;
668 CACert = NULL;
669 CACertData = NULL;
670 Data = NULL;
671 Attr = 0;
672
673 Status = ReadFileContent (
674 Private->FileContext->FHandle,
675 &X509Data,
676 &X509DataSize,
677 0
678 );
679 if (EFI_ERROR (Status)) {
680 goto ON_EXIT;
681 }
682
683 ASSERT (X509Data != NULL);
684
685 SigDataSize = sizeof (EFI_SIGNATURE_LIST) + sizeof (EFI_SIGNATURE_DATA) - 1 + X509DataSize;
686
687 Data = AllocateZeroPool (SigDataSize);
688 if (Data == NULL) {
689 Status = EFI_OUT_OF_RESOURCES;
690 goto ON_EXIT;
691 }
692
693 //
694 // Fill Certificate Database parameters.
695 //
696 CACert = (EFI_SIGNATURE_LIST *)Data;
697 CACert->SignatureListSize = (UINT32)SigDataSize;
698 CACert->SignatureHeaderSize = 0;
699 CACert->SignatureSize = (UINT32)(sizeof (EFI_SIGNATURE_DATA) - 1 + X509DataSize);
700 CopyGuid (&CACert->SignatureType, &gEfiCertX509Guid);
701
702 CACertData = (EFI_SIGNATURE_DATA *)((UINT8 *)CACert + sizeof (EFI_SIGNATURE_LIST));
703 CopyGuid (&CACertData->SignatureOwner, Private->CertGuid);
704 CopyMem ((UINT8 *)(CACertData->SignatureData), X509Data, X509DataSize);
705
706 //
707 // Check if the signature database entry already exists. If it does, use the
708 // EFI_VARIABLE_APPEND_WRITE attribute to append the new signature data to
709 // the original variable, plus preserve the original variable attributes.
710 //
711 Status = gRT->GetVariable (
712 VariableName,
713 &gEfiTlsCaCertificateGuid,
714 &Attr,
715 &DataSize,
716 NULL
717 );
718 if (Status == EFI_BUFFER_TOO_SMALL) {
719 Attr |= EFI_VARIABLE_APPEND_WRITE;
720 } else if (Status == EFI_NOT_FOUND) {
721 Attr = TLS_AUTH_CONFIG_VAR_BASE_ATTR;
722 } else {
723 goto ON_EXIT;
724 }
725
726 Status = gRT->SetVariable (
727 VariableName,
728 &gEfiTlsCaCertificateGuid,
729 Attr,
730 SigDataSize,
731 Data
732 );
733 if (EFI_ERROR (Status)) {
734 goto ON_EXIT;
735 }
736
737ON_EXIT:
738 CleanFileContext (Private);
739
740 if (Private->CertGuid != NULL) {
741 FreePool (Private->CertGuid);
742 Private->CertGuid = NULL;
743 }
744
745 if (Data != NULL) {
746 FreePool (Data);
747 }
748
749 if (X509Data != NULL) {
750 FreePool (X509Data);
751 }
752
753 return Status;
754}
755
771 IN CHAR16 *VariableName
772 )
773{
774 UINT16 *FilePostFix;
775 UINTN NameLength;
776
777 if ((Private->FileContext->FileName == NULL) || (Private->FileContext->FHandle == NULL) || (Private->CertGuid == NULL)) {
778 return EFI_INVALID_PARAMETER;
779 }
780
781 //
782 // Parse the file's postfix.
783 //
784 NameLength = StrLen (Private->FileContext->FileName);
785 if (NameLength <= 4) {
786 return EFI_INVALID_PARAMETER;
787 }
788
789 FilePostFix = Private->FileContext->FileName + NameLength - 4;
790
791 if (IsDerPemEncodeCertificate (FilePostFix)) {
792 //
793 // Supports DER-encoded X509 certificate.
794 //
795 return EnrollX509toVariable (Private, VariableName);
796 }
797
798 return EFI_UNSUPPORTED;
799}
800
805VOID
807 VOID
808 )
809{
810 //
811 // Free current updated date
812 //
813 if (mStartOpCodeHandle != NULL) {
814 HiiFreeOpCodeHandle (mStartOpCodeHandle);
815 }
816
817 //
818 // Create new OpCode Handle
819 //
820 mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
821
822 //
823 // Create Hii Extend Label OpCode as the start opcode
824 //
825 mStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
826 mStartOpCodeHandle,
827 &gEfiIfrTianoGuid,
828 NULL,
829 sizeof (EFI_IFR_GUID_LABEL)
830 );
832}
833
841VOID
843 IN UINT16 LabelId,
845 )
846{
848
849 //
850 // Remove all op-codes from dynamic page
851 //
852 mStartLabel->Number = LabelId;
854 PrivateData->RegisteredHandle,
855 &gTlsAuthConfigGuid,
856 LabelId,
857 mStartOpCodeHandle, // Label LabelId
858 mEndOpCodeHandle // LABEL_END
859 );
860}
861
872BOOLEAN
875 IN EFI_FORM_ID FormId
876 )
877{
878 CHAR16 *FileName;
879 EFI_STRING_ID StringToken;
880
881 FileName = NULL;
882
883 if (FilePath != NULL) {
884 FileName = ExtractFileNameFromDevicePath (FilePath);
885 }
886
887 if (FileName == NULL) {
888 //
889 // FileName = NULL has two case:
890 // 1. FilePath == NULL, not select file.
891 // 2. FilePath != NULL, but ExtractFileNameFromDevicePath return NULL not enough memory resource.
892 // In these two case, no need to update the form, and exit the caller function.
893 //
894 return TRUE;
895 }
896
897 StringToken = HiiSetString (mTlsAuthPrivateData->RegisteredHandle, 0, FileName, NULL);
898
899 mTlsAuthPrivateData->FileContext->FileName = FileName;
900
902 &FilePath,
903 &mTlsAuthPrivateData->FileContext->FHandle,
904 EFI_FILE_MODE_READ,
905 0
906 );
907 //
908 // Create Subtitle op-code for the display string of the option.
909 //
911 mStartLabel->Number = FormId;
912
914 mStartOpCodeHandle,
915 StringToken,
916 0,
917 0,
918 0
919 );
920
922 mTlsAuthPrivateData->RegisteredHandle,
923 &gTlsAuthConfigGuid,
924 FormId,
925 mStartOpCodeHandle,
926 mEndOpCodeHandle
927 );
928
929 return TRUE;
930}
931
940BOOLEAN
941EFIAPI
944 )
945{
946 return UpdatePage (FilePath, TLS_AUTH_CONFIG_FORMID4_FORM);
947}
948
962 )
963{
964 if (Private->DriverHandle != NULL) {
965 //
966 // Uninstall EFI_HII_CONFIG_ACCESS_PROTOCOL
967 //
968 gBS->UninstallMultipleProtocolInterfaces (
969 Private->DriverHandle,
970 &gEfiDevicePathProtocolGuid,
971 &mTlsAuthConfigHiiVendorDevicePath,
972 &gEfiHiiConfigAccessProtocolGuid,
973 &Private->ConfigAccess,
974 NULL
975 );
976 Private->DriverHandle = NULL;
977 }
978
979 if (Private->RegisteredHandle != NULL) {
980 //
981 // Remove HII package list
982 //
983 HiiRemovePackages (Private->RegisteredHandle);
984 Private->RegisteredHandle = NULL;
985 }
986
987 if (Private->CertGuid != NULL) {
988 FreePool (Private->CertGuid);
989 }
990
991 if (Private->FileContext != NULL) {
992 FreePool (Private->FileContext);
993 }
994
995 FreePool (Private);
996
997 if (mStartOpCodeHandle != NULL) {
998 HiiFreeOpCodeHandle (mStartOpCodeHandle);
999 }
1000
1001 if (mEndOpCodeHandle != NULL) {
1002 HiiFreeOpCodeHandle (mEndOpCodeHandle);
1003 }
1004
1005 return EFI_SUCCESS;
1006}
1007
1020 )
1021{
1022 EFI_STATUS Status;
1023
1024 Private->Signature = TLS_AUTH_CONFIG_PRIVATE_DATA_SIGNATURE;
1025
1026 Private->ConfigAccess.ExtractConfig = TlsAuthConfigAccessExtractConfig;
1027 Private->ConfigAccess.RouteConfig = TlsAuthConfigAccessRouteConfig;
1028 Private->ConfigAccess.Callback = TlsAuthConfigAccessCallback;
1029
1030 //
1031 // Install Device Path Protocol and Config Access protocol to driver handle.
1032 //
1033 Status = gBS->InstallMultipleProtocolInterfaces (
1034 &Private->DriverHandle,
1035 &gEfiDevicePathProtocolGuid,
1036 &mTlsAuthConfigHiiVendorDevicePath,
1037 &gEfiHiiConfigAccessProtocolGuid,
1038 &Private->ConfigAccess,
1039 NULL
1040 );
1041 if (EFI_ERROR (Status)) {
1042 return Status;
1043 }
1044
1045 //
1046 // Publish our HII data.
1047 //
1048 Private->RegisteredHandle = HiiAddPackages (
1049 &gTlsAuthConfigGuid,
1050 Private->DriverHandle,
1051 TlsAuthConfigDxeStrings,
1052 TlsAuthConfigVfrBin,
1053 NULL
1054 );
1055 if (Private->RegisteredHandle == NULL) {
1056 Status = EFI_OUT_OF_RESOURCES;
1057 goto Error;
1058 }
1059
1060 Private->FileContext = AllocateZeroPool (sizeof (TLS_AUTH_CONFIG_FILE_CONTEXT));
1061 if (Private->FileContext == NULL) {
1062 Status = EFI_OUT_OF_RESOURCES;
1063 goto Error;
1064 }
1065
1066 //
1067 // Init OpCode Handle and Allocate space for creation of Buffer
1068 //
1069 mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
1070 if (mStartOpCodeHandle == NULL) {
1071 Status = EFI_OUT_OF_RESOURCES;
1072 goto Error;
1073 }
1074
1075 mEndOpCodeHandle = HiiAllocateOpCodeHandle ();
1076 if (mEndOpCodeHandle == NULL) {
1077 Status = EFI_OUT_OF_RESOURCES;
1078 goto Error;
1079 }
1080
1081 //
1082 // Create Hii Extend Label OpCode as the start opcode
1083 //
1084 mStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
1085 mStartOpCodeHandle,
1086 &gEfiIfrTianoGuid,
1087 NULL,
1088 sizeof (EFI_IFR_GUID_LABEL)
1089 );
1091
1092 //
1093 // Create Hii Extend Label OpCode as the end opcode
1094 //
1096 mEndOpCodeHandle,
1097 &gEfiIfrTianoGuid,
1098 NULL,
1099 sizeof (EFI_IFR_GUID_LABEL)
1100 );
1102 mEndLabel->Number = LABEL_END;
1103
1104 return EFI_SUCCESS;
1105
1106Error:
1107 TlsAuthConfigFormUnload (Private);
1108 return Status;
1109}
1110
1183EFIAPI
1186 IN CONST EFI_STRING Request,
1187 OUT EFI_STRING *Progress,
1188 OUT EFI_STRING *Results
1189 )
1190{
1191 EFI_STATUS Status;
1192 UINTN BufferSize;
1193 UINTN Size;
1194 EFI_STRING ConfigRequest;
1195 EFI_STRING ConfigRequestHdr;
1197 BOOLEAN AllocatedRequest;
1198
1199 if ((Progress == NULL) || (Results == NULL)) {
1200 return EFI_INVALID_PARAMETER;
1201 }
1202
1203 AllocatedRequest = FALSE;
1204 ConfigRequestHdr = NULL;
1205 ConfigRequest = NULL;
1206 Size = 0;
1207
1208 Private = TLS_AUTH_CONFIG_PRIVATE_FROM_THIS (This);
1209
1210 BufferSize = sizeof (TLS_AUTH_CONFIG_IFR_NVDATA);
1211 ZeroMem (&Private->TlsAuthConfigNvData, BufferSize);
1212
1213 *Progress = Request;
1214
1215 if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gTlsAuthConfigGuid, mTlsAuthConfigStorageName)) {
1216 return EFI_NOT_FOUND;
1217 }
1218
1219 ConfigRequest = Request;
1220 if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
1221 //
1222 // Request is set to NULL or OFFSET is NULL, construct full request string.
1223 //
1224 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
1225 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
1226 //
1227 ConfigRequestHdr = HiiConstructConfigHdr (&gTlsAuthConfigGuid, mTlsAuthConfigStorageName, Private->DriverHandle);
1228 Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
1229 ConfigRequest = AllocateZeroPool (Size);
1230 ASSERT (ConfigRequest != NULL);
1231 AllocatedRequest = TRUE;
1232 UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
1233 FreePool (ConfigRequestHdr);
1234 ConfigRequestHdr = NULL;
1235 }
1236
1237 Status = gHiiConfigRouting->BlockToConfig (
1239 ConfigRequest,
1240 (UINT8 *)&Private->TlsAuthConfigNvData,
1241 BufferSize,
1242 Results,
1243 Progress
1244 );
1245
1246 //
1247 // Free the allocated config request string.
1248 //
1249 if (AllocatedRequest) {
1250 FreePool (ConfigRequest);
1251 }
1252
1253 //
1254 // Set Progress string to the original request string.
1255 //
1256 if (Request == NULL) {
1257 *Progress = NULL;
1258 } else if (StrStr (Request, L"OFFSET") == NULL) {
1259 *Progress = Request + StrLen (Request);
1260 }
1261
1262 return Status;
1263}
1264
1306EFIAPI
1309 IN CONST EFI_STRING Configuration,
1310 OUT EFI_STRING *Progress
1311 )
1312{
1313 EFI_STATUS Status;
1314 UINTN BufferSize;
1316
1317 if (Progress == NULL) {
1318 return EFI_INVALID_PARAMETER;
1319 }
1320
1321 *Progress = Configuration;
1322
1323 if (Configuration == NULL) {
1324 return EFI_INVALID_PARAMETER;
1325 }
1326
1327 //
1328 // Check routing data in <ConfigHdr>.
1329 // Note: there is no name for Name/Value storage, only GUID will be checked
1330 //
1331 if (!HiiIsConfigHdrMatch (Configuration, &gTlsAuthConfigGuid, mTlsAuthConfigStorageName)) {
1332 return EFI_NOT_FOUND;
1333 }
1334
1335 Private = TLS_AUTH_CONFIG_PRIVATE_FROM_THIS (This);
1336
1337 BufferSize = sizeof (TLS_AUTH_CONFIG_IFR_NVDATA);
1338 ZeroMem (&Private->TlsAuthConfigNvData, BufferSize);
1339
1340 Status = gHiiConfigRouting->ConfigToBlock (
1342 Configuration,
1343 (UINT8 *)&Private->TlsAuthConfigNvData,
1344 &BufferSize,
1345 Progress
1346 );
1347 if (EFI_ERROR (Status)) {
1348 return Status;
1349 }
1350
1351 return Status;
1352}
1353
1380EFIAPI
1383 IN EFI_BROWSER_ACTION Action,
1384 IN EFI_QUESTION_ID QuestionId,
1385 IN UINT8 Type,
1386 IN OUT EFI_IFR_TYPE_VALUE *Value,
1387 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1388 )
1389{
1390 EFI_STATUS Status;
1391 RETURN_STATUS RStatus;
1393 UINTN BufferSize;
1394 TLS_AUTH_CONFIG_IFR_NVDATA *IfrNvData;
1395 UINT16 LabelId;
1397 EFI_HII_POPUP_PROTOCOL *HiiPopUp;
1398 EFI_HII_POPUP_SELECTION PopUpSelect;
1399
1400 Status = EFI_SUCCESS;
1401 File = NULL;
1402
1403 if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {
1404 return EFI_INVALID_PARAMETER;
1405 }
1406
1407 Private = TLS_AUTH_CONFIG_PRIVATE_FROM_THIS (This);
1408
1409 mTlsAuthPrivateData = Private;
1410 Status = gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid, NULL, (VOID **)&HiiPopUp);
1411 if (EFI_ERROR (Status)) {
1412 DEBUG ((DEBUG_ERROR, "Can't find Form PopUp protocol. Exit (%r)\n", Status));
1413 return Status;
1414 }
1415
1416 //
1417 // Retrieve uncommitted data from Browser
1418 //
1419 BufferSize = sizeof (TLS_AUTH_CONFIG_IFR_NVDATA);
1420 IfrNvData = AllocateZeroPool (BufferSize);
1421 if (IfrNvData == NULL) {
1422 return EFI_OUT_OF_RESOURCES;
1423 }
1424
1425 HiiGetBrowserData (&gTlsAuthConfigGuid, mTlsAuthConfigStorageName, BufferSize, (UINT8 *)IfrNvData);
1426
1427 if ((Action != EFI_BROWSER_ACTION_CHANGED) &&
1428 (Action != EFI_BROWSER_ACTION_CHANGING) &&
1429 (Action != EFI_BROWSER_ACTION_FORM_CLOSE))
1430 {
1431 Status = EFI_UNSUPPORTED;
1432 goto EXIT;
1433 }
1434
1435 if (Action == EFI_BROWSER_ACTION_CHANGING) {
1436 switch (QuestionId) {
1437 case KEY_TLS_AUTH_CONFIG_CLIENT_CERT:
1438 case KEY_TLS_AUTH_CONFIG_SERVER_CA:
1439 //
1440 // Clear Cert GUID.
1441 //
1442 ZeroMem (IfrNvData->CertGuid, sizeof (IfrNvData->CertGuid));
1443 if (Private->CertGuid == NULL) {
1444 Private->CertGuid = (EFI_GUID *)AllocateZeroPool (sizeof (EFI_GUID));
1445 if (Private->CertGuid == NULL) {
1446 return EFI_OUT_OF_RESOURCES;
1447 }
1448 }
1449
1450 if (QuestionId == KEY_TLS_AUTH_CONFIG_CLIENT_CERT) {
1451 LabelId = TLS_AUTH_CONFIG_FORMID3_FORM;
1452 } else {
1453 LabelId = TLS_AUTH_CONFIG_FORMID4_FORM;
1454 }
1455
1456 //
1457 // Refresh selected file.
1458 //
1459 CleanUpPage (LabelId, Private);
1460 break;
1461 case KEY_TLS_AUTH_CONFIG_ENROLL_CERT_FROM_FILE:
1462 //
1463 // If the file is already opened, clean the file related resource first.
1464 //
1465 CleanFileContext (Private);
1466
1468 break;
1469
1470 case KEY_TLS_AUTH_CONFIG_VALUE_SAVE_AND_EXIT:
1471 Status = EnrollCertDatabase (Private, EFI_TLS_CA_CERTIFICATE_VARIABLE);
1472 if (EFI_ERROR (Status)) {
1473 CleanFileContext (Private);
1474
1475 HiiPopUp->CreatePopup (
1476 HiiPopUp,
1477 EfiHiiPopupStyleError,
1478 EfiHiiPopupTypeOk,
1479 Private->RegisteredHandle,
1480 STRING_TOKEN (STR_TLS_AUTH_ENROLL_CERT_FAILURE),
1481 &PopUpSelect
1482 );
1483 }
1484
1485 break;
1486
1487 case KEY_TLS_AUTH_CONFIG_VALUE_NO_SAVE_AND_EXIT:
1488 CleanFileContext (Private);
1489
1490 if (Private->CertGuid != NULL) {
1491 FreePool (Private->CertGuid);
1492 Private->CertGuid = NULL;
1493 }
1494
1495 break;
1496
1497 case KEY_TLS_AUTH_CONFIG_DELETE_CERT:
1499 Private,
1500 EFI_TLS_CA_CERTIFICATE_VARIABLE,
1501 &gEfiTlsCaCertificateGuid,
1502 LABEL_CA_DELETE,
1503 TLS_AUTH_CONFIG_FORMID5_FORM,
1504 OPTION_DEL_CA_ESTION_ID
1505 );
1506 break;
1507
1508 default:
1509 if ((QuestionId >= OPTION_DEL_CA_ESTION_ID) &&
1510 (QuestionId < (OPTION_DEL_CA_ESTION_ID + OPTION_CONFIG_RANGE)))
1511 {
1512 DeleteCert (
1513 Private,
1514 EFI_TLS_CA_CERTIFICATE_VARIABLE,
1515 &gEfiTlsCaCertificateGuid,
1516 LABEL_CA_DELETE,
1517 TLS_AUTH_CONFIG_FORMID5_FORM,
1518 OPTION_DEL_CA_ESTION_ID,
1519 QuestionId - OPTION_DEL_CA_ESTION_ID
1520 );
1521 }
1522
1523 break;
1524 }
1525 } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
1526 switch (QuestionId) {
1527 case KEY_TLS_AUTH_CONFIG_CERT_GUID:
1528 ASSERT (Private->CertGuid != NULL);
1529 RStatus = StrToGuid (
1530 IfrNvData->CertGuid,
1531 Private->CertGuid
1532 );
1533 if (RETURN_ERROR (RStatus) || (IfrNvData->CertGuid[GUID_STRING_LENGTH] != L'\0')) {
1534 Status = EFI_INVALID_PARAMETER;
1535 break;
1536 }
1537
1538 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
1539 break;
1540 default:
1541 break;
1542 }
1543 } else if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
1544 CleanFileContext (Private);
1545 }
1546
1547EXIT:
1548
1549 if (!EFI_ERROR (Status)) {
1550 BufferSize = sizeof (TLS_AUTH_CONFIG_IFR_NVDATA);
1551 HiiSetBrowserData (&gTlsAuthConfigGuid, mTlsAuthConfigStorageName, BufferSize, (UINT8 *)IfrNvData, NULL);
1552 }
1553
1554 FreePool (IfrNvData);
1555
1556 if (File != NULL) {
1557 FreePool (File);
1558 File = NULL;
1559 }
1560
1561 return EFI_SUCCESS;
1562}
UINT64 UINTN
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
Definition: String.c:109
RETURN_STATUS EFIAPI StrToGuid(IN CONST CHAR16 *String, OUT GUID *Guid)
Definition: SafeString.c:1500
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI ChooseFile(IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, IN CHAR16 *FileType OPTIONAL, IN CHOOSE_HANDLER ChooseHandler OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
Definition: HiiLib.c:723
UINT8 *EFIAPI HiiCreateSubTitleOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 Flags, IN UINT8 Scope)
Definition: HiiLib.c:3504
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
Definition: HiiLib.c:2872
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
Definition: HiiLib.c:3051
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
Definition: HiiLib.c:3085
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
Definition: HiiLib.c:3411
UINT8 *EFIAPI HiiCreateCheckBoxOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 CheckBoxFlags, IN VOID *DefaultsOpCodeHandle OPTIONAL)
Definition: HiiLib.c:3675
BOOLEAN EFIAPI HiiSetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, IN CONST UINT8 *Buffer, IN CONST CHAR16 *RequestElement OPTIONAL)
Definition: HiiLib.c:2954
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
Definition: HiiLib.c:4410
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
Definition: HiiLib.c:2813
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
Definition: HiiString.c:52
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
#define EFI_IFR_EXTEND_OP_LABEL
Definition: MdeModuleHii.h:33
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define RETURN_ERROR(StatusCode)
Definition: Base.h:1061
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_STATUS TlsAuthConfigFormInit(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private)
UINTN GuidToString(IN EFI_GUID *Guid, IN CHAR16 *Buffer, IN UINTN BufferSize)
BOOLEAN IsDerPemEncodeCertificate(IN CONST CHAR16 *FileSuffix)
EFI_STATUS EFIAPI TlsAuthConfigAccessRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS ReadFileContent(IN EFI_FILE_HANDLE FileHandle, IN OUT VOID **BufferPtr, OUT UINTN *FileSize, IN UINTN AddtionAllocateSize)
EFI_STATUS UpdateDeletePage(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private, IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT16 LabelNumber, IN EFI_FORM_ID FormId, IN EFI_QUESTION_ID QuestionIdBase)
VOID RefreshUpdateData(VOID)
EFI_STATUS EnrollCertDatabase(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private, IN CHAR16 *VariableName)
BOOLEAN EFIAPI UpdateCAFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
VOID CleanUpPage(IN UINT16 LabelId, IN TLS_AUTH_CONFIG_PRIVATE_DATA *PrivateData)
EFI_STATUS EFIAPI TlsAuthConfigAccessCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN OUT EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STATUS DeleteCert(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private, IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT16 LabelNumber, IN EFI_FORM_ID FormId, IN EFI_QUESTION_ID QuestionIdBase, IN UINTN DeleteIndex)
EFI_STATUS EnrollX509toVariable(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private, IN CHAR16 *VariableName)
CHAR16 *EFIAPI DevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
EFI_STATUS TlsAuthConfigFormUnload(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private)
BOOLEAN UpdatePage(IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_FORM_ID FormId)
VOID CleanFileContext(IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private)
CHAR16 * ExtractFileNameFromDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI TlsAuthConfigAccessExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
#define STRING_TOKEN(t)
EFI_STATUS EFIAPI EfiOpenFileByDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT EFI_FILE_PROTOCOL **File, IN UINT64 OpenMode, IN UINT64 Attributes)
Definition: UefiLib.c:1806
Definition: Base.h:213