2011-07-07 Milan Broz <mbroz@redhat.com>
* Remove old API functions (all functions using crypt_options).
* Add --enable-discards option to allow discards/TRIM requests.
2011-07-07 Milan Broz <mbroz@redhat.com>
* Remove old API functions (all functions using crypt_options).
* Add --enable-discards option to allow discards/TRIM requests.
+ * Add crypt_get_iv_offset() function to API.
2011-07-01 Milan Broz <mbroz@redhat.com>
* Add --shared option for creating non-overlapping crypt segments.
2011-07-01 Milan Broz <mbroz@redhat.com>
* Add --shared option for creating non-overlapping crypt segments.
const char *name,
struct volume_key *vk,
uint64_t size,
const char *name,
struct volume_key *vk,
uint64_t size,
uint32_t flags);
#endif /* INTERNAL_H */
uint32_t flags);
#endif /* INTERNAL_H */
struct crypt_params_plain {
const char *hash; /* password hash function */
uint64_t offset; /* offset in sectors */
struct crypt_params_plain {
const char *hash; /* password hash function */
uint64_t offset; /* offset in sectors */
- uint64_t skip; /* IV initilisation sector */
+ uint64_t skip; /* IV offset / initialisation sector */
uint64_t size; /* size of mapped device or 0 for autodetection */
};
uint64_t size; /* size of mapped device or 0 for autodetection */
};
struct crypt_params_loopaes {
const char *hash; /* key hash function */
uint64_t offset; /* offset in sectors */
struct crypt_params_loopaes {
const char *hash; /* key hash function */
uint64_t offset; /* offset in sectors */
- uint64_t skip; /* IV initilisation sector */
+ uint64_t skip; /* IV offset / initialisation sector */
};
/**
* Create (format) new crypt device (and possible header on-disk) but not activates it.
};
/**
* Create (format) new crypt device (and possible header on-disk) but not activates it.
* uuid - device UUID or NULL if not set
* device_name - underlying device name or NULL if not yet set
* data_offset - device offset in sectors where real data starts on underlying device)
* uuid - device UUID or NULL if not set
* device_name - underlying device name or NULL if not yet set
* data_offset - device offset in sectors where real data starts on underlying device)
+ * iv_offset - IV offset in sectors (skip)
* volume_key_size - size (in bytes) of volume key for crypt device
*/
const char *crypt_get_cipher(struct crypt_device *cd);
* volume_key_size - size (in bytes) of volume key for crypt device
*/
const char *crypt_get_cipher(struct crypt_device *cd);
const char *crypt_get_uuid(struct crypt_device *cd);
const char *crypt_get_device_name(struct crypt_device *cd);
uint64_t crypt_get_data_offset(struct crypt_device *cd);
const char *crypt_get_uuid(struct crypt_device *cd);
const char *crypt_get_device_name(struct crypt_device *cd);
uint64_t crypt_get_data_offset(struct crypt_device *cd);
+uint64_t crypt_get_iv_offset(struct crypt_device *cd);
int crypt_get_volume_key_size(struct crypt_device *cd);
/**
int crypt_get_volume_key_size(struct crypt_device *cd);
/**
crypt_get_cipher_mode;
crypt_get_uuid;
crypt_get_data_offset;
crypt_get_cipher_mode;
crypt_get_uuid;
crypt_get_data_offset;
crypt_get_volume_key_size;
crypt_get_device_name;
crypt_get_volume_key_size;
crypt_get_device_name;
const char *base_cipher,
unsigned int keys_count,
struct volume_key *vk,
const char *base_cipher,
unsigned int keys_count,
struct volume_key *vk,
uint32_t flags)
{
char *cipher = NULL;
uint32_t flags)
{
char *cipher = NULL;
.uuid = crypt_get_uuid(cd),
.vk = vk,
.offset = crypt_get_data_offset(cd),
.uuid = crypt_get_uuid(cd),
.vk = vk,
.offset = crypt_get_data_offset(cd),
+ .iv_offset = crypt_get_iv_offset(cd),
.size = 0,
.flags = flags
};
.size = 0,
.flags = flags
};
const char *base_cipher,
unsigned int keys_count,
struct volume_key *vk,
const char *base_cipher,
unsigned int keys_count,
struct volume_key *vk,
const char *name,
struct volume_key *vk,
uint64_t size,
const char *name,
struct volume_key *vk,
uint64_t size,
.uuid = crypt_get_uuid(cd),
.vk = vk,
.offset = crypt_get_data_offset(cd),
.uuid = crypt_get_uuid(cd),
.vk = vk,
.offset = crypt_get_data_offset(cd),
- .iv_offset = iv_offset,
+ .iv_offset = crypt_get_iv_offset(cd),
.size = size,
.flags = flags
};
.size = size,
.flags = flags
};
- r = PLAIN_activate(cd, name, vk,
- cd->plain_hdr.size,
- cd->plain_hdr.skip, flags);
+ r = PLAIN_activate(cd, name, vk, cd->plain_hdr.size, flags);
keyslot = 0;
} else if (isLUKS(cd->type)) {
/* provided passphrase, do not retry */
keyslot = 0;
} else if (isLUKS(cd->type)) {
/* provided passphrase, do not retry */
- r = PLAIN_activate(cd, name, vk,
- cd->plain_hdr.size,
- cd->plain_hdr.skip, flags);
+ r = PLAIN_activate(cd, name, vk, cd->plain_hdr.size, flags);
} else if (isLUKS(cd->type)) {
r = key_from_file(cd, _("Enter passphrase: "), &passphrase_read,
&passphrase_size_read, keyfile, keyfile_size);
} else if (isLUKS(cd->type)) {
r = key_from_file(cd, _("Enter passphrase: "), &passphrase_read,
&passphrase_size_read, keyfile, keyfile_size);
goto out;
if (name)
r = LOOPAES_activate(cd, name, cd->loopaes_cipher,
goto out;
if (name)
r = LOOPAES_activate(cd, name, cd->loopaes_cipher,
- key_count, vk,
- cd->loopaes_hdr.skip,
- flags);
- r = PLAIN_activate(cd, name, vk,
- cd->plain_hdr.size,
- cd->plain_hdr.skip, flags);
+ r = PLAIN_activate(cd, name, vk, cd->plain_hdr.size, flags);
} else if (isLUKS(cd->type)) {
/* If key is not provided, try to use internal key */
if (!volume_key) {
} else if (isLUKS(cd->type)) {
/* If key is not provided, try to use internal key */
if (!volume_key) {
+uint64_t crypt_get_iv_offset(struct crypt_device *cd)
+{
+ if (isPLAIN(cd->type))
+ return cd->plain_hdr.skip;
+
+ if (isLUKS(cd->type))
+ return 0;
+
+ if (isLOOPAES(cd->type))
+ return cd->loopaes_hdr.skip;
+
+ return 0;
+}
+
crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot)
{
if (!isLUKS(cd->type)) {
crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot)
{
if (!isLUKS(cd->type)) {