/** @file\r
The Miscellaneous Routines for TlsAuthConfigDxe driver.\r
\r
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\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
CACert = NULL;\r
CACertData = NULL;\r
Data = NULL;\r
+ Attr = 0;\r
\r
Status = ReadFileContent (\r
Private->FileContext->FHandle,\r
CopyMem ((UINT8* ) (CACertData->SignatureData), X509Data, X509DataSize);\r
\r
//\r
- // Check if signature database entry has been already existed.\r
- // If true, use EFI_VARIABLE_APPEND_WRITE attribute to append the\r
- // new signature data to original variable\r
+ // Check if the signature database entry already exists. If it does, use the\r
+ // EFI_VARIABLE_APPEND_WRITE attribute to append the new signature data to\r
+ // the original variable, plus preserve the original variable attributes.\r
//\r
- Attr = TLS_AUTH_CONFIG_VAR_BASE_ATTR;\r
-\r
Status = gRT->GetVariable(\r
VariableName,\r
&gEfiTlsCaCertificateGuid,\r
- NULL,\r
+ &Attr,\r
&DataSize,\r
NULL\r
);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
Attr |= EFI_VARIABLE_APPEND_WRITE;\r
- } else if (Status != EFI_NOT_FOUND) {\r
+ } else if (Status == EFI_NOT_FOUND) {\r
+ Attr = TLS_AUTH_CONFIG_VAR_BASE_ATTR;\r
+ } else {\r
goto ON_EXIT;\r
}\r
\r
HiiGetBrowserData (&gTlsAuthConfigGuid, mTlsAuthConfigStorageName, BufferSize, (UINT8 *) IfrNvData);\r
\r
if ((Action != EFI_BROWSER_ACTION_CHANGED) &&\r
- (Action != EFI_BROWSER_ACTION_CHANGING) && \r
+ (Action != EFI_BROWSER_ACTION_CHANGING) &&\r
(Action != EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
Status = EFI_UNSUPPORTED;\r
goto EXIT;\r
break;\r
case KEY_TLS_AUTH_CONFIG_ENROLL_CERT_FROM_FILE:\r
//\r
- // If the file is already opened, clean the file related resource first. \r
+ // If the file is already opened, clean the file related resource first.\r
//\r
CleanFileContext (Private);\r
- \r
+\r
ChooseFile( NULL, NULL, UpdateCAFromFile, &File);\r
break;\r
\r