Exemplo n.º 1
0
TPM_RC Tss2_Sys_CreatePrimary_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM_HANDLE	*objectHandle,
    TPM2B_PUBLIC	*outPublic,
    TPM2B_CREATION_DATA	*creationData,
    TPM2B_DIGEST	*creationHash,
    TPMT_TK_CREATION	*creationTicket,
    TPM2B_NAME	*name
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), objectHandle, &(SYS_CONTEXT->rval) );

    CommonComplete( sysContext );

    Unmarshal_TPM2B_PUBLIC( sysContext, outPublic );

    Unmarshal_TPM2B_CREATION_DATA( sysContext, creationData );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( creationHash->b ) );

    Unmarshal_TPMT_TK_CREATION( sysContext, creationTicket );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( name->b ) );

    return SYS_CONTEXT->rval;
}
void Unmarshal_TPMS_CERTIFY_INFO(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_CERTIFY_INFO *certifyInfo
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( certifyInfo == 0 )
		return;

	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&certifyInfo->name );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&certifyInfo->qualifiedName );

	return;
}
void Unmarshal_TPMS_CREATION_INFO(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_CREATION_INFO *creationInfo
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( creationInfo == 0 )
		return;

	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&creationInfo->objectName );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&creationInfo->creationHash );

	return;
}
void Unmarshal_TPMS_AUTH_RESPONSE(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_AUTH_RESPONSE *authResponse
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( authResponse == 0 )
		return;

	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&authResponse->nonce );
	Unmarshal_TPMA_SESSION( sysContext, &authResponse->sessionAttributes );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&authResponse->hmac );

	return;
}
void Unmarshal_TPMS_NV_CERTIFY_INFO(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_NV_CERTIFY_INFO *nvCertifyInfo
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( nvCertifyInfo == 0 )
		return;

	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&nvCertifyInfo->indexName );
	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &nvCertifyInfo->offset, &( SYS_CONTEXT->rval ) );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&nvCertifyInfo->nvContents );

	return;
}
void Unmarshal_TPMS_ALGORITHM_DETAIL_ECC(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_ALGORITHM_DETAIL_ECC *algorithmDetailEcc
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( algorithmDetailEcc == 0 )
		return;

	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &algorithmDetailEcc->curveID, &( SYS_CONTEXT->rval ) );
	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &algorithmDetailEcc->keySize, &( SYS_CONTEXT->rval ) );
	Unmarshal_TPMT_KDF_SCHEME( sysContext, &algorithmDetailEcc->kdf );
	Unmarshal_TPMT_ECC_SCHEME( sysContext, &algorithmDetailEcc->sign );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->p );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->a );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->b );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->gX );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->gY );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->n );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&algorithmDetailEcc->h );

	return;
}
Exemplo n.º 7
0
TPM_RC Tss2_Sys_Rewrap_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_PRIVATE	*outDuplicate,
    TPM2B_ENCRYPTED_SECRET	*outSymSeed
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outDuplicate->b ) );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outSymSeed->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 8
0
TPM_RC Tss2_Sys_EncryptDecrypt_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_MAX_BUFFER	*outData,
    TPM2B_IV	*ivOut
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outData->b ) );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( ivOut->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 9
0
TPM_RC Tss2_Sys_MakeCredential_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_ID_OBJECT	*credentialBlob,
    TPM2B_ENCRYPTED_SECRET	*secret
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( credentialBlob->b ) );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( secret->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 10
0
void Unmarshal_TPMS_ATTEST(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_ATTEST *attest
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( attest == 0 )
		return;

	Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &attest->magic, &( SYS_CONTEXT->rval ) );
	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &attest->type, &( SYS_CONTEXT->rval ) );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&attest->qualifiedSigner );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&attest->extraData );
	Unmarshal_TPMS_CLOCK_INFO( sysContext, &attest->clockInfo );
	Unmarshal_UINT64( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &attest->firmwareVersion, &( SYS_CONTEXT->rval ) );
	Unmarshal_TPMU_ATTEST( sysContext, &attest->attested, attest->type );

	return;
}
void Unmarshal_TPMU_SENSITIVE_COMPOSITE(
	TSS2_SYS_CONTEXT *sysContext,
	TPMU_SENSITIVE_COMPOSITE *sensitiveComposite,
	UINT32 selector
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( sensitiveComposite == 0 )
		return;

	switch( selector )
	{
#ifdef TPM_ALG_RSA
	case TPM_ALG_RSA:
			UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&sensitiveComposite->rsa );
			break;
#endif
#ifdef TPM_ALG_ECC
	case TPM_ALG_ECC:
			UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&sensitiveComposite->ecc );
			break;
#endif
#ifdef TPM_ALG_KEYEDHASH
	case TPM_ALG_KEYEDHASH:
			UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&sensitiveComposite->bits );
			break;
#endif
#ifdef TPM_ALG_SYMCIPHER
	case TPM_ALG_SYMCIPHER:
			UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&sensitiveComposite->sym );
			break;
#endif
	}
	return;
}
Exemplo n.º 12
0
TPM_RC Tss2_Sys_Vendor_TCG_Test_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_DATA	*outputData
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outputData->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 13
0
TPM_RC Tss2_Sys_HMAC_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_DIGEST	*outHMAC
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outHMAC->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 14
0
TPM_RC Tss2_Sys_RSA_Encrypt_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_PUBLIC_KEY_RSA	*outData
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outData->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 15
0
TPM_RC Tss2_Sys_GetRandom_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_DIGEST	*randomBytes
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( randomBytes->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 16
0
void Unmarshal_TPMS_QUOTE_INFO(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_QUOTE_INFO *quoteInfo
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( quoteInfo == 0 )
		return;

	Unmarshal_TPML_PCR_SELECTION( sysContext, &quoteInfo->pcrSelect );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&quoteInfo->pcrDigest );

	return;
}
Exemplo n.º 17
0
TPM_RC Tss2_Sys_NV_Read_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_MAX_NV_BUFFER	*data
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( data->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 18
0
TPM_RC Tss2_Sys_Import_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_PRIVATE	*outPrivate
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outPrivate->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 19
0
void Unmarshal_TPMT_TK_AUTH(
	TSS2_SYS_CONTEXT *sysContext,
	TPMT_TK_AUTH *tkAuth
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( tkAuth == 0 )
		return;

	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &tkAuth->tag, &( SYS_CONTEXT->rval ) );
	Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &tkAuth->hierarchy, &( SYS_CONTEXT->rval ) );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&tkAuth->digest );

	return;
}
Exemplo n.º 20
0
TPM_RC Tss2_Sys_NV_Certify_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_ATTEST	*certifyInfo,
    TPMT_SIGNATURE	*signature
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( certifyInfo->b ) );

    Unmarshal_TPMT_SIGNATURE( sysContext, signature );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 21
0
TPM_RC Tss2_Sys_Hash_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_DIGEST	*outHash,
    TPMT_TK_HASHCHECK	*validation
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outHash->b ) );

    Unmarshal_TPMT_TK_HASHCHECK( sysContext, validation );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 22
0
void Unmarshal_TPMS_NV_PUBLIC(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_NV_PUBLIC *nvPublic
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( nvPublic == 0 )
		return;

	Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &nvPublic->nvIndex, &( SYS_CONTEXT->rval ) );
	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &nvPublic->nameAlg, &( SYS_CONTEXT->rval ) );
	Unmarshal_TPMA_NV( sysContext, &nvPublic->attributes );
	UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&nvPublic->authPolicy );
	Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &nvPublic->dataSize, &( SYS_CONTEXT->rval ) );

	return;
}
Exemplo n.º 23
0
TPM_RC Tss2_Sys_PolicySigned_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_TIMEOUT	*timeout,
    TPMT_TK_AUTH	*policyTicket
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( timeout->b ) );

    Unmarshal_TPMT_TK_AUTH( sysContext, policyTicket );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 24
0
TPM_RC Tss2_Sys_Load_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM_HANDLE	*objectHandle,
    TPM2B_NAME	*name
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), objectHandle, &(SYS_CONTEXT->rval) );

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( name->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 25
0
TPM_RC Tss2_Sys_NV_ReadPublic_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_NV_PUBLIC	*nvPublic,
    TPM2B_NAME	*nvName
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    Unmarshal_TPM2B_NV_PUBLIC( sysContext, nvPublic );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( nvName->b ) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 26
0
TPM_RC Tss2_Sys_GetTestResult_Complete(
    TSS2_SYS_CONTEXT *sysContext,
    TPM2B_MAX_BUFFER	*outData,
    TPM_RC	*testResult
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonComplete( sysContext );

    UNMARSHAL_SIMPLE_TPM2B( sysContext, &( outData->b ) );

    Unmarshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), testResult, &(SYS_CONTEXT->rval) );

    return SYS_CONTEXT->rval;
}
Exemplo n.º 27
0
void Unmarshal_TPML_DIGEST(
	TSS2_SYS_CONTEXT *sysContext,
	TPML_DIGEST *digest
	)
{
	UINT32	i;

	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	if( digest == 0 )
		return;

	Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &(SYS_CONTEXT->nextData), &digest->count, &( SYS_CONTEXT->rval ) );

	for( i = 0; i < digest->count; i++ )
	{
		UNMARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&digest->digests[i] );
	}

	return;
}