Logo Search packages:      
Sourcecode: u3-tool version File versions

int u3_change_password ( u3_handle_t device,
const char *  old_password,
const char *  new_password,
int *  result 

Change password of data partition

This changes the password of the data partition.

device U3 device handle
old_password The current password of the private zone
new_password The new password of the private zone
result Return variable for result: True if password changed, else False if old password incorrect.
U3_SUCCESS if successful, else U3_FAILURE and an error string can be obtained using u3_error()

Definition at line 525 of file u3_commands.c.

References u3_send_cmd().

      uint8_t status;
      uint8_t cmd[U3_CMD_LEN] = {
            0xff, 0xA6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00
        uint8_t passhash_buf[U3_PASSWORD_HASH_LEN * 2];

      *result = 0;
      u3_pass_to_hash(old_password, passhash_buf);
      u3_pass_to_hash(new_password, passhash_buf+U3_PASSWORD_HASH_LEN);
      if (u3_send_cmd(device, cmd, U3_DATA_TO_DEV, sizeof(passhash_buf),
            (uint8_t *) passhash_buf, &status) != U3_SUCCESS)
            return U3_FAILURE;

      if (status == 0) {
            *result = 1;

      return U3_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index