Re: crypto-ixp4xx: Deletion of a few unnecessary checks
>> Delete unnecessary checks before the function call "dma_pool_destroy" It seems that you accepted this specific update suggestion, didn't you? https://lkml.org/lkml/2015/11/17/391 https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1021951.html >> Reduce assignment for a variable in init_ixp_crypto() >> crypto-ixp4xx: Less function calls in init_ixp_crypto() after error >> detection > > You completely ignored my comments. Nack. Will it be useful to clarify the proposed changes a bit more? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
A new, fast and "unbreakable" encryption algorithm
Hello, I've developed a new encryption algorithm, which dynamically changes the key according to plaintext and practically impossible to break. I also opened to public with MIT&GPL dual License. It is also quite fast; ~80% faster than the fastest mode of AES without cpu instruction set support. I will present a paper on a Turkish National Inet-tr 2015 Symposium on 3 December: It is a very simple and yet efficient logic. Anyone who looks at the self documented(in English) C code at http://ismail-kizir.blogspot.com/2015/11/hohha-dynamic-xor-algorithm-source-code.html may understand why and how it is unbreakable. I simply use the key as a jump table and, with every encrypted byte, I change the jump table(the key) as a result of 3-4 parameters including the last plaintext byte itself. Briefly, I encypt the plaintext with the key and also dynamically encrypt the key with the plaintext. The code is self documented in English. On Linux simply gcc HohhaDynamicXOR.c -O2 -Wall ./a.out will make integrity checks and print benchmarks. It is production ready. Other algorithm results are the output of the "openssl speed" command. If I am right; you will not be disappointed to include "Hohha Dynamic XOR Encryption Algorithm" on Linux Kernel. I will be glad to see my algorithm included in Linux distributions. Regards Ismail Kizir -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] crypto: Multi-buffer encryptioin infrastructure support
On Tue, Nov 17, 2015 at 04:30:14PM -0800, Tim Chen wrote: > On Wed, 2015-11-18 at 08:07 +0800, Herbert Xu wrote: > > On Tue, Nov 17, 2015 at 02:59:29PM -0800, Tim Chen wrote: > > > > > > Herbert, would you prefer me to use ablkcipher scatter walk instead, > > > assuming the overhead of both walk are about the same? > > > > Well since you are going to potentially sleep in the middle of > > an operation I'd think ablkcipher is required, no? > > We're using blkcipher walk in the implementation. > As long as we use kmap and instead of kmap_atomic, > it allows us to sleep in the middle of the walk. What if you were called from an atomic context, such as IPsec? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] crypto: Multi-buffer encryptioin infrastructure support
On Wed, 2015-11-18 at 08:07 +0800, Herbert Xu wrote: > On Tue, Nov 17, 2015 at 02:59:29PM -0800, Tim Chen wrote: > > > > Herbert, would you prefer me to use ablkcipher scatter walk instead, > > assuming the overhead of both walk are about the same? > > Well since you are going to potentially sleep in the middle of > an operation I'd think ablkcipher is required, no? We're using blkcipher walk in the implementation. As long as we use kmap and instead of kmap_atomic, it allows us to sleep in the middle of the walk. Tim -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] crypto: Multi-buffer encryptioin infrastructure support
On Tue, Nov 17, 2015 at 02:59:29PM -0800, Tim Chen wrote: > > Herbert, would you prefer me to use ablkcipher scatter walk instead, > assuming the overhead of both walk are about the same? Well since you are going to potentially sleep in the middle of an operation I'd think ablkcipher is required, no? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] crypto: akcipher: add crypto_akcipher_type methods needed by templates.
On Tue, Nov 17, 2015 at 10:47:11PM +0100, Andrzej Zaborowski wrote: > > Will you then accept a patch to add a cra_u.akcipher to struct > crypto_alg? I see shash/ahash use one method to create instances and No as struct crypto_alg is obsolete. > blkcipher use another. I have no way to know which of them is > "obsolete" (possibly both) and that was the reason for sending an RFC > first. AEAD is the best example to use for templates. It was recently converted. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks
On Tue, Nov 17, 2015 at 04:32:47PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 17 Nov 2015 16:26:01 +0100 > Subject: [PATCH 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks > > Further update suggestions were taken into account after a patch > was applied from static source code analysis. > > Markus Elfring (3): > Delete unnecessary checks before the function call "dma_pool_destroy" > Reduce assignment for a variable in init_ixp_crypto() > crypto-ixp4xx: Less function calls in init_ixp_crypto() after error > detection You completely ignored my comments. Nack. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] crypto: Multi-buffer encryptioin infrastructure support
On Tue, 2015-11-17 at 21:06 +0800, Herbert Xu wrote: > On Thu, Oct 29, 2015 at 03:21:03PM -0700, Tim Chen wrote: > > > > c) Add support to crypto scatterwalk support that can sleep during > > encryption operation, as we may have buffers for jobs in data lanes > > that are half-finished, waiting for additional jobs to come to fill > > empty lanes before we start the encryption again. Therefore, we need to > > enhance crypto walk with the option to map data buffers non-atomically. > > This is done by algorithms run from crypto daemon who knows it is safe > > to do so as it can save and restore FPU state in correct context. > > What about the existing ablkcipher scatterwalk helpers? > > Cheers, I suppose blkcipher was originally used because we were under the impression that there are less buffer copying and less allocation of intermediate buffers with blkcipher walk. But looking at the blkcipher walk and ablkcipher walk code more carefully now, I am not sure that's really true as it seems like ablkcipher keep all intermediate buffers till the end and copy them to destination in one shot while blkcipher does that at walk of every chunk. The advantage of blkcipher is you don't have as many outstanding buffers in a list. If there's really not much speed difference, I can try to use ablkcipher. Herbert, would you prefer me to use ablkcipher scatter walk instead, assuming the overhead of both walk are about the same? Thanks. Tim -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: sun4i-ss: add missing statesize
On Tue, Nov 17, 2015 at 10:27:42PM +0800, Herbert Xu wrote: > On Tue, Nov 17, 2015 at 03:26:03PM +0100, LABBE Corentin wrote: > > > > I have lots of user reporting that they cannot use the device since it wont > > load. > > For me it need to go stable since it respect all "stable rules", simple, > > tested, minimal, and fix a real bug that bother people. > > Well it will hit stable eventually. I just don't feel comfortable > with sending it in straight away. You can't send it in "straight away", the rule is that it has to be in Linus's tree first, don't worry, you are doing it correctly. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] crypto: akcipher: add crypto_akcipher_type methods needed by templates.
Hi Herbert, On 17 November 2015 at 14:42, Herbert Xu wrote: > Andrew Zaborowski wrote: >> Add two dummy methods that are required by the crypto API internals: >> .ctxsize and .init >> (just because the framework calls them without checking if they were >> provided). They're only required by the complicated code path needed to >> instantiate a template algorithm. Also expose crypto_akcipher_type like >> other crypto types are exposed to be used from outside modules. >> >> Signed-off-by: Andrew Zaborowski > > Nack. They are only required if you use obsolete methods of creating > a tfm. Will you then accept a patch to add a cra_u.akcipher to struct crypto_alg? I see shash/ahash use one method to create instances and blkcipher use another. I have no way to know which of them is "obsolete" (possibly both) and that was the reason for sending an RFC first. Best regards -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] nx-842: Ignore bit 3 of condition register returned by icswx
On Tue, Nov 17, 2015 at 10:00:20PM +0800, Herbert Xu wrote: > On Fri, Oct 30, 2015 at 03:43:01PM -0700, Ram Pai wrote: > > icswx occasionally under heavy load sets bit 3 of condition register 0. > > It has no software implication. > > > > Currently that bit is interpreted by the driver as a failure, when > > it should have calmly ignored it. > > > > Signed-off-by: Ram Pai > > Your patch is corrupted: > > $ patch -s -p1 < .git/rebase-apply/patch > patch: malformed patch at line 21: To unsubscribe from this list: send > the line "unsubscribe linux-crypto" in > $ Herbert, There were some comments about the patch on the ppc mailing list. There are times this bit could be set and could be used by its consumers; depending on how the RFC is implemented by the hardware. The RFC does allow the hardware to assign meaning to that bit; though no hardware currently exploits that feature. However from a software point of view, we probably should not ignore the bit entirely. So please ignore this patch till we come with a better solution. RP > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- Ram Pai -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] keys, trusted: select hash algorithm for TPM2 chips
Added 'hash=' option for selecting the hash algorithm for add_key() syscall and documentation for it. Added entry for sm3-256 to the following tables in order to support TPM_ALG_SM3_256: * hash_algo_name * hash_digest_size Includes support for the following hash algorithms: * sha1 * sha256 * sha384 * sha512 * sm3-256 v2: * Added missing select CRYPTO_HASH_INFO to security/keys/Kconfig v3: * Squashed patches into a single patch as the commits did not make alone any sense. * Added a klog message when TPM 1.x is used for sealing and other than SHA-1 is used as the hash algorithm. * Got rid of TPM2_HASH_COUNT and moved into ARRAY_SIZE(tpm2_hash_map). v4: * Added missing select CRYPTO_HASH_INFO to drivers/char/tpm/Kconfig v5: * Minor clean ups. * Removed dev_dbg() from tpm2-cmd.c in order to get rid of CRYPTO_HASH_INFO dep. Signed-off-by: Jarkko Sakkinen Reviewed-by: James Morris --- Documentation/security/keys-trusted-encrypted.txt | 3 ++ crypto/hash_info.c| 2 ++ drivers/char/tpm/tpm.h| 10 +-- drivers/char/tpm/tpm2-cmd.c | 36 +-- include/crypto/hash_info.h| 3 ++ include/keys/trusted-type.h | 1 + include/uapi/linux/hash_info.h| 1 + security/keys/Kconfig | 1 + security/keys/trusted.c | 27 - 9 files changed, 77 insertions(+), 7 deletions(-) diff --git a/Documentation/security/keys-trusted-encrypted.txt b/Documentation/security/keys-trusted-encrypted.txt index e105ae9..fd2565b 100644 --- a/Documentation/security/keys-trusted-encrypted.txt +++ b/Documentation/security/keys-trusted-encrypted.txt @@ -38,6 +38,9 @@ Usage: pcrlock= pcr number to be extended to "lock" blob migratable= 0|1 indicating permission to reseal to new PCR values, default 1 (resealing allowed) + hash= hash algorithm name as a string. For TPM 1.x the only + allowed value is sha1. For TPM 2.x the allowed values + are sha1, sha256, sha384, sha512 and sm3-256. "keyctl print" returns an ascii hex copy of the sealed key, which is in standard TPM_STORED_DATA format. The key length for new keys are always in bytes. diff --git a/crypto/hash_info.c b/crypto/hash_info.c index 3e7ff46..7b1e0b1 100644 --- a/crypto/hash_info.c +++ b/crypto/hash_info.c @@ -31,6 +31,7 @@ const char *const hash_algo_name[HASH_ALGO__LAST] = { [HASH_ALGO_TGR_128] = "tgr128", [HASH_ALGO_TGR_160] = "tgr160", [HASH_ALGO_TGR_192] = "tgr192", + [HASH_ALGO_SM3_256] = "sm3-256", }; EXPORT_SYMBOL_GPL(hash_algo_name); @@ -52,5 +53,6 @@ const int hash_digest_size[HASH_ALGO__LAST] = { [HASH_ALGO_TGR_128] = TGR128_DIGEST_SIZE, [HASH_ALGO_TGR_160] = TGR160_DIGEST_SIZE, [HASH_ALGO_TGR_192] = TGR192_DIGEST_SIZE, + [HASH_ALGO_SM3_256] = SM3256_DIGEST_SIZE, }; EXPORT_SYMBOL_GPL(hash_digest_size); diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index a4257a3..cdd49cd 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -83,16 +83,20 @@ enum tpm2_structures { }; enum tpm2_return_codes { - TPM2_RC_INITIALIZE = 0x0100, - TPM2_RC_TESTING = 0x090A, + TPM2_RC_HASH= 0x0083, /* RC_FMT1 */ + TPM2_RC_INITIALIZE = 0x0100, /* RC_VER1 */ TPM2_RC_DISABLED= 0x0120, + TPM2_RC_TESTING = 0x090A, /* RC_WARN */ }; enum tpm2_algorithms { TPM2_ALG_SHA1 = 0x0004, TPM2_ALG_KEYEDHASH = 0x0008, TPM2_ALG_SHA256 = 0x000B, - TPM2_ALG_NULL = 0x0010 + TPM2_ALG_SHA384 = 0x000C, + TPM2_ALG_SHA512 = 0x000D, + TPM2_ALG_NULL = 0x0010, + TPM2_ALG_SM3_256= 0x0012, }; enum tpm2_command_codes { diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index c121304..d9d0822 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -16,6 +16,7 @@ */ #include "tpm.h" +#include #include enum tpm2_object_attributes { @@ -104,6 +105,19 @@ struct tpm2_cmd { union tpm2_cmd_params params; } __packed; +struct tpm2_hash { + unsigned int crypto_id; + unsigned int tpm_id; +}; + +static struct tpm2_hash tpm2_hash_map[] = { + {HASH_ALGO_SHA1, TPM2_ALG_SHA1}, + {HASH_ALGO_SHA256, TPM2_ALG_SHA256}, + {HASH_ALGO_SHA384, TPM2_ALG_SHA384}, + {HASH_ALGO_SHA512, TPM2_ALG_SHA512}, + {HASH_ALGO_SM3_256, TPM2_ALG_SM3_256}, +}; + /* * Array with one entry per ordinal defining the maximum amount * of time the chip could take to return the result. The values @@ -429,8 +443,20 @@ int tpm2_seal_trusted(struct tpm_chip *chip, { unsigned int blob_len;
[PATCH 0/2] TPM 2.0 trusted key features for v4.5
These are the remaining features to enable trusted keys for TPM 2.0 that very not finished by the v4.4 merge window. These patches enable authorization policy based sealing (like using PCRs together with a password for example or something more complicated) with a user selected hash algorithm. Jarkko Sakkinen (2): keys, trusted: select hash algorithm for TPM2 chips keys, trusted: seal with a policy Documentation/security/keys-trusted-encrypted.txt | 31 ++ crypto/hash_info.c| 2 + drivers/char/tpm/tpm.h| 10 +++- drivers/char/tpm/tpm2-cmd.c | 60 --- include/crypto/hash_info.h| 3 + include/keys/trusted-type.h | 4 ++ include/uapi/linux/hash_info.h| 1 + security/keys/Kconfig | 1 + security/keys/trusted.c | 73 ++- 9 files changed, 161 insertions(+), 24 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection
From: Markus Elfring Date: Tue, 17 Nov 2015 16:15:21 +0100 The dma_pool_destroy() function was called in up to two cases by the init_ixp_crypto() function during error handling even if a call of the dma_pool_create() function failed. This implementation detail could be improved by the adjustment of jump targets according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/crypto/ixp4xx_crypto.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 79b6958..0a5969c 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -483,23 +483,23 @@ static int init_ixp_crypto(struct device *dev) sizeof(struct buffer_desc), 32, 0); if (!buffer_pool) { ret = -ENOMEM; - goto err; + goto release_npe; } ctx_pool = dma_pool_create("context", dev, NPE_CTX_LEN, 16, 0); if (!ctx_pool) { ret = -ENOMEM; - goto err; + goto destroy_buffer_pool; } ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0, "ixp_crypto:out", NULL); if (ret) - goto err; + goto destroy_ctx_pool; ret = qmgr_request_queue(RECV_QID, NPE_QLEN, 0, 0, "ixp_crypto:in", NULL); if (ret) { qmgr_release_queue(SEND_QID); - goto err; + goto destroy_ctx_pool; } qmgr_set_irq(RECV_QID, QUEUE_IRQ_SRC_NOT_EMPTY, irqhandler, NULL); tasklet_init(&crypto_done_tasklet, crypto_done_action, 0); @@ -510,9 +510,11 @@ static int init_ixp_crypto(struct device *dev) npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; -err: +destroy_ctx_pool: dma_pool_destroy(ctx_pool); +destroy_buffer_pool: dma_pool_destroy(buffer_pool); +release_npe: npe_release(npe_c); return ret; } -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/3] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto()
From: Markus Elfring Date: Tue, 17 Nov 2015 15:45:32 +0100 The variable "ret" was set more often than necessary by the init_ixp_crypto() function. * Omit its initialisation at the beginning. * Use an error return code in two cases directly. * Improve compliance with the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/crypto/ixp4xx_crypto.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index e52496a..79b6958 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -433,17 +433,17 @@ static void crypto_done_action(unsigned long arg) static int init_ixp_crypto(struct device *dev) { - int ret = -ENODEV; + int ret; u32 msg[2] = { 0, 0 }; if (! ( ~(*IXP4XX_EXP_CFG2) & (IXP4XX_FEATURE_HASH | IXP4XX_FEATURE_AES | IXP4XX_FEATURE_DES))) { printk(KERN_ERR "ixp_crypto: No HW crypto available\n"); - return ret; + return -ENODEV; } npe_c = npe_request(NPE_ID); if (!npe_c) - return ret; + return -ENODEV; if (!npe_running(npe_c)) { ret = npe_load_firmware(npe_c, npe_name(npe_c), dev); @@ -481,13 +481,14 @@ static int init_ixp_crypto(struct device *dev) BUILD_BUG_ON(SHA1_DIGEST_SIZE > sizeof(struct buffer_desc)); buffer_pool = dma_pool_create("buffer", dev, sizeof(struct buffer_desc), 32, 0); - ret = -ENOMEM; if (!buffer_pool) { + ret = -ENOMEM; goto err; } ctx_pool = dma_pool_create("context", dev, NPE_CTX_LEN, 16, 0); if (!ctx_pool) { + ret = -ENOMEM; goto err; } ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0, -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/3] crypto-ixp4xx: Delete unnecessary checks before the function call "dma_pool_destroy"
From: Markus Elfring Date: Sun, 15 Nov 2015 16:51:21 +0100 The dma_pool_destroy() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/crypto/ixp4xx_crypto.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 8f27903..e52496a 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -510,10 +510,8 @@ npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; err: - if (ctx_pool) - dma_pool_destroy(ctx_pool); - if (buffer_pool) - dma_pool_destroy(buffer_pool); + dma_pool_destroy(ctx_pool); + dma_pool_destroy(buffer_pool); npe_release(npe_c); return ret; } -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks
From: Markus Elfring Date: Tue, 17 Nov 2015 16:26:01 +0100 Subject: [PATCH 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks Further update suggestions were taken into account after a patch was applied from static source code analysis. Markus Elfring (3): Delete unnecessary checks before the function call "dma_pool_destroy" Reduce assignment for a variable in init_ixp_crypto() crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection drivers/crypto/ixp4xx_crypto.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: sun4i-ss: add missing statesize
On Tue, Nov 17, 2015 at 03:26:03PM +0100, LABBE Corentin wrote: > > I have lots of user reporting that they cannot use the device since it wont > load. > For me it need to go stable since it respect all "stable rules", simple, > tested, minimal, and fix a real bug that bother people. Well it will hit stable eventually. I just don't feel comfortable with sending it in straight away. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: sun4i-ss: add missing statesize
On Tue, Nov 17, 2015 at 10:09:38PM +0800, Herbert Xu wrote: > On Fri, Nov 13, 2015 at 02:10:28PM +0100, LABBE Corentin wrote: > > sun4i-ss implementaton of md5/sha1 is via ahash algorithms. > > Commit 8996eafdcbad ("crypto: ahash - ensure statesize is non-zero") > > made impossible to load them without giving statesize. This patch > > specifiy statesize for sha1 and md5. > > > > Fixes: 6298e948215f ("crypto: sunxi-ss - Add Allwinner Security System > > crypto accelerator") > > Cc: # v4.3+ > > Tested-by: Chen-Yu Tsai > > Signed-off-by: LABBE Corentin > > Patch applied to cryptodev as I don't think it needs to go into > stable straight away. Thanks. Hello I have lots of user reporting that they cannot use the device since it wont load. For me it need to go stable since it respect all "stable rules", simple, tested, minimal, and fix a real bug that bother people. Thanks in advance. Regards -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/4] crypto: hifn_795x: remove the hifn_test function
On Thu, Oct 22, 2015 at 08:51:50AM +0200, LABBE Corentin wrote: > The hifn_test function is redundant with test done at register time by > the crypto API, so remove it. > > Signed-off-by: LABBE Corentin Patches 2-4 applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] crypto-ixp4xx: Delete unnecessary checks before the function call "dma_pool_destroy"
On Sun, Nov 15, 2015 at 07:49:16PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 15 Nov 2015 16:51:21 +0100 > > The dma_pool_destroy() function tests whether its argument is NULL > and then returns immediately. Thus the test around the calls is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] crypto: marvell: check return value of sg_nents_for_len
On Wed, Nov 04, 2015 at 09:13:33PM +0100, LABBE Corentin wrote: > The sg_nents_for_len() function could fail, this patch add a check for > its return value. > > Signed-off-by: LABBE Corentin All applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: sun4i-ss: add missing statesize
On Fri, Nov 13, 2015 at 02:10:28PM +0100, LABBE Corentin wrote: > sun4i-ss implementaton of md5/sha1 is via ahash algorithms. > Commit 8996eafdcbad ("crypto: ahash - ensure statesize is non-zero") > made impossible to load them without giving statesize. This patch > specifiy statesize for sha1 and md5. > > Fixes: 6298e948215f ("crypto: sunxi-ss - Add Allwinner Security System crypto > accelerator") > Cc: # v4.3+ > Tested-by: Chen-Yu Tsai > Signed-off-by: LABBE Corentin Patch applied to cryptodev as I don't think it needs to go into stable straight away. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/9] crypto: constify pci_error_handlers structures
On Sat, Nov 14, 2015 at 11:06:59AM +0100, Julia Lawall wrote: > This pci_error_handlers structure is never modified, like all the other > pci_error_handlers structures, so declare it as const. > > Done with the help of Coccinelle. > > Signed-off-by: Julia Lawall Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: qat - when stopping all devices make fure VF are stopped first
On Tue, Oct 20, 2015 at 12:50:03PM -0700, Tadeusz Struk wrote: > When stopping all devices make sure VFs are stopped before the > corresponding PF. > VFs will always be after PF so just need to loop back. > > Signed-off-by: Tadeusz Struk Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/11] crypto: algif: Change some variable to size_t
On Fri, Oct 23, 2015 at 02:10:36PM +0200, LABBE Corentin wrote: > Some variable are set as int but store only positive values. > Furthermore there are used in operation/function that wait for unsigned > value. > This patch set them as size_t. > > Signed-off-by: LABBE Corentin Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: qat - remove superfluous check from adf_probe
On Thu, Oct 22, 2015 at 03:23:12PM +0100, Salvatore Benedetto wrote: > - ent->device is already checked at the beginning of the function >against the same value. This check is a duplicate. > > Signed-off-by: Salvatore Benedetto Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: qat - fix get instance function
On Thu, Oct 22, 2015 at 06:30:36AM -0700, Tadeusz Struk wrote: > Fix the logic in case we have found a device on a given node. > > Signed-off-by: Tadeusz Struk Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] nx-842: Ignore bit 3 of condition register returned by icswx
On Fri, Oct 30, 2015 at 03:43:01PM -0700, Ram Pai wrote: > icswx occasionally under heavy load sets bit 3 of condition register 0. > It has no software implication. > > Currently that bit is interpreted by the driver as a failure, when > it should have calmly ignored it. > > Signed-off-by: Ram Pai Your patch is corrupted: $ patch -s -p1 < .git/rebase-apply/patch patch: malformed patch at line 21: To unsubscribe from this list: send the line "unsubscribe linux-crypto" in $ -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto()
On Sun, Nov 15, 2015 at 07:52:22PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 15 Nov 2015 19:06:44 +0100 > > The variable "ret" was set more often than necessary by the > init_ixp_crypto() function. > > * Omit its initialisation at the beginning. > > * Use an error return code in two cases directly. > > * Improve compliance with the Linux coding style convention. > > Signed-off-by: Markus Elfring Again I don't see how this is making the code better so nack. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/4] crypto-ixp4xx: Two function calls less in init_ixp_crypto() after error detection
On Sun, Nov 15, 2015 at 07:50:51PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 15 Nov 2015 18:28:39 +0100 > > The dma_pool_destroy() function was called twice with a null pointer > if a "npe_error" was reported. > > This implementation detail could be improved by the introduction > of another jump label. > > Signed-off-by: Markus Elfring > --- > drivers/crypto/ixp4xx_crypto.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c > index e52496a..efe0eca 100644 > --- a/drivers/crypto/ixp4xx_crypto.c > +++ b/drivers/crypto/ixp4xx_crypto.c > @@ -509,9 +509,11 @@ static int init_ixp_crypto(struct device *dev) > npe_error: > printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); > ret = -EIO; > + goto release_npe; > err: > dma_pool_destroy(ctx_pool); > dma_pool_destroy(buffer_pool); > +release_npe: > npe_release(npe_c); > return ret; I think this patch is making the code worse so I'm not applying it. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] crypto: akcipher: add crypto_akcipher_type methods needed by templates.
Andrew Zaborowski wrote: > Add two dummy methods that are required by the crypto API internals: > .ctxsize and .init > (just because the framework calls them without checking if they were > provided). They're only required by the complicated code path needed to > instantiate a template algorithm. Also expose crypto_akcipher_type like > other crypto types are exposed to be used from outside modules. > > Signed-off-by: Andrew Zaborowski Nack. They are only required if you use obsolete methods of creating a tfm. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] hw_random: omap3-rom-rng: convert timer to delayed work
On Fri, Nov 06, 2015 at 12:15:24AM +0200, Aaro Koskinen wrote: > We cannot put the HW RNG to idle using a timer because we cannot disable > clocks from atomic context. Use a delayed work instead. > > Fixes a warning with CONFIG_DEBUG_MUTEXES on Nokia N900 during boot. > > Reported-by: Sebastian Reichel > Signed-off-by: Aaro Koskinen Thanks for the patch. Can you please remove timer.h and include workqueue.h instead? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] crypto: Multi-buffer encryptioin infrastructure support
On Thu, Oct 29, 2015 at 03:21:03PM -0700, Tim Chen wrote: > > c) Add support to crypto scatterwalk support that can sleep during > encryption operation, as we may have buffers for jobs in data lanes > that are half-finished, waiting for additional jobs to come to fill > empty lanes before we start the encryption again. Therefore, we need to > enhance crypto walk with the option to map data buffers non-atomically. > This is done by algorithms run from crypto daemon who knows it is safe > to do so as it can save and restore FPU state in correct context. What about the existing ablkcipher scatterwalk helpers? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] crypto: tcrypt: fix keysize argument of test_aead_speed for gcm(aes)
The key sizes used by AES in GCM mode should be 128, 192 or 256 bits (16, 24 or 32 bytes). There is no additional 4byte nonce as for RFC 4106. Signed-off-by: Cyrille Pitchen --- crypto/tcrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 46a4a757d478..270bc4b82bd9 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -1789,7 +1789,7 @@ static int do_test(const char *alg, u32 type, u32 mask, int m) test_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec, NULL, 0, 16, 16, aead_speed_template_20); test_aead_speed("gcm(aes)", ENCRYPT, sec, - NULL, 0, 16, 8, aead_speed_template_20); + NULL, 0, 16, 8, speed_template_16_24_32); break; case 212: -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: atmel: fix 64-bit warnings
Hi Arnd, I add my Acked-by to your patch. By the way, I'm currently reworking this whole driver. So I take your modifications into account for the new version as many parts of the source code such as the part dealing with DMA transfers have changed a lot. The new version fixes the 16 or 32bit counter overflow for the CTR mode, adds support to the GCM mode and should increase the global performances (the work is still in progress). For the GCM mode, it relies on the latest updates from Herbert in linux-next to AEAD algorithms. The tcrypt module was used to validate the new implementation of CTR and GCM modes. Updates in the Atmel SHA driver are also likely to follow. Thanks for your contribution! Best regards, Cyrille Le 17/11/2015 10:22, Arnd Bergmann a écrit : > The atmel AES driver assumes that 'int' and 'size_t' are the same > type in multiple locations, which the compiler warns about when > building it for 64-bit systems: > > In file included from ../drivers/crypto/atmel-aes.c:17:0: > drivers/crypto/atmel-aes.c: In function 'atmel_aes_sg_copy': > include/linux/kernel.h:724:17: warning: comparison of distinct pointer types > lacks a cast > drivers/crypto/atmel-aes.c:448:11: note: in expansion of macro 'min' > > drivers/crypto/atmel-aes.c: In function 'atmel_aes_crypt_dma_stop': > include/linux/kern_levels.h:4:18: warning: format '%u' expects argument of > type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' > [-Wformat=] > > This changes the format strings to use the %z modifier when printing > a size_t, and makes sure that we use the correct size_t type where > needed. In case of sg_dma_len(), the type of the result depends > on CONFIG_NEED_SG_DMA_LENGTH, so we have to use min_t to get it to > work in all configurations. > > Signed-off-by: Arnd Bergmann Acked-by: Cyrille Pitchen > > diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c > index fb16d812c8f5..bfb1f799bf56 100644 > --- a/drivers/crypto/atmel-aes.c > +++ b/drivers/crypto/atmel-aes.c > @@ -184,7 +184,7 @@ static int atmel_aes_sg_length(struct ablkcipher_request > *req, > static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, > void *buf, size_t buflen, size_t total, int out) > { > - unsigned int count, off = 0; > + size_t count, off = 0; > > while (buflen && total) { > count = min((*sg)->length - *offset, total); > @@ -444,8 +444,8 @@ static int atmel_aes_crypt_dma_start(struct atmel_aes_dev > *dd) > > > if (fast) { > - count = min(dd->total, sg_dma_len(dd->in_sg)); > - count = min(count, sg_dma_len(dd->out_sg)); > + count = min_t(size_t, dd->total, sg_dma_len(dd->in_sg)); > + count = min_t(size_t, count, sg_dma_len(dd->out_sg)); > > err = dma_map_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); > if (!err) { > @@ -639,7 +639,7 @@ static int atmel_aes_crypt_dma_stop(struct atmel_aes_dev > *dd) > dd->buf_out, dd->buflen, dd->dma_size, 1); > if (count != dd->dma_size) { > err = -EINVAL; > - pr_err("not all data converted: %u\n", count); > + pr_err("not all data converted: %zu\n", count); > } > } > } > @@ -666,7 +666,7 @@ static int atmel_aes_buff_init(struct atmel_aes_dev *dd) > dd->dma_addr_in = dma_map_single(dd->dev, dd->buf_in, > dd->buflen, DMA_TO_DEVICE); > if (dma_mapping_error(dd->dev, dd->dma_addr_in)) { > - dev_err(dd->dev, "dma %d bytes error\n", dd->buflen); > + dev_err(dd->dev, "dma %zd bytes error\n", dd->buflen); > err = -EINVAL; > goto err_map_in; > } > @@ -674,7 +674,7 @@ static int atmel_aes_buff_init(struct atmel_aes_dev *dd) > dd->dma_addr_out = dma_map_single(dd->dev, dd->buf_out, > dd->buflen, DMA_FROM_DEVICE); > if (dma_mapping_error(dd->dev, dd->dma_addr_out)) { > - dev_err(dd->dev, "dma %d bytes error\n", dd->buflen); > + dev_err(dd->dev, "dma %zd bytes error\n", dd->buflen); > err = -EINVAL; > goto err_map_out; > } > > -- > To unsubscribe from this list: send the line "unsubscribe linux-crypto" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] crypto: hifn_795x: replace simple_strtoul by kstrtouint
On Thu, Oct 22, 2015 at 08:51:49AM +0200, LABBE Corentin wrote: > The simple_strtoul function is marked as obsolete. > This patch replace it by kstrtouint at the cost of changing some function > return type from void to int. > > Signed-off-by: LABBE Corentin If you're going to clean this up then please take one more step and store the result of req in hifn_init so that you don't have to parse it over and over agin. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/8] crypto: testmgr: Use the xxx_zero_message_hash from headers
On Tue, Oct 20, 2015 at 09:34:04AM +0200, LABBE Corentin wrote: > Since md5/shaxxx headers have hash for zero message length, just use them. > > Signed-off-by: LABBE Corentin This too would need a dependency on the MD5/SHA Kconfig options. However, for now this is just too hard as it would result in a circular dependency. Let's revisit this after we move the test vectors into the generic implementations. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/8] crypto: akcipher: the key parameter must be const u8 *
On Tue, Oct 20, 2015 at 09:34:02AM +0200, LABBE Corentin wrote: > All cryptoAPI setkey function set the key parameter as const u8 *. > This patch make the crypto_akcipher_setkey parameters like others. > > Signed-off-by: LABBE Corentin This patch no longer applies. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/8] crypto: niagara: Use precalculated hash from headers
On Tue, Oct 20, 2015 at 09:33:58AM +0200, LABBE Corentin wrote: > Precalculated hash for empty message are now present in hash headers. > This patch just use them. > > Signed-off-by: LABBE Corentin You need to select CRYPTO_MD5 and CRYPTO_SHA*. Please add the corresponding Kconfig changes and resubmit. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Crypto Fixes for 4.4
Hi Linus: This push fixes a bug in the qat driver where a user-space pointer is dereferenced. Please pull from git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git linus Tadeusz Struk (1): crypto: qat - don't use userspace pointer drivers/crypto/qat/qat_common/adf_ctl_drv.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] crypto: atmel: fix 64-bit warnings
The atmel AES driver assumes that 'int' and 'size_t' are the same type in multiple locations, which the compiler warns about when building it for 64-bit systems: In file included from ../drivers/crypto/atmel-aes.c:17:0: drivers/crypto/atmel-aes.c: In function 'atmel_aes_sg_copy': include/linux/kernel.h:724:17: warning: comparison of distinct pointer types lacks a cast drivers/crypto/atmel-aes.c:448:11: note: in expansion of macro 'min' drivers/crypto/atmel-aes.c: In function 'atmel_aes_crypt_dma_stop': include/linux/kern_levels.h:4:18: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=] This changes the format strings to use the %z modifier when printing a size_t, and makes sure that we use the correct size_t type where needed. In case of sg_dma_len(), the type of the result depends on CONFIG_NEED_SG_DMA_LENGTH, so we have to use min_t to get it to work in all configurations. Signed-off-by: Arnd Bergmann diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index fb16d812c8f5..bfb1f799bf56 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -184,7 +184,7 @@ static int atmel_aes_sg_length(struct ablkcipher_request *req, static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { - unsigned int count, off = 0; + size_t count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); @@ -444,8 +444,8 @@ static int atmel_aes_crypt_dma_start(struct atmel_aes_dev *dd) if (fast) { - count = min(dd->total, sg_dma_len(dd->in_sg)); - count = min(count, sg_dma_len(dd->out_sg)); + count = min_t(size_t, dd->total, sg_dma_len(dd->in_sg)); + count = min_t(size_t, count, sg_dma_len(dd->out_sg)); err = dma_map_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); if (!err) { @@ -639,7 +639,7 @@ static int atmel_aes_crypt_dma_stop(struct atmel_aes_dev *dd) dd->buf_out, dd->buflen, dd->dma_size, 1); if (count != dd->dma_size) { err = -EINVAL; - pr_err("not all data converted: %u\n", count); + pr_err("not all data converted: %zu\n", count); } } } @@ -666,7 +666,7 @@ static int atmel_aes_buff_init(struct atmel_aes_dev *dd) dd->dma_addr_in = dma_map_single(dd->dev, dd->buf_in, dd->buflen, DMA_TO_DEVICE); if (dma_mapping_error(dd->dev, dd->dma_addr_in)) { - dev_err(dd->dev, "dma %d bytes error\n", dd->buflen); + dev_err(dd->dev, "dma %zd bytes error\n", dd->buflen); err = -EINVAL; goto err_map_in; } @@ -674,7 +674,7 @@ static int atmel_aes_buff_init(struct atmel_aes_dev *dd) dd->dma_addr_out = dma_map_single(dd->dev, dd->buf_out, dd->buflen, DMA_FROM_DEVICE); if (dma_mapping_error(dd->dev, dd->dma_addr_out)) { - dev_err(dd->dev, "dma %d bytes error\n", dd->buflen); + dev_err(dd->dev, "dma %zd bytes error\n", dd->buflen); err = -EINVAL; goto err_map_out; } -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html