Exemplo n.º 1
0
void Marshal_TPMU_SIG_SCHEME(
	TSS2_SYS_CONTEXT *sysContext,
	TPMU_SIG_SCHEME *sigScheme,
	UINT32 selector
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	switch( selector )
	{
#ifdef TPM_ALG_RSASSA
	case TPM_ALG_RSASSA:
			Marshal_TPMS_SIG_SCHEME_RSASSA( sysContext, &sigScheme->rsassa );
			break;
#endif
#ifdef TPM_ALG_RSAPSS
	case TPM_ALG_RSAPSS:
			Marshal_TPMS_SIG_SCHEME_RSAPSS( sysContext, &sigScheme->rsapss );
			break;
#endif
#ifdef TPM_ALG_ECDSA
	case TPM_ALG_ECDSA:
			Marshal_TPMS_SIG_SCHEME_ECDSA( sysContext, &sigScheme->ecdsa );
			break;
#endif
#ifdef TPM_ALG_ECDAA
	case TPM_ALG_ECDAA:
			Marshal_TPMS_SIG_SCHEME_ECDAA( sysContext, &sigScheme->ecdaa );
			break;
#endif
#ifdef TPM_ALG_SM2
	case TPM_ALG_SM2:
			Marshal_TPMS_SIG_SCHEME_SM2( sysContext, &sigScheme->sm2 );
			break;
#endif
#ifdef TPM_ALG_ECSCHNORR
	case TPM_ALG_ECSCHNORR:
			Marshal_TPMS_SIG_SCHEME_ECSCHNORR( sysContext, &sigScheme->ecschnorr );
			break;
#endif
#ifdef TPM_ALG_HMAC
	case TPM_ALG_HMAC:
			Marshal_TPMS_SCHEME_HMAC( sysContext, &sigScheme->hmac );
			break;
#endif
#ifdef TPM_ALG_NULL
	case TPM_ALG_NULL:
					break;
#endif
	}
	return;
}
void Marshal_TPMU_ASYM_SCHEME(
	TSS2_SYS_CONTEXT *sysContext,
	TPMU_ASYM_SCHEME *asymScheme,
	UINT32 selector
	)
{
	if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
		return;

	switch( selector )
	{
#ifdef TPM_ALG_ECDH
	case TPM_ALG_ECDH:
			Marshal_TPMS_KEY_SCHEME_ECDH( sysContext, &asymScheme->ecdh );
			break;
#endif
#ifdef TPM_ALG_ECMQV
	case TPM_ALG_ECMQV:
			Marshal_TPMS_KEY_SCHEME_ECMQV( sysContext, &asymScheme->ecmqv );
			break;
#endif
#ifdef TPM_ALG_RSASSA
	case TPM_ALG_RSASSA:
			Marshal_TPMS_SIG_SCHEME_RSASSA( sysContext, &asymScheme->rsassa );
			break;
#endif
#ifdef TPM_ALG_RSAPSS
	case TPM_ALG_RSAPSS:
			Marshal_TPMS_SIG_SCHEME_RSAPSS( sysContext, &asymScheme->rsapss );
			break;
#endif
#ifdef TPM_ALG_ECDSA
	case TPM_ALG_ECDSA:
			Marshal_TPMS_SIG_SCHEME_ECDSA( sysContext, &asymScheme->ecdsa );
			break;
#endif
#ifdef TPM_ALG_ECDAA
	case TPM_ALG_ECDAA:
			Marshal_TPMS_SIG_SCHEME_ECDAA( sysContext, &asymScheme->ecdaa );
			break;
#endif
#ifdef TPM_ALG_SM2
	case TPM_ALG_SM2:
			Marshal_TPMS_SIG_SCHEME_SM2( sysContext, &asymScheme->sm2 );
			break;
#endif
#ifdef TPM_ALG_ECSCHNORR
	case TPM_ALG_ECSCHNORR:
			Marshal_TPMS_SIG_SCHEME_ECSCHNORR( sysContext, &asymScheme->ecschnorr );
			break;
#endif
#ifdef TPM_ALG_RSAES
	case TPM_ALG_RSAES:
			Marshal_TPMS_ENC_SCHEME_RSAES( sysContext, &asymScheme->rsaes );
			break;
#endif
#ifdef TPM_ALG_OAEP
	case TPM_ALG_OAEP:
			Marshal_TPMS_ENC_SCHEME_OAEP( sysContext, &asymScheme->oaep );
			break;
#endif
#ifdef TPM_ALG_NULL
	case TPM_ALG_NULL:
					break;
#endif
	}
	return;
}