|
|
|
|
|
by wolfwyrd
1302 days ago
|
|
This is a timing attack or timing oracle. Lets assume a mac represented in an array of 32 bytes. If we had a pseudocode method like: byte [32] (actualMac, expectedMac)
for int x = 0..31
if (actualMac[x] != expectedMac[x])
return false;
fi
end
return true;
We return false as soon as we hit an invalid byte in our calculated mac. If the time taken to execute one iteration of the loop is Y and the attacker is able to time this method accurately they will be able to tell what the value of actualMac is by feeding known inputs. They will know because the return time will be 2Y when they have bailed after the first byte. 3Y after the second, 4Y after the third etc.This is why we should check the arrays in constant time - compare every byte in both arrays before returning. We do not return early so we can’t leak information |
|
why is it called constant time if it isn't constant with respect to array length? Just seems confusing because the algorithm is linear without a short circuit