\r
Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
@param[in] QuestionIdBase Base question id of the cert list.\r
@param[in] DeleteIndex Cert index to delete.\r
\r
- @retval EFI_SUCCESS Delete siganture successfully.\r
+ @retval EFI_SUCCESS Delete signature successfully.\r
@retval EFI_NOT_FOUND Can't find the signature item,\r
@retval EFI_OUT_OF_RESOURCES Could not allocate needed resources.\r
**/\r
\r
@param DevicePath Device path.\r
\r
- @retval NULL Not enough memory resourece for AllocateCopyPool.\r
+ @retval NULL Not enough memory resource for AllocateCopyPool.\r
@retval Other A new allocated string that represents the file name.\r
\r
**/\r
EFI_SIGNATURE_LIST *CACert;\r
EFI_SIGNATURE_DATA *CACertData;\r
VOID *Data;\r
+ VOID *CurrentData;\r
UINTN DataSize;\r
UINTN SigDataSize;\r
UINT32 Attr;\r
CACert = NULL;\r
CACertData = NULL;\r
Data = NULL;\r
+ CurrentData = NULL;\r
Attr = 0;\r
\r
Status = ReadFileContent (\r
Status = gRT->GetVariable(\r
VariableName,\r
&gEfiTlsCaCertificateGuid,\r
- &Attr,\r
+ NULL,\r
&DataSize,\r
NULL\r
);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ //\r
+ // Per spec, we have to fetch the variable's contents, even though we're\r
+ // only interested in the variable's attributes.\r
+ //\r
+ CurrentData = AllocatePool (DataSize);\r
+ if (CurrentData == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ON_EXIT;\r
+ }\r
+ Status = gRT->GetVariable(\r
+ VariableName,\r
+ &gEfiTlsCaCertificateGuid,\r
+ &Attr,\r
+ &DataSize,\r
+ CurrentData\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_EXIT;\r
+ }\r
Attr |= EFI_VARIABLE_APPEND_WRITE;\r
} else if (Status == EFI_NOT_FOUND) {\r
Attr = TLS_AUTH_CONFIG_VAR_BASE_ATTR;\r
FreePool (Data);\r
}\r
\r
+ if (CurrentData != NULL) {\r
+ FreePool (CurrentData);\r
+ }\r
+\r
if (X509Data != NULL) {\r
FreePool (X509Data);\r
}\r
@param Progress A pointer to a string filled in with the\r
offset of the most recent '&' before the\r
first failing name / value pair (or the\r
- beginn ing of the string if the failure\r
+ beginning of the string if the failure\r
is in the first name / value pair) or\r
the terminating NULL if all was\r
successful.\r