Re: [RFC PATCH 1/4] X.509: Parse public key parameters from x509 for akcipher

2019-02-23 Thread Vitaly Chikunov
Herbert, On Tue, Feb 19, 2019 at 12:37:32PM +0800, Herbert Xu wrote: > On Sun, Feb 10, 2019 at 09:46:28PM +0300, Vitaly Chikunov wrote: > > > > >From the other point of view, set_params may never be called or > > implemented. So, making it called first and move memory zeroing > > into set_params m

[PATCH v5 02/10] crypto: akcipher - check the presence of callback before the call

2019-02-23 Thread Vitaly Chikunov
Because with introduction of EC-RDSA and change in workings of RSA in regard to sign/verify, akcipher could have not all callbacks defined, check the presence of callbacks before calling them to increase robustness. Signed-off-by: Vitaly Chikunov --- include/crypto/akcipher.h | 25 ++

[PATCH v5 09/10] crypto: ecrdsa - add EC-RDSA test vectors to testmgr

2019-02-23 Thread Vitaly Chikunov
Add testmgr test vectors for EC-RDSA algorithm for every of five supported parameters (curves). Because there are no officially published test vectors for the curves, the vectors are generated by gost-engine. Signed-off-by: Vitaly Chikunov --- crypto/testmgr.c | 6 +++ crypto/testmgr.h | 154 +

[PATCH v5 05/10] X.509: parse public key parameters from x509 for akcipher

2019-02-23 Thread Vitaly Chikunov
Some public key algorithms (like EC-DSA) keep in parameters field important data such as digest and curve OIDs (possibly more for different EC-DSA variants). Thus, just setting a public key (as for RSA) is not enough. Introduce set_params() callback for akcipher which will be used to pass BER enco

[PATCH v5 03/10] crypto: rsa - unimplement sign/verify for raw RSA backends

2019-02-23 Thread Vitaly Chikunov
In preparation for new akcipher verify call remove sign/verify callbacks from RSA backends and make PKCS1 driver call encrypt/decrypt instead. This also complies with the well-known idea that raw RSA should never be used for sign/verify. It only should be used with proper padding scheme such as PK

[PATCH v5 00/10] crypto: add EC-RDSA (GOST 34.10) algorithm

2019-02-23 Thread Vitaly Chikunov
This patchset changes akcipher API to support ECDSA style signature verification, augments x509 parser to make it work with EC-RDSA certificates, and, finally, implements EC-RDSA (GOST 34.10) signature verification and its integration with IMA. Changes since RFC (v1-v4): - akcipher set_max_size, e

[PATCH v5 01/10] KEYS: report to keyctl only actually supported key ops

2019-02-23 Thread Vitaly Chikunov
Because with the introduction of EC-RDSA and change in workings of RSA in regard to sign/verify, akcipher may have not all callbacks defined, report to keyctl only actually supported ops determined by the presence of the akcipher callbacks. Cc: David Howells Cc: keyri...@vger.kernel.org Signed-of

[PATCH v5 07/10] crypto: ecc - make ecc into separate module

2019-02-23 Thread Vitaly Chikunov
ecc.c have algorithms that could be used togeter by ecdh and ecrdsa. Make it separate module. Add CRYPTO_ECC into Kconfig. EXPORT_SYMBOL and document to what seems appropriate. Move structs ecc_point and ecc_curve from ecc_curve_defs.h into ecc.h. No code changes. Signed-off-by: Vitaly Chikunov

[PATCH v5 04/10] crypto: akcipher - new verify API for public key algorithms

2019-02-23 Thread Vitaly Chikunov
Previous akcipher .verify() just `decrypts' (using RSA encrypt which is using public key) signature to uncover message hash, which was then compared in upper level public_key_verify_signature() with the expected hash value, which itself was never passed into verify(). This approach was incompatibl

[PATCH v5 06/10] crypto: Kconfig - create Public-key cryptography section

2019-02-23 Thread Vitaly Chikunov
Group RSA, DH, and ECDH into Public-key cryptography config section. Signed-off-by: Vitaly Chikunov --- crypto/Kconfig | 48 +--- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/crypto/Kconfig b/crypto/Kconfig index bbab6bf33519..370cbd

[PATCH v5 10/10] integrity: support EC-RDSA signatures for asymmetric_verify

2019-02-23 Thread Vitaly Chikunov
Allow to use EC-RDSA signatures for IMA by determining signature type by the hash algorithm name. This works good for EC-RDSA since Streebog and EC-RDSA should always be used together. Cc: Mimi Zohar Cc: Dmitry Kasatkin Cc: linux-integr...@vger.kernel.org Signed-off-by: Vitaly Chikunov --- sec

[PATCH v5 08/10] crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm

2019-02-23 Thread Vitaly Chikunov
Add Elliptic Curve Russian Digital Signature Algorithm (GOST R 34.10-2012, RFC 7091, ISO/IEC 14888-3) is one of the Russian (and since 2018 the CIS countries) cryptographic standard algorithms (called GOST algorithms). Only signature verification is supported, with intent to be used in the IMA. Su

[PATCH 00/12] add missing of_node_put after of_device_is_available

2019-02-23 Thread Julia Lawall
Failure of of_device_is_available implies that the device node should be put, if it is not used otherwise. --- arch/arm/mach-omap2/display.c|4 +++- arch/powerpc/platforms/83xx/usb.c|4 +++- drivers/bus/arm-cci.c

[PATCH 08/12] crypto: add missing of_node_put after of_device_is_available

2019-02-23 Thread Julia Lawall
Add an of_node_put when a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any

Re: [PATCH 2/2] crypto: arm64/chacha - fix hchacha_block_neon() for big endian

2019-02-23 Thread Ard Biesheuvel
On Sat, 23 Feb 2019 at 07:54, Eric Biggers wrote: > > From: Eric Biggers > > On big endian arm64 kernels, the xchacha20-neon and xchacha12-neon > self-tests fail because hchacha_block_neon() outputs little endian words > but the C code expects native endianness. Fix it to output the words in > n

Re: [PATCH 1/2] crypto: arm64/chacha - fix chacha_4block_xor_neon() for big endian

2019-02-23 Thread Ard Biesheuvel
On Sat, 23 Feb 2019 at 07:54, Eric Biggers wrote: > > From: Eric Biggers > > The change to encrypt a fifth ChaCha block using scalar instructions > caused the chacha20-neon, xchacha20-neon, and xchacha12-neon self-tests > to start failing on big endian arm64 kernels. The bug is that the > keystr

[PATCH] crypto: cavium/zip - fix collision with generic cra_driver_name

2019-02-23 Thread Eric Biggers
From: Eric Biggers The cavium/zip implementation of the deflate compression algorithm is incorrectly being registered under the generic driver name, which prevents the generic implementation from being registered with the crypto API when CONFIG_CRYPTO_DEV_CAVIUM_ZIP=y. Similarly the lzs algorith