]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix leakage when the cacheline is 32-bytes in CBC_MAC_ROTATE_IN_PLACE
authorbasavesh <basavesh.shivakumar@gmail.com>
Sun, 3 Apr 2022 14:04:53 +0000 (16:04 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 9 May 2022 14:40:21 +0000 (16:40 +0200)
commit3b836385679504579ee1052ed4b4ef1d9f49fa13
tree9aa5351bd0b1185430a50777f1dd324955de09b0
parenta6680123643bc3289ecbcbd6bce844a814c1510a
Fix leakage when the cacheline is 32-bytes in CBC_MAC_ROTATE_IN_PLACE

rotated_mac is a 64-byte aligned buffer of size 64 and rotate_offset is secret.
Consider a weaker leakage model(CL) where only cacheline base address is leaked,
i.e address/32 for 32-byte cacheline(CL32).

Previous code used to perform two loads
    1. rotated_mac[rotate_offset ^ 32] and
    2. rotated_mac[rotate_offset++]
which would leak 2q + 1, 2q for 0 <= rotate_offset < 32
and 2q, 2q + 1 for 32 <= rotate_offset < 64

The proposed fix performs load operations which will always leak 2q, 2q + 1 and
selects the appropriate value in constant-time.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18033)
ssl/record/tls_pad.c