summaryrefslogtreecommitdiff
path: root/src/usr.sbin
diff options
context:
space:
mode:
authorjsing <>2021-06-19 17:21:40 +0000
committerjsing <>2021-06-19 17:21:40 +0000
commit6afe60e39f7d03240c1f094e1f341b84a8de3f4e (patch)
tree4031b006d4844852d99c4ada4526be15b731c8e0 /src/usr.sbin
parente5895fba963b225b4275079fc84444579ae34b3d (diff)
downloadopenbsd-6afe60e39f7d03240c1f094e1f341b84a8de3f4e.tar.gz
openbsd-6afe60e39f7d03240c1f094e1f341b84a8de3f4e.tar.bz2
openbsd-6afe60e39f7d03240c1f094e1f341b84a8de3f4e.zip
Correctly handle epoch wrapping in dtls1_get_bitmap().
Due to a type bug that has been present in DTLS since the code was first committed in 2005, dtls1_get_bitmap() fails to handle next epoch correctly when the epoch is currently 0xffff (and wraps to zero). For various reasons unknown, the epoch field in the SSL3_RECORD_INTERNAL (formerly SSL3_RECORD) was added as unsigned long (even though the value is an unsigned 16 bit value on the wire, hence cannot exceed 0xffff), however was added to other code as unsigned short. Due to integer promotion, the r_epoch value is incremented by one to become 0x10000, before being cast to an unsigned long and compared to the value pulled from the DTLS record header (which is zero). Strangely 0x10000 != 0, meaning that we drop the DTLS record, instead of queueing it for the next epoch. Fix this issue by using more appropriate types and pulling up the calculation of the next epoch value for improved readability. ok inoguchi@ tb@
Diffstat (limited to 'src/usr.sbin')
0 files changed, 0 insertions, 0 deletions