[PATCH 2/2] crypto: caam - add support for rfc4106(gcm(aes))

2014-10-09 Thread Tudor Ambarus
Add Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) as an IPsec Encapsulating Security Payload (ESP) mechanism to provide confidentiality and data origin authentication. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/caamalg.c | 430

[PATCH 1/2] crypto: caam - add support for gcm(aes)

2014-10-09 Thread Tudor Ambarus
the GCM specification. Signed-off-by: Tudor Ambarus Signed-off-by: Horia Geanta --- drivers/crypto/caam/caamalg.c | 330 -- 1 file changed, 320 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c

[PATCH v2 1/2] crypto: caam - add support for gcm(aes)

2014-10-14 Thread Tudor Ambarus
the GCM specification. Signed-off-by: Tudor Ambarus Signed-off-by: Horia Geanta --- drivers/crypto/caam/caamalg.c | 331 -- 1 file changed, 321 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c

[PATCH v2 2/2] crypto: caam - add support for rfc4106(gcm(aes))

2014-10-14 Thread Tudor Ambarus
Add Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) as an IPsec Encapsulating Security Payload (ESP) mechanism to provide confidentiality and data origin authentication. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/caamalg.c | 423

Re: [PATCH v2 2/2] crypto: caam - add support for rfc4106(gcm(aes))

2014-10-15 Thread Tudor Ambarus
On 10/14/2014 12:17 PM, Tudor Ambarus wrote: +static int rfc4106_setkey(struct crypto_aead *aead, + const u8 *key, unsigned int keylen) +{ + struct caam_ctx *ctx = crypto_aead_ctx(aead); + struct device *jrdev = ctx->jrdev; + int ret

[PATCH 2/2] crypto: caam - add support for rfc4106(gcm(aes))

2014-10-15 Thread Tudor Ambarus
Add Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) as an IPsec Encapsulating Security Payload (ESP) mechanism to provide confidentiality and data origin authentication. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/caamalg.c | 424

[PATCH v3 1/2] crypto: caam - add support for gcm(aes)

2014-10-23 Thread Tudor Ambarus
the GCM specification. Signed-off-by: Tudor Ambarus Signed-off-by: Horia Geanta --- This new patchset fixes GCM's input sequence format, when data is contiguous. drivers/crypto/caam/caamalg.c | 342 -- 1 file changed, 331 insertions(+), 11 dele

[PATCH v3 2/2] crypto: caam - add support for rfc4106(gcm(aes))

2014-10-23 Thread Tudor Ambarus
Add Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) as an IPsec Encapsulating Security Payload (ESP) mechanism to provide confidentiality and data origin authentication. Signed-off-by: Tudor Ambarus --- This new patchset fixes rfc4106's input sequence format, when da

[PATCH] caam: caamalg - fix output sequence contiguity check

2014-10-23 Thread Tudor Ambarus
This patch fixes the assumption that output sequence is not contiguous when input sequence is not contiguous and in-place encryption is done. Output sequence does not need to be contiguous with associated data. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/caamalg.c | 3 ++- 1 file

[PATCH v2] crypto: caam - fix output sequence contiguity check

2014-10-24 Thread Tudor Ambarus
This patch fixes the assumption that output sequence is not contiguous when input sequence is not contiguous and in-place encryption is done. Output sequence does not need to be contiguous with associated data. Signed-off-by: Tudor Ambarus --- Substitute 'caam: caamalg' with 'c

[PATCH] crypto: caam - add support for rfc4543(gcm(aes))

2014-10-30 Thread Tudor Ambarus
Add AES-GMAC as an IPSec ESP mechanism to provide data origin authentication, but not confidentiality. This method is referred as ENCR_NULL_AUTH_AES_GMAC. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/caamalg.c | 459 +- 1 file changed, 458

[PATCH] crypto: caam - add support for rfc4543(gcm(aes))

2014-10-30 Thread Tudor Ambarus
Add AES-GMAC as an IPSec ESP mechanism to provide data origin authentication, but not confidentiality. This method is referred as ENCR_NULL_AUTH_AES_GMAC. Signed-off-by: Tudor Ambarus --- removed a blank line introduced in aead_encrypt function. drivers/crypto/caam/caamalg.c | 458

[PATCH] crypto: caam - treat SGT address pointer as u64

2016-09-29 Thread Tudor Ambarus
!= caam endianness. Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/desc.h | 6 -- drivers/crypto/caam/regs.h | 8 drivers/crypto/caam/sg_sw_sec4.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/caam/desc.h b/drivers/crypto/caam

[PATCH v2] crypto: caam - treat SGT address pointer as u64

2016-09-30 Thread Tudor Ambarus
!= caam endianness. Signed-off-by: Tudor Ambarus --- v2: Removed mx7d restriction. drivers/crypto/caam/desc.h | 6 -- drivers/crypto/caam/regs.h | 8 drivers/crypto/caam/sg_sw_sec4.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/caam

Re: KPP questions and confusion

2017-07-28 Thread Tudor Ambarus
Hi, Marcel, Kyle, On 07/17/2017 09:17 PM, Marcel Holtmann wrote: Hi Kyle, I am confused about several things in the new key agreement code. net/bluetooth/smp.c in two places generates random bytes for the private_key argument to net/bluetooth/ecdh_helper.c:generate_ecdh_keys, which suggests t

Re: [PATCH v8 1/4] crypto: AF_ALG -- add sign/verify API

2017-08-10 Thread Tudor Ambarus
Hi, Stephan, On 08/10/2017 09:39 AM, Stephan Müller wrote: Add the flags for handling signature generation and signature verification. The af_alg helper code as well as the algif_skcipher and algif_aead code must be changed from a boolean indicating the cipher operation to an integer because th

Re: [PATCH v8 1/4] crypto: AF_ALG -- add sign/verify API

2017-08-10 Thread Tudor Ambarus
On 08/10/2017 04:03 PM, Stephan Mueller wrote: Is there a style requirement for that? checkpatch.pl does not complain. I thought that one liners in a conditional should not have braces? Linux coding style requires braces in both branches when you have a branch with a statement and the other w

Re: [PATCH v8 3/4] crypto: AF_ALG -- add asymmetric cipher

2017-08-11 Thread Tudor Ambarus
Hi, Stephan, On 08/10/2017 09:40 AM, Stephan Müller wrote: This patch adds the user space interface for asymmetric ciphers. The interface allows the use of sendmsg as well as vmsplice to provide data. The akcipher interface implementation uses the common AF_ALG interface code regarding TX and R

Re: [PATCH v8 4/4] crypto: algif_akcipher - enable compilation

2017-08-11 Thread Tudor Ambarus
Hi, Stephan, On 08/10/2017 09:40 AM, Stephan Müller wrote: Add the Makefile and Kconfig updates to allow algif_akcipher to be compiled. Signed-off-by: Stephan Mueller --- crypto/Kconfig | 9 + crypto/Makefile | 1 + 2 files changed, 10 insertions(+) Any reason why you keep this p

Re: [PATCH v8 0/4] crypto: add algif_akcipher user space API

2017-08-17 Thread Tudor Ambarus
Hi, all, On 08/11/2017 07:05 PM, Marcel Holtmann wrote: Hi Stephan, AF_ALG is best suited for crypto use cases where a socket is set up once and there are lots of reads and writes to justify the setup cost. With asymmetric crypto, the setup cost is high when you might only use the socket for a

Re: [PATCH v8 3/4] crypto: AF_ALG -- add asymmetric cipher

2017-08-21 Thread Tudor Ambarus
Hi, Stephan, +static int akcipher_setprivkey(void *private, const u8 *key, + unsigned int keylen) +{ + struct akcipher_tfm *tfm = private; + struct crypto_akcipher *akcipher = tfm->akcipher; + int err; + + err = crypto_akcipher_set_priv_key(ak

Re: [PATCH v8 3/4] crypto: AF_ALG -- add asymmetric cipher

2017-08-21 Thread Tudor Ambarus
On 08/21/2017 11:55 AM, Tudor Ambarus wrote: Hi, Stephan, +static int akcipher_setprivkey(void *private, const u8 *key, + unsigned int keylen) +{ +struct akcipher_tfm *tfm = private; +struct crypto_akcipher *akcipher = tfm->akcipher; +int err; + +

Re: Re: [PATCH 0/6] Add support for ECDSA algorithm

2017-08-22 Thread Tudor Ambarus
Hi, Herbert, On 02/02/2017 03:57 PM, Herbert Xu wrote: Yes but RSA had an in-kernel user in the form of module signature verification. We don't add algorithms to the kernel without actual users. So this patch-set needs to come with an actual in-kernel user of ECDSA. ECDSA can be used by the

Re: [PATCH 0/6] Add support for ECDSA algorithm

2017-08-23 Thread Tudor Ambarus
Hi, Sandy, On 08/22/2017 08:22 PM, Sandy Harris wrote: On Tue, Aug 22, 2017 at 12:14 PM, Tudor Ambarus wrote: Hi, Herbert, On 02/02/2017 03:57 PM, Herbert Xu wrote: Yes but RSA had an in-kernel user in the form of module signature verification. We don't add algorithms to the k

Re: [PATCH 7/8] crypto: ecdh - constify key

2017-08-28 Thread Tudor Ambarus
/crypto/ecdh.h @@ -40,7 +40,7 @@ */ struct ecdh { unsigned short curve_id; - char *key; + const char *key; unsigned short key_size; }; I just came across this and remembered that Stephan already made a patch, so: Acked-by: Tudor Ambarus

Re: [PATCH v8 0/4] crypto: add algif_akcipher user space API

2017-08-29 Thread Tudor Ambarus
7 04:17 PM, Tudor Ambarus wrote: Hi, all, On 08/11/2017 07:05 PM, Marcel Holtmann wrote: Hi Stephan, AF_ALG is best suited for crypto use cases where a socket is set up once and there are lots of reads and writes to justify the setup cost. With asymmetric crypto, the setup cost is high when

Re: [PATCH v8 0/4] crypto: add algif_akcipher user space API

2017-08-30 Thread Tudor Ambarus
Hi, Marcel, On 08/30/2017 10:21 AM, Marcel Holtmann wrote: you still need to get the public key out of the kernel if you want to use it from user space. Or feed the remote public key if you plan to use some sort of key derivation function. The crypto hardware that I'm working on, generates

Re: KPP questions and confusion

2017-09-21 Thread Tudor Ambarus
Hi, Marcel, On 08/03/2017 11:40 AM, Marcel Holtmann wrote: Essentially we do what all other key exchange procedure do. Generate a private/public key pair, give the public key to the other side, run DH with the value from the other side. That Bluetooth SMP knows about the private key is really

[RFC PATCH 0/2] let the crypto subsystem generate the ecc privkey

2017-09-21 Thread Tudor Ambarus
generate and handle the ecdh private key, potentially benefiting of hardware ecc private key generation and retention. Tested with selftest and with btmon and smp-tester on top of hci_vhci, with ecdh done in both software and hardware (through atmel-ecc driver). All tests passed. Tudor Ambarus (2

[RESEND RFC PATCH 2/2] Bluetooth: let the crypto subsystem generate the ecc privkey

2017-09-25 Thread Tudor Ambarus
ff-by: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 102 +--- net/bluetooth/smp.c | 55 +--- 2 files changed, 67 insertions(+), 90 deletions(-) diff --git a/net/bluetooth/ecdh_helper.c b/net/bluetooth/ecdh_helper.c index ac

[RESEND RFC PATCH 1/2] Bluetooth: move ecdh allocation outside of ecdh_helper

2017-09-25 Thread Tudor Ambarus
key pair generation with the shared secret computation via the same crypto tfm. Once the key is set, we can compute the shared secret without referring to the private key. Signed-off-by: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 32 --- net/bluetooth/ecdh_helper.h | 8

[RESEND RFC PATCH 0/2] Bluetooth: let the crypto subsystem generate the ecc privkey

2017-09-25 Thread Tudor Ambarus
generate and handle the ecdh private key, potentially benefiting of hardware ecc private key generation and retention. Tested with selftest and with btmon and smp-tester on top of hci_vhci, with ecdh done in both software and hardware (through atmel-ecc driver). All tests passed. Tudor Ambarus

Re: [RESEND RFC PATCH 1/2] Bluetooth: move ecdh allocation outside of ecdh_helper

2017-09-25 Thread Tudor Ambarus
Hi, Marcel, On 09/25/2017 04:02 PM, Marcel Holtmann wrote: diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index a0ef897..6532689 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c [cut] @@ -2677,7 +2695,16 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_

Re: [RESEND RFC PATCH 2/2] Bluetooth: let the crypto subsystem generate the ecc privkey

2017-09-25 Thread Tudor Ambarus
Hi, Marcel, Agreed on all suggestions, I will send a v2 patch set. Thanks, ta

[v2 PATCH 1/5] Bluetooth: move ecdh allocation outside of ecdh_helper

2017-09-28 Thread Tudor Ambarus
Before this change, a new crypto tfm was allocated, each time, for both key generation and shared secret computation. Allocate a single tfm for both cases. Signed-off-by: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 32 - net/bluetooth/ecdh_helper.h | 8 -- net

[v2 PATCH 0/5] Bluetooth: let the crypto subsystem generate the ecc privkey

2017-09-28 Thread Tudor Ambarus
-archive.com/linux-crypto@vger.kernel.org/msg28036.html Changes in v2: - add patches 2, 3, 4. - adress Marcel's suggestions: - revive the check for accidentally generated debug keys - bypass the handling of private key to the crypto subsytem, even when using debug keys. Tudor Ambar

[v2 PATCH 2/5] Bluetooth: ecdh_helper - reveal error codes

2017-09-28 Thread Tudor Ambarus
ned-off-by: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 32 +++- net/bluetooth/ecdh_helper.h | 8 net/bluetooth/smp.c | 17 ++--- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/net/bluetooth/ecdh_helper.c b/net

[v2 PATCH 4/5] Bluetooth: ecdh_helper - fix leak of private key

2017-09-28 Thread Tudor Ambarus
tmp buffer contains the swapped private key. In case the setkey call failed, the tmp buffer was freed without clearing the private key. Zeroize the temporary buffer so we don't leak the private key. Signed-off-by: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 2 +- 1 file chang

[v2 PATCH 3/5] Bluetooth: selftest - check for errors when computing ZZ

2017-09-28 Thread Tudor Ambarus
Signed-off-by: Tudor Ambarus --- net/bluetooth/selftest.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/selftest.c b/net/bluetooth/selftest.c index 126bdc5..ce99648 100644 --- a/net/bluetooth/selftest.c +++ b/net/bluetooth/selftest.c @@ -143,7

[v2 PATCH 5/5] Bluetooth: let the crypto subsystem generate the ecc privkey

2017-09-28 Thread Tudor Ambarus
: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 186 net/bluetooth/ecdh_helper.h | 9 ++- net/bluetooth/selftest.c| 14 +++- net/bluetooth/smp.c | 66 +++- 4 files changed, 147 insertions(+), 128 deletions(-) diff --git a/net

Re: [v2 PATCH 5/5] Bluetooth: let the crypto subsystem generate the ecc privkey

2017-09-28 Thread Tudor Ambarus
backup logic should be done in crypto, if really needed. Signed-off-by: Tudor Ambarus --- net/bluetooth/ecdh_helper.c | 186 net/bluetooth/ecdh_helper.h | 9 ++- net/bluetooth/selftest.c| 14 +++- net/bluetooth/smp.c | 66 +++- 4

[PATCH] crypto: ecdh_helper - return unsigned value for crypto_ecdh_key_len()

2017-09-29 Thread Tudor Ambarus
ECDH_KPP_SECRET_MIN_SIZE and params->key_size are both returning unsigned values. Signed-off-by: Tudor Ambarus --- crypto/ecdh_helper.c | 2 +- include/crypto/ecdh.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/ecdh_helper.c b/crypto/ecdh_helper.c index f05b

[PATCH 1/3] crypto: dh_helper - return unsigned int for dh_data_size()

2017-09-29 Thread Tudor Ambarus
p->key_size, p->p_size, p->g_size are all of unsigned int type. Signed-off-by: Tudor Ambarus --- crypto/dh_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/dh_helper.c b/crypto/dh_helper.c index 8ba8a3f..69869da 100644 --- a/crypto/dh_helper.c +++

[PATCH 3/3] KEYS: dh - make some length variables unsigned

2017-09-29 Thread Tudor Ambarus
Both crypto_kpp_maxsize() and crypto_dh_key_len() are returning unsigned integers. Signed-off-by: Tudor Ambarus --- security/keys/dh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/keys/dh.c b/security/keys/dh.c index d1ea9f3..89e9255 100644 --- a/security

[PATCH 2/3] crypto: dh_helper - return unsigned value for crypto_dh_key_len()

2017-09-29 Thread Tudor Ambarus
DH_KPP_SECRET_MIN_SIZE and dh_data_size() are both returning unsigned values. Signed-off-by: Tudor Ambarus --- crypto/dh_helper.c | 2 +- include/crypto/dh.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/dh_helper.c b/crypto/dh_helper.c index 69869da..a413b31

Re: [PATCH v8 0/4] crypto: add algif_akcipher user space API

2017-10-02 Thread Tudor Ambarus
Hi, all, On 08/10/2017 09:39 AM, Stephan Müller wrote: Hi, This patch set adds the AF_ALG user space API to externalize the asymmetric cipher API recently added to the kernel crypto API. Do we have enough pros and cons so we can decide which interface to use for exporting akcipher/kpp to user

Re: [PATCH 1/3] crypto: dh_helper - return unsigned int for dh_data_size()

2017-10-03 Thread Tudor Ambarus
Hi, David, On 10/03/2017 12:06 PM, David Howells wrote: Tudor Ambarus wrote: -static inline int dh_data_size(const struct dh *p) +static inline unsigned int dh_data_size(const struct dh *p) { return p->key_size + p->p_size + p->g_size; } If this is a problem, do you n

Re: Kernel panic when using ccm(aes) with the Atmel AES HW accelerator

2017-10-23 Thread Tudor Ambarus
Hi, Romain, On 10/18/2017 04:32 PM, Romain Izard wrote: my fix also led to a systematic oops when running the ccm(aes) test case. The NULL deference appears because of a memory corruption issue. atmel-aes does not implement ccm(aes), so the algorithm will be in the following form: ccm_base(at

[PATCH 2/3] crypto: atmel-aes/tdes - remove empty function

2017-10-23 Thread Tudor Ambarus
this empty function along with all the references to it. Signed-off-by: Tudor Ambarus --- drivers/crypto/atmel-aes.c | 14 -- drivers/crypto/atmel-tdes.c | 18 -- 2 files changed, 32 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c

[PATCH 3/3] crypto: atmel-aes/tdes/sha - remove useless irq init

2017-10-23 Thread Tudor Ambarus
irq would be set to -1 and then unused, if we failed to get IORESOURCE_MEM. Signed-off-by: Tudor Ambarus --- drivers/crypto/atmel-aes.c | 2 -- drivers/crypto/atmel-sha.c | 2 -- drivers/crypto/atmel-tdes.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b

[PATCH 1/3] crypto: atmel-aes/tdes/sha - return appropriate error code

2017-10-23 Thread Tudor Ambarus
Return -ENODEV when dma_request_slave_channel_compat() fails. Signed-off-by: Tudor Ambarus --- drivers/crypto/atmel-aes.c | 3 +-- drivers/crypto/atmel-sha.c | 3 +-- drivers/crypto/atmel-tdes.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/atmel-aes.c

Re: Kernel panic when using ccm(aes) with the Atmel AES HW accelerator

2017-10-24 Thread Tudor Ambarus
Hi, Romain, On 10/18/2017 04:32 PM, Romain Izard wrote: diff --git a/crypto/ccm.c b/crypto/ccm.c index 1ce37ae0ce56..e7c2121a3ab2 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c @@ -47,6 +47,7 @@ struct crypto_ccm_req_priv_ctx { u8 odata[16]; u8 idata[16]; u8 auth_tag[16]

Re: Kernel panic when using ccm(aes) with the Atmel AES HW accelerator

2017-10-26 Thread Tudor Ambarus
Hi, Romain, On 10/18/2017 04:32 PM, Romain Izard wrote: diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 29e20c37f3a6..f3eabe1f1490 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -80,6 +80,7 @@ #define AES_FLAGS_BUSY BIT(3) #defi

[v2 PATCH 2/3] crypto: atmel-aes/tdes - remove empty functions

2017-10-26 Thread Tudor Ambarus
this empty functions along with all the references to them. Signed-off-by: Tudor Ambarus --- changes in v2: - remove empty atmel_aes_gcm_exit() drivers/crypto/atmel-aes.c | 20 drivers/crypto/atmel-tdes.c | 18 -- 2 files changed, 38 deletions(-) diff --git

Re: [PATCH 1/4] crypto: dh - fix double free of ctx->p

2017-11-02 Thread Tudor Ambarus
Hi, Eric, On 11/02/2017 12:25 AM, Eric Biggers wrote: When setting the secret with the software Diffie-Hellman implementation, if allocating 'g' failed (e.g. if it was longer than MAX_EXTERN_MPI_BITS), then 'p' was freed twice: once immediately, and once later when the crypto_kpp tfm was destroy

Re: [PATCH 2/4] crypto: dh - don't permit 'p' to be 0

2017-11-02 Thread Tudor Ambarus
Hi, Eric, On 11/02/2017 12:25 AM, Eric Biggers wrote: If 'p' is 0 for the software Diffie-Hellman implementation, then dh_max_size() returns 0. dh_set_secret() returns -EINVAL if p_len < 1536, see dh_check_params_length(). What am I missing? Cheers, ta

Re: [PATCH] crypto: ccm - preserve the IV buffer

2017-11-02 Thread Tudor Ambarus
ccm_decrypt_done, req); Reviewed-by: Tudor Ambarus

[PATCH] crypto: ecdh - remove empty exit()

2017-11-02 Thread Tudor Ambarus
Pointer members of an object with static storage duration, if not explicitly initialized, will be initialized to a NULL pointer. The crypto API checks if this pointer is not NULL before using it, we are safe to remove the function. Signed-off-by: Tudor Ambarus --- crypto/ecdh.c | 6 -- 1

[v3 PATCH 2/3] crypto: atmel-aes/tdes - remove empty functions

2017-11-02 Thread Tudor Ambarus
Pointer members of an object with static storage duration, if not explicitly initialized, will be initialized to a NULL pointer. The crypto API checks if these pointers are not NULL before using them, therefore we can safely remove these empty functions. Signed-off-by: Tudor Ambarus --- changes

Re: [PATCH 2/4] crypto: dh - don't permit 'p' to be 0

2017-11-02 Thread Tudor Ambarus
sg_set_buf include/linux/scatterlist.h:140 [inline] RSP: 88006c7cfb08 RIP: sg_init_one+0x1b3/0x240 lib/scatterlist.c:156 RSP: 88006c7cfb08 Fixes: 802c7f1c84e4 ("crypto: dh - Add DH software implementation") Cc: # v4.8+ Signed-off-by: Eric Biggers Reviewed-by: Tudor Ambarus

Re: [PATCH v2 1/5] crypto: dh - Fix double free of ctx->p

2017-11-06 Thread Tudor Ambarus
4_fastpath+0x1f/0xbe Fixes: 802c7f1c84e4 ("crypto: dh - Add DH software implementation") Cc: # v4.8+ Signed-off-by: Eric Biggers Reviewed-by: Tudor Ambarus --- crypto/dh.c | 33 + 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/c

Re: [PATCH v2 3/5] crypto: dh - Don't permit 'key' or 'g' size longer than 'p'

2017-11-06 Thread Tudor Ambarus
llowed users to cause a buffer underflow via KEYCTL_DH_COMPUTE. Fix this by updating crypto_dh_decode_key() to verify this precondition for all DH implementations. Fixes: c9839143ebbf ("crypto: qat - Add DH support") Cc: # v4.8+ Reviewed-by: Tudor Ambarus Signed-off-by: Eric Bigge

Re: [PATCH v2 5/5] crypto: dh - Remove pointless checks for NULL 'p' and 'g'

2017-11-06 Thread Tudor Ambarus
On 11/06/2017 04:30 AM, Eric Biggers wrote: From: Eric Biggers Neither 'p' nor 'g' can be NULL, as they were unpacked using crypto_dh_decode_key(). And it makes no sense for them to be optional. So remove the NULL checks that were copy-and-pasted into both modules.

Re: [PATCH 2/2] crypto: atmel-aes - Reset the controller before each use

2017-11-06 Thread Tudor Ambarus
Hi, Romain, On 10/31/2017 05:25 PM, Romain Izard wrote: When using the rfc4543(gcm(aes))) mode, the registers of the hardware engine are not empty after use. If the engine is not reset before its next use, the following results will be invalid. Always reset the hardware engine. Thanks for the

Re: [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed()

2017-11-13 Thread Tudor Ambarus
Hi, On 10/10/2017 01:21 PM, Robert Baronescu wrote: In case buffer length is a multiple of PAGE_SIZE, the S/G table is incorrectly generated. Fix this by handling buflen = k * PAGE_SIZE separately. Signed-off-by: Robert Baronescu --- crypto/tcrypt.c | 6 -- 1 file changed, 4 insertions(

Re: [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed()

2017-11-13 Thread Tudor Ambarus
Hi, On 11/12/2017 06:26 PM, Horia Geantă wrote: -sg[0] - (1 entry) reserved for associated data, filled outside sg_init_aead() Let's fill the sg[0] with aad inside sg_init_aead()! Cheers, ta

[PATCH] crypto: tcrypt - set assoc in sg_init_aead()

2017-11-14 Thread Tudor Ambarus
Results better code readability. Signed-off-by: Tudor Ambarus --- Should be applied after: crypto: tcrypt - fix S/G table for test_aead_speed() crypto/tcrypt.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index

[PATCH 1/3] crypto: scatterwak - Add scatterwalk_sg_copychunks

2016-02-22 Thread Tudor Ambarus
This patch adds the function scatterwalk_sg_copychunks which writes a chunk of data from a scatterwalk to another scatterwalk. It will be used by caam driver to remove the leading zeros of RSA's algorithm output. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c

[PATCH 2/3] crypto: scatterwalk - export scatterwalk_pagedone

2016-02-22 Thread Tudor Ambarus
Used in caam driver. Export the symbol since the caam driver can be built as a module. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c | 5 +++-- include/crypto/scatterwalk.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/scatterwalk.c b/crypto

[PATCH 3/3] crypto: caam - add support for RSA algorithm

2016-02-22 Thread Tudor Ambarus
Add RSA support to caam driver. Coauthored-by: Yashpal Dutta Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/Kconfig | 13 + drivers/crypto/caam/Makefile | 13 + drivers/crypto/caam/caam_rsaprivkey.asn1 | 11 + drivers/crypto/caam/caam_rsapubkey.asn1 | 4

[PATCH v2 3/3] crypto: caam - add support for RSA algorithm

2016-02-24 Thread Tudor Ambarus
Add RSA support to caam driver. Coauthored-by: Yashpal Dutta Signed-off-by: Tudor Ambarus --- v2: use kzfree instead of memset with zero and kfree. drivers/crypto/caam/Kconfig | 13 + drivers/crypto/caam/Makefile | 13 + drivers/crypto/caam/caam_rsaprivkey.asn1

[PATCH 09/10] crypto: scatterwalk - export scatterwalk_pagedone

2016-03-19 Thread Tudor Ambarus
Used in caam driver. Export the symbol since the caam driver can be built as a module. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c | 5 +++-- include/crypto/scatterwalk.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/scatterwalk.c b/crypto

[PATCH 05/10] crypto: qat - avoid memory corruption or undefined behaviour

2016-03-19 Thread Tudor Ambarus
memcopying to a (null pointer + offset) will result in memory corruption or undefined behaviour. Signed-off-by: Tudor Ambarus --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b

[PATCH 08/10] crypto: scatterwak - Add scatterwalk_sg_copychunks

2016-03-19 Thread Tudor Ambarus
This patch adds the function scatterwalk_sg_copychunks which writes a chunk of data from a scatterwalk to another scatterwalk. It will be used by caam driver to remove the leading zeros of RSA's algorithm output. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c

[PATCH 03/10] crypto: add CONFIG_ symbol for rsa helper

2016-03-19 Thread Tudor Ambarus
All RSA implementations can now use the key extract symbols by selecting CRYPTO_RSA_HELPER. Signed-off-by: Tudor Ambarus --- crypto/Kconfig | 8 ++-- crypto/Makefile | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/crypto/Kconfig b/crypto/Kconfig index f6bfdda

[PATCH 07/10] crypto: qat - remove duplicate ASN.1 parser

2016-03-19 Thread Tudor Ambarus
Use the RSA's software implementation parser with raw integer actions. Compile-tested only. Signed-off-by: Tudor Ambarus --- drivers/crypto/qat/Kconfig| 3 +- drivers/crypto/qat/qat_common/Makefile| 10 +- drivers/crypto/qat/qat_common/qat_asym_a

[PATCH 01/10] crypto: rsa - generalize ASN.1 sequences

2016-03-19 Thread Tudor Ambarus
tions. Signed-off-by: Tudor Ambarus --- crypto/rsa.c | 48 + crypto/rsa_helper.c | 117 +- include/crypto/internal/rsa.h | 28 +++--- 3 files changed, 130 insertions(+), 63 deletions(-) diff --git a/crypto/rs

[PATCH 04/10] crypto: rsa_helper - export symbols for asn1 structures

2016-03-19 Thread Tudor Ambarus
Export rsapubkey_decoder and rsaprivkey_decoder structures, since they can (will) be used by caam and qat drivers. Signed-off-by: Tudor Ambarus --- crypto/rsa_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/rsa_helper.c b/crypto/rsa_helper.c index 1708db8..14aef69 100644

[PATCH 06/10] crypto: qat - fix address leaking of RSA public exponent

2016-03-19 Thread Tudor Ambarus
Signed-off-by: Tudor Ambarus --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index 8dbbf084..05f49d4 100644 --- a/drivers/crypto

[PATCH 02/10] crypto: rsa_helper - add raw integer parser actions

2016-03-19 Thread Tudor Ambarus
Dedicated to RSA (hardware) implementations that want to use raw integers instead of MPI keys. Signed-off-by: Tudor Ambarus --- crypto/rsa.c | 15 crypto/rsa_helper.c | 158 ++ include/crypto/internal/rsa.h | 24

[PATCH 10/10] crypto: caam - add support for RSA algorithm

2016-03-19 Thread Tudor Ambarus
Add RSA support to caam driver. Coauthored-by: Yashpal Dutta Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/Kconfig| 12 + drivers/crypto/caam/Makefile | 4 + drivers/crypto/caam/caampkc.c | 513 + drivers/crypto/caam/caampkc.h | 84

[PATCH v2 1/4] crypto: rsa - generalize ASN.1 sequences

2016-03-23 Thread Tudor Ambarus
ction pointers to specific actions. Signed-off-by: Tudor Ambarus --- crypto/rsa.c | 60 ++- crypto/rsa_helper.c | 166 -- include/crypto/internal/rsa.h | 31 ++-- 3 files changed, 194 insertions(+), 63 deletions(-)

[PATCH v2 0/4] crypto: rsa - generalize ASN.1 sequences

2016-03-23 Thread Tudor Ambarus
herent_key functions - export raw_rsa_get_ symbols Tudor Ambarus (4): crypto: rsa - generalize ASN.1 sequences crypto: rsa_helper - add raw integer parser actions crypto: add CONFIG_ symbol for rsa helper crypto: rsa_helper - export symbols for asn1 structures crypto/Kconfig

[PATCH v2 2/4] crypto: rsa_helper - add raw integer parser actions

2016-03-23 Thread Tudor Ambarus
Dedicated to RSA (hardware) implementations that want to use raw integers instead of MPI keys. Signed-off-by: Tudor Ambarus --- crypto/rsa.c | 15 crypto/rsa_helper.c | 182 ++ include/crypto/internal/rsa.h | 28

[PATCH v2 4/4] crypto: rsa_helper - export symbols for asn1 structures

2016-03-23 Thread Tudor Ambarus
Export rsapubkey_decoder and rsaprivkey_decoder structures, since they can (will) be used by caam and qat drivers. Signed-off-by: Tudor Ambarus --- crypto/rsa_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/rsa_helper.c b/crypto/rsa_helper.c index df1f480..d81a0ec 100644

[PATCH v2 3/4] crypto: add CONFIG_ symbol for rsa helper

2016-03-23 Thread Tudor Ambarus
All RSA implementations can now use the key extract symbols by selecting CRYPTO_RSA_HELPER. Signed-off-by: Tudor Ambarus --- crypto/Kconfig | 8 ++-- crypto/Makefile | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/crypto/Kconfig b/crypto/Kconfig index f6bfdda

[PATCH v2 0/3] crypto: caam - add support for RSA algorithm

2016-03-23 Thread Tudor Ambarus
a_free_key helper function - fix memory leaks on error path - rename rsa akcipher_alg struct to caam_rsa Tudor Ambarus (3): crypto: scatterwak - Add scatterwalk_sg_copychunks crypto: scatterwalk - export scatterwalk_pagedone crypto: caam - add support for RSA algorith

[PATCH v2 2/3] crypto: scatterwalk - export scatterwalk_pagedone

2016-03-23 Thread Tudor Ambarus
Used in caam driver. Export the symbol since the caam driver can be built as a module. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c | 5 +++-- include/crypto/scatterwalk.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/scatterwalk.c b/crypto

[PATCH v2 3/3] crypto: caam - add support for RSA algorithm

2016-03-23 Thread Tudor Ambarus
Add RSA support to caam driver. Coauthored-by: Yashpal Dutta Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/Kconfig| 12 + drivers/crypto/caam/Makefile | 4 + drivers/crypto/caam/caampkc.c | 509 + drivers/crypto/caam/caampkc.h | 84

[PATCH v2 1/3] crypto: scatterwak - Add scatterwalk_sg_copychunks

2016-03-23 Thread Tudor Ambarus
This patch adds the function scatterwalk_sg_copychunks which writes a chunk of data from a scatterwalk to another scatterwalk. It will be used by caam driver to remove the leading zeros of RSA's algorithm output. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c

[PATCH v2 2/2] crypto: qat - fix address leaking of RSA public exponent

2016-03-23 Thread Tudor Ambarus
Signed-off-by: Tudor Ambarus --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index 8dbbf084..05f49d4 100644 --- a/drivers/crypto

[PATCH v2 0/2] crypto: qat fixes

2016-03-23 Thread Tudor Ambarus
Initial patch set can be found here: http://www.mail-archive.com/linux-crypto@vger.kernel.org/msg18185.html This patch set is no longer related to the generalized ASN.1 parser. Tadeusz will remove the ASN.1 parser from qat. No changes from initial patch set. Tudor Ambarus (2): crypto

[PATCH v2 1/2] crypto: qat - avoid memory corruption or undefined behaviour

2016-03-23 Thread Tudor Ambarus
memcopying to a (null pointer + offset) will result in memory corruption or undefined behaviour. Signed-off-by: Tudor Ambarus --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b

[PATCH v3 2/3] crypto: rsa_helper - add raw integer parser actions

2016-04-06 Thread Tudor Ambarus
Dedicated to RSA (hardware) implementations that want to use raw integers instead of MPI keys. Signed-off-by: Tudor Ambarus --- crypto/rsa.c | 15 crypto/rsa_helper.c | 182 ++ include/crypto/internal/rsa.h | 28

[PATCH v3 1/3] crypto: rsa - generalize ASN.1 sequences

2016-04-06 Thread Tudor Ambarus
ction pointers to specific actions. Signed-off-by: Tudor Ambarus --- crypto/rsa.c | 60 ++- crypto/rsa_helper.c | 166 -- include/crypto/internal/rsa.h | 31 ++-- 3 files changed, 194 insertions(+), 63 deletions(-)

[PATCH v3 0/3] crypto: rsa - generalize ASN.1 sequences

2016-04-06 Thread Tudor Ambarus
v2 patch set can be found here: http://www.mail-archive.com/linux-crypto%40vger.kernel.org/msg18269.html Changes to v2 patch set: - "crypto: add CONFIG_ symbol for rsa helper" - removed. The drivers will select the CRYPTO_RSA symbol instead. Tudor Ambarus (3): c

[PATCH v3 1/3] crypto: scatterwak - Add scatterwalk_sg_copychunks

2016-04-06 Thread Tudor Ambarus
This patch adds the function scatterwalk_sg_copychunks which writes a chunk of data from a scatterwalk to another scatterwalk. It will be used by caam driver to remove the leading zeros of RSA's algorithm output. Signed-off-by: Tudor Ambarus --- crypto/scatterwalk.c

[PATCH v3 3/3] crypto: rsa_helper - export symbols for asn1 structures

2016-04-06 Thread Tudor Ambarus
Export rsapubkey_decoder and rsaprivkey_decoder structures, since they can (will) be used by caam and qat drivers. Signed-off-by: Tudor Ambarus --- crypto/rsa_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/rsa_helper.c b/crypto/rsa_helper.c index df1f480..d81a0ec 100644

[PATCH v3 3/3] crypto: caam - add support for RSA algorithm

2016-04-06 Thread Tudor Ambarus
Add RSA support to caam driver. Coauthored-by: Yashpal Dutta Signed-off-by: Tudor Ambarus --- drivers/crypto/caam/Kconfig| 12 + drivers/crypto/caam/Makefile | 4 + drivers/crypto/caam/caampkc.c | 509 + drivers/crypto/caam/caampkc.h | 84

[PATCH v3 0/3] crypto: caam - add support for RSA algorithm

2016-04-06 Thread Tudor Ambarus
it selects CRYPTO_RSA Tudor Ambarus (3): crypto: scatterwak - Add scatterwalk_sg_copychunks crypto: scatterwalk - export scatterwalk_pagedone crypto: caam - add support for RSA algorithm crypto/scatterwalk.c | 31 ++- drivers/crypto/caam/Kconfig| 12 + drivers/crypto/caam/Makefi

  1   2   3   >