~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/include/ecryptfs.h

  • Committer: Dustin Kirkland
  • Date: 2016-02-27 00:00:23 UTC
  • Revision ID: kirkland@ubuntu.com-20160227000023-h0e4oui5y1vbaurd
openingĀ 112

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#ifndef S_SPLINT_S
41
41
#include <sys/types.h>
42
42
#include <linux/types.h>
43
 
#include <linux/netlink.h>
44
 
#endif
45
 
 
46
 
#ifndef NETLINK_ECRYPTFS
47
 
#warning NETLINK_ECRYPTFS not defined in netlink.h
48
 
#define NETLINK_ECRYPTFS 19
49
43
#endif
50
44
 
51
45
/* Version verification for shared data structures w/ userspace */
114
108
#define ECRYPTFS_MSG_REQUEST 102
115
109
#define ECRYPTFS_MSG_RESPONSE 103
116
110
#define ECRYPTFS_MSG_MAX_SIZE 1024
117
 
#define ECRYPTFS_NETLINK_ERROR_COUNT_THRESHOLD 8
 
111
#define ECRYPTFS_MSG_ERROR_COUNT_THRESHOLD 8
118
112
#define ECRYPTFS_MAX_KEY_MOD_NAME_BYTES 16
119
113
 
120
114
#ifndef SHA512_DIGEST_LENGTH
407
401
struct val_node;
408
402
struct param_node;
409
403
 
410
 
struct cipher_str_name_map_elem {
411
 
        char *kernel_name;
412
 
        char *user_name;
413
 
        int keysize_bytes;
414
 
};
415
 
 
416
 
struct ecryptfs_cipher_elem;
417
 
 
418
 
struct ecryptfs_cipher_elem {
419
 
        uint8_t loaded_cipher;
420
 
        char *kernel_name;
421
 
        char *user_name;
422
 
        uint32_t bytes;
423
 
        struct ecryptfs_cipher_elem *next;
424
 
};
425
 
 
426
 
struct cipher_descriptor;
427
 
 
428
 
struct cipher_descriptor {
429
 
#define CIPHER_DESCRIPTOR_FLAG_LOADED 0x00000001
430
 
        uint32_t flags;
431
 
        char *crypto_api_name;
432
 
        char *descriptive_name;
433
 
        char *driver_name;
434
 
        char *module_name;
435
 
        uint32_t blocksize;
436
 
        uint32_t min_keysize;
437
 
        uint32_t max_keysize;
438
 
        uint32_t priority;
439
 
        struct cipher_descriptor *next;
440
 
};
441
 
 
442
404
struct ecryptfs_nl_ctx {
443
405
        int socket_fd;
444
406
};
452
414
};
453
415
 
454
416
struct ecryptfs_messaging_ctx {
455
 
#define ECRYPTFS_MESSAGING_TYPE_NETLINK 0x00000001
 
417
#define ECRYPTFS_MESSAGING_TYPE_NETLINK 0x00000001 /* No longer supported */
456
418
#define ECRYPTFS_MESSAGING_TYPE_MISCDEV 0x00000002
457
419
        uint32_t type;
458
420
#define ECRYPTFS_MESSAGING_STATE_LISTENING 0x00000001
490
452
        unsigned char *data;
491
453
} binary_data;
492
454
 
493
 
#define ECRYPTFS_DEFAULT_MESSAGING_TYPE ECRYPTFS_MESSAGING_TYPE_NETLINK
494
 
 
495
 
int ecryptfs_get_kernel_ciphers(struct cipher_descriptor *cd_head);
496
 
int ecryptfs_get_module_ciphers(struct cipher_descriptor *cd_head);
497
 
int ecryptfs_sort_ciphers(struct cipher_descriptor *cd_head);
498
455
int ecryptfs_get_version(uint32_t *version);
499
456
int ecryptfs_supports_passphrase(uint32_t version);
500
457
int ecryptfs_supports_pubkey(uint32_t version);
514
471
int get_string_stdin(char **val, char *prompt, int echo);
515
472
int stack_pop(struct val_node **head);
516
473
int stack_pop_val(struct val_node **head, void **val);
517
 
int ecryptfs_mount(char *source, char *target, unsigned long flags, char *opts);
518
 
int ecryptfs_get_current_kernel_ciphers(
519
 
        struct ecryptfs_cipher_elem *cipher_list_head);
520
 
int ecryptfs_default_cipher(struct ecryptfs_cipher_elem **default_cipher,
521
 
                            struct ecryptfs_cipher_elem *cipher_list_head);
522
474
int stack_push(struct val_node **head, void *val);
523
 
int ecryptfs_free_cipher_list(struct ecryptfs_cipher_elem cipher_list_head);
524
475
int ecryptfs_get_key_mod_list(struct ecryptfs_ctx* ctx);
525
476
int ecryptfs_parse_rc_file(struct ecryptfs_name_val_pair *nvp_list_head);
526
477
int ecryptfs_parse_options(char *opts, struct ecryptfs_name_val_pair *head);
538
489
int create_default_dir(char *home, struct ecryptfs_key_mod *key_mod);
539
490
int
540
491
create_subdirectory(char *file, char *home, struct ecryptfs_key_mod *key_mod);
541
 
int ecryptfs_get_loaded_ciphers(struct ecryptfs_cipher_elem *cipher_list_head);
542
 
int ecryptfs_add_crypto_modules(struct ecryptfs_cipher_elem *cipher_list_head);
543
492
int parse_packet(struct ecryptfs_ctx *ctx,
544
493
                 struct ecryptfs_message *emsg,
545
494
                 struct ecryptfs_message **reply);
558
507
int free_name_val_pairs(struct ecryptfs_name_val_pair *pair);
559
508
int ecryptfs_init_messaging(struct ecryptfs_messaging_ctx *mctx, uint32_t type);
560
509
int ecryptfs_messaging_exit(struct ecryptfs_messaging_ctx *mctx);
561
 
int ecryptfs_send_netlink(struct ecryptfs_nl_ctx *nl_ctx,
562
 
                          struct ecryptfs_message *emsg, uint8_t msg_type,
563
 
                          uint16_t msg_flags, uint32_t msg_seq);
564
 
void ecryptfs_release_netlink(struct ecryptfs_nl_ctx *nl_ctx);
565
 
int ecryptfs_init_netlink_daemon(void);
566
 
int ecryptfs_run_netlink_daemon(struct ecryptfs_nl_ctx *nl_ctx);
567
 
int ecryptfs_init_netlink(struct ecryptfs_nl_ctx *nl_ctx);
568
510
int ecryptfs_nvp_list_union(struct ecryptfs_name_val_pair *dst,
569
511
                            struct ecryptfs_name_val_pair *src,
570
512
                            struct ecryptfs_name_val_pair *allowed_duplicates);
573
515
int ecryptfs_check_sig(char *auth_tok_sig, char *sig_cache_filename,
574
516
                       int *flags);
575
517
int ecryptfs_append_sig(char *auth_tok_sig, char *sig_cache_filename);
 
518
int __ecryptfs_detect_wrapped_passphrase_file_version(const char *filename,
 
519
                                                      uint8_t *version);
576
520
int ecryptfs_wrap_passphrase_file(char *dest, char *wrapping_passphrase,
577
521
                             char *wrapping_salt, char *src);
578
522
int ecryptfs_wrap_passphrase(char *filename, char *wrapping_passphrase,
579
 
                             char *wrapping_salt, char *decrypted_passphrase);
 
523
                             char *unused, char *decrypted_passphrase);
580
524
int ecryptfs_unwrap_passphrase(char *decrypted_passphrase, char *filename,
581
525
                               char *wrapping_passphrase, char *wrapping_salt);
582
526
int ecryptfs_insert_wrapped_passphrase_into_keyring(