You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Didn't expected this but the AES-CTR implementation has a flaw. The counter/IV is not increasing at all.
Critical code snippet:
function AESCTR(blocks::Array{UInt8, 1}, key::Array{UInt8, 1},
iv::Array{UInt8, 1})
noBlocks = keyStreamCheck(blocks, key, iv)
curr = copy(iv)
o = Array{UInt8}(undef, length(blocks))
for i=1:noBlocks
indices = blockIndices(blocks, i)
eb = AESEncrypt(curr, key)
o[indices] = xor.(eb[1:length(indices)] , blocks[indices])
for bi=(length(curr) - 7):length(curr)
tmp = curr[bi]
curr[bi] = UInt8(Int(tmp) + 1)
if curr[bi] > tmp
# no byte overflow
break
end
end
end
return o
end
If one puts a print before the AESEncrypt call:
function AESCTR(blocks::Array{UInt8, 1}, key::Array{UInt8, 1},
iv::Array{UInt8, 1})
noBlocks = keyStreamCheck(blocks, key, iv)
curr = copy(iv)
o = Array{UInt8}(undef, length(blocks))
for i=1:noBlocks
indices = blockIndices(blocks, i)
println("######LIB Iv: ", curr)
eb = AESEncrypt(curr, key)
o[indices] = xor.(eb[1:length(indices)] , blocks[indices])
for bi=(length(curr) - 7):length(curr)
tmp = curr[bi]
curr[bi] = UInt8(Int(tmp) + 1)
if curr[bi] > tmp
# no byte overflow
break
end
end
end
return o
end
You will see that the IV is not increasing. The error lies perhaps in the scopes of variables. I'm not sure but this may have been changed from 0.6 to 1.0?
Hey,
Didn't expected this but the AES-CTR implementation has a flaw. The counter/IV is not increasing at all.
Critical code snippet:
If one puts a print before the
AESEncrypt
call:You will see that the IV is not increasing. The error lies perhaps in the scopes of variables. I'm not sure but this may have been changed from 0.6 to 1.0?
JuliaLang/julia#28750 seems to be something similiar.
Version: Julia 1.0.2 (LTS)
The text was updated successfully, but these errors were encountered: