Loading cmds/keystore/keymgmt.c +7 −0 Original line number Original line Diff line number Diff line Loading @@ -185,6 +185,7 @@ static int change_passwd(char *data) p = strtok_r(NULL, delimiter, &context); p = strtok_r(NULL, delimiter, &context); } } if (count != 2) return -1; if (count != 2) return -1; if (strlen(new_pass) < MIN_PASSWD_LENGTH) return -1; if ((ret = get_master_key(old_pass, master_key)) == 0) { if ((ret = get_master_key(old_pass, master_key)) == 0) { ret = store_master_key(new_pass, master_key); ret = store_master_key(new_pass, master_key); retry_count = 0; retry_count = 0; Loading Loading @@ -259,6 +260,11 @@ int list_keys(const char *namespace, char reply[BUFFER_MAX]) DIR *d; DIR *d; struct dirent *de; struct dirent *de; if (state != UNLOCKED) { LOGE("Can not list key with current state %d\n", state); return -1; } if (!namespace || ((d = opendir("."))) == NULL) { if (!namespace || ((d = opendir("."))) == NULL) { LOGE("cannot open keystore dir or namespace is null\n"); LOGE("cannot open keystore dir or namespace is null\n"); return -1; return -1; Loading Loading @@ -287,6 +293,7 @@ int passwd(char *data) { { if (state == UNINITIALIZED) { if (state == UNINITIALIZED) { if (strchr(data, ' ')) return -1; if (strchr(data, ' ')) return -1; if (strlen(data) < MIN_PASSWD_LENGTH) return -1; return create_master_key(data); return create_master_key(data); } } return change_passwd(data); return change_passwd(data); Loading cmds/keystore/keymgmt.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define USER_KEY_LEN (AES_KEY_LEN/8) #define USER_KEY_LEN (AES_KEY_LEN/8) #define IV_LEN USER_KEY_LEN #define IV_LEN USER_KEY_LEN #define MAX_RETRY_COUNT 6 #define MAX_RETRY_COUNT 6 #define MIN_PASSWD_LENGTH 8 #define gen_key(passwd, key, len) \ #define gen_key(passwd, key, len) \ PKCS5_PBKDF2_HMAC_SHA1(passwd, strlen(passwd), \ PKCS5_PBKDF2_HMAC_SHA1(passwd, strlen(passwd), \ Loading cmds/keystore/netkeystore.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -224,6 +224,7 @@ static void do_reset_keystore(LPC_MARSHAL *cmd, LPC_MARSHAL *reply) } } reply->retcode = reset_keystore(); reply->retcode = reset_keystore(); } } static void execute(LPC_MARSHAL *cmd, LPC_MARSHAL *reply) static void execute(LPC_MARSHAL *cmd, LPC_MARSHAL *reply) { { uint32_t cmd_max = sizeof(cmds)/sizeof(struct cmdinfo); uint32_t cmd_max = sizeof(cmds)/sizeof(struct cmdinfo); Loading Loading
cmds/keystore/keymgmt.c +7 −0 Original line number Original line Diff line number Diff line Loading @@ -185,6 +185,7 @@ static int change_passwd(char *data) p = strtok_r(NULL, delimiter, &context); p = strtok_r(NULL, delimiter, &context); } } if (count != 2) return -1; if (count != 2) return -1; if (strlen(new_pass) < MIN_PASSWD_LENGTH) return -1; if ((ret = get_master_key(old_pass, master_key)) == 0) { if ((ret = get_master_key(old_pass, master_key)) == 0) { ret = store_master_key(new_pass, master_key); ret = store_master_key(new_pass, master_key); retry_count = 0; retry_count = 0; Loading Loading @@ -259,6 +260,11 @@ int list_keys(const char *namespace, char reply[BUFFER_MAX]) DIR *d; DIR *d; struct dirent *de; struct dirent *de; if (state != UNLOCKED) { LOGE("Can not list key with current state %d\n", state); return -1; } if (!namespace || ((d = opendir("."))) == NULL) { if (!namespace || ((d = opendir("."))) == NULL) { LOGE("cannot open keystore dir or namespace is null\n"); LOGE("cannot open keystore dir or namespace is null\n"); return -1; return -1; Loading Loading @@ -287,6 +293,7 @@ int passwd(char *data) { { if (state == UNINITIALIZED) { if (state == UNINITIALIZED) { if (strchr(data, ' ')) return -1; if (strchr(data, ' ')) return -1; if (strlen(data) < MIN_PASSWD_LENGTH) return -1; return create_master_key(data); return create_master_key(data); } } return change_passwd(data); return change_passwd(data); Loading
cmds/keystore/keymgmt.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define USER_KEY_LEN (AES_KEY_LEN/8) #define USER_KEY_LEN (AES_KEY_LEN/8) #define IV_LEN USER_KEY_LEN #define IV_LEN USER_KEY_LEN #define MAX_RETRY_COUNT 6 #define MAX_RETRY_COUNT 6 #define MIN_PASSWD_LENGTH 8 #define gen_key(passwd, key, len) \ #define gen_key(passwd, key, len) \ PKCS5_PBKDF2_HMAC_SHA1(passwd, strlen(passwd), \ PKCS5_PBKDF2_HMAC_SHA1(passwd, strlen(passwd), \ Loading
cmds/keystore/netkeystore.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -224,6 +224,7 @@ static void do_reset_keystore(LPC_MARSHAL *cmd, LPC_MARSHAL *reply) } } reply->retcode = reset_keystore(); reply->retcode = reset_keystore(); } } static void execute(LPC_MARSHAL *cmd, LPC_MARSHAL *reply) static void execute(LPC_MARSHAL *cmd, LPC_MARSHAL *reply) { { uint32_t cmd_max = sizeof(cmds)/sizeof(struct cmdinfo); uint32_t cmd_max = sizeof(cmds)/sizeof(struct cmdinfo); Loading