diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2022-04-25 15:53:29 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2022-05-09 19:34:03 +0300 |
commit | 567dd8f34560fa221a6343729474536aa7ede4fd (patch) | |
tree | b6735601f3577a755c95902502ebe253eb9a0909 /net/packet | |
parent | d3f2a14b8906df913cb04a706367b012db94a6e8 (diff) | |
download | linux-567dd8f34560fa221a6343729474536aa7ede4fd.tar.xz |
dm crypt: make printing of the key constant-time
The device mapper dm-crypt target is using scnprintf("%02x", cc->key[i]) to
report the current key to userspace. However, this is not a constant-time
operation and it may leak information about the key via timing, via cache
access patterns or via the branch predictor.
Change dm-crypt's key printing to use "%c" instead of "%02x". Also
introduce hex2asc() that carefully avoids any branching or memory
accesses when converting a number in the range 0 ... 15 to an ascii
character.
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Tested-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'net/packet')
0 files changed, 0 insertions, 0 deletions