-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 sporadic CI failure in crypto test for nrf platform #4582
Conversation
@@ -65,7 +65,6 @@ void PASESession::Clear() | |||
memset(&mWS[0][0], 0, sizeof(mWS)); | |||
memset(&mKe[0], 0, sizeof(mKe)); | |||
mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2pError; | |||
mSpake2p.Init(nullptr); |
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.
Ah, and the point is since we are initing mSpake2p
with mCommissioningHash
and we are clearing that we don't need to mess with mSpake2p
? This could actually use a comment explaining why we don't need to touch that member here. Looks good to me with the comment added.
Size increase report for "esp32-example-build" from 4c56ede
Full report output
|
@@ -65,8 +65,11 @@ void PASESession::Clear() | |||
memset(&mWS[0][0], 0, sizeof(mWS)); | |||
memset(&mKe[0], 0, sizeof(mKe)); | |||
mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2pError; | |||
mSpake2p.Init(nullptr); | |||
|
|||
// Note: we don't need to explicitly clear the state of mSpake2p object. |
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.
It says 'we don't need to' which sounds a as if we could but it does not matter.
However from the change, it seems that calling 'init' actually caused unit test failues, so we likely we 'must not init spake2p'. Should we update the comment? I think the comment may make sense within this PR, however looking in time the comment could use a bit more context. Like:
// clearing mCommisioningHash will automatically clear mSpake2p.
// NOTE: do NOT call mSpake2p.Init(nullptr) here since that will leak the spake hash.
... assuming the above comment is really what is going on.
Could we fix the possiblity of a memory leak when init is called?
…#4582) * Fix sporadic CI failure in crypto test for nrf platform
…#4582) * Fix sporadic CI failure in crypto test for nrf platform
…#4582) * Fix sporadic CI failure in crypto test for nrf platform
…#4582) * Fix sporadic CI failure in crypto test for nrf platform
Problem
CI is intermittently failing in crypto tests while running
nrf
platform tests.Failure logs are
Summary of Changes
PASESession.Clear()
was callingmSpake2p.Init(nullptr);
, but it doesn't clear the state of the Spake2p object. It initialized the SHA256 context, which was eventually leaked. The test runs were calling this repeatedly that drained the buffer pool from mbedTLS library.