"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/luks2/luks2_internal.h" between
cryptsetup-2.3.6.tar.xz and cryptsetup-2.4.0.tar.xz

About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.

luks2_internal.h  (cryptsetup-2.3.6.tar.xz):luks2_internal.h  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 33 skipping to change at line 33
#define _CRYPTSETUP_LUKS2_INTERNAL_H #define _CRYPTSETUP_LUKS2_INTERNAL_H
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <json-c/json.h> #include <json-c/json.h>
#include "internal.h" #include "internal.h"
#include "base64.h" #include "base64.h"
#include "luks2.h" #include "luks2.h"
#define UNUSED(x) (void)(x)
/* override useless forward slash escape when supported by json-c */ /* override useless forward slash escape when supported by json-c */
#ifndef JSON_C_TO_STRING_NOSLASHESCAPE #ifndef JSON_C_TO_STRING_NOSLASHESCAPE
#define JSON_C_TO_STRING_NOSLASHESCAPE 0 #define JSON_C_TO_STRING_NOSLASHESCAPE 0
#endif #endif
/* /*
* On-disk access function prototypes * On-disk access function prototypes
*/ */
int LUKS2_disk_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr, int LUKS2_disk_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr,
struct device *device, int do_recovery, int do_blkprobe); struct device *device, int do_recovery, int do_blkprobe);
int LUKS2_disk_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr, int LUKS2_disk_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr,
struct device *device, bool seqid_check); struct device *device, bool seqid_check);
int LUKS2_device_write_lock(struct crypt_device *cd,
struct luks2_hdr *hdr, struct device *device);
/* /*
* JSON struct access helpers * JSON struct access helpers
*/ */
json_object *LUKS2_get_keyslot_jobj(struct luks2_hdr *hdr, int keyslot); json_object *LUKS2_get_keyslot_jobj(struct luks2_hdr *hdr, int keyslot);
json_object *LUKS2_get_token_jobj(struct luks2_hdr *hdr, int token); json_object *LUKS2_get_token_jobj(struct luks2_hdr *hdr, int token);
json_object *LUKS2_get_digest_jobj(struct luks2_hdr *hdr, int digest); json_object *LUKS2_get_digest_jobj(struct luks2_hdr *hdr, int digest);
json_object *LUKS2_get_segment_jobj(struct luks2_hdr *hdr, int segment); json_object *LUKS2_get_segment_jobj(struct luks2_hdr *hdr, int segment);
json_object *LUKS2_get_tokens_jobj(struct luks2_hdr *hdr); json_object *LUKS2_get_tokens_jobj(struct luks2_hdr *hdr);
json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr); json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr);
skipping to change at line 95 skipping to change at line 95
/* /*
* LUKS2 JSON repair for known glitches * LUKS2 JSON repair for known glitches
*/ */
void LUKS2_hdr_repair(struct crypt_device *cd, json_object *jobj_hdr); void LUKS2_hdr_repair(struct crypt_device *cd, json_object *jobj_hdr);
void LUKS2_keyslots_repair(struct crypt_device *cd, json_object *jobj_hdr); void LUKS2_keyslots_repair(struct crypt_device *cd, json_object *jobj_hdr);
/* /*
* JSON array helpers * JSON array helpers
*/ */
struct json_object *LUKS2_array_jobj(struct json_object *array, const char *num) json_object *LUKS2_array_jobj(json_object *array, const char *num);
; json_object *LUKS2_array_remove(json_object *array, const char *num);
struct json_object *LUKS2_array_remove(struct json_object *array, const char *nu
m);
/* /*
* Plugins API * Plugins API
*/ */
/** /**
* LUKS2 keyslots handlers (EXPERIMENTAL) * LUKS2 keyslots handlers (EXPERIMENTAL)
*/ */
typedef int (*keyslot_alloc_func)(struct crypt_device *cd, int keyslot, typedef int (*keyslot_alloc_func)(struct crypt_device *cd, int keyslot,
size_t volume_key_len, size_t volume_key_len,
skipping to change at line 165 skipping to change at line 165
const char *volume_key, size_t volume_key_len); const char *volume_key, size_t volume_key_len);
typedef int (*digest_dump_func) (struct crypt_device *cd, int digest); typedef int (*digest_dump_func) (struct crypt_device *cd, int digest);
typedef struct { typedef struct {
const char *name; const char *name;
digest_verify_func verify; digest_verify_func verify;
digest_store_func store; digest_store_func store;
digest_dump_func dump; digest_dump_func dump;
} digest_handler; } digest_handler;
/** int keyring_open(struct crypt_device *cd,
* LUKS2 token handlers (internal use only) int token,
*/ char **buffer,
typedef int (*builtin_token_get_func) (json_object *jobj_token, void *params); size_t *buffer_len,
typedef int (*builtin_token_set_func) (json_object **jobj_token, const void *par void *usrptr);
ams);
void keyring_dump(struct crypt_device *cd, const char *json);
int keyring_validate(struct crypt_device *cd, const char *json);
struct crypt_token_handler_v2 {
const char *name;
crypt_token_open_func open;
crypt_token_buffer_free_func buffer_free;
crypt_token_validate_func validate;
crypt_token_dump_func dump;
typedef struct { /* here ends v1. Do not touch anything above */
/* internal only section used by builtin tokens */
builtin_token_get_func get;
builtin_token_set_func set;
/* public token handler */
const crypt_token_handler *h;
} token_handler;
int token_keyring_set(json_object **, const void *); crypt_token_open_pin_func open_pin;
int token_keyring_get(json_object *, void *); crypt_token_version_func version;
void *dlhandle;
};
/*
* Initial sequence of structure members in union 'u' must be always
* identical. Version 4 must fully contain version 3 which must
* subsequently fully contain version 2, etc.
*
* See C standard, section 6.5.2.3, item 5.
*/
struct crypt_token_handler_internal {
uint32_t version;
union {
crypt_token_handler v1; /* deprecated public structure */
struct crypt_token_handler_v2 v2; /* internal helper v2 structure
*/
} u;
};
int LUKS2_find_area_gap(struct crypt_device *cd, struct luks2_hdr *hdr, int LUKS2_find_area_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
size_t keylength, uint64_t *area_offset, uint64_t *area_l ength); size_t keylength, uint64_t *area_offset, uint64_t *area_l ength);
int LUKS2_find_area_max_gap(struct crypt_device *cd, struct luks2_hdr *hdr, int LUKS2_find_area_max_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
uint64_t *area_offset, uint64_t *area_length); uint64_t *area_offset, uint64_t *area_length);
uint64_t LUKS2_hdr_and_areas_size_jobj(json_object *jobj);
int LUKS2_check_cipher(struct crypt_device *cd, int LUKS2_check_cipher(struct crypt_device *cd,
size_t keylength, size_t keylength,
const char *cipher, const char *cipher,
const char *cipher_mode); const char *cipher_mode);
static inline const char *crypt_reencrypt_mode_to_str(crypt_reencrypt_mode_info mi) static inline const char *crypt_reencrypt_mode_to_str(crypt_reencrypt_mode_info mi)
{ {
if (mi == CRYPT_REENCRYPT_REENCRYPT) if (mi == CRYPT_REENCRYPT_REENCRYPT)
return "reencrypt"; return "reencrypt";
if (mi == CRYPT_REENCRYPT_ENCRYPT) if (mi == CRYPT_REENCRYPT_ENCRYPT)
return "encrypt"; return "encrypt";
if (mi == CRYPT_REENCRYPT_DECRYPT) if (mi == CRYPT_REENCRYPT_DECRYPT)
return "decrypt"; return "decrypt";
return "<unknown>"; return "<unknown>";
} }
/*
* Generic LUKS2 keyslot
*/
int LUKS2_keyslot_reencrypt_store(struct crypt_device *cd,
struct luks2_hdr *hdr,
int keyslot,
const void *buffer,
size_t buffer_length);
int LUKS2_keyslot_reencrypt_create(struct crypt_device *cd,
struct luks2_hdr *hdr,
int keyslot,
const struct crypt_params_reencrypt *params);
int LUKS2_keyslot_dump(struct crypt_device *cd,
int keyslot);
/* JSON helpers */
uint64_t json_segment_get_offset(json_object *jobj_segment, unsigned blockwise);
const char *json_segment_type(json_object *jobj_segment);
uint64_t json_segment_get_iv_offset(json_object *jobj_segment);
uint64_t json_segment_get_size(json_object *jobj_segment, unsigned blockwise);
const char *json_segment_get_cipher(json_object *jobj_segment);
int json_segment_get_sector_size(json_object *jobj_segment);
bool json_segment_is_backup(json_object *jobj_segment);
json_object *json_segments_get_segment(json_object *jobj_segments, int segment);
unsigned json_segments_count(json_object *jobj_segments);
void json_segment_remove_flag(json_object *jobj_segment, const char *flag);
uint64_t json_segments_get_minimal_offset(json_object *jobj_segments, unsigned b
lockwise);
json_object *json_segment_create_linear(uint64_t offset, const uint64_t *length,
unsigned reencryption);
json_object *json_segment_create_crypt(uint64_t offset, uint64_t iv_offset, cons
t uint64_t *length, const char *cipher, uint32_t sector_size, unsigned reencrypt
ion);
int json_segments_segment_in_reencrypt(json_object *jobj_segments);
int LUKS2_assembly_multisegment_dmd(struct crypt_device *cd,
struct luks2_hdr *hdr,
struct volume_key *vks,
json_object *jobj_segments,
struct crypt_dm_active_device *dmd);
/*
* Generic LUKS2 segment
*/
int LUKS2_segments_count(struct luks2_hdr *hdr);
int LUKS2_segment_first_unused_id(struct luks2_hdr *hdr);
int LUKS2_segment_set_flag(json_object *jobj_segment, const char *flag);
json_object *LUKS2_get_segment_by_flag(struct luks2_hdr *hdr, const char *flag);
int LUKS2_get_segment_id_by_flag(struct luks2_hdr *hdr, const char *flag);
int LUKS2_segments_set(struct crypt_device *cd,
struct luks2_hdr *hdr,
json_object *jobj_segments,
int commit);
uint64_t LUKS2_segment_offset(struct luks2_hdr *hdr,
int segment,
unsigned blockwise);
uint64_t LUKS2_segment_size(struct luks2_hdr *hdr,
int segment,
unsigned blockwise);
int LUKS2_segment_is_type(struct luks2_hdr *hdr,
int segment,
const char *type);
int LUKS2_segment_by_type(struct luks2_hdr *hdr,
const char *type);
int LUKS2_last_segment_by_type(struct luks2_hdr *hdr,
const char *type);
int LUKS2_get_default_segment(struct luks2_hdr *hdr);
int LUKS2_reencrypt_digest_new(struct luks2_hdr *hdr);
int LUKS2_reencrypt_digest_old(struct luks2_hdr *hdr);
int LUKS2_reencrypt_data_offset(struct luks2_hdr *hdr, bool blockwise);
/*
* Generic LUKS2 digest
*/
int LUKS2_digest_verify_by_digest(struct crypt_device *cd,
struct luks2_hdr *hdr,
int digest,
const struct volume_key *vk);
void LUKS2_digests_erase_unused(struct crypt_device *cd,
struct luks2_hdr *hdr);
int LUKS2_digest_dump(struct crypt_device *cd,
int digest);
/*
* Generic LUKS2 token
*/
int LUKS2_tokens_count(struct luks2_hdr *hdr);
/*
* LUKS2 generic
*/
int LUKS2_reload(struct crypt_device *cd,
const char *name,
struct volume_key *vks,
uint64_t device_size,
uint32_t flags);
int LUKS2_keyslot_for_segment(struct luks2_hdr *hdr, int keyslot, int segment);
int LUKS2_find_keyslot(struct luks2_hdr *hdr, const char *type);
int LUKS2_set_keyslots_size(struct crypt_device *cd,
struct luks2_hdr *hdr,
uint64_t data_offset);
#endif #endif
 End of changes. 8 change blocks. 
21 lines changed or deleted 163 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)