INNER CODE UNIT · C++
rconIdx
ph4r05/Whitebox-crypto-AES · BGEAttack.cpp:870
int rconIdx = -1;
for(int rc=0; rc<16; rc++){
vec_GF2E gw7_copy(INIT_SIZE, 4);
for(int i=0; i<4; i++) gw7_copy[i] = gw7[i];
// Revert RC[rc] application on first element
gw7_copy[0] = GF2EFromLong(getLong(gw7[0] + aes.RC[rc]),8);
// Inverse Sbox application
for(int i=0; i<4; i++) gw7_copy[i] = GF2EFromLong(aes.sboxAffineInv[getLong(gw7_copy[i])], 8);
// Inverse left shift -> shift to the right, respectively test it with taking shift into account
bool correctRcon=true;
for(int i=0; i<4; i++){
if (w7[(i+1) % 4] != gw7_copy[i]) {
correctRcon=false;
break;
}
}