INNER CODE UNIT · C++

idxTwice

ph4r05/Whitebox-crypto-AES · BGEAttack.cpp:741

		int idxTwice=-1;              // index that has 01 as MC coefficient
		for(int d1=0;d1<4;d1++){
			for(int d2=0;d2<4;d2++){
				if (d1!=d2 && out->P[d1].delta == out->P[d2].delta){ idxTwice = d1; break; }
			}
		}

		if (idxTwice==-1){
			if (doCout) cout << "Weird thing happened, there should be 2 deltas with same value, is MC as it should be?" << endl;
			return PiOK;
		}

		// Now we are able to derive gamma, delta^{-1}_{idxTwice} = gamma * 01 = gamma
		// alfa = delta^{-1} * gamma^{-1}
		GF2E gammaInvGF = GF2EFromLong(out->P[idxTwice].delta, 8);
		GF2E gammaGF    = NTL::inv(gammaInvGF);
		out->gamma      = (BYTE) getLong(gammaGF);
		for(int d=0; d<4; d++){

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…