conversion.h File Reference

TPM-SDK data conversion interface. More...

#include <tss2/TPM_Types.h>
#include "epid/common/errors.h"
#include "epid/common/types.h"

Macros

#define TPM_ALG_SHA256   (TPM_ALG_ID)(0x000B)
 TPM code of SHA 256 algorithm.
 
#define TPM_ALG_SHA384   (TPM_ALG_ID)(0x000C)
 TPM code of SHA 384 algorithm.
 
#define TPM_ALG_SHA512   (TPM_ALG_ID)(0x000D)
 TPM code of SHA 512 algorithm.
 
#define TPM_ALG_NULL   (TPM_ALG_ID)(0x0010)
 TPM code of Null algorithm.
 

Functions

TPMI_ALG_HASH EpidtoTpm2HashAlg (HashAlg hash_alg)
 Maps HashAlg to TPM type. More...
 
HashAlg Tpm2toEpidHashAlg (TPMI_ALG_HASH tpm_hash_alg)
 Maps TPMI_ALG_HASH to HashAlg. More...
 
EpidStatus ReadTpm2FfElement (OctStr256 const *str, TPM2B_ECC_PARAMETER *tpm_data)
 Converts serialized FfElement into TPM type. More...
 
EpidStatus WriteTpm2FfElement (TPM2B_ECC_PARAMETER const *tpm_data, OctStr256 *str)
 Converts TPM finite field element types into serialized FfElement. More...
 
EpidStatus ReadTpm2EcPoint (G1ElemStr const *p_str, TPM2B_ECC_POINT *tpm_point)
 Converts ECPoint string to TMP ECPoint structure. More...
 
EpidStatus WriteTpm2EcPoint (TPM2B_ECC_POINT const *tpm_point, G1ElemStr *p_str)
 Serializes TMP ECPoint to ECPoint string. More...
 

Detailed Description

TPM-SDK data conversion interface.

Function Documentation

◆ EpidtoTpm2HashAlg()

TPMI_ALG_HASH EpidtoTpm2HashAlg ( HashAlg  hash_alg)

Maps HashAlg to TPM type.

Maps Intel(R) EPID SDK HashAlg into TPMI_ALG_HASH.

Parameters
[in]hash_algCode of the hash algorithm
Returns
TPMI_ALG_HASH

◆ ReadTpm2EcPoint()

EpidStatus ReadTpm2EcPoint ( G1ElemStr const *  p_str,
TPM2B_ECC_POINT *  tpm_point 
)

Converts ECPoint string to TMP ECPoint structure.

Parameters
[in]p_strThe serialized EcPoint to convert.
[out]tpm_pointThe TPM EC point representation.
Returns
EpidStatus

◆ ReadTpm2FfElement()

EpidStatus ReadTpm2FfElement ( OctStr256 const *  str,
TPM2B_ECC_PARAMETER *  tpm_data 
)

Converts serialized FfElement into TPM type.

Parameters
[in]strSerialized Intel(R) EPID SDK FfElement
[out]tpm_datatpm type data.
Returns
EpidStatus

◆ Tpm2toEpidHashAlg()

HashAlg Tpm2toEpidHashAlg ( TPMI_ALG_HASH  tpm_hash_alg)

Maps TPMI_ALG_HASH to HashAlg.

Maps TPM hash code TPMI_ALG_HASH into HashAlg.

Parameters
[in]tpm_hash_algCode of the hash algorithm in TPM
Returns
HashAlg

◆ WriteTpm2EcPoint()

EpidStatus WriteTpm2EcPoint ( TPM2B_ECC_POINT const *  tpm_point,
G1ElemStr p_str 
)

Serializes TMP ECPoint to ECPoint string.

Parameters
[in]tpm_pointThe TPM EC point to convert.
[in]p_strThe target string.
Returns
EpidStatus

◆ WriteTpm2FfElement()

EpidStatus WriteTpm2FfElement ( TPM2B_ECC_PARAMETER const *  tpm_data,
OctStr256 str 
)

Converts TPM finite field element types into serialized FfElement.

Parameters
[in]tpm_dataThe TPM finite field data, typically TPM2B_DIGEST or TPM2B_ECC_PARAMETER.
[out]strThe target buffer.
Returns
EpidStatus