Re: [PATCH V2 2/3] crypto: ccp - Enable support for AES GCM on v5 CCPs

2017-03-02 Thread Stephan Müller
Am Donnerstag, 2. März 2017, 22:26:54 CET schrieb Gary R Hook: Hi Gary, > A version 5 device provides the primitive commands > required for AES GCM. This patch adds support for > en/decryption. > > Signed-off-by: Gary R Hook > --- > drivers/crypto/ccp/Makefile|1 > drivers/

Re: XTS Crypto Not Found In /proc/crypto Even After Compiled for 4.10.1.

2017-03-02 Thread Herbert Xu
On Thu, Mar 02, 2017 at 05:35:30PM -0600, Nathan Royce wrote: > ARM ODroid XU4 > > $ cat /proc/config.gz | gunzip | grep XTS > CONFIG_CRYPTO_XTS=y > > $ grep xts /proc/crypto > //4.9.13 > name : xts(aes) > driver : xts(aes-generic) > //4.10.1 > > //cbc can be found though > > CRYP

[PATCH] crypto: powerpc - Fix initialisation of crc32c context

2017-03-02 Thread Daniel Axtens
Turning on crypto self-tests on a POWER8 shows: alg: hash: Test 1 failed for crc32c-vpmsum : ff ff ff ff Comparing the code with the Intel CRC32c implementation on which ours is based shows that we are doing an init with 0, not ~0 as CRC32c requires. This probably wasn't caught b

Re: [PATCH] crypto: Add ECB dependency for XTS mode

2017-03-02 Thread Milan Broz
Patch below should be backported to 4.10 stable (only 4.10, older kernels are ok). We have reports some systems fail to boot from LUKS now (missing ecb module in initramdisk) ... Upstream commit is 12cb3a1c4184f891d965d1f39f8cfcc9ef617647 Thanks, Milan On 02/23/2017 08:38 AM, Milan Broz wrote: >

Re: [PATCH V2 0/3] Series short description

2017-03-02 Thread Gary R Hook
On 03/02/2017 03:26 PM, Hook, Gary wrote: The following series: - Move verbose init messages to debug mode - Update the queue pointers in the event of an error - Simplify buffer management and eliminate an unused option *sigh* That Subject line is supposed to read "Minor CCP improvements and c

[PATCH V2 0/3] Series short description

2017-03-02 Thread Gary R Hook
The following series: - Move verbose init messages to debug mode - Update the queue pointers in the event of an error - Simplify buffer management and eliminate an unused option --- Gary R Hook (3): crypto: ccp - Add SHA-2 384- and 512-bit support crypto: ccp - Enable support for AES

[PATCH V2 3/3] crypto: ccp - Enable 3DES function on v5 CCPs

2017-03-02 Thread Gary R Hook
Wire up support for Triple DES in ECB mode. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/Makefile |1 drivers/crypto/ccp/ccp-crypto-des3.c | 254 ++ drivers/crypto/ccp/ccp-crypto-main.c | 10 + drivers/crypto/ccp/ccp-crypto.h | 22 +++

[PATCH V2 1/3] crypto: ccp - Add SHA-2 384- and 512-bit support

2017-03-02 Thread Gary R Hook
Incorporate 384-bit and 512-bit hashing for a version 5 CCP device Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-crypto-sha.c | 22 +++ drivers/crypto/ccp/ccp-crypto.h |8 ++-- drivers/crypto/ccp/ccp-ops.c| 72 +++ include/linu

[PATCH V2 2/3] crypto: ccp - Enable support for AES GCM on v5 CCPs

2017-03-02 Thread Gary R Hook
A version 5 device provides the primitive commands required for AES GCM. This patch adds support for en/decryption. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/Makefile|1 drivers/crypto/ccp/ccp-crypto-aes-galois.c | 257 drivers/crypto/cc

[RFC PATCH v2 17/32] x86: kvmclock: Clear encryption attribute when SEV is active

2017-03-02 Thread Brijesh Singh
The guest physical memory area holding the struct pvclock_wall_clock and struct pvclock_vcpu_time_info are shared with the hypervisor. Hypervisor periodically updates the contents of the memory. When SEV is active we must clear the encryption attributes of the shared memory pages so that both hyper

[RFC PATCH v2 27/32] kvm: svm: Add support for SEV LAUNCH_FINISH command

2017-03-02 Thread Brijesh Singh
The command is used for finializing the SEV guest launch process. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 36 1 file changed, 36 insertions(+) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 62c2b22..c108064 100644 --- a/arch/x86/k

Re: [RFC PATCH v2 19/32] crypto: ccp: Introduce the AMD Secure Processor device

2017-03-02 Thread Brijesh Singh
Hi Mark, On 03/02/2017 11:39 AM, Mark Rutland wrote: On Thu, Mar 02, 2017 at 10:16:15AM -0500, Brijesh Singh wrote: The CCP device is part of the AMD Secure Processor. In order to expand the usage of the AMD Secure Processor, create a framework that allows functional components of the AMD Secur

[RFC PATCH v2 00/32] x86: Secure Encrypted Virtualization (AMD)

2017-03-02 Thread Brijesh Singh
This RFC series provides support for AMD's new Secure Encrypted Virtualization (SEV) feature. This RFC is build upon Secure Memory Encryption (SME) RFCv4 [1]. SEV is an extension to the AMD-V architecture which supports running multiple VMs under the control of a hypervisor. When enabled, SEV hard

[RFC PATCH v2 15/32] x86: Add support for changing memory encryption attribute in early boot

2017-03-02 Thread Brijesh Singh
Some KVM-specific custom MSRs shares the guest physical address with hypervisor. When SEV is active, the shared physical address must be mapped with encryption attribute cleared so that both hypervsior and guest can access the data. Add APIs to change memory encryption attribute in early boot code

Re: [RFC PATCH v2 19/32] crypto: ccp: Introduce the AMD Secure Processor device

2017-03-02 Thread Mark Rutland
On Thu, Mar 02, 2017 at 10:16:15AM -0500, Brijesh Singh wrote: > The CCP device is part of the AMD Secure Processor. In order to expand the > usage of the AMD Secure Processor, create a framework that allows functional > components of the AMD Secure Processor to be initialized and handled > appropr

[RFC PATCH v2 10/32] x86: DMA support for SEV memory encryption

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky DMA access to memory mapped as encrypted while SEV is active can not be encrypted during device write or decrypted during device read. In order for DMA to properly work when SEV is active, the swiotlb bounce buffers must be used. Signed-off-by: Tom Lendacky --- arch/x86/mm/m

[RFC PATCH v2 14/32] x86: mm: Provide support to use memblock when spliting large pages

2017-03-02 Thread Brijesh Singh
If kernel_maps_pages_in_pgd is called early in boot process to change the memory attributes then it fails to allocate memory when spliting large pages. The patch extends the cpa_data to provide the support to use memblock_alloc when slab allocator is not available. The feature will be used in Secu

[RFC PATCH v2 13/32] KVM: SVM: Enable SEV by setting the SEV_ENABLE CPU feature

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Modify the SVM cpuid update function to indicate if Secure Encrypted Virtualization (SEV) is active in the guest by setting the SEV KVM CPU features bit. SEV is active if Secure Memory Encryption is enabled in the host and the SEV_ENABLE bit of the VMCB is set. Signed-off-by:

[RFC PATCH v2 12/32] x86: Add early boot support when running with SEV active

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Early in the boot process, add checks to determine if the kernel is running with Secure Encrypted Virtualization (SEV) active by issuing a CPUID instruction. During early compressed kernel booting, if SEV is active the pagetables are updated so that data is accessed and decomp

Re: Problem with RSA test from testmgr

2017-03-02 Thread Tadeusz Struk
On 03/01/2017 10:21 PM, Corentin Labbe wrote: > I am finishing a patch that made testmgr test both (padded and unpadded). Even if you patch the test vectors there is no guarantee that a user of the API will always have the plain text padded. It can be anything between 1 and the key size. This need

Re: [PATCH v3 2/2] crypto: vmx - Use skcipher for xts fallback

2017-03-02 Thread Herbert Xu
On Wed, Mar 01, 2017 at 11:00:00AM -0300, Paulo Flabiano Smorigo wrote: > Signed-off-by: Paulo Flabiano Smorigo Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Re: Problem with RSA test from testmgr

2017-03-02 Thread Tadeusz Struk
Hi Stephan, On 03/01/2017 10:08 PM, Stephan Müller wrote: >> memset(ptextp, 0, 256); >> memcpy(ptextp + 64 - 8, ptext_ex, plen); > I actually have tested that and it did not return the data the kernel > implementation would return It did for me: Result 64 plen=8 63 1c cd 7b e1 7e e4 de

[RFC PATCH v2 26/32] kvm: svm: Add support for SEV LAUNCH_UPDATE_DATA command

2017-03-02 Thread Brijesh Singh
The command is used for encrypting the guest memory region using the VM encryption key (VEK) created from LAUNCH_START. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 150 1 file changed, 150 insertions(+) diff --git a/arch/x86/kvm/sv

[RFC PATCH v2 28/32] kvm: svm: Add support for SEV GUEST_STATUS command

2017-03-02 Thread Brijesh Singh
The command is used for querying the SEV guest status. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 37 + 1 file changed, 37 insertions(+) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c108064..977aa22 100644 --- a/arch/x86/kvm/svm.c +

[RFC PATCH v2 21/32] crypto: ccp: Add Secure Encrypted Virtualization (SEV) interface support

2017-03-02 Thread Brijesh Singh
The Secure Encrypted Virtualization (SEV) interface allows the memory contents of a virtual machine (VM) to be transparently encrypted with a key unique to the guest. The interface provides: - /dev/sev device and ioctl (SEV_ISSUE_CMD) to execute the platform provisioning commands from the us

[RFC PATCH v2 25/32] kvm: svm: Add support for SEV LAUNCH_START command

2017-03-02 Thread Brijesh Singh
The command is used to bootstrap SEV guest from unencrypted boot images. The command creates a new VM encryption key (VEK) using the guest owner's public DH certificates, and session data. The VEK will be used to encrypt the guest memory. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 30

[RFC PATCH v2 20/32] crypto: ccp: Add Platform Security Processor (PSP) interface support

2017-03-02 Thread Brijesh Singh
AMD Platform Security Processor (PSP) is a dedicated processor that provides the support for encrypting the guest memory in a Secure Encrypted Virtualiztion (SEV) mode, along with software-based Tursted Executation Environment (TEE) to enable the third-party tursted applications. Signed-off-by: Br

[RFC PATCH v2 29/32] kvm: svm: Add support for SEV DEBUG_DECRYPT command

2017-03-02 Thread Brijesh Singh
The command is used to decrypt guest memory region for debug purposes. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 76 1 file changed, 76 insertions(+) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 977aa22..ce8819a 10

[RFC PATCH v2 16/32] x86: kvm: Provide support to create Guest and HV shared per-CPU variables

2017-03-02 Thread Brijesh Singh
Some KVM specific MSR's (steal-time, asyncpf, avic_eio) allocates per-CPU variable at compile time and share its physical address with hypervisor. It presents a challege when SEV is active in guest OS. When SEV is active, guest memory is encrypted with guest key and hypervisor will no longer able t

[RFC PATCH v2 22/32] kvm: svm: prepare to reserve asid for SEV guest

2017-03-02 Thread Brijesh Singh
In current implementation, asid allocation starts from 1, this patch adds a min_asid variable in svm_vcpu structure to allow starting asid from something other than 1. Signed-off-by: Brijesh Singh Reviewed-by: Paolo Bonzini --- arch/x86/kvm/svm.c |4 +++- 1 file changed, 3 insertions(+), 1

[RFC PATCH v2 18/32] kvm: svm: Use the hardware provided GPA instead of page walk

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky When a guest causes a NPF which requires emulation, KVM sometimes walks the guest page tables to translate the GVA to a GPA. This is unnecessary most of the time on AMD hardware since the hardware provides the GPA in EXITINFO2. The only exception cases involve string operation

[RFC PATCH v2 23/32] kvm: introduce KVM_MEMORY_ENCRYPT_OP ioctl

2017-03-02 Thread Brijesh Singh
If hardware supports encrypting then KVM_MEMORY_ENCRYPT_OP ioctl can be used by qemu to issue platform specific memory encryption commands. Signed-off-by: Brijesh Singh --- arch/x86/include/asm/kvm_host.h |2 ++ arch/x86/kvm/x86.c | 12 include/uapi/linux/kvm.h

[RFC PATCH v2 01/32] x86: Add the Secure Encrypted Virtualization CPU feature

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Update the CPU features to include identifying and reporting on the Secure Encrypted Virtualization (SEV) feature. SME is identified by CPUID 0x801f, but requires BIOS support to enable it (set bit 23 of MSR_K8_SYSCFG and set bit 0 of MSR_K7_HWCR). Only show the SEV featu

[RFC PATCH v2 03/32] KVM: SVM: prepare for new bit definition in nested_ctl

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Currently the nested_ctl variable in the vmcb_control_area structure is used to indicate nested paging support. The nested paging support field is actually defined as bit 0 of the field. In order to support a new feature flag the usage of the nested_ctl and nested paging suppor

[RFC PATCH v2 24/32] kvm: x86: prepare for SEV guest management API support

2017-03-02 Thread Brijesh Singh
The patch adds initial support required to integrate Secure Encrypted Virtualization (SEV) feature. ASID management: - Reserve asid range for SEV guest, SEV asid range is obtained through CPUID Fn8000_001f[ECX]. A non-SEV guest can use any asid outside the SEV asid range. - SEV guest must

[RFC PATCH v2 32/32] x86: kvm: Pin the guest memory when SEV is active

2017-03-02 Thread Brijesh Singh
The SEV memory encryption engine uses a tweak such that two identical plaintexts at different location will have a different ciphertexts. So swapping or moving ciphertexts of two pages will not result in plaintexts being swapped. Relocating (or migrating) a physical backing pages for SEV guest will

[RFC PATCH v2 31/32] kvm: svm: Add support for SEV LAUNCH_MEASURE command

2017-03-02 Thread Brijesh Singh
The command is used to retrieve the measurement of memory encrypted through the LAUNCH_UPDATE_DATA command. This measurement can be used for attestation purposes. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 52 1 file changed, 52 i

[RFC PATCH v2 06/32] x86/pci: Use memremap when walking setup data

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky The use of ioremap will force the setup data to be mapped decrypted even though setup data is encrypted. Switch to using memremap which will be able to perform the proper mapping. Signed-off-by: Tom Lendacky --- arch/x86/pci/common.c |4 ++-- 1 file changed, 2 insertion

[RFC PATCH v2 05/32] x86: Use encrypted access of BOOT related data with SEV

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky When Secure Encrypted Virtualization (SEV) is active, BOOT data (such as EFI related data, setup data) is encrypted and needs to be accessed as such when mapped. Update the architecture override in early_memremap to keep the encryption attribute when mapping this data. Signed-

[RFC PATCH v2 30/32] kvm: svm: Add support for SEV DEBUG_ENCRYPT command

2017-03-02 Thread Brijesh Singh
The command copies a plain text into guest memory and encrypts it using the VM encryption key. The command will be used for debug purposes (e.g setting breakpoint through gdbserver) Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 87 1

[RFC PATCH v2 04/32] KVM: SVM: Add SEV feature definitions to KVM

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Define a new KVM CPU feature for Secure Encrypted Virtualization (SEV). The kernel will check for the presence of this feature to determine if it is running with SEV active. Define the SEV enable bit for the VMCB control structure. The hypervisor will use this bit to enable SE

[RFC PATCH v2 02/32] x86: Secure Encrypted Virtualization (SEV) support

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Provide support for Secure Encyrpted Virtualization (SEV). This initial support defines a flag that is used by the kernel to determine if it is running with SEV active. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/mem_encrypt.h | 14 +- arch/x86/mm/mem_

[RFC PATCH v2 09/32] x86: Change early_ioremap to early_memremap for BOOT data

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky In order to map BOOT data with the proper encryption bit, the early_ioremap() function calls are changed to early_memremap() calls. This allows the proper access for both SME and SEV. Signed-off-by: Tom Lendacky --- arch/x86/kernel/acpi/boot.c |4 ++-- arch/x86/kernel/mp

[RFC PATCH v2 08/32] x86: Use PAGE_KERNEL protection for ioremap of memory page

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky In order for memory pages to be properly mapped when SEV is active, we need to use the PAGE_KERNEL protection attribute as the base protection. This will insure that memory mapping of, e.g. ACPI tables, receives the proper mapping attributes. Signed-off-by: Tom Lendacky ---

[RFC PATCH v2 07/32] x86/efi: Access EFI data as encrypted when SEV is active

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky EFI data is encrypted when the kernel is run under SEV. Update the page table references to be sure the EFI memory areas are accessed encrypted. Signed-off-by: Tom Lendacky Signed-off-by: Brijesh Singh --- arch/x86/platform/efi/efi_64.c | 15 ++- 1 file change

[RFC PATCH v2 19/32] crypto: ccp: Introduce the AMD Secure Processor device

2017-03-02 Thread Brijesh Singh
The CCP device is part of the AMD Secure Processor. In order to expand the usage of the AMD Secure Processor, create a framework that allows functional components of the AMD Secure Processor to be initialized and handled appropriately. Signed-off-by: Brijesh Singh Signed-off-by: Tom Lendacky ---

[RFC PATCH v2 11/32] x86: Unroll string I/O when SEV is active

2017-03-02 Thread Brijesh Singh
From: Tom Lendacky Secure Encrypted Virtualization (SEV) does not support string I/O, so unroll the string I/O operation into a loop operating on one element at a time. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/io.h | 26 ++ 1 file changed, 22 insertions(+)

Re: [RFC PATCH v4] IV Generation algorithms for dm-crypt

2017-03-02 Thread Gilad Ben-Yossef
On Wed, Mar 1, 2017 at 3:21 PM, Ondrej Mosnacek wrote: > 2017-03-01 13:42 GMT+01:00 Gilad Ben-Yossef : > > Wouldn't adopting a bulk request API (something like what I tried to > do here [1]) that allows users to supply multiple messages, each with > their own IV, fulfill this purpose? That way, we

Re: [PATCH v3 1/2] crypto: vmx - Use skcipher for cbc fallback

2017-03-02 Thread Herbert Xu
On Wed, Mar 01, 2017 at 10:58:20AM -0300, Paulo Flabiano Smorigo wrote: > Signed-off-by: Paulo Flabiano Smorigo > --- Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt