vold: get the fscrypt kernel API declarations from linux/fs.h
bionic now has linux/fs.h from the 4.14 kernel, which has the fscrypt kernel API declarations. Replace the manual declarations in vold, except for FS_AES_256_XTS_KEY_SIZE which is not available. Test: built, booted device with f2fs encryption Change-Id: I6a0e3117eaebe3baac7385421afce2169d46ad55
This commit is contained in:
parent
a701c458ca
commit
ba997ee583
1 changed files with 2 additions and 10 deletions
12
KeyUtil.cpp
12
KeyUtil.cpp
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "KeyUtil.h"
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
@ -32,16 +33,7 @@
|
|||
namespace android {
|
||||
namespace vold {
|
||||
|
||||
// fscrypt:TODO get these definitions from <linux/fs.h>
|
||||
constexpr int FS_KEY_DESCRIPTOR_SIZE = 8;
|
||||
constexpr int FS_ENCRYPTION_MODE_AES_256_XTS = 1;
|
||||
constexpr int FS_AES_256_XTS_KEY_SIZE = 64;
|
||||
constexpr int FS_MAX_KEY_SIZE = 64;
|
||||
struct fscrypt_key {
|
||||
uint32_t mode;
|
||||
char raw[FS_MAX_KEY_SIZE];
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
bool randomKey(KeyBuffer* key) {
|
||||
*key = KeyBuffer(FS_AES_256_XTS_KEY_SIZE);
|
||||
|
@ -54,7 +46,7 @@ bool randomKey(KeyBuffer* key) {
|
|||
}
|
||||
|
||||
// Get raw keyref - used to make keyname and to pass to ioctl
|
||||
static std::string generateKeyRef(const char* key, int length) {
|
||||
static std::string generateKeyRef(const uint8_t* key, int length) {
|
||||
SHA512_CTX c;
|
||||
|
||||
SHA512_Init(&c);
|
||||
|
|
Loading…
Reference in a new issue