Lines Matching refs:device
15 char *device; member
211 openedIndex = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, in verify_other_keyslot()
242 keyIndex = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, password, in find_keyslot_by_passphrase()
251 const char *device, in device_check_and_adjust() argument
257 if (!device || get_device_infos(device, &infos, cd) < 0) { in device_check_and_adjust()
259 device ?: "[none]"); in device_check_and_adjust()
266 log_err(cd, _("Device %s has zero size.\n"), device); in device_check_and_adjust()
270 log_err(cd, _("Device %s is too small.\n"), device); in device_check_and_adjust()
375 r = device_check_and_adjust(cd, cd->device, &size, &offset, &read_only); in create_device_helper()
386 r = dm_create_device(name, cd->device, dm_cipher ?: cipher, cd->type, uuid, size, skip, offset, in create_device_helper()
408 r = device_check_and_adjust(cd, cd->device, &size, &offset, &read_only); in open_from_hdr_and_mk()
416 r = dm_create_device(name, cd->device, cipher, cd->type, in open_from_hdr_and_mk()
473 if(asprintf(&prompt, _("Enter passphrase for %s: "), cd->device) < 0) in volume_key_by_terminal_passphrase()
489 r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase_read, in volume_key_by_terminal_passphrase()
530 r = crypt_init(cd, options->device); in _crypt_init()
632 char *device = NULL, *cipher = NULL, *uuid = NULL, *key = NULL; in crypt_resize_device() local
642 r = dm_query_device(options->name, &device, &size, &skip, &offset, in crypt_resize_device()
660 if (!options->device) in crypt_resize_device()
661 options->device = device; in crypt_resize_device()
668 r = device_check_and_adjust(cd, device, &size, &offset, &read_only); in crypt_resize_device()
672 r = dm_create_device(options->name, device, cipher, type, in crypt_resize_device()
678 if (options->device == device) in crypt_resize_device()
679 options->device = NULL; in crypt_resize_device()
680 free(device); in crypt_resize_device()
703 r = dm_query_device(options->name, (char **)&options->device, &options->size, in crypt_query_device()
904 log_dbg("Check device %s for LUKS header.", options->device); in crypt_isLuks()
911 r = crypt_init(&cd, options->device); in crypt_isLuks()
916 r = LUKS_read_phdr(cd->device, &cd->hdr, 0, cd) ? -EINVAL : 0; in crypt_isLuks()
955 free((char *)options->device); in crypt_put_options()
956 options->device = NULL; in crypt_put_options()
976 int crypt_init(struct crypt_device **cd, const char *device) in crypt_init() argument
983 log_dbg("Allocating crypt device %s context.", device); in crypt_init()
985 if (device && !device_ready(NULL, device, O_RDONLY)) in crypt_init()
993 if (device) { in crypt_init()
994 h->device = strdup(device); in crypt_init()
995 if (!h->device) { in crypt_init()
1000 h->device = NULL; in crypt_init()
1017 char *device = NULL; in crypt_init_by_name() local
1031 r = dm_query_device(name, &device, NULL, NULL, NULL, in crypt_init_by_name()
1035 if (r >= 0 && !device) in crypt_init_by_name()
1040 r = crypt_init(cd, device); in crypt_init_by_name()
1042 free(device); in crypt_init_by_name()
1090 if (!cd->device) { in _crypt_format_luks1()
1098 get_topology_alignment(cd->device, &required_alignment, in _crypt_format_luks1()
1111 r = wipe_device_header(cd->device, 8); in _crypt_format_luks1()
1113 log_err(cd, _("Can't wipe header on device %s.\n"), cd->device); in _crypt_format_luks1()
1117 r = LUKS_write_phdr(cd->device, &cd->hdr, cd); in _crypt_format_luks1()
1133 log_dbg("Formatting device %s as type %s.", cd->device ?: "(none)", cd->type ?: "(none)"); in crypt_format()
1184 requested_type ?: "any", cd->device ?: "(none)"); in crypt_load()
1186 if (!cd->device) in crypt_load()
1198 r = LUKS_read_phdr(cd->device, &hdr, 1, cd); in crypt_load()
1224 "file %s.", cd->device, requested_type, backup_file); in crypt_header_backup()
1226 return LUKS_hdr_backup(backup_file, cd->device, &cd->hdr, cd); in crypt_header_backup()
1243 "file %s.", cd->device, requested_type, backup_file); in crypt_header_restore()
1245 return LUKS_hdr_restore(backup_file, cd->device, &cd->hdr, cd); in crypt_header_restore()
1251 log_dbg("Releasing crypt device %s context.", cd->device); in crypt_free()
1257 free(cd->device); in crypt_free()
1337 r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase, in crypt_resume_by_passphrase()
1394 r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase_read, in crypt_resume_by_keyfile()
1448 r = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, passphrase, in crypt_keyslot_add_by_passphrase()
1459 r = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, password, in crypt_keyslot_add_by_passphrase()
1479 r = LUKS_set_key(cd->device, keyslot, new_password, new_passwordLen, in crypt_keyslot_add_by_passphrase()
1536 r = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, password, passwordLen, in crypt_keyslot_add_by_keyfile()
1557 r = LUKS_set_key(cd->device, keyslot, new_password, new_passwordLen, in crypt_keyslot_add_by_keyfile()
1608 r = LUKS_set_key(cd->device, keyslot, passphrase, passphrase_size, in crypt_keyslot_add_by_volume_key()
1639 return LUKS_del_key(cd->device, keyslot, &cd->hdr, cd); in crypt_keyslot_destroy()
1679 if(asprintf(&prompt, _("Enter passphrase for %s: "), cd->device) < 0) in crypt_activate_by_passphrase()
1684 r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase, in crypt_activate_by_passphrase()
1740 r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase_read, in crypt_activate_by_keyfile()
1872 r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase, in crypt_volume_key_get()
1983 log_std(cd, "LUKS header information for %s\n\n", cd->device); in crypt_dump()