Matt Caswell f42e68dc47 Defer Finished MAC handling until after state transition
In TLS we process received messages like this:

1) Read Message Header
2) Validate and transition state based on received message type
3) Read Message Body
4) Process Message

In DTLS we read messages like this:

1) Read Message Header and Body
2) Validate and transition state based on received message type
3) Process Message

The difference is because of the stream vs datagram semantics of the
underlying transport.

In both TLS and DTLS we were doing finished MAC processing as part of
reading the message body. This means that in DTLS this was occurring
*before* the state transition has been validated. A crash was occurring
in DTLS if a Finished message was sent in an invalid state due to
assumptions in the code that certain variables would have been setup by
the time a Finished message arrives.

To avoid this problem we shift the finished MAC processing to be after
the state transition in DTLS.

Thanks to github user @bathooman for reporting this issue.

Fixes #14906

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14930)
2021-04-28 16:23:08 +01:00
..
2021-04-22 14:38:44 +01:00
2021-04-08 13:04:41 +01:00
2021-01-28 13:54:57 +01:00
2020-11-26 14:18:57 +00:00
2020-11-26 14:18:57 +00:00
2020-11-26 14:18:57 +00:00
2020-11-26 14:18:57 +00:00
2020-11-11 12:12:23 +01:00
2020-11-18 23:38:34 +01:00
2021-04-08 13:04:41 +01:00
2019-09-28 20:26:35 +02:00
2019-09-28 20:26:35 +02:00
2021-02-18 15:05:17 +00:00
2021-02-18 15:05:17 +00:00