void Marshal_TPMS_SYMCIPHER_PARMS(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_SYMCIPHER_PARMS *symcipherParms
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	Marshal_TPMT_SYM_DEF_OBJECT( sysContext, &symcipherParms->sym );

	return;
}
void Marshal_TPMS_ECC_PARMS(
	TSS2_SYS_CONTEXT *sysContext,
	TPMS_ECC_PARMS *eccParms
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	Marshal_TPMT_SYM_DEF_OBJECT( sysContext, &eccParms->symmetric );
	Marshal_TPMT_ECC_SCHEME( sysContext, &eccParms->scheme );
	Marshal_UINT16( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), eccParms->curveID, &( SYS_CONTEXT->rval ) );
	Marshal_TPMT_KDF_SCHEME( sysContext, &eccParms->kdf );

	return;
}
示例#3
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;
}
示例#4
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;
}
示例#5
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;
}