[PATCH 00/18 v3] Signature verification of hibernate snapshot

2013-08-22 Thread Lee, Chun-Yi
Hi experts, This patchset is the implementation for signature verification of hibernate snapshot image. The origin idea is from Jiri Kosina: Let EFI bootloader generate key-pair in UEFI secure boot environment, then pass it to kernel for sign/verify S4 image. Due to there have potential threat

[PATCH 01/18] asymmetric keys: add interface and skeleton for implement signature generation

2013-08-22 Thread Lee, Chun-Yi
Add generate_signature interface on signature.c, asymmetric-subtype and rsa.c for prepare to implement signature generation. Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com --- crypto/asymmetric_keys/private_key.h | 29 +

[RFC PATCH 00/18 v3] Signature verification of hibernate snapshot

2013-08-22 Thread Lee, Chun-Yi
Hi experts, This patchset is the implementation for signature verification of hibernate snapshot image. The origin idea is from Jiri Kosina: Let EFI bootloader generate key-pair in UEFI secure boot environment, then pass it to kernel for sign/verify S4 image. Due to there have potential threat

[PATCH 01/18] asymmetric keys: add interface and skeleton for implement signature generation

2013-08-22 Thread Lee, Chun-Yi
Add generate_signature interface on signature.c, asymmetric-subtype and rsa.c for prepare to implement signature generation. Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com --- crypto/asymmetric_keys/private_key.h | 29 +

[PATCH 03/18] asymmetric keys: separate the length checking of octet string from RSA_I2OSP

2013-08-22 Thread Lee, Chun-Yi
Due to RSA_I2OSP is not only used by signature verification path but also used in signature generation path. So, separate the length checking of octet string because it's not for generate 0x00 0x01 leading string when used in signature generation. Reviewed-by: Jiri Kosina jkos...@suse.cz

[PATCH 08/18] Secure boot: Add new capability

2013-08-22 Thread Lee, Chun-Yi
From: Matthew Garrett m...@redhat.com Secure boot adds certain policy requirements, including that root must not be able to do anything that could cause the kernel to execute arbitrary code. The simplest way to handle this would seem to be to add a new capability and gate various functionality on

[PATCH 17/18] Hibernate: introduced SNAPSHOT_SIG_HASH config for select hash algorithm

2013-08-22 Thread Lee, Chun-Yi
This patch introduced SNAPSHOT_SIG_HASH config for user to select which hash algorithm will be used during signature generation of snapshot. v2: Add define check of oCONFIG_SNAPSHOT_VERIFICATION in snapshot.c before declare pkey_hash(). Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by:

[PATCH 18/18] Hibernate: notify bootloader regenerate key-pair for snapshot verification

2013-08-22 Thread Lee, Chun-Yi
This patch introduced SNAPSHOT_REGEN_KEYS kernel config, enable this option let kernel notify booloader (e.g. shim) to regenerate key-pair of snapshot verification for each hibernate. Kernel loaded S4 sign key in efi stub, so the private key forward from efi bootloader to kernel in UEFI secure

[PATCH 14/18] Hibernate: applied SNAPSHOT_VERIFICATION config to switch signature check

2013-08-22 Thread Lee, Chun-Yi
This patch applied SNAPSHOT_VERIFICATION kernel config for switching signature check of hibernate snapshot image. Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com --- kernel/power/snapshot.c | 19 +++ kernel/power/swap.c | 30

[PATCH 15/18] Hibernate: adapt to UEFI secure boot with signature check

2013-08-22 Thread Lee, Chun-Yi
In current solution, the snapshot signature check used the RSA key-pair that are generated by bootloader(e.g. shim) and pass the key-pair to kernel through EFI variables. I choice to binding the snapshot signature check mechanism with UEFI secure boot for provide stronger protection of hibernate.

[PATCH 16/18] Hibernate: show the verification time for monitor performance

2013-08-22 Thread Lee, Chun-Yi
Show the verification time for monitor the performance of SHA256 and RSA verification. Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com --- kernel/power/snapshot.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git

[PATCH 13/18] Hibernate: Avoid S4 sign key data included in snapshot image

2013-08-22 Thread Lee, Chun-Yi
This patch add swsusp_page_is_sign_key() method to hibernate_key.c and check the page is S4 sign key data when collect saveable page in snapshot.c to avoid sign key data included in snapshot image. Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com ---

[PATCH 12/18] Hibernate: generate and verify signature of snapshot

2013-08-22 Thread Lee, Chun-Yi
This patch add the code for generate/verify signature of snapshot, it put the signature to snapshot header. This approach can support both on userspace hibernate and in-kernel hibernate. v2: - Due to loaded S4 sign key before ExitBootServices, we need forward key from boot kernel to resume

[PATCH 11/18] Hibernate: introduced RSA key-pair to verify signature of snapshot

2013-08-22 Thread Lee, Chun-Yi
Introduced a hibernate_key.c file to query the key pair from EFI variables and maintain key pair for check signature of S4 snapshot image. We loaded the private key when snapshot image stored success. This patch introduced 2 EFI variables for store the key to sign S4 image and verify signature

[PATCH 09/18] Secure boot: Add a dummy kernel parameter that will switch on Secure Boot mode

2013-08-22 Thread Lee, Chun-Yi
From: Josh Boyer jwbo...@redhat.com This forcibly drops CAP_COMPROMISE_KERNEL from both cap_permitted and cap_bset in the init_cred struct, which everything else inherits from. This works on any machine and can be used to develop even if the box doesn't have UEFI. Signed-off-by: Josh Boyer

[PATCH 06/18] asymmetric keys: support parsing PKCS #8 private key information

2013-08-22 Thread Lee, Chun-Yi
Add ASN.1 files and parser to support parsing PKCS #8 noncompressed private key information. It's better than direct parsing pure private key because PKCS #8 has a privateKeyAlgorithm to indicate the algorithm of private key, e.g. RSA from PKCS #1 Reviewed-by: Jiri Kosina jkos...@suse.cz

[PATCH 04/18] asymmetric keys: implement OS2IP in rsa

2013-08-22 Thread Lee, Chun-Yi
Implement Octet String to Integer conversion [RFC3447 sec 4.2] in rsa.c. It's the second step of signature generation operation. This patch is temporary set non-RSASP1 message to pks-S for debugging. Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com ---

[PATCH 05/18] asymmetric keys: implement RSASP1

2013-08-22 Thread Lee, Chun-Yi
Implement RSASP1 and fill-in the following data to public key signature structure: signature length (pkcs-k), signature octet strings (pks-S) and MPI of signature (pks-rsa.s). Reviewed-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Lee, Chun-Yi j...@suse.com --- crypto/asymmetric_keys/rsa.c |