cup
1
I was getting a range error in util-encoders.aes.adb. I’ve tracked it down to a bug in the code.
I don’t know if this has already been reported. In utilada_2.6.0, src/sys/encoders/util-encoders-ads.adb, around line 1545, where it says
Remain := Input'Last - First;
This causes the arithmetic in line 1551 to be incorrect, causing the range error. it should read
Remain := Input'Last - First + 1;
Where it says
Encrypt(0, Output(Last..Last + 16), Key);
This is obviously wrong because it would have 17 characters. it should read
Encrypt(0, Output(Last .. Last + 15), Key);
Once you do that, the code just works.
1 Like
Indeed, I agree with your remark, it should be Last + 15
since AES blocks are 16 bytes. I was not aware of this issue.
cup
3
@stcarrez checked the changes with ECB, CFB, CTR, OFB and CBC. Do you need test programs/test data? I don’t know how to put stuff in GitHub.
I hadn’t time to look further until now… I’ve created the following bug and I’ll submit a fix with test case this week-end.
1 Like