Commit 5fdfc0b5 authored by Milan Broz's avatar Milan Broz

Fix AF prototypes and move then to af.h.

parent ef966bd2
......@@ -137,6 +137,8 @@ int PLAIN_activate(struct crypt_device *cd,
uint64_t size,
uint32_t flags);
void *crypt_get_hdr(struct crypt_device *cd, const char *type);
/**
* Different methods used to erase sensitive data concerning
* either encrypted payload area or master key inside keyslot
......@@ -152,8 +154,9 @@ typedef enum {
int crypt_wipe(struct device *device,
uint64_t offset,
uint64_t sectors,
uint64_t size,
crypt_wipe_type type,
int flags);
int exclusive);
#endif /* INTERNAL_H */
......@@ -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.
*/
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 i;
......@@ -125,7 +125,7 @@ out:
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 i;
......
......@@ -37,8 +37,24 @@
* 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_merge(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(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);
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
......@@ -173,22 +173,6 @@ int LUKS_keyslot_area(const struct luks_phdr *hdr,
uint64_t *offset,
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,
const char *name,
struct volume_key *vk,
......
......@@ -48,6 +48,9 @@ struct safe_allocation {
int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
char *cipher_mode)
{
if (!s || !cipher || !cipher_mode)
return -EINVAL;
if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s",
cipher, cipher_mode) == 2) {
if (!strcmp(cipher_mode, "plain"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment