📄 security.h
字号:
/** * \file * general definitions for security system. * * \version $Revision: #13 $ $State$ * * \date $Date: 2004/09/14 $ * * \author $Author: awachtle $ * * \par Last changed by: * $Author: awachtle $ * *****************************************************************************//* * Copyright 2002 ADVANCED MICRO DEVICES, INC. All Rights Reserved. * s * This software and any related documentation (the "Materials") are the * confidential proprietary information of AMD. Unless otherwise provided * in an agreement specifically licensing the Materials, the Materials are * provided in confidence and may not to be used, distributed, modified, or * reproduced in whole or in part by any means. * * LIMITATION OF LIABILITY: THE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY * EXPRESS OR IMPLIED WARRANTY OF ANY KIND, INCLUDING BUT NOT LIMITED TO * WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, TITLE, FITNESS FOR ANY * PARTICULAR PURPOSE, OR WARRANTIES ARISING FORM CONDUCT, COURSE OF * DEALING, OR USAGE OF TRADE. IN NO EVENT SHALL AMD OR ITS LICENSORS BE * LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, * DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF * INFORMATION) ARISING OUT OF THE USE OF OR INABILITY TO USE THE * MATERIALS, EVEN IF AMD HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH * DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR * LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE * ABOVE LIMITATION MAY NOT APPLY TO YOU. * * AMD does not assume any responsibility for any errors which may appear * in the Materials nor any responsibility to support or update the * Materials. AMD retains the right to modify the Materials at any time, * without notice, and is not obligated to provide such modified Materials * to you. * * NO SUPPORT OBLIGATION: AMD is not obligated to furnish, support, or make * any further information, software, technical information, know-how, or * show-how available to you. * *****************************************************************************/#ifndef SECURITY_H#define SECURITY_H/***************************************************************************** Constants*****************************************************************************/#define PP_SHA1_LENGTH (20) /* size of a SHA1 message digest */#define PP_CRYPT_IV_LENGTH (16) /* AES block size */#define PP_VERSION_LENGTH (8) /* Int32 major, Int32 minor number */#define PP_INVALID_SIGNATURE_PATTERN (0x55)#define PP_PATCH_CHAIN_END_PATTERN (0xAA)#define PP_SIGNATURE_DATA_SIZE (212) /** < this corresponds to MY_HEADSIZE * platforms/amd/seccode/conf.h */#define PP_FRAGMENTATION_SIZE (1024) /** < fragmentation size of the PP data *//****************************************************************************** Types*****************************************************************************//** information field of patch package */typedef struct SpsPpPatchInfo_tag { Int32 MagicNb; /** < Magic Number, which marks the begin of a patch */ Int8 Iv[PP_CRYPT_IV_LENGTH]; /** < Init Vector for encryption */ Int8 SigData[PP_SIGNATURE_DATA_SIZE]; /** < signature data */} SpsPpPatchInfo_t;/** header field of patch package */typedef struct SpsPpPatchHeader_tag { Int32 MagicNb; /** < Magic Number, which marks the begin of a header */// Int32 PrNb; /** < Number of the patch records */ Int32 PrSize; /** < Size of the patch records */ Int8 sha1[PP_SHA1_LENGTH]; /** < total size needed to store the PR's */ Int8 VersionInfo[PP_VERSION_LENGTH]; /** < Version Information String */} SpsPpPatchHeader_t;/** patch record structure */typedef struct SpsPpPatchRecord_tag { Int32 Addr; /** < target address of patch record */ Int32 Length; /** < length of patch record in bytes */ Int8 PrData1; /** < first Payload byte */} SpsPpPatchRecord_t;/* this structure is prepended to EEPROM Patch Object, in order to avoid, that the whole data structure must be parsed */typedef struct SnvPobjHeader_tag { Int32 Magic; Int16 Size; /* better aligment */ Int16 Records; Int8 VersionInfo[PP_VERSION_LENGTH]; /** < Version Information String */} SnvPobjHeader_t;/** * security enable mask */typedef Int32 SsfSecurityEnableMask_t;/****************************************************************************** Macros*****************************************************************************//* Revision of this include File */#define SECURITY_H_REVISION_STRING "$Revision: #13 $"/* magic numbers for patch recognition and separation*//*#define PP_MAGIC_NUMBER (0x12345678)*/#define PP_MAGIC_NUMBER (0xcafebabe)#define POBJ_MAGIC_NUMBER (0x87654321)#define PATCH_MAGIC_SEPARATOR (0x00000000)#define PATCH_INFO_DUMMY_BYTE (0x5A)/* SNV header Macros */#define SNV_OBJ_LENGTH (sizeof(SnvPobjHeader_t))/* Patch Info Macros */#define PP_INFO_LENGTH (sizeof(SpsPpPatchInfo_t))/* Patch Header Macros */#define PP_HEADER_LENGTH (sizeof(SpsPpPatchHeader_t))#define PP_PR_HEADER_LENGTH (2*sizeof(Int32))#define PP_PR_MIN_LENGTH (1)#define PP_PR_MIN_SIZE (PP_PR_HEADER_LENGTH + PP_PR_MIN_LENGTH)/* PP_PR_MAX_LENGTH is defined by: * * 65535 [0xffff in the EPR Length field, PP_EPR_MAX_LENGTH] * - 3 [EprHeader] * - 4 [PR AddressOrDataId] * - 4 [PR LengthOfData] * - 12 [EPR Padding] * - 20 [EPR HMAC] * = 65492 [max value LengthOfData]*//* todo: refine it, based on size of the Patch Buffer in MacEntity * (i.e. 1 PR of MXSize code + 1 PR for patching jump table) */#define PP_PR_MAX_LENGTH (65492)#define PP_PR_MAX_SIZE (PP_PR_HEADER_LENGTH + PP_PR_MAX_LENGTH)/** * definition of Bit fields of security enable mask */#define SEM_ENABLE_SPS_CHECKING (0x00000001)#define SEM_SECURITY_ENABLED (0xFFFFFFFF)#define SEM_SECURITY_DISABLED (0x00000000)/****************************************************************************** Classes*****************************************************************************//****************************************************************************** Data*****************************************************************************/#ifdef __cplusplusextern "C" {#endif#ifdef __cplusplus} /* extern "C" */#endif/****************************************************************************** Functions*****************************************************************************/#ifdef __cplusplusextern "C" {#endif#ifdef __cplusplus} /* extern "C" */#endif/****************************************************************************** Inline Functions*****************************************************************************/#endif /* #ifndef SECURITY_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -