KEYS: Convert KEYCTL_DH_COMPUTE to use the crypto KPP API
Subsystems (2)
PATCH v4 1/1 KEYS: Convert KEYCTL_DH_COMPUTE to use the crypto KPP API
The initial Diffie-Hellman computation made direct use of the MPI library because the crypto module did not support DH at the time. Now that KPP is implemented, KEYCTL_DH_COMPUTE should use it to get rid of duplicate code and leverage possible hardware acceleration.
This fixes an issue whereby the input to the KDF computation would include additional uninitialized memory when the result of the Diffie-Hellman computation was shorter than the input prime number.
---
v2: Fix issue when DH computation results with leading zeros are used with
a KDF.
v3: Rebase on keys-fixes (v2 was on keys-next)
v4: Updated commit message
This commit is in my git tree at
https://git.kernel.org/pub/scm/linux/kernel/git/martineau/linux.git
(dh-refactor branch)
security/keys/Kconfig | 2 +- security/keys/dh.c | 272 +++++++++++++++++++++++++++++++------------------- 2 files changed, 171 insertions(+), 103 deletions(-)
security/keys/Kconfig +1 -1
@@ -93,9 +93,9 @@ config ENCRYPTED_KEYS config KEY_DH_OPERATIONS bool "Diffie-Hellman operations on retained keys" depends on KEYS - select MPILIB select CRYPTO select CRYPTO_HASH + select CRYPTO_DH help This option provides support for calculating Diffie-Hellman public keys and shared secrets using values stored as keys
security/keys/dh.c +170 -102
381 lines not on this page · raw message
Signature · 1 line
2.13.1