]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix ubsan 'left shift of negative value -1' error in satsub64be()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 2 Aug 2016 21:54:46 +0000 (22:54 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 26 Aug 2016 12:44:11 +0000 (13:44 +0100)
commitba30f1a070d5824fcee19bdcceb4eb3228e397e9
treeb3c480c992fcbff512198775f6cadc370e758f82
parentdf426c06919e9d30fa9b226c15d24a25c2b90c93
Fix ubsan 'left shift of negative value -1' error in satsub64be()

Baroque, almost uncommented code triggers behaviour which is undefined
by the C standard. You might quite reasonably not care that the code was
broken on ones-complement machines, but if we support a ubsan build then
we need to at least pretend to care.

It looks like the special-case code for 64-bit big-endian is going to
behave differently (and wrongly) on wrap-around, because it treats the
values as signed. That seems wrong, and allows replay and other attacks.
Surely you need to renegotiate and start a new epoch rather than
wrapping around to sequence number zero again?

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 2e94723c1b5d8ab974645e83de90b248265af3cd)
ssl/d1_pkt.c