VirtualBox

Changeset 91005 in vbox for trunk/include


Ignore:
Timestamp:
Aug 30, 2021 4:32:25 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146645
Message:

Security: The underlying driver specifies the input buffer size of the TPM for the device emulation to use and not the other way around, bugref:10075

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/formats/tpm.h

    r90588 r91005  
    3737#include <iprt/string.h>
    3838
    39 #pragma pack(1)
     39
    4040/**
    4141 * TPM request header (everything big endian).
    4242 */
     43#pragma pack(1)
    4344typedef struct TPMREQHDR
    4445{
     
    5051    uint32_t            u32Ordinal;
    5152} TPMREQHDR;
     53#pragma pack()
    5254AssertCompileSize(TPMREQHDR, 2 + 4 + 4);
    5355/** Pointer to a TPM request header. */
     
    5759
    5860
    59 /** @name TPM request ordinals.
     61/** @name TPM 1.2 request tags
     62 * @{ */
     63/** Command with no authentication. */
     64#define TPM_TAG_RQU_COMMAND                 UINT16_C(0x00c1)
     65/** An authenticated command with one authentication handle. */
     66#define TPM_TAG_RQU_AUTH1_COMMAND           UINT16_C(0x00c2)
     67/** An authenticated command with two authentication handles. */
     68#define TPM_TAG_RQU_AUTH2_COMMAND           UINT16_C(0x00c3)
     69/** @} */
     70
     71
     72/** @name TPM 2.0 request/response tags
     73 * @{ */
     74/** Command with no associated session. */
     75#define TPM2_ST_NO_SESSIONS                 UINT16_C(0x8001)
     76/** Command with an associated session. */
     77#define TPM2_ST_SESSIONS                    UINT16_C(0x8002)
     78/** @} */
     79
     80
     81/** @name TPM 1.2 request ordinals.
    6082 * @{ */
    6183/** Perform a full self test. */
     
    6587/** Return the test result. */
    6688#define TPM_ORD_GETTESTRESULT               UINT32_C(84)
     89/** Get a capability. */
     90#define TPM_ORD_GETCAPABILITY               UINT32_C(101)
     91/** @} */
     92
     93
     94/** @name TPM 2.0 command codes.
     95 * @{ */
     96/** Get a capability. */
     97#define TPM2_CC_GET_CAPABILITY              UINT32_C(378)
     98/** @} */
     99
     100
     101/** @name Defines related to TPM_ORD_GETCAPABILITY.
     102 * @{ */
     103/** Return a TPM related property. */
     104#define TPM_CAP_PROPERTY                    UINT32_C(5)
     105
     106/** Returns the size of the input buffer. */
     107#define TPM_CAP_PROP_INPUT_BUFFER           UINT32_C(0x124)
     108
     109/**
     110 * TPM_ORD_GETCAPABILITY request.
     111 */
     112#pragma pack(1)
     113typedef struct TPMREQGETCAPABILITY
     114{
     115    /** Request header. */
     116    TPMREQHDR                   Hdr;
     117    /** The capability group to query. */
     118    uint32_t                    u32Cap;
     119    /** Length of the capability. */
     120    uint32_t                    u32Length;
     121    /** The sub capability to query. */
     122    uint32_t                    u32SubCap;
     123} TPMREQGETCAPABILITY;
     124#pragma pack()
     125/** Pointer to a TPM_ORD_GETCAPABILITY request. */
     126typedef TPMREQGETCAPABILITY *PTPMREQGETCAPABILITY;
     127/** Pointer to a const TPM_ORD_GETCAPABILITY request. */
     128typedef const TPMREQGETCAPABILITY *PCTPMREQGETCAPABILITY;
     129/** @} */
     130
     131
     132/** @name Defines related to TPM2_CC_GET_CAPABILITY.
     133 * @{ */
     134/** Return a TPM related property. */
     135#define TPM2_CAP_TPM_PROPERTIES             UINT32_C(6)
     136
     137/** Returns the size of the input buffer. */
     138#define TPM2_PT_INPUT_BUFFER                UINT32_C(0x10d)
     139
     140/**
     141 * TPM2_CC_GET_CAPABILITY request.
     142 */
     143#pragma pack(1)
     144typedef struct TPM2REQGETCAPABILITY
     145{
     146    /** Request header. */
     147    TPMREQHDR                   Hdr;
     148    /** The capability group to query. */
     149    uint32_t                    u32Cap;
     150    /** Property to query. */
     151    uint32_t                    u32Property;
     152    /** Number of values to return. */
     153    uint32_t                    u32Count;
     154} TPM2REQGETCAPABILITY;
     155#pragma pack()
     156/** Pointer to a TPM2_CC_GET_CAPABILITY request. */
     157typedef TPM2REQGETCAPABILITY *PTPM2REQGETCAPABILITY;
     158/** Pointer to a const TPM2_CC_GET_CAPABILITY request. */
     159typedef const TPM2REQGETCAPABILITY *PCTPM2REQGETCAPABILITY;
    67160/** @} */
    68161
     
    71164 * TPM response header (everything big endian).
    72165 */
     166#pragma pack(1)
    73167typedef struct TPMRESPHDR
    74168{
     
    80174    uint32_t            u32ErrCode;
    81175} TPMRESPHDR;
     176#pragma pack()
    82177AssertCompileSize(TPMRESPHDR, 2 + 4 + 4);
    83178/** Pointer to a TPM response header. */
     
    85180/** Pointer to a const TPM response header. */
    86181typedef const TPMRESPHDR *PCTPMRESPHDR;
     182
     183
     184/** @name TPM 1.2 response tags
     185 * @{ */
     186/** A response from a command with no authentication. */
     187#define TPM_TAG_RSP_COMMAND                 UINT16_C(0x00c4)
     188/** An authenticated response with one authentication handle. */
     189#define TPM_TAG_RSP_AUTH1_COMMAND           UINT16_C(0x00c5)
     190/** An authenticated response with two authentication handles. */
     191#define TPM_TAG_RSP_AUTH2_COMMAND           UINT16_C(0x00c6)
     192/** @} */
    87193
    88194
     
    158264
    159265/**
    160  * Returns the request size of the given TPM request header.
     266 * Returns the response size included in the given TPM response header.
    161267 *
    162268 * @returns TPM response size in bytes.
     
    172278
    173279/**
    174  * Returns the request ordinal of the given TPM request header.
     280 * Returns the error code of the given TPM response header.
    175281 *
    176282 * @returns TPM response error code.
     
    184290}
    185291
    186 #pragma pack()
    187 
    188292#endif /* !IPRT_INCLUDED_formats_tpm_h */
    189293
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette