cryptfs: Don't use bare integers for key size
Rather than use an integer and have a comment, we use a named
constant for sizing these master key buffers. This will help
avoid confusion when we switch to allowing different sized
master keys.
Bug: 73079191
Test: Build
Change-Id: Ifaffdd94d337bb2d5a178f818dfe00f9386ae03b
diff --git a/cryptfs.cpp b/cryptfs.cpp
index f32bb42..d0de553 100644
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
@@ -1604,8 +1604,7 @@
static int test_mount_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr,
const char *passwd, const char *mount_point, const char *label)
{
- /* Allocate enough space for a 256 bit key, but we may use less */
- unsigned char decrypted_master_key[32];
+ unsigned char decrypted_master_key[KEY_LEN_BYTES];
char crypto_blkdev[MAXPATHLEN];
char real_blkdev[MAXPATHLEN];
char tmp_mount_point[64];
@@ -1862,8 +1861,7 @@
int cryptfs_verify_passwd(const char *passwd)
{
struct crypt_mnt_ftr crypt_ftr;
- /* Allocate enough space for a 256 bit key, but we may use less */
- unsigned char decrypted_master_key[32];
+ unsigned char decrypted_master_key[KEY_LEN_BYTES];
char encrypted_state[PROPERTY_VALUE_MAX];
int rc;