~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/libecryptfs/module_mgr.c

  • Committer: mhalcrow@us.ibm.com
  • Date: 2008-01-02 20:41:42 UTC
  • Revision ID: git-v1:606e207bd8f6a43c61df5dad92207f1d0d3ab8f1
Add HMAC mount option to mount helper.

(Thanks to Trevor Highland).

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
                .trans_func = sig_param_node_callback}}
97
97
};
98
98
 
 
99
static int get_hmac(struct ecryptfs_ctx *ctx, struct param_node *node,
 
100
                    struct val_node **head, void **foo)
 
101
{
 
102
        if (node->val && (*(node->val) == 'y')) {
 
103
                stack_push(head, "ecryptfs_hmac");
 
104
        } else if (node->flags & PARAMETER_SET) {
 
105
                stack_push(head, "ecryptfs_hmac");
 
106
                return 0;
 
107
        }
 
108
        free(node->val);
 
109
        return 0;
 
110
}
 
111
 
99
112
static int get_passthrough(struct ecryptfs_ctx *ctx, struct param_node *node,
100
113
                           struct val_node **head, void **foo)
101
114
{
216
229
                .trans_func = get_passthrough}}
217
230
};
218
231
 
 
232
static struct param_node hmac_param_node = {
 
233
        .num_mnt_opt_names = 1,
 
234
        .mnt_opt_names = {"ecryptfs_hmac"},
 
235
        .prompt = "Enable HMAC integrity verification (y/n)",
 
236
        .val_type = VAL_STR,
 
237
        .val = NULL,
 
238
        .display_opts = NULL,
 
239
        .default_val = NULL,
 
240
        .flags = ECRYPTFS_PARAM_FLAG_ECHO_INPUT,
 
241
        .num_transitions = 1,
 
242
        .tl = {{.val = "default",
 
243
                .pretty_val = "default",
 
244
                .next_token = &end_param_node,
 
245
                .trans_func = get_hmac}}
 
246
};
 
247
 
219
248
static struct param_node ecryptfs_key_bytes_param_node = {
220
249
        .num_mnt_opt_names = 1,
221
250
        .mnt_opt_names = {"ecryptfs_key_bytes"},
541
570
                                &passthrough_param_node;
542
571
                last_param_node = &passthrough_param_node;
543
572
        }
 
573
        if (ecryptfs_supports_hmac(version)) {
 
574
                int i;
 
575
 
 
576
                for (i = 0; i < last_param_node->num_transitions; i++)
 
577
                        last_param_node->tl[i].next_token =
 
578
                                &hmac_param_node;
 
579
                last_param_node = &hmac_param_node;
 
580
        }
544
581
        if (ecryptfs_supports_xattr(version)) {
545
582
                int i;
546
583