static int nla_client_recv_pub_key_auth(rdpNla* nla)
{
	WINPR_ASSERT(nla);

	/* Verify Server Public Key Echo */
	if (nla->peerVersion < 5)
		nla->status = nla_decrypt_public_key_echo(nla);
	else
		nla->status = nla_decrypt_public_key_hash(nla);

	nla_buffer_free(nla);

	if (nla->status != SEC_E_OK)
	{
		WLog_ERR(TAG, "Could not verify public key echo %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(nla->status), nla->status);
		return -1;
	}

	/* Send encrypted credentials */
	nla->status = nla_encrypt_ts_credentials(nla);
	if (nla->status != SEC_E_OK)
		return -1;

	if (!nla_send(nla))
	{
		nla_buffer_free(nla);
		return -1;
	}

	nla_buffer_free(nla);

	if (SecIsValidHandle(&nla->credentials))
	{
		nla->table->FreeCredentialsHandle(&nla->credentials);
		SecInvalidateHandle(&nla->credentials);
	}

	if (nla->status != SEC_E_OK)
	{
		WLog_ERR(TAG, "FreeCredentialsHandle status %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(nla->status), nla->status);
	}

	if (nla->status != SEC_E_OK)
		return -1;

	nla_set_state(nla, NLA_STATE_AUTH_INFO);
	return 1;
}
static int nla_client_recv_pub_key_auth(rdpNla* nla)
{
	WINPR_ASSERT(nla);

	 
	if (nla->peerVersion < 5)
		nla->status = nla_decrypt_public_key_echo(nla);
	else
		nla->status = nla_decrypt_public_key_hash(nla);

	nla_buffer_free(nla);

	if (nla->status != SEC_E_OK)
	{
		WLog_ERR(TAG, "Could not verify public key echo %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(nla->status), nla->status);
		return -1;
	}

	 
	nla->status = nla_encrypt_ts_credentials(nla);
	if (nla->status != SEC_E_OK)
		return -1;

	if (!nla_send(nla))
	{
		nla_buffer_free(nla);
		return -1;
	}

	nla_buffer_free(nla);

	if (SecIsValidHandle(&nla->credentials))
	{
		nla->table->FreeCredentialsHandle(&nla->credentials);
		SecInvalidateHandle(&nla->credentials);
	}

	if (nla->status != SEC_E_OK)
	{
		WLog_ERR(TAG, "FreeCredentialsHandle status %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(nla->status), nla->status);
	}

	if (nla->status != SEC_E_OK)
		return -1;

	nla_set_state(nla, NLA_STATE_AUTH_INFO);
	return 1;
}