-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 723 - Fixed use of ECB with Botan #724
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable.
Are all the extra debug printouts needed? I seems that existing printouts are quite sparse with information, maybe for security reasons(?).
As an addition I suggest that we also disable 2 testcases when built WITH_BOTAN.
They will always fail when using Botan as I understand it. WDYT?
1) test: AESTests::testECB (F) line: 518 AESTests.cpp
assertion failed
- Expression: aes->encryptInit(&aesKey128, SymMode::ECB, IV)
2) test: DESTests::testECB (F) line: 537 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::ECB, IV)
I think that you are right about the tests. I have added the debug logs because they are often useful. I agree that some security reasons, it may seem bad, but:
So I thought this was tolerable. But per your request, I deleted all the offending lines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good comments. Using debug logs in production would be "beyond madness" :)
src/lib/crypto/test/AESTests.cpp
Outdated
@@ -328,6 +328,7 @@ void AESTests::testCBC() | |||
} | |||
} | |||
|
|||
#ifndef WITH_BOTAN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this will give an undefined reference to this function while linking.
Maybe its better to just remove the registration of the testcase in the header file.
#ifndef WITH_BOTAN
CPPUNIT_TEST(testECB);
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the testECB()
testcase in:
src/lib/crypto/test/DESTests.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed your suggestion and compilation/linking is ok now.
The tests fail on the src/lib/test though but I am pretty sure that it was the case before my changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Looks good.
if you revert BotanSymmetricAlgorithm.cpp 8fd89ec and uncomment if (mode == SymMode::ECB) all tests are passing. |
That's because ECB is not taken into account during compilation phase. It does not fix the failing tests in |
Sorry I dont understand what do you mean "ECB is not taken into account". You mean because Botan_ecb.cpp is missing in CMakelists.txt? The test was performed with dev branch and not with fix-botan-ecb |
Here is my proposed fix for issue 723