ANDROID: Incremental fs: Remove signature checks from kernel

Test: selftests pass
Bug: 133435829
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ia7e69b1b0176202da4b418ea815b370cbdacd5c2
This commit is contained in:
Paul Lawrence 2020-03-13 12:38:35 -07:00
commit 8630e95541
11 changed files with 305 additions and 869 deletions

View file

@ -35,6 +35,8 @@
#define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
#define INCFS_MAX_SIGNATURE_SIZE 8096
#define INCFS_SIGNATURE_VERSION 2
#define INCFS_SIGNATURE_SECTIONS 2
#define INCFS_IOCTL_BASE_CODE 'g'
@ -139,46 +141,6 @@ enum incfs_hash_tree_algorithm {
INCFS_HASH_TREE_SHA256 = 1
};
struct incfs_file_signature_info {
/*
* A pointer to file's root hash (if determined != 0)
* Actual hash size determined by hash_tree_alg.
* Size of the buffer should be at least INCFS_MAX_HASH_SIZE
*
* Equivalent to: u8 *root_hash;
*/
__aligned_u64 root_hash;
/*
* A pointer to additional data that was attached to the root hash
* before signing.
*
* Equivalent to: u8 *additional_data;
*/
__aligned_u64 additional_data;
/* Size of additional data. */
__u32 additional_data_size;
__u32 reserved1;
/*
* A pointer to pkcs7 signature DER blob.
*
* Equivalent to: u8 *signature;
*/
__aligned_u64 signature;
/* Size of pkcs7 signature DER blob */
__u32 signature_size;
__u32 reserved2;
/* Value from incfs_hash_tree_algorithm */
__u8 hash_tree_alg;
};
/*
* Create a new file or directory.
*/
@ -232,10 +194,30 @@ struct incfs_new_file_args {
__u32 reserved4;
/* struct incfs_file_signature_info *signature_info; */
/*
* Points to an APK V4 Signature data blob
* Signature must have two sections
* Format is:
* u32 version
* u32 size_of_hash_info_section
* u8 hash_info_section[]
* u32 size_of_signing_info_section
* u8 signing_info_section[]
*
* Note that incfs does not care about what is in signing_info_section
*
* hash_info_section has following format:
* u32 hash_algorithm; // Must be SHA256 == 1
* u8 log2_blocksize; // Must be 12 for 4096 byte blocks
* u32 salt_size;
* u8 salt[];
* u32 hash_size;
* u8 root_hash[];
*/
__aligned_u64 signature_info;
__aligned_u64 reserved5;
/* Size of signature_info */
__aligned_u64 signature_size;
__aligned_u64 reserved6;
};