]> Git Repo - linux.git/commit
crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
authorArd Biesheuvel <[email protected]>
Tue, 24 Nov 2020 10:47:19 +0000 (11:47 +0100)
committerHerbert Xu <[email protected]>
Fri, 4 Dec 2020 07:13:13 +0000 (18:13 +1100)
commit17858b140bf49961b71d4e73f1c3ea9bc8e7dda0
tree89b0f162292703ef55bf19475fc3156da73b96f8
parent05c2a705917b77e0915cca3551583583f4eafcf8
crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()

ecdh_set_secret() casts a void* pointer to a const u64* in order to
feed it into ecc_is_key_valid(). This is not generally permitted by
the C standard, and leads to actual misalignment faults on ARMv6
cores. In some cases, these are fixed up in software, but this still
leads to performance hits that are entirely avoidable.

So let's copy the key into the ctx buffer first, which we will do
anyway in the common case, and which guarantees correct alignment.

Cc: <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
crypto/ecdh.c
This page took 0.055585 seconds and 4 git commands to generate.