Merge changes from topic "e4crypt_to_fscrypt"
am: ddbd8325f5
Change-Id: Ifbe5a1bfd2d9a4b0e97197ab91358df356b0d0b2
This commit is contained in:
commit
e6680f17a8
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