TPM_RC Tss2_Sys_CertifyCreation_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	signHandle,
    TPMI_DH_OBJECT	objectHandle,
    TPM2B_DATA	*qualifyingData,
    TPM2B_DIGEST	*creationHash,
    TPMT_SIG_SCHEME	*inScheme,
    TPMT_TK_CREATION	*creationTicket
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( inScheme == NULL  || creationTicket == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	}

    CommonPreparePrologue( sysContext, TPM_CC_CertifyCreation );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), signHandle, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), objectHandle, &(SYS_CONTEXT->rval) );

    if( qualifyingData == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}

    MARSHAL_SIMPLE_TPM2B( sysContext, &( qualifyingData->b ) );

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

    Marshal_TPMT_SIG_SCHEME( sysContext, inScheme );

    Marshal_TPMT_TK_CREATION( sysContext, creationTicket );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#2
0
TPM_RC Tss2_Sys_PolicySigned_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	authObject,
    TPMI_SH_POLICY	policySession,
    TPM2B_NONCE	*nonceTPM,
    TPM2B_DIGEST	*cpHashA,
    TPM2B_NONCE	*policyRef,
    INT32	expiration,
    TPMT_SIGNATURE	*auth
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_PolicySigned );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), authObject, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), policySession, &(SYS_CONTEXT->rval) );

    if( nonceTPM == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( nonceTPM->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( cpHashA->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( policyRef->b ) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), expiration, &(SYS_CONTEXT->rval) );

    Marshal_TPMT_SIGNATURE( sysContext, auth );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#3
0
void Marshal_TPML_CC(
	TSS2_SYS_CONTEXT *sysContext,
	TPML_CC *cc
	)
{
	UINT32	i;

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

	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), cc->count, &( SYS_CONTEXT->rval ) );

	for( i = 0; i < cc->count; i++ )
	{
		Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), cc->commandCodes[i], &( SYS_CONTEXT->rval ) );
	}

	return;
}
示例#4
0
TPM_RC Tss2_Sys_PolicyNV_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_NV_AUTH	authHandle,
    TPMI_RH_NV_INDEX	nvIndex,
    TPMI_SH_POLICY	policySession,
    TPM2B_OPERAND	*operandB,
    UINT16	offset,
    TPM_EO	operation
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_PolicyNV );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), authHandle, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), nvIndex, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), policySession, &(SYS_CONTEXT->rval) );

    if( operandB == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( operandB->b ) );

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), offset, &(SYS_CONTEXT->rval) );

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), operation, &(SYS_CONTEXT->rval) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#5
0
TPM_RC Tss2_Sys_Rewrap_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	oldParent,
    TPMI_DH_OBJECT	newParent,
    TPM2B_PRIVATE	*inDuplicate,
    TPM2B_NAME	*name,
    TPM2B_ENCRYPTED_SECRET	*inSymSeed
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

     

    CommonPreparePrologue( sysContext, TPM_CC_Rewrap );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), oldParent, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), newParent, &(SYS_CONTEXT->rval) );

    if( inDuplicate == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( inDuplicate->b ) );

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

    MARSHAL_SIMPLE_TPM2B( sysContext, &( inSymSeed->b ) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#6
0
TPM_RC Tss2_Sys_GetTime_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_ENDORSEMENT	privacyAdminHandle,
    TPMI_DH_OBJECT	signHandle,
    TPM2B_DATA	*qualifyingData,
    TPMT_SIG_SCHEME	*inScheme
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( inScheme == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	} 

    CommonPreparePrologue( sysContext, TPM_CC_GetTime );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), privacyAdminHandle, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), signHandle, &(SYS_CONTEXT->rval) );

    if( qualifyingData == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( qualifyingData->b ) );

    Marshal_TPMT_SIG_SCHEME( sysContext, inScheme );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#7
0
TPM_RC Tss2_Sys_NV_Write_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_NV_AUTH	authHandle,
    TPMI_RH_NV_INDEX	nvIndex,
    TPM2B_MAX_NV_BUFFER	*data,
    UINT16	offset
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }



    CommonPreparePrologue( sysContext, TPM_CC_NV_Write );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), authHandle, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), nvIndex, &(SYS_CONTEXT->rval) );

    if( data == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}

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

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), offset, &(SYS_CONTEXT->rval) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
void Marshal_TPMT_TK_CREATION(
	TSS2_SYS_CONTEXT *sysContext,
	TPMT_TK_CREATION *tkCreation
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), tkCreation->tag, &( SYS_CONTEXT->rval ) );
	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), tkCreation->hierarchy, &( SYS_CONTEXT->rval ) );
	MARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&tkCreation->digest );

	return;
}
示例#9
0
void Marshal_TPMS_RSA_PARMS(
    TSS2_SYS_CONTEXT *sysContext,
    TPMS_RSA_PARMS *rsaParms
)
{
    if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
        return;

    Marshal_TPMT_SYM_DEF_OBJECT( sysContext, &rsaParms->symmetric );
    Marshal_TPMT_RSA_SCHEME( sysContext, &rsaParms->scheme );
    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), rsaParms->keyBits, &( SYS_CONTEXT->rval ) );
    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), rsaParms->exponent, &( SYS_CONTEXT->rval ) );

    return;
}
void Marshal_TPMS_AUTH_COMMAND(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_AUTH_COMMAND *authCommand
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), authCommand->sessionHandle, &( SYS_CONTEXT->rval ) );
	MARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&authCommand->nonce );
	Marshal_TPMA_SESSION( sysContext, authCommand->sessionAttributes );
	MARSHAL_SIMPLE_TPM2B( sysContext, (TPM2B *)&authCommand->hmac );

	return;
}
TPM_RC Tss2_Sys_PCR_SetAuthPolicy_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_PLATFORM	authHandle,
    TPM2B_DIGEST	*authPolicy,
    TPMI_ALG_HASH	hashAlg,
    TPMI_DH_PCR	pcrNum
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_PCR_SetAuthPolicy );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), authHandle, &(SYS_CONTEXT->rval) );

    if( authPolicy == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( authPolicy->b ) );

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), hashAlg, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), pcrNum, &(SYS_CONTEXT->rval) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#12
0
void Marshal_TPMA_OBJECT(
	TSS2_SYS_CONTEXT *sysContext,
	TPMA_OBJECT object
	)
{
	void	*tmp;

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

	tmp = (void *)&object;
	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), *( UINT32 *)tmp, &( SYS_CONTEXT->rval ) );

	return;
}
示例#13
0
void Marshal_TPMA_ALGORITHM(
	TSS2_SYS_CONTEXT *sysContext,
	TPMA_ALGORITHM algorithm
	)
{
	void	*tmp;

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

	tmp = (void *)&algorithm;
	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), *( UINT32 *)tmp, &( SYS_CONTEXT->rval ) );

	return;
}
示例#14
0
TPM_RC Tss2_Sys_Duplicate_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	objectHandle,
    TPMI_DH_OBJECT	newParentHandle,
    TPM2B_DATA	*encryptionKeyIn,
    TPMT_SYM_DEF_OBJECT	*symmetricAlg
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_Duplicate );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), objectHandle, &(SYS_CONTEXT->rval) );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), newParentHandle, &(SYS_CONTEXT->rval) );

    if( encryptionKeyIn == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( encryptionKeyIn->b ) );

    Marshal_TPMT_SYM_DEF_OBJECT( sysContext, symmetricAlg );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#15
0
TPM_RC Tss2_Sys_CreatePrimary_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_HIERARCHY	primaryHandle,
    TPM2B_SENSITIVE_CREATE	*inSensitive,
    TPM2B_PUBLIC	*inPublic,
    TPM2B_DATA	*outsideInfo,
    TPML_PCR_SELECTION	*creationPCR
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( creationPCR == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	}

    CommonPreparePrologue( sysContext, TPM_CC_CreatePrimary );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), primaryHandle, &(SYS_CONTEXT->rval) );

    if( inSensitive == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}

    Marshal_TPM2B_SENSITIVE_CREATE( sysContext, inSensitive );

    Marshal_TPM2B_PUBLIC( sysContext, inPublic );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( outsideInfo->b ) );

    Marshal_TPML_PCR_SELECTION( sysContext, creationPCR );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#16
0
TPM_RC Tss2_Sys_PolicyAuthorize_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_SH_POLICY	policySession,
    TPM2B_DIGEST	*approvedPolicy,
    TPM2B_NONCE	*policyRef,
    TPM2B_NAME	*keySign,
    TPMT_TK_VERIFIED	*checkTicket
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( checkTicket == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	}

    CommonPreparePrologue( sysContext, TPM_CC_PolicyAuthorize );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), policySession, &(SYS_CONTEXT->rval) );

    if( approvedPolicy == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}

    MARSHAL_SIMPLE_TPM2B( sysContext, &( approvedPolicy->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( policyRef->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( keySign->b ) );

    Marshal_TPMT_TK_VERIFIED( sysContext, checkTicket );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#17
0
void Marshal_TPML_DIGEST(
	TSS2_SYS_CONTEXT *sysContext,
	TPML_DIGEST *digest
	)
{
	UINT32	i;

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

	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), digest->count, &( SYS_CONTEXT->rval ) );

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

	return;
}
void Marshal_TPML_PCR_SELECTION(
	TSS2_SYS_CONTEXT *sysContext,
	TPML_PCR_SELECTION *pcrSelection
	)
{
	UINT32	i;

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

	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), pcrSelection->count, &( SYS_CONTEXT->rval ) );

	for( i = 0; i < pcrSelection->count; i++ )
	{
		Marshal_TPMS_PCR_SELECTION( sysContext, &pcrSelection->pcrSelections[i] );
	}

	return;
}
void Marshal_TPML_DIGEST_VALUES(
	TSS2_SYS_CONTEXT *sysContext,
	TPML_DIGEST_VALUES *digestValues
	)
{
	UINT32	i;

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

	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), digestValues->count, &( SYS_CONTEXT->rval ) );

	for( i = 0; i < digestValues->count; i++ )
	{
		Marshal_TPMT_HA( sysContext, &digestValues->digests[i] );
	}

	return;
}
示例#20
0
void Marshal_TPML_ALG(
	TSS2_SYS_CONTEXT *sysContext,
	TPML_ALG *alg
	)
{
	UINT32	i;

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

	Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), alg->count, &( SYS_CONTEXT->rval ) );

	for( i = 0; i < alg->count; i++ )
	{
		Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), alg->algorithms[i], &( SYS_CONTEXT->rval ) );
	}

	return;
}
示例#21
0
TPM_RC Tss2_Sys_Import_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	parentHandle,
    TPM2B_DATA	*encryptionKey,
    TPM2B_PUBLIC	*objectPublic,
    TPM2B_PRIVATE	*duplicate,
    TPM2B_ENCRYPTED_SECRET	*inSymSeed,
    TPMT_SYM_DEF_OBJECT	*symmetricAlg
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_Import );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), parentHandle, &(SYS_CONTEXT->rval) );

    if( encryptionKey == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( encryptionKey->b ) );

    Marshal_TPM2B_PUBLIC( sysContext, objectPublic );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( duplicate->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( inSymSeed->b ) );

    Marshal_TPMT_SYM_DEF_OBJECT( sysContext, symmetricAlg );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#22
0
TPM_RC Tss2_Sys_PolicyTicket_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_SH_POLICY	policySession,
    TPM2B_TIMEOUT	*timeout,
    TPM2B_DIGEST	*cpHashA,
    TPM2B_NONCE	*policyRef,
    TPM2B_NAME	*authName,
    TPMT_TK_AUTH	*ticket
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_PolicyTicket );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), policySession, &(SYS_CONTEXT->rval) );

    if( timeout == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( timeout->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( cpHashA->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( policyRef->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( authName->b ) );

    Marshal_TPMT_TK_AUTH( sysContext, ticket );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#23
0
TPM_RC Tss2_Sys_RSA_Decrypt_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	keyHandle,
    TPM2B_PUBLIC_KEY_RSA	*cipherText,
    TPMT_RSA_DECRYPT	*inScheme,
    TPM2B_DATA	*label
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( inScheme == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	} 

    CommonPreparePrologue( sysContext, TPM_CC_RSA_Decrypt );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), keyHandle, &(SYS_CONTEXT->rval) );

    if( cipherText == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( cipherText->b ) );

    Marshal_TPMT_RSA_DECRYPT( sysContext, inScheme );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( label->b ) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#24
0
TPM_RC Tss2_Sys_ZGen_2Phase_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	keyA,
    TPM2B_ECC_POINT	*inQsB,
    TPM2B_ECC_POINT	*inQeB,
    TPMI_ECC_KEY_EXCHANGE	inScheme,
    UINT16	counter
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

     

    CommonPreparePrologue( sysContext, TPM_CC_ZGen_2Phase );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), keyA, &(SYS_CONTEXT->rval) );

    if( inQsB == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    Marshal_TPM2B_ECC_POINT( sysContext, inQsB );

    Marshal_TPM2B_ECC_POINT( sysContext, inQeB );

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), inScheme, &(SYS_CONTEXT->rval) );

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), counter, &(SYS_CONTEXT->rval) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#25
0
TPM_RC Tss2_Sys_VerifySignature_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	keyHandle,
    TPM2B_DIGEST	*digest,
    TPMT_SIGNATURE	*signature
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( signature == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	}

    CommonPreparePrologue( sysContext, TPM_CC_VerifySignature );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), keyHandle, &(SYS_CONTEXT->rval) );

    if( digest == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}

    MARSHAL_SIMPLE_TPM2B( sysContext, &( digest->b ) );

    Marshal_TPMT_SIGNATURE( sysContext, signature );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
TPM_RC Tss2_Sys_SetCommandCodeAuditStatus_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_PROVISION	auth,
    TPMI_ALG_HASH	auditAlg,
    TPML_CC	*setList,
    TPML_CC	*clearList
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    if( setList == NULL  || clearList == NULL  )
	{
		return TSS2_SYS_RC_BAD_REFERENCE;
	} 

    CommonPreparePrologue( sysContext, TPM_CC_SetCommandCodeAuditStatus );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), auth, &(SYS_CONTEXT->rval) );

    
            
    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), auditAlg, &(SYS_CONTEXT->rval) );

    Marshal_TPML_CC( sysContext, setList );

    Marshal_TPML_CC( sysContext, clearList );

    SYS_CONTEXT->decryptAllowed = 0;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#27
0
TPM_RC Tss2_Sys_EncryptDecrypt_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	keyHandle,
    TPMI_YES_NO	decrypt,
    TPMI_ALG_SYM_MODE	mode,
    TPM2B_IV	*ivIn,
    TPM2B_MAX_BUFFER	*inData
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }



    CommonPreparePrologue( sysContext, TPM_CC_EncryptDecrypt );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), keyHandle, &(SYS_CONTEXT->rval) );



    Marshal_UINT8( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), decrypt, &(SYS_CONTEXT->rval) );

    Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), mode, &(SYS_CONTEXT->rval) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( ivIn->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( inData->b ) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
示例#28
0
TPM_RC Tss2_Sys_PCR_Reset_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_PCR	pcrHandle
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_PCR_Reset );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), pcrHandle, &(SYS_CONTEXT->rval) );

    
            
    SYS_CONTEXT->decryptAllowed = 0;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
TPM_RC Tss2_Sys_PolicyDuplicationSelect_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_SH_POLICY	policySession,
    TPM2B_NAME	*objectName,
    TPM2B_NAME	*newParentName,
    TPMI_YES_NO	includeObject
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_PolicyDuplicationSelect );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), policySession, &(SYS_CONTEXT->rval) );

    if( objectName == 0 )
	{
		SYS_CONTEXT->decryptNull = 1;
	}
            
    MARSHAL_SIMPLE_TPM2B( sysContext, &( objectName->b ) );

    MARSHAL_SIMPLE_TPM2B( sysContext, &( newParentName->b ) );

    Marshal_UINT8( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), includeObject, &(SYS_CONTEXT->rval) );

    SYS_CONTEXT->decryptAllowed = 1;
    SYS_CONTEXT->encryptAllowed = 0;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
TPM_RC Tss2_Sys_NV_ReadPublic_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_RH_NV_INDEX	nvIndex
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

    CommonPreparePrologue( sysContext, TPM_CC_NV_ReadPublic );

    Marshal_UINT32( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), nvIndex, &(SYS_CONTEXT->rval) );

    
            
    SYS_CONTEXT->decryptAllowed = 0;
    SYS_CONTEXT->encryptAllowed = 1;
    SYS_CONTEXT->authAllowed = 1;

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}