-
Notifications
You must be signed in to change notification settings - Fork 6
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
Test failed due to premature clearing of xA in ProveOVHdr - Re-open #22
Comments
The finalizer shouldn't be removed, because it is used to ensure that whatever the transport implementation, the value is cleared in memory after use. Generally this is after the transport performs CBOR marshaling. For In the case of fdotest, the mock transport actually reuses the in-memory type. Before #21, this type would go out of scope at the end of a function ( However, now that the key exchange session uses a copy ( Are you sure it's the exact same error occurring? |
By spec:
|
Yes, definitely. Those are fresh copy/pastes from my verry recent test. Note - this is actually running on a different machine than my previous ones. |
I reproduced this:
I'm not sure what's going on, though. #21 was clearly not the fix for this particular problem (yet made it rarer?), because it wasn't the key exchange which was failing. Two things are unusual:
My initial guesses are:
|
Stick a |
But that I added these logs at the end of respType, resp := responder.Respond(ctx, msgType, &msgBody)
t.T.Logf("Response 1 %d: %v", respType, tryDebugNotation(resp))
t.token, _ = t.Tokens.TokenFromContext(ctx)
t.prevMsg = msgType
var respBody bytes.Buffer
if err := cbor.NewEncoder(&respBody).Encode(resp); err != nil {
return 0, nil, err
}
respDebug, _ := cdn.FromCBOR(respBody.Bytes())
t.T.Logf("Response 2 %d: %v", respType, respDebug)
return respType, io.NopCloser(&respBody), nil And observed "Response 2" containing a sequence of null bytes within it corresponding to the KeyExchange A. However, the "Response 1" line had the correct CDN output. The |
Weirdly, I can't trigger it by sticking a bunch of And more weirdly, adding If confirmed, it means that the finalizer is sometimes running inside the CBOR encoding function! |
@bkgoodman Please try with the 1-line fix from #26. I'll keep a test loop running for an hour as well. |
I accidentally ran the tests for 5.5 hours. Calling it fixed. 😛 |
Could not re-open Issue #20
I just got another failure.
I did notice that you added the defer clear - but never removed the old Runtime Finalizer. It appears as though the finalizer cleared in the case I ran:
*** SIGN OVHPROOF with key RSA2048 Fingerprint: 1dc0424e52b976c298d2988ee973541b2ae1be46822a5b1222827f19ade94987
*** FINALIZER CLEARING!!!!
*** FINALIZER CLEARING!!!!
*** VERIFY OVHPROOF with key RSA2048 Fingerprint: 1dc0424e52b976c298d2988ee973541b2ae1be46822a5b1222827f19ade94987
*** KeyExchangeA Set to [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
defer clear(proveOVHdr.Payload.Val.KeyExchangeA)
... is still in sendHelloDevice, but...
... is still in proveOVHHdr.
The text was updated successfully, but these errors were encountered: