| 1 |
From 50b682087c42e5c42d9aad6333cc591c0de647f3 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Stephan Mueller <[email protected]> |
| 3 |
Date: Fri, 29 Sep 2017 01:29:23 +0200 |
| 4 |
Subject: [PATCH v2 0/8] crypto: AF_ALG support for KPP |
| 5 |
|
| 6 |
Hi, |
| 7 |
|
| 8 |
This is an RFC to discuss whether and how to support access to the |
| 9 |
KPP kernel crypto API (Diffie-Hellman and EC Diffie-Hellman) by |
| 10 |
user space. |
| 11 |
|
| 12 |
The patch set is only meant for discussion and not for production use. |
| 13 |
Testing is only performed for the DH part via [1]. The DH testing shows |
| 14 |
that the DH operation shows the same results as OpenSSL. |
| 15 |
|
| 16 |
The patch set includes: |
| 17 |
|
| 18 |
- addition of PKCS#3 support for DH to allow domain parameters to be set |
| 19 |
|
| 20 |
- extension of the setsockopt and cmsg API |
| 21 |
|
| 22 |
- addition of AF_ALG KPP interface where the implementation follows the |
| 23 |
exact same coding style as currently discussed for the memory management |
| 24 |
fix patch set for algif_skcipher and algif_aead -- this shall allow |
| 25 |
the immediate incorporation of patches that replace duplicated code with |
| 26 |
common service functions. |
| 27 |
|
| 28 |
The patch 8 describes the different operations that are supported by AF_ALG |
| 29 |
KPP. This support includes generation and retaining of the private key |
| 30 |
inside the kernel. This private key would never be sent to user space. |
| 31 |
|
| 32 |
I am aware and in fact supported development of the DH support in the keys |
| 33 |
subsystem. The question will be raised whether the AF_ALG KPP interface is |
| 34 |
superfluous in light of the keys DH support. My answer is that AF_ALG KPP is |
| 35 |
orthogonal to the keys DH support. The keys DH support use case is that |
| 36 |
the keys are managed inside the kernel and thus has the focus on the |
| 37 |
key management. Contrary, AF_ALG KPP does not really focus on key management |
| 38 |
but simply externalizes the DH/ECDH support found in the kernel including |
| 39 |
hardware acceleration. User space is in full control of the key life cycle. |
| 40 |
This way, AF_ALG could be used to complement user-space network protocol |
| 41 |
implementations like TLS or IKE to offload the resource intense DH |
| 42 |
calculations to accelerators. |
| 43 |
|
| 44 |
A full description of the DH testing and how to compare it to OpenSSL |
| 45 |
is present in [1] with the test/kcapi-main.c tool, function "kpp". |
| 46 |
|
| 47 |
Changes v2: |
| 48 |
* port to 4.14-rc1 and thus eliminate most of the code |
| 49 |
|
| 50 |
Stephan Mueller (8): |
| 51 |
crypto: AF_ALG -- add DH keygen / ssgen API |
| 52 |
crypto: AF_ALG -- add DH param / ECDH curve setsockopt call |
| 53 |
crypto: AF_ALG - eliminate code duplication |
| 54 |
crypto: KPP - add API crypto_kpp_set_params |
| 55 |
crypto: DH - allow params and key to be set independently |
| 56 |
crypto: DH - add PKCS#3 parameter handling |
| 57 |
crypto: ecdh - constify key |
| 58 |
crypto: AF_ALG - add KPP support |
| 59 |
|
| 60 |
Documentation/crypto/api-kpp.rst | 2 +- |
| 61 |
crypto/Kconfig | 10 + |
| 62 |
crypto/Makefile | 8 +- |
| 63 |
crypto/af_alg.c | 19 +- |
| 64 |
crypto/algif_kpp.c | 607 +++++++++++++++++++++++++++++++++++++++ |
| 65 |
crypto/dh.c | 36 ++- |
| 66 |
crypto/dh_helper.c | 53 +++- |
| 67 |
crypto/dhparameter.asn1 | 4 + |
| 68 |
include/crypto/dh.h | 21 +- |
| 69 |
include/crypto/ecdh.h | 2 +- |
| 70 |
include/crypto/if_alg.h | 4 + |
| 71 |
include/crypto/kpp.h | 28 ++ |
| 72 |
include/uapi/linux/if_alg.h | 4 + |
| 73 |
security/keys/dh.c | 2 +- |
| 74 |
14 files changed, 777 insertions(+), 23 deletions(-) |
| 75 |
create mode 100644 crypto/algif_kpp.c |
| 76 |
create mode 100644 crypto/dhparameter.asn1 |
| 77 |
|
| 78 |
-- |
| 79 |
2.13.5 |
| 80 |
|