Add TCRYPT api test, fix some minor problems found.

This commit is contained in:
Milan Broz
2012-11-30 18:41:10 +01:00
parent 6123541d80
commit ffb6ecc488
2 changed files with 92 additions and 9 deletions

View File

@@ -829,6 +829,10 @@ uint64_t TCRYPT_get_data_offset(struct crypt_device *cd,
{
uint64_t size;
/* No real header loaded, initialized by active device */
if (!hdr->d.version)
return hdr->d.mk_offset / hdr->d.sector_size;
if (params->mode && !strncmp(params->mode, "xts", 3)) {
if (hdr->d.version < 3)
return 1;
@@ -877,7 +881,7 @@ int TCRYPT_get_volume_key(struct crypt_device *cd,
int i, key_index;
if (!hdr->d.version) {
log_dbg("TCRYPT: this function is not supported without encrypted header load.");
log_err(cd, _("This function is not supported without TCRYPT header load."));
return -ENOTSUP;
}