bc-csharp
bc-csharp copied to clipboard
DTLS fixes
- Change the size of the
recordbuffer inDtlsRecordLayer.Receiveto be able to hold the actual record. Before, it was sized to fit the decrypted plaintext plus the header, whereas the ciphertext is what's actually sent over the underlying transport. ResettheGCMBlockCiphereven when the MAC is invalid, because DTLS needs to be able to decrypt each record independently. Without the reset, corrupt packets can cause theGCMBlockCipherobject to enter a state in which it will fail to decrypt all subsequent records.- Ignore
bad_record_mac"fatal" errors inDtlsTransport.Receive, because DTLS is meant to be able to ignore corrupt records.