Re: [PATCH v2] crypto: ccp - Release all allocated memory if sha type is invalid

2019-09-19 Thread Gary R Hook
On 9/19/19 11:04 AM, Navid Emamdoost wrote: > Release all allocated memory if sha type is invalid: > In ccp_run_sha_cmd, if the type of sha is invalid, the allocated > hmac_buf should be released. > > v2: fix the goto. > > Signed-off-by: Navid Emamdoost

Re: [PATCH] crypto: ccp - release hmac_buf if ccp_run_sha_cmd fails

2019-09-19 Thread Gary R Hook
On 9/16/19 8:22 AM, Lendacky, Thomas wrote: > On 9/13/19 6:48 PM, Navid Emamdoost wrote: >> In ccp_run_sha_cmd, if the type of sha is invalid, the allocated >> hmac_buf should be released. >> >> Signed-off-by: Navid Emamdoost >> --- >> drivers/crypto/ccp/ccp-ops.c | 1 + >> 1 file changed, 1 in

Re: Crypto driver callback problem

2019-09-10 Thread Gary R Hook
And an apology for a ping using the wrong mail handler, and the top post... Would love to know if this has gotten any cycles. On 8/15/19 5:31 PM, Gary R Hook wrote: > Context: > We've run into a possible locking issue when using the AMD CCP device > for crypto offload, with the n

Crypto driver callback problem

2019-08-15 Thread Gary R Hook
Context: We've run into a possible locking issue when using the AMD CCP device for crypto offload, with the new extra tests, and with lock debugging enabled. Pre-reqs: Enable the crypto self-tests and extra tests Build the crypto testing module (tcrypt) Enable the kern

Re: [PATCH 1/2] crypto: ccp - Include DMA declarations explicitly

2019-08-06 Thread Gary R Hook
> > Similarly, ccp-dmaengine.c uses dma_get_mask(), which is defined in > linux/dma-mapping.h, so include that explicitly since it requires nothing > else from linux/pci.h. > > A future patch will remove the includes of linux/pci.h where it is not > needed. > > Signe

Re: [PATCH 2/2] crypto: ccp - Remove unnecessary linux/pci.h include

2019-08-06 Thread Gary R Hook
On 8/2/19 6:20 PM, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > Remove unused includes of linux/pci.h. > > Signed-off-by: Bjorn Helgaas Acked-by: Gary R Hook > --- > drivers/crypto/ccp/ccp-crypto.h | 1 - > drivers/crypto/ccp/ccp-dev-v3.c | 1 - > drivers/

Re: [PATCH] crypto:ccp - Return from init on allocation failure

2019-07-31 Thread Gary R Hook
On 7/30/19 1:28 PM, Hook, Gary wrote: > Return and fail driver initialization if a DMA pool can't be > allocated. > > Fixes: 4b394a232df7 ("crypto: ccp - Let a v5 CCP provide the same function as > v3") > > Signed-off-by: Gary R Hook > --- > driver

Re: [PATCH] crypto: ccp - Replace dma_pool_alloc + memset with dma_pool_zalloc

2019-07-18 Thread Gary R Hook
On 7/18/19 8:16 AM, Chuhong Yuan wrote: > Use dma_pool_zalloc instead of using dma_pool_alloc to allocate > memory and then zeroing it with memset 0. > This simplifies the code. > > Signed-off-by: Chuhong Yuan Acked-by: Gary R Hook > --- > drivers/crypto/ccp/ccp-ops

Re: [patch v2] crypto: ccp - Fix SEV_VERSION_GREATER_OR_EQUAL

2019-07-15 Thread Gary R Hook
this and move to a static inline function for appropriate type >> checking. >> >> Fixes: edd303ff0e9e ("crypto: ccp - Add DOWNLOAD_FIRMWARE SEV command") >> Reported-by: Cfir Cohen >> Signed-off-by: David Rientjes > > Acked-by: Tom Lendacky Acked-by: Ga

Re: [PATCH v2] crypto: ccp - memset structure fields to zero before reuse

2019-07-11 Thread Gary R Hook
On 7/10/19 7:46 PM, Eric Biggers wrote: > > The generic implementation allows authentication tags of 4, 8, 12, 13, 14, 15, > or 16 bytes. See crypto_gcm_setauthsize() in crypto/gcm.c, and see > https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf > section 5.2.1.2 "Output

Re: [PATCH v2] crypto: ccp - memset structure fields to zero before reuse

2019-07-10 Thread Gary R Hook
On 7/10/19 3:34 PM, Eric Biggers wrote: > On Wed, Jul 10, 2019 at 03:59:05PM +0000, Gary R Hook wrote: >> On 7/9/19 8:57 PM, Eric Biggers wrote: >>> On Wed, Jul 10, 2019 at 12:09:22AM +, Hook, Gary wrote: >>>> The AES GCM function reuses an 'op' da

Re: [PATCH v2] crypto: ccp - memset structure fields to zero before reuse

2019-07-10 Thread Gary R Hook
self-test failure: >> alg: aead: gcm-aes-ccp encryption test failed (wrong result) on test vector >> 2, cfg="two even aligned splits" >> >> Fixes: 36cf515b9bbe ("crypto: ccp - Enable support for AES GCM on v5 CCPs") >> >> Signed

Re: [PATCH] crypto: ccp - memset structure fields to zero before reuse

2019-07-09 Thread Gary R Hook
On 7/9/19 5:56 PM, Eric Biggers wrote: > On Tue, Jul 09, 2019 at 10:09:16PM +0000, Gary R Hook wrote: >> On 7/9/19 3:10 PM, Eric Biggers wrote: >>> On Mon, Jul 08, 2019 at 05:08:09PM +, Gary R Hook wrote: >>>> On 7/5/19 2:40 PM, Eric Biggers wrote: >>>

Re: [PATCH] crypto: ccp - memset structure fields to zero before reuse

2019-07-09 Thread Gary R Hook
On 7/9/19 3:10 PM, Eric Biggers wrote: > On Mon, Jul 08, 2019 at 05:08:09PM +0000, Gary R Hook wrote: >> On 7/5/19 2:40 PM, Eric Biggers wrote: >>> Hi Gary, >>> >>> On Wed, Jul 03, 2019 at 07:21:26PM +, Hook, Gary wrote: >>>> The AES GCM funct

Re: [PATCH] crypto: ccp - memset structure fields to zero before reuse

2019-07-08 Thread Gary R Hook
36cf515b9bbe ("crypto: ccp - Enable support for AES GCM on v5 CCPs") >> >> Signed-off-by: Gary R Hook >> --- >> drivers/crypto/ccp/ccp-ops.c | 12 +++- >> 1 file changed, 11 insertions(+), 1 deletion(-) > > Is this patch meant to

Re: [PATCH v2] crypto: ccp/gcm - use const time tag comparison.

2019-07-02 Thread Gary R Hook
On 7/2/19 12:32 PM, Cfir Cohen wrote: > Avoid leaking GCM tag through timing side channel. > > Fixes: 36cf515b9bbe ("crypto: ccp - Enable support for AES GCM on v5 CCPs") > Cc: # v4.12+ > Signed-off-by: Cfir Cohen Acked-by: Gary R Hook > --- > drivers/cry

Re: gcm-aes-ccp self-tests failure

2019-07-02 Thread Gary R Hook
On 7/2/19 11:06 AM, Eric Biggers wrote: > Hi Tom and Gary, > > On latest cryptodev tree, I'm seeing the following self-test failure after I > built a kernel with the AMD CCP driver and crypto self-tests enabled, and > booted > it on system with a Ryzen processor ("Threadripper 1950X"): > > [

Re: [PATCH] crypto: ccp/gcm - use const time tag comparison.

2019-07-02 Thread Gary R Hook
On 7/1/19 7:25 PM, Eric Biggers wrote: > On Mon, Jul 01, 2019 at 05:01:32PM -0700, Cfir Cohen wrote: >> Avoid leaking GCM tag through timing side channel. >> >> Signed-off-by: Cfir Cohen >> --- >> drivers/crypto/ccp/ccp-ops.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff

Re: [PATCH v2 2/2] crypto: doc - Fix formatting of new crypto engine content

2019-06-26 Thread Gary R Hook
On 6/25/19 7:13 PM, Joe Perches wrote: > On Tue, 2019-06-25 at 23:43 +, Hook, Gary wrote: >> Tidy up the formatting/grammar in crypto_engine.rst. Use bulleted lists >> where appropriate. > > Hi again Gary. Howdy! > >> diff --git a/Documentation/crypto/crypto_engine.rst >> b/Documentation/c

Re: [PATCH 0/3] Clean up crypto documentation

2019-06-25 Thread Gary R Hook
On 6/25/19 8:52 AM, Jonathan Corbet wrote: > On Tue, 25 Jun 2019 13:33:27 + > Gary R Hook wrote: > >>> It's been "valid" since I wrote it...it's just not upstream yet :) I >>> expect it to be in 5.3, though. So the best way to refer to a kerne

Re: [PATCH 0/3] Clean up crypto documentation

2019-06-25 Thread Gary R Hook
On 6/24/19 3:37 PM, Jonathan Corbet wrote: > On Mon, 24 Jun 2019 13:29:42 -0700 > Joe Perches wrote: > >>> Finally, would you prefer a v2 of the patch set? Happy to do >>> whatever is preferred, of course. >> >> Whatever Jonathan decides is fine with me. >> Mine was just a plea to avoid unnecessa

Re: [PATCH 03/11] crypto: ccp - Expose the value of nqueues in DebugFS

2019-06-25 Thread Gary R Hook
the > value in the module_param() definition. I'll take "who's an idiot" for $200, Alex. There'll be v2 patchset a-comin'. grh > > Thanks, > Tom > >> >> Signed-off-by: Gary R Hook >> --- >> drivers/crypto/ccp/ccp-debugfs.c |

Re: [PATCH 2/3] crypto: doc - Describe the crypto engine

2019-06-25 Thread Gary R Hook
On 6/24/19 5:03 PM, Eric Biggers wrote: > On Mon, Jun 24, 2019 at 07:07:49PM +, Hook, Gary wrote: >> Add a reference to the crypto engine documentation to >> the index. >> >> Signed-off-by: Gary R Hook >> --- >> Documentation/crypto/index.rst |

Re: [PATCH 0/3] Clean up crypto documentation

2019-06-24 Thread Gary R Hook
On 6/24/19 2:30 PM, Joe Perches wrote: > On Mon, 2019-06-24 at 19:07 +, Hook, Gary wrote: >> Tidy up the crypto documentation by filling in some variable >> descriptions, make some grammatical corrections, and enhance >> formatting. > > While this seems generally OK, please try not to make the

Re: [patch] crypto: ccp - Free ccp if initialization fails

2019-06-24 Thread Gary R Hook
On 6/24/19 8:04 AM, Lendacky, Thomas wrote: > On 6/23/19 2:18 PM, David Rientjes wrote: >> If ccp_dev_init() fails, kfree() the allocated ccp since it will otherwise >> be leaked. > > Not needed. It's allocated with devm_kzalloc(), so it won't be leaked. > >

Re: [PATCH -next] crypto: ccp - Use kmemdup in ccp_copy_and_save_keypart()

2019-04-01 Thread Gary R Hook
On 3/29/19 8:43 PM, YueHaibing wrote: > Use kmemdup rather than duplicating its implementation > > Signed-off-by: YueHaibing Acked-by: Gary R Hook > --- > drivers/crypto/ccp/ccp-crypto-rsa.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git

Re: [PATCH 6/7] crypto: ccp: no need to check return value of debugfs_create functions

2019-01-22 Thread Gary R Hook
en of a mind to kick out and not try to do any further work. But debugfs is to be treated as an exception to that paradigm? Carry on, ignore errors, don't worry about it? That said, Acked-by: Gary R Hook > > Cc: Tom Lendacky > Cc: Gary Hook > Cc: Herbert Xu > Cc: &quo

Re: [PATCH -next] crypto: ccp - Make function sev_get_firmware() static

2018-09-25 Thread Gary R Hook
On 09/25/2018 09:35 AM, Wei Yongjun wrote: > Fixes the following sparse warning: > > drivers/crypto/ccp/psp-dev.c:444:5: warning: > symbol 'sev_get_firmware' was not declared. Should it be static? > > Signed-off-by: Wei Yongjun This appears to have been introduced by (cryptodev-2.6) commit e

Re: [PATCH] crypto: ccp: Remove forward declaration

2018-09-24 Thread Gary R Hook
On 09/24/2018 04:44 PM, Nick Desaulniers wrote: > On Mon, Sep 24, 2018 at 2:27 PM Gary R Hook wrote: >> >> On 09/24/2018 03:24 PM, Nick Desaulniers wrote: >>> On Mon, Sep 24, 2018 at 12:18 PM Gary R Hook wrote: >>>> >>>> On 09/24/2018 12:26

Re: [PATCH] crypto: ccp: Remove forward declaration

2018-09-24 Thread Gary R Hook
On 09/24/2018 03:24 PM, Nick Desaulniers wrote: > On Mon, Sep 24, 2018 at 12:18 PM Gary R Hook wrote: >> >> On 09/24/2018 12:26 PM, Nathan Chancellor wrote: >>> Clang emits a warning about this construct: >>> >>> drivers/crypto/ccp/sp-platform.c:36:3

Re: [PATCH] crypto: ccp: Remove forward declaration

2018-09-24 Thread Gary R Hook
On 09/24/2018 02:40 PM, Nathan Chancellor wrote: > On Mon, Sep 24, 2018 at 07:18:23PM +0000, Gary R Hook wrote: >> On 09/24/2018 12:26 PM, Nathan Chancellor wrote: >>> Clang emits a warning about this construct: >>> >>> drivers/crypto/ccp/sp-platfo

Re: [PATCH] crypto: ccp: Remove forward declaration

2018-09-24 Thread Gary R Hook
On 09/24/2018 12:26 PM, Nathan Chancellor wrote: > Clang emits a warning about this construct: > > drivers/crypto/ccp/sp-platform.c:36:36: warning: tentative array > definition assumed to have one element > static const struct acpi_device_id sp_acpi_match[]; > ^

Re: [PATCH 2/2] Allow SEV firmware to be chosen based on Family and Model

2018-09-19 Thread Gary R Hook
d on the family and > model of the processor. > > Model specific firmware files are given highest priority. Followed by > firmware for a subset of models. Lastly, failing the previous two options, > fallback to looking for sev.fw. > > Signed-off-by: Janakaraj

Re: [PATCH 1/2] Fix static checker warning

2018-09-19 Thread Gary R Hook
y: Janakarajan Natarajan Acked-by: Gary R Hook > --- > drivers/crypto/ccp/psp-dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c > index 72790d8..f541e60 100644 > --- a/drivers/crypto

Re: [PATCH] crypto: ccp: Check for NULL PSP pointer at module unload

2018-07-26 Thread Gary R Hook
pointer. Add a pointer check of the psp_data field in the sp_device struct in psp_dev_destroy() and return immediately if it is NULL. Cc: # 4.16.x- Fixes: 2a6170dfe755 ("crypto: ccp: Add Platform Security Processor (PSP) device support") Signed-off-by: Tom Lendacky Acked-by: G

Re: [PATCH v1 5/5] crypto: ccp: Add support for new CCP/PSP device ID

2018-07-05 Thread Gary R Hook
On 07/03/2018 12:12 PM, Tom Lendacky wrote: Add a new CCP/PSP PCI device ID and new PSP register offsets. Signed-off-by: Tom Lendacky Acked-by: Gary R Hook --- drivers/crypto/ccp/sp-pci.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git

Re: [PATCH v1 1/5] crypto: ccp: Fix command completion detection race

2018-07-05 Thread Gary R Hook
ecure Encrypted Virtualization (SEV) command support") Cc: # 4.16.x- Signed-off-by: Tom Lendacky --- Reviewed-by: Brijesh Singh Acked-by: Gary R Hook   drivers/crypto/ccp/psp-dev.c |    4 ++--   1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/p

Re: [PATCH v1 4/5] crypto: ccp: Support register differences between PSP devices

2018-07-05 Thread Gary R Hook
-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 24 drivers/crypto/ccp/psp-dev.h |9 - drivers/crypto/ccp/sp-dev.h |7 ++- drivers/crypto/ccp/sp-pci.c |7 ++- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers

Re: [PATCH v1 3/5] crypto: ccp: Remove unused #defines

2018-07-05 Thread Gary R Hook
On 07/03/2018 12:11 PM, Tom Lendacky wrote: Remove some unused #defines for register offsets that are not used. This will lessen the changes required when register offsets change between versions of the device. Signed-off-by: Tom Lendacky Acked-by: Gary R Hook --- drivers/crypto/ccp/psp

Re: [PATCH v1 2/5] crypto: ccp: Add psp enabled message when initialization succeeds

2018-07-05 Thread Gary R Hook
On 07/03/2018 12:11 PM, Tom Lendacky wrote: Add a dev_notice() message to the PSP initialization to report when the PSP initialization has succeeded and the PSP is enabled. Signed-off-by: Tom Lendacky Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c |2 ++ 1 file changed, 2

Re: [PATCH v1 1/5] crypto: ccp: Fix command completion detection race

2018-07-05 Thread Gary R Hook
pport") Cc: # 4.16.x- Signed-off-by: Tom Lendacky Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index ff478d8..973d683 100644 --- a/drivers/cryp

[PATCH] crypto: doc - Document remaining members in struct crypto_alg

2018-03-14 Thread Gary R Hook
Add missing comments for union members ablkcipher, blkcipher, cipher, and compress. This silences complaints when building the htmldocs. Fixes: 0d7f488f0305a (crypto: doc - cipher data structures) Signed-off-by: Gary R Hook --- include/linux/crypto.h |8 1 file changed, 8

[PATCH] crypto/ccp - Fill the result buffer only on digest, finup, and final ops

2018-03-07 Thread Gary R Hook
Any change to the result buffer should only happen on final, finup and digest operations. Changes to the buffer for update, import, export, etc, are not allowed. Fixes: 66d7b9f6175e ("crypto: testmgr - test misuse of result in ahash") Signed-off-by: Gary R Hook Cc: --- 0 files cha

[PATCH] crypto/ccp: Validate buffer lengths for copy operations

2018-03-07 Thread Gary R Hook
The CCP driver copies data between scatter/gather lists and DMA buffers. The length of the requested copy operation must be checked against the available destination buffer length. Reported-by: Maciej S. Szmigiero Signed-off-by: Gary R Hook --- 0 files changed diff --git a/drivers/crypto/ccp

Re: Why are we testing an intermediate result in ahash?

2018-03-05 Thread Gary R Hook
On 03/05/2018 12:31 PM, Kamil Konieczny wrote: On 05.03.2018 18:47, Gary R Hook wrote: On 03/05/2018 03:57 AM, Kamil Konieczny wrote: On 02.03.2018 22:11, Gary R Hook wrote: Commit 466d7b9f6 (cryptodev-2.6) added code to testmgr to populate, for async hash operations, the result buffer

Re: [PATCH] crypto: ccp: Use memdup_user() rather than duplicating its implementation

2018-03-05 Thread Gary R Hook
Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 15 +-- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index fcfa5b1eae61..8255258cd040 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp

Re: Why are we testing an intermediate result in ahash?

2018-03-05 Thread Gary R Hook
On 03/05/2018 03:57 AM, Kamil Konieczny wrote: On 02.03.2018 22:11, Gary R Hook wrote: Commit 466d7b9f6 (cryptodev-2.6) added code to testmgr to populate, for async hash operations, the result buffer with a known value and to test the buffer against that value at intermediate steps. If the

Re: Why are we testing an intermediate result in ahash?

2018-03-05 Thread Gary R Hook
On 03/05/2018 03:50 AM, Herbert Xu wrote: On Fri, Mar 02, 2018 at 03:11:52PM -0600, Gary R Hook wrote: Commit 466d7b9f6 (cryptodev-2.6) added code to testmgr to populate, for async hash operations, the result buffer with a known value and to test the buffer against that value at intermediate

Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback

2018-03-02 Thread Gary R Hook
On 03/02/2018 05:58 PM, Maciej S. Szmigiero wrote: On 03.03.2018 00:49, Hook, Gary wrote: On 3/2/2018 5:15 PM, Maciej S. Szmigiero wrote: Thanks. However, what about the first patch from this series? Without it, while it no longer should cause a buffer overflow, in-kernel X.509 certificate ve

Why are we testing an intermediate result in ahash?

2018-03-02 Thread Gary R Hook
Commit 466d7b9f6 (cryptodev-2.6) added code to testmgr to populate, for async hash operations, the result buffer with a known value and to test the buffer against that value at intermediate steps. If the result buffer changes the operation is failed. My question is: why? What problem does thi

Re: [PATCH 3/3] crypto: ccp - protect RSA implementation from too large input data

2018-02-28 Thread Gary R Hook
On 02/24/2018 10:03 AM, Maciej S. Szmigiero wrote: CCP RSA implementation uses a hardware input buffer which size depends only on the current RSA key length. Key modulus and a message to be processed is then copied to this buffer based on their own lengths. Since the price for providing too long

Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback

2018-02-28 Thread Gary R Hook
in this huge buffer being passed by rsa-pkcs1pad to CCP even for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd() tried to copy this large input buffer into a RSA key length-sized hardware input buffer. Signed-off-by: Maciej S. Szmigiero Acked-by: Gary R Hook Fixes

Re: Can a driver->probe be called for two devices at the same time (WAS: Re: [PATCH] crypto/ccp: don't disable interrupts while setting up debugfs)

2018-02-27 Thread Gary R Hook
On 02/27/2018 01:36 PM, Sebastian Andrzej Siewior wrote: On 2018-02-27 19:40:34 [+0100], Greg Kroah-Hartman wrote: On Tue, Feb 27, 2018 at 06:33:14PM +0100, Sebastian Andrzej Siewior wrote: On 2018-02-27 11:08:56 [-0600], Gary R Hook wrote: That issue remains unclear to me: Are probes of PCI

Re: [PATCH] crypto/ccp: don't disable interrupts while setting up debugfs

2018-02-27 Thread Gary R Hook
0x90 | work_for_cpu_fn+0x11/0x20 | process_one_work+0x1ff/0x650 | worker_thread+0x1d4/0x3a0 | kthread+0xfe/0x130 | ret_from_fork+0x27/0x50 If any locking is required, a simple mutex will do it. Cc: Gary R Hook Signed-off-by: Sebastian Andrzej Siewior Acked-by: Gary R Hook --- driv

Re: Can a driver->probe be called for two devices at the same time (WAS: Re: [PATCH] crypto/ccp: don't disable interrupts while setting up debugfs)

2018-02-27 Thread Gary R Hook
On 02/27/2018 11:33 AM, Sebastian Andrzej Siewior wrote: On 2018-02-27 11:08:56 [-0600], Gary R Hook wrote: That issue remains unclear to me: Are probes of PCI devices guaranteed to be serialized? Observations on my CCPs says that they occur in order, but I don't know for certain

Re: [PATCH] crypto/ccp: don't disable interrupts while setting up debugfs

2018-02-27 Thread Gary R Hook
On 02/26/2018 02:35 AM, Sebastian Andrzej Siewior wrote: On 2018-02-25 21:04:27 [-0500], Hook, Gary wrote: On 2/23/2018 5:33 PM, Sebastian Andrzej Siewior wrote: I don't why we need take a single write lock and disable interrupts while setting up debugfs. This is what what happens when we try a

Re: [PATCH v2] hwrng: Clean up RNG list when last hwrng is unregistered

2018-01-08 Thread Gary R Hook
On 01/07/2018 11:05 PM, Herbert Xu wrote: On Fri, Jan 05, 2018 at 11:28:23AM -0600, Gary R Hook wrote: It may not have been obvious from the title but this fixes a bug which will impact the use of any HW RNG that is the only RNG registered. The breakage of rmmod/modprobe -r that this fix

Re: [PATCH v2] hwrng: Clean up RNG list when last hwrng is unregistered

2018-01-05 Thread Gary R Hook
On 12/15/2017 01:55 PM, Gary R Hook wrote: Commit 142a27f0a731 added support for a "best" RNG, and in doing so introduced a hang from rmmod/modprobe -r when the last RNG on the list was unloaded. When the hwrng list is depleted, return the global variables to their original state and

Re: [PATCH] iommu/amd - Set the device table entry PPR bit for IOMMU V2 devices

2017-12-20 Thread Gary R Hook
Please ignore; sent to the wrong list. Mea culpa. On 12/20/2017 10:57 AM, Gary R Hook wrote: The AMD IOMMU specification Rev 3.00 (December 2016) introduces a new Enhanced PPR Handling Support (EPHSup) bit in the MMIO register offset 0030h (IOMMU Extended Feature Register). When EPHSup=1, the

[PATCH] iommu/amd - Set the device table entry PPR bit for IOMMU V2 devices

2017-12-20 Thread Gary R Hook
support PPR for a particular endpoint device. Please see https://support.amd.com/TechDocs/48882_IOMMU.pdf for this revision of the AMD IOMMU specification. Signed-off-by: Gary R Hook --- drivers/iommu/amd_iommu.c | 20 +++- drivers/iommu/amd_iommu_types.h |2 ++ 2 files

Re: [PATCH v2] hwrng: Clean up RNG list when last hwrng is unregistered

2017-12-19 Thread Gary R Hook
On 12/17/2017 03:49 AM, PrasannaKumar Muralidharan wrote: On 17 December 2017 at 14:53, PrasannaKumar Muralidharan wrote: Hi Gary, Some minor comments below. On 16 December 2017 at 01:25, Gary R Hook wrote: Commit 142a27f0a731 added support for a "best" RNG, and in doing so in

[PATCH v2] hwrng: Clean up RNG list when last hwrng is unregistered

2017-12-15 Thread Gary R Hook
ct. Fixes: 142a27f0a731 ("hwrng: core - Reset user selected rng by writing "" to rng_current") Signed-off-by: Gary R Hook --- Changes since v1: fix misspelled word in subject drivers/char/hw_random/core.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/char/h

[PATCH] hwrng: Clean up RNG list when last hwrng is unregisterd

2017-12-12 Thread Gary R Hook
ct. Fixes: 142a27f0a731 ("hwrng: core - Reset user selected rng by writing "" to rng_current") Signed-off-by: Gary R Hook --- drivers/char/hw_random/core.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c in

Re: [Part2 PATCH v8 14/38] crypto: ccp: Implement SEV_FACTORY_RESET ioctl command

2017-11-07 Thread Gary R Hook
y Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 77 +++- 1 fi

Re: [Part2 PATCH v8 13/38] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support

2017-11-07 Thread Gary R Hook
vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 344 +++ drivers/crypto/ccp/psp-dev.h | 24 +++ drivers/crypto/ccp/sp-dev.c |

Re: [Part2 PATCH v8 12/38] crypto: ccp: Add Platform Security Processor (PSP) device support

2017-11-07 Thread Gary R Hook
rčmář" Cc: Borislav Petkov Cc: Herbert Xu Cc: Gary Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Reviewed-by: Borislav Petkov Acked-by: Gary R Hook --- dri

Re: [Part2 PATCH v6 15/38] crypto: ccp: Implement SEV_PLATFORM_STATUS ioctl command

2017-10-24 Thread Gary R Hook
y Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 24 1 file changed, 24

Re: [Part2 PATCH v6.1 16/38] crypto: ccp: Implement SEV_PEK_GEN ioctl command

2017-10-24 Thread Gary R Hook
Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- Changes since v6: * when sev_do_cmd() and sev_platform_shutdown() fails then propogate the error status code from sev_do_cmd() because it c

Re: [Part2 PATCH v6.1 19/38] crypto: ccp: Implement SEV_PEK_CERT_IMPORT ioctl command

2017-10-24 Thread Gary R Hook
Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- Changes since v6: * when sev_do_cmd() and sev_platform_shutdown() fails then propogate the error status code from sev_do_cmd() because it c

Re: [Part2 PATCH v6.1 20/38] crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl command

2017-10-24 Thread Gary R Hook
ndacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- Changes since v6: * when sev_do_cmd() and sev_platform_shutdown() fails then propogate the error status code from sev_do_cmd() beca

Re: [Part2 PATCH v6.1 18/38] crypto: ccp: Implement SEV_PEK_CSR ioctl command

2017-10-24 Thread Gary R Hook
Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Brijesh Singh --- Acked-by: Gary R Hook Changes since v6: * when sev_do_cmd() and sev_platform_shutdown() fails then propogate the error status code from sev_do_cmd() because i

Re: [Part2 PATCH v6 14/38] crypto: ccp: Implement SEV_FACTORY_RESET ioctl command

2017-10-24 Thread Gary R Hook
y Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 28 +++- 1 file changed, 27

Re: [Part2 PATCH v6 17/38] crypto: ccp: Implement SEV_PDH_GEN ioctl command

2017-10-24 Thread Gary R Hook
ndacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Brijesh Singh Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-d

Re: [Part2 PATCH v6 12/38] crypto: ccp: Add Platform Security Processor (PSP) device support

2017-10-24 Thread Gary R Hook
rčmář" Cc: Borislav Petkov Cc: Herbert Xu Cc: Gary Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Reviewed-by: Borislav Petkov Acked-by: Gary R Hook --- dri

Re: [Part2 PATCH v6 09/38] crypto: ccp: Build the AMD secure processor driver only with AMD CPU support

2017-10-24 Thread Gary R Hook
Cc: Gary Hook Cc: Herbert Xu Cc: "David S. Miller" Cc: linux-crypto@vger.kernel.org Reviewed-by: Gary R Hook --- drivers/crypto/ccp/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/ccp/Kconfig b/drivers/crypto/ccp/Kconfig index 6d626606b9c5..9c84f9838

Re: [Part2 PATCH v6 11/38] crypto: ccp: Define SEV key management command id

2017-10-24 Thread Gary R Hook
Radim Krčmář" Cc: Borislav Petkov Cc: Herbert Xu Cc: Gary Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Reviewed-by: Borislav Petkov Acked-by: G

Re: [Part2 PATCH v6 10/38] crypto: ccp: Define SEV userspace ioctl and command id

2017-10-24 Thread Gary R Hook
nux-crypto@vger.kernel.org Cc: k...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Improvements-by: Borislav Petkov Signed-off-by: Brijesh Singh Reviewed-by: Borislav Petkov Acked-by: Gary R Hook --- include/uapi/linux/psp-sev.h | 113 +++ 1 file ch

Re: [PATCH] crypto: ccp: remove unused variable qim

2017-10-17 Thread Gary R Hook
as v3") Signed-off-by: Colin Ian King Acked-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev-v5.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index 65604fc65e8f..44a4d2779b15 100644 --- a/drivers/c

Re: [RFC Part2 PATCH v3 02/26] crypto: ccp: Add Platform Security Processor (PSP) device support

2017-09-07 Thread Gary R Hook
On 09/07/2017 05:19 PM, Brijesh Singh wrote: Hi Boris, On 09/07/2017 09:27 AM, Borislav Petkov wrote: ... The commit message above reads better to me as the help text than what you have here. Also, in order to make it easier for the user, I think we'll need a CONFIG_AMD_MEM_ENCRYPT_SEV or s

Re: [RFC Part2 PATCH v3 02/26] crypto: ccp: Add Platform Security Processor (PSP) device support

2017-09-06 Thread Gary R Hook
On 09/06/2017 03:46 PM, Borislav Petkov wrote: On Wed, Sep 06, 2017 at 03:38:38PM -0500, Brijesh Singh wrote: This bit of my struggle -- tip/master is not in sync with cryptodev-2.6 [1]. Aaha. In order to expand the CCP driver we need the following commits from the cryptodev-2.6 57de3aefb73

[PATCH] crypto:ccp - invoke the DMA callback in a standard way

2017-09-05 Thread Gary R Hook
From: amd Use the provided mechanism in dmaengine.h to invoke the completion callback. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dmaengine.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp

[PATCH] crypto: ccp - unmap pages and remove unmap objects in callback

2017-09-05 Thread Gary R Hook
From: amd Clean up the mapped pages and the unmap object once we are done with it. This enables the final clean-up of the object once the transfer is complete. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dmaengine.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers

Re: [PATCH] crypto: ccp - Fix XTS-AES-128 support on v5 CCPs

2017-08-22 Thread Gary R Hook
On 08/18/2017 11:02 PM, Herbert Xu wrote: On Fri, Aug 18, 2017 at 11:41:04AM -0500, Gary R Hook wrote: On Tue, Jul 25, 2017 at 02:12:11PM -0500, Gary R Hook wrote: Version 5 CCPs have some new requirements for XTS-AES: the type field must be specified, and the key requires 512 bits, with each

Re: [PATCH] crypto: ccp - Fix XTS-AES support on a version 5 CCP

2017-08-18 Thread Gary R Hook
On 08/18/2017 11:19 AM, Gary R Hook wrote: On 07/17/2017 04:48 PM, Lendacky, Thomas wrote: On 7/17/2017 3:08 PM, Gary R Hook wrote: Version 5 CCPs have differing requirements for XTS-AES: key components are stored in a 512-bit vector. The context must be little-endian justified. AES-256 is

Re: [PATCH] crypto: ccp - Fix XTS-AES-128 support on v5 CCPs

2017-08-18 Thread Gary R Hook
On Tue, Jul 25, 2017 at 02:12:11PM -0500, Gary R Hook wrote: > Version 5 CCPs have some new requirements for XTS-AES: the type field > must be specified, and the key requires 512 bits, with each part > occupying 256 bits and padded with zeroes. > > cc: # 4.9.x+ > > Signe

Re: [PATCH] crypto: ccp - Fix XTS-AES support on a version 5 CCP

2017-08-18 Thread Gary R Hook
On 07/17/2017 04:48 PM, Lendacky, Thomas wrote: On 7/17/2017 3:08 PM, Gary R Hook wrote: Version 5 CCPs have differing requirements for XTS-AES: key components are stored in a 512-bit vector. The context must be little-endian justified. AES-256 is supported now, so propagate the cipher size to

Re: [PATCH v5 02/19] crypto: ccp: use -EAGAIN for transient busy indication

2017-08-14 Thread Gary R Hook
On 08/14/2017 10:21 AM, Gilad Ben-Yossef wrote: Replace -EBUSY with -EAGAIN when reporting transient busy indication in the absence of backlog. Signed-off-by: Gilad Ben-Yossef Reviewed-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-main.c | 8 +++- drivers/crypto/ccp/ccp-dev.c

Re: crypto: ccp: use dma_mapping_error to check map error

2017-08-08 Thread Gary R Hook
On 08/08/2017 08:42 AM, Pan Bian wrote: The return value of dma_map_single() should be checked by dma_mapping_error(). However, in function ccp_init_dm_workarea(), its return value is checked against NULL, which could result in failures. Signed-off-by: Pan Bian Acked-by: Gary R Hook

Re: [PATCH v4 02/19] crypto: ccm: use -EAGAIN for transient busy indication

2017-08-08 Thread Gary R Hook
On 08/08/2017 07:03 AM, Gilad Ben-Yossef wrote: Replace -EBUSY with -EAGAIN when reporting transient busy indication in the absence of backlog. Signed-off-by: Gilad Ben-Yossef Could we use "ccp" in the subject line, please? --- drivers/crypto/ccp/ccp-crypto-main.c | 8 +++- drivers/cry

Re: [PATCH] crypto: ccp - avoid uninitialized variable warning

2017-08-01 Thread Gary R Hook
, 0)) + if (sb_count) cmd_q->ccp->vdata->perform->sbfree(cmd_q, op.sb_key, sb_count); return ret; Reviewed-by: Gary R Hook

Re: [PATCH] crypto: ccp - avoid uninitialized variable warning

2017-08-01 Thread Gary R Hook
On 08/01/2017 03:35 PM, Arnd Bergmann wrote: On Tue, Aug 1, 2017 at 4:52 PM, Gary R Hook wrote: On 07/31/2017 03:49 PM, Arnd Bergmann wrote: The added support for version 5 CCPs introduced a false-positive warning in the RSA implementation: drivers/crypto/ccp/ccp-ops.c: In function

Re: [PATCH] crypto: ccp - select CONFIG_CRYPTO_RSA

2017-08-01 Thread Gary R Hook
select CRYPTO_RSA help Support for using the cryptographic API with the AMD Cryptographic Coprocessor. This module supports offload of SHA and AES algorithms. Reviewed by: Gary R Hook

Re: [PATCH] crypto: ccp - avoid uninitialized variable warning

2017-08-01 Thread Gary R Hook
On 07/31/2017 03:49 PM, Arnd Bergmann wrote: The added support for version 5 CCPs introduced a false-positive warning in the RSA implementation: drivers/crypto/ccp/ccp-ops.c: In function 'ccp_run_rsa_cmd': drivers/crypto/ccp/ccp-ops.c:1856:3: error: 'sb_count' may be used uninitialized in this

Re: [PATCH v3 0/3] Update support for XTS-AES on AMD CCPs

2017-07-25 Thread Gary R Hook
- Edit comments - Remove unnecessary variable - Delay a change (that belongs in the CCP v5 patch) Changes since v1: - rework the validation of the unit-size; move to a separate patch - expand the key buffer to accommodate 256-bit keys - use xts_check_key() in the crypto layer ---

[PATCH v3 0/3] Update support for XTS-AES on AMD CCPs

2017-07-25 Thread Gary R Hook
- Remove unnecessary variable - Delay a change (that belongs in the CCP v5 patch) Changes since v1: - rework the validation of the unit-size; move to a separate patch - expand the key buffer to accommodate 256-bit keys - use xts_check_key() in the crypto layer --- Gary R Hook (3): crypto

[PATCH v3 1/3] crypto: ccp - Add a call to xts_check_key()

2017-07-25 Thread Gary R Hook
Vet the key using the available standard function Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-aes-xts.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp-crypto-aes-xts.c b/drivers/crypto/ccp/ccp-crypto-aes-xts.c index

[PATCH v3 2/3] crypto: ccp - Rework the unit-size check for XTS-AES

2017-07-25 Thread Gary R Hook
The CCP supports a limited set of unit-size values. Change the check for this parameter such that acceptable values match the enumeration. Then clarify the conditions under which we must use the fallback implementation. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-aes-xts.c

[PATCH v3 3/3] crypto: ccp - Add XTS-AES-256 support for CCP version 5

2017-07-25 Thread Gary R Hook
Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-aes-xts.c | 26 ++ drivers/crypto/ccp/ccp-crypto.h |2 +- drivers/crypto/ccp/ccp-ops.c|2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ccp/ccp

[PATCH] crypto: ccp - Fix XTS-AES-128 support on v5 CCPs

2017-07-25 Thread Gary R Hook
Version 5 CCPs have some new requirements for XTS-AES: the type field must be specified, and the key requires 512 bits, with each part occupying 256 bits and padded with zeroes. cc: # 4.9.x+ Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-aes-xts.c |4 ++- drivers/crypto/ccp

[PATCH v2 4/4] crypto: ccp - Add XTS-AES-256 support for CCP version 5

2017-07-21 Thread Gary R Hook
Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-aes-xts.c | 16 +--- drivers/crypto/ccp/ccp-crypto.h |2 +- drivers/crypto/ccp/ccp-ops.c|3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ccp/ccp-crypto-aes

  1   2   3   >