예제 #1
0
TPM_RC Tss2_Sys_Load_Prepare(
    TSS2_SYS_CONTEXT *sysContext,
    TPMI_DH_OBJECT	parentHandle,
    TPM2B_PRIVATE	*inPrivate,
    TPM2B_PUBLIC	*inPublic
    )
{
    if( sysContext == NULL )
    {
        return( TSS2_SYS_RC_BAD_REFERENCE );
    }

     

    CommonPreparePrologue( sysContext, TPM_CC_Load );

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

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

    Marshal_TPM2B_PUBLIC( sysContext, inPublic );

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

    CommonPrepareEpilogue( sysContext );

    return SYS_CONTEXT->rval;
}
예제 #2
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;
}
예제 #3
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;
}