Fix AF prototypes and move then to af.h.

This commit is contained in:
Milan Broz
2016-01-26 16:05:56 +01:00
parent ef966bd261
commit 5fdfc0b54a
5 changed files with 28 additions and 22 deletions

View File

@@ -137,6 +137,8 @@ int PLAIN_activate(struct crypt_device *cd,
uint64_t size, uint64_t size,
uint32_t flags); uint32_t flags);
void *crypt_get_hdr(struct crypt_device *cd, const char *type);
/** /**
* Different methods used to erase sensitive data concerning * Different methods used to erase sensitive data concerning
* either encrypted payload area or master key inside keyslot * either encrypted payload area or master key inside keyslot
@@ -152,8 +154,9 @@ typedef enum {
int crypt_wipe(struct device *device, int crypt_wipe(struct device *device,
uint64_t offset, uint64_t offset,
uint64_t sectors, uint64_t size,
crypt_wipe_type type, crypt_wipe_type type,
int flags); int exclusive);
#endif /* INTERNAL_H */ #endif /* INTERNAL_H */

View File

@@ -99,7 +99,7 @@ static int diffuse(char *src, char *dst, size_t size, const char *hash_name)
* must be supplied to AF_merge to recover information. * must be supplied to AF_merge to recover information.
*/ */
int AF_split(char *src, char *dst, size_t blocksize, int AF_split(const char *src, char *dst, size_t blocksize,
unsigned int blocknumbers, const char *hash) unsigned int blocknumbers, const char *hash)
{ {
unsigned int i; unsigned int i;
@@ -125,7 +125,7 @@ out:
return r; return r;
} }
int AF_merge(char *src, char *dst, size_t blocksize, int AF_merge(const char *src, char *dst, size_t blocksize,
unsigned int blocknumbers, const char *hash) unsigned int blocknumbers, const char *hash)
{ {
unsigned int i; unsigned int i;

View File

@@ -37,8 +37,24 @@
* On error, both functions return -1, 0 otherwise. * On error, both functions return -1, 0 otherwise.
*/ */
int AF_split(char *src, char *dst, size_t blocksize, unsigned int blocknumbers, const char *hash); int AF_split(const char *src, char *dst, size_t blocksize, unsigned int blocknumbers, const char *hash);
int AF_merge(char *src, char *dst, size_t blocksize, unsigned int blocknumbers, const char *hash); int AF_merge(const char *src, char *dst, size_t blocksize, unsigned int blocknumbers, const char *hash);
size_t AF_split_sectors(size_t blocksize, unsigned int blocknumbers); size_t AF_split_sectors(size_t blocksize, unsigned int blocknumbers);
int LUKS_encrypt_to_storage(
char *src, size_t srcLength,
const char *cipher,
const char *cipher_mode,
struct volume_key *vk,
unsigned int sector,
struct crypt_device *ctx);
int LUKS_decrypt_from_storage(
char *dst, size_t dstLength,
const char *cipher,
const char *cipher_mode,
struct volume_key *vk,
unsigned int sector,
struct crypt_device *ctx);
#endif #endif

View File

@@ -173,22 +173,6 @@ int LUKS_keyslot_area(const struct luks_phdr *hdr,
uint64_t *offset, uint64_t *offset,
uint64_t *length); uint64_t *length);
int LUKS_encrypt_to_storage(
char *src, size_t srcLength,
const char *cipher,
const char *cipher_mode,
struct volume_key *vk,
unsigned int sector,
struct crypt_device *ctx);
int LUKS_decrypt_from_storage(
char *dst, size_t dstLength,
const char *cipher,
const char *cipher_mode,
struct volume_key *vk,
unsigned int sector,
struct crypt_device *ctx);
int LUKS1_activate(struct crypt_device *cd, int LUKS1_activate(struct crypt_device *cd,
const char *name, const char *name,
struct volume_key *vk, struct volume_key *vk,

View File

@@ -48,6 +48,9 @@ struct safe_allocation {
int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums, int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
char *cipher_mode) char *cipher_mode)
{ {
if (!s || !cipher || !cipher_mode)
return -EINVAL;
if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s", if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s",
cipher, cipher_mode) == 2) { cipher, cipher_mode) == 2) {
if (!strcmp(cipher_mode, "plain")) if (!strcmp(cipher_mode, "plain"))