Skip to content

x86/crypto: Fix function prototypes

Joao Moreira kernel-hardening lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86/crypto: camellia: Fix function prototypesarch/x86/crypto/camellia_aesni_avx2_glue.c arch/x86/crypto/camellia_aesni_avx_glue.c arch/x86/crypto/camellia_glue.c +1 more+40 -554 replies
2/4x86/crypto: cast6: Fix function prototypesarch/x86/crypto/cast6_avx_glue.c+10 -140 replies
3/4x86/crypto: serpent: Fix function prototypesarch/x86/crypto/serpent_avx2_glue.c arch/x86/crypto/serpent_avx_glue.c arch/x86/include/asm/crypto/serpent-avx.h +1 more+37 -510 replies
4/4x86/crypto: twofish: Fix function prototypesarch/x86/crypto/twofish_avx_glue.c arch/x86/crypto/twofish_glue.c arch/x86/crypto/twofish_glue_3way.c +1 more+23 -330 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] x86/crypto: Fix function prototypes

It is possible to indirectly invoke functions with prototypes that do not match those of the respectively used function pointers by using void types. This feature is frequently used as a way of relaxing function invocation, making it possible that different data structures are passed to different functions through the same pointer.

Despite the benefits, this can lead to a situation where functions with a given prototype are invoked by pointers with a different prototype, what is undesirable as it may prevent the use of heuristics such as prototype matching-based Control-Flow Integrity, which can be used to prevent ROP-based attacks.

One way of fixing this situation is through converting the function prototypes to the one used in the pointer declaration, what means converting function arguments from a given '<type> *' to a 'void *', and later casting its uses accordingly throughout the function scope.

Given the above, the current efforts to improve the Linux security, and the upcoming kernel support to compilers with CFI features, fix prototypes in x86/crypto algorithms: camellia, cast6, serpent, and twofish.

This patch does not introduce semantic changes to the cryptographic algorithms, yet, if someone finds relevant, the affected algorithms were tested with the help of tcrypt.ko without any visible harm.

Joao Moreira (4):
x86/crypto: camellia: Fix function prototypes
x86/crypto: cast6: Fix function prototypes
x86/crypto: serpent: Fix function prototypes
x86/crypto: twofish: Fix function prototypes

 arch/x86/crypto/camellia_aesni_avx2_glue.c | 25 ++++++++---------
 arch/x86/crypto/camellia_aesni_avx_glue.c  | 21 +++++++--------
 arch/x86/crypto/camellia_glue.c            |  6 ++---
 arch/x86/crypto/cast6_avx_glue.c           | 22 ++++++---------
 arch/x86/crypto/serpent_avx2_glue.c        | 14 +++++-----
 arch/x86/crypto/serpent_avx_glue.c         | 19 ++++++-------
 arch/x86/crypto/twofish_avx_glue.c         | 30 +++++++++------------
 arch/x86/crypto/twofish_glue.c             |  7 +++--
 arch/x86/crypto/twofish_glue_3way.c        | 10 +++----
 arch/x86/include/asm/crypto/camellia.h     | 43 +++++++++++++-----------------
 arch/x86/include/asm/crypto/serpent-avx.h  | 25 ++++++++---------
 arch/x86/include/asm/crypto/serpent-sse2.h | 30 +++++++++------------
 arch/x86/include/asm/crypto/twofish.h      |  9 +++----
 13 files changed, 108 insertions(+), 153 deletions(-)
Signature · 1 line
2.12.0