conversion.c File Reference

TPM-SDK data conversion implementation. More...

#include "epid/member/tpm2/ibm_tss/conversion.h"
#include <string.h>
#include <tss2/TPM_Types.h>
#include "epid/common/math/ecgroup.h"
#include "epid/common/src/memory.h"
#include "epid/common/types.h"

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 implementation.

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