may not be modified without authorization. If platform fails to protect these resources,\r
the authentication service provided in this driver will be broken, and the behavior is undefined.\r
\r
-Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\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
#include <Guid/AuthenticatedVariableFormat.h>\r
#include <Guid/ImageAuthentication.h>\r
\r
+#define TWO_BYTE_ENCODE 0x82\r
+\r
///\r
/// Struct to record signature requirement defined by UEFI spec.\r
/// For SigHeaderSize and SigDataSize, ((UINT32) ~0) means NO exact length requirement for this field.\r
AuthVarTypePayload\r
} AUTHVAR_TYPE;\r
\r
-///\r
-/// "AuthVarKeyDatabase" variable for the Public Key store\r
-/// of variables with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.\r
-///\r
-/// GUID: gEfiAuthenticatedVariableGuid\r
-///\r
-/// We need maintain atomicity.\r
-///\r
-/// Format:\r
-/// +----------------------------+\r
-/// | AUTHVAR_KEY_DB_DATA | <-- First AuthVarKey\r
-/// +----------------------------+\r
-/// | ...... |\r
-/// +----------------------------+\r
-/// | AUTHVAR_KEY_DB_DATA | <-- Last AuthKey\r
-/// +----------------------------+\r
-///\r
-#define AUTHVAR_KEYDB_NAME L"AuthVarKeyDatabase"\r
-\r
-#define EFI_CERT_TYPE_RSA2048_SHA256_SIZE 256\r
-#define EFI_CERT_TYPE_RSA2048_SIZE 256\r
-\r
-#pragma pack(1)\r
-typedef struct {\r
- UINT32 KeyIndex;\r
- UINT8 KeyData[EFI_CERT_TYPE_RSA2048_SIZE];\r
-} AUTHVAR_KEY_DB_DATA;\r
-#pragma pack()\r
-\r
///\r
/// "certdb" variable stores the signer's certificates for non PK/KEK/DB/DBX\r
/// variables with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS|EFI_VARIABLE_NON_VOLATILE set.\r
} AUTH_CERT_DB_DATA;\r
#pragma pack()\r
\r
-extern UINT8 *mPubKeyStore;\r
-extern UINT32 mPubKeyNumber;\r
-extern UINT32 mMaxKeyNumber;\r
-extern UINT32 mMaxKeyDbSize;\r
extern UINT8 *mCertDbStore;\r
extern UINT32 mMaxCertDbSize;\r
extern UINT32 mPlatformMode;\r
extern UINT8 mVendorKeyState;\r
-extern BOOLEAN mUserPhysicalPresent;\r
\r
extern VOID *mHashCtx;\r
\r
);\r
\r
/**\r
- Process variable with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS/EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set\r
+ Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set\r
\r
Caution: This function may receive untrusted input.\r
This function may be invoked in SMM mode, and datasize and data are external input.\r
\r
@return EFI_INVALID_PARAMETER Invalid parameter.\r
@return EFI_WRITE_PROTECTED Variable is write-protected and needs authentication with\r
- EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.\r
+ EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.\r
@return EFI_OUT_OF_RESOURCES The Database to save the public key is full.\r
- @return EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\r
+ @return EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\r
set, but the AuthInfo does NOT pass the validation\r
check carried out by the firmware.\r
@return EFI_SUCCESS Variable is not write-protected or pass validation successfully.\r
IN UINT32 Attributes\r
);\r
\r
-/**\r
- Update the variable region with Variable information.\r
-\r
- @param[in] VariableName Name of variable.\r
- @param[in] VendorGuid Guid of variable.\r
- @param[in] Data Data pointer.\r
- @param[in] DataSize Size of Data.\r
- @param[in] Attributes Attribute value of the variable.\r
- @param[in] KeyIndex Index of associated public key.\r
- @param[in] MonotonicCount Value of associated monotonic count.\r
-\r
- @retval EFI_SUCCESS The update operation is success.\r
- @retval EFI_INVALID_PARAMETER Invalid parameter.\r
- @retval EFI_WRITE_PROTECTED Variable is write-protected.\r
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.\r
-\r
-**/\r
-EFI_STATUS\r
-AuthServiceInternalUpdateVariableWithMonotonicCount (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- IN VOID *Data,\r
- IN UINTN DataSize,\r
- IN UINT32 Attributes,\r
- IN UINT32 KeyIndex,\r
- IN UINT64 MonotonicCount\r
- );\r
-\r
/**\r
Update the variable region with Variable information.\r
\r