Beispiel #1
0
//-----------------------------------------------------------------------------
int ctkLDAPExpreTest(int argc, char * argv [] )
{
  Q_UNUSED(argc);
  Q_UNUSED(argv);  

  if ( TestParsing( ) != EXIT_SUCCESS )
  {
    return EXIT_FAILURE;
  }

  if ( TestEvaluate( ) != EXIT_SUCCESS )
  {
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}
Beispiel #2
0
void CServer::RunGateThread()
{
	cout <<  "\ngate thread started \n" << flush;
	int nGateStart = m_pCircuit->GetGateStart();
	m_nGatesDone = nGateStart-1;

	USE_ENCRYPTION();
	KEY *c, *p, *l, *r; 
	KEY* table;
	GATE* gate;
	
	BYTE type;
	YAO_WIRE *leftwire, *rightwire, *outwire;
	int gateid, left, right;
	YAO_WIRE clean_wire = {0,0,0,0,0,0,0,0,0,0,0};
	KEY clean_key = {0,0,0,0,0};

	int a0, a1, b0, b1, c0;

	for( ; m_nGatesDone < m_nNumGates-1; ++m_nGatesDone )
	{ 
		gateid = m_nGatesDone+1;
		gate = m_pGates+gateid;
		type = gate->type;
  
		#ifdef USE_XOR_TECH 
		if( type == G_XOR ) 
			continue;
		#endif
		

		outwire = m_pYaoWires + gateid;
		left = gate->left;
		leftwire = m_pYaoWires + left;
		right = gate->right;
		rightwire = m_pYaoWires + right; 
 
		while( gateid > m_nWiresDone || left > m_nWiresDone || right > m_nWiresDone )
		{
			SleepMiliSec(100);
		}
		
		table = m_pYaoGates[gateid - nGateStart].table;
		a0 = leftwire->b;
		a1 = a0^1;
		b0 = rightwire->b;
		b1 = b0^1;
		c0 = outwire->b;
		
		c = table;
		p = outwire->keys + (TRUTH_TABLE(type, a0, b0)^c0); 
		l = leftwire->keys;
		r = rightwire->keys;
		Encrypt(c, p, l, r, gateid);
			
			
		c++; 
		p = outwire->keys + (TRUTH_TABLE(type, a0, b1)^c0); 
		l = leftwire->keys; 
		r = rightwire->keys + 1; 
		Encrypt(c, p, l, r, gateid);
		
		c++; 
		p = outwire->keys + (TRUTH_TABLE(type, a1, b0)^c0);  
		l = leftwire->keys + 1; 
		r = rightwire->keys; 
		Encrypt(c, p, l, r, gateid);
		
		c++; 
		p = outwire->keys + (TRUTH_TABLE(type, a1, b1)^c0);  
		l = leftwire->keys + 1; 
		r = rightwire->keys + 1; 
		Encrypt(c, p, l, r, gateid);
	}

	#ifdef _DEBUG
	TestEvaluate();
	#endif

	cout << "\ngate thread ended \n" << flush;
}