2
2
* Copyright (C) 2007 International Business Machines
3
3
* Author(s): Michael Halcrow <mhalcrow@us.ibm.com>
4
* Dustin Kirkland <kirkland@canonical.com>
5
6
* This program is free software; you can redistribute it and/or
6
7
* modify it under the terms of the GNU General Public License as
38
43
char salt[ECRYPTFS_SALT_SIZE];
39
44
char salt_hex[ECRYPTFS_SALT_SIZE_HEX];
52
if (strlen(argv[2]) == 1 && strncmp(argv[2], "-", 1) == 0) {
53
if ((wrapping_passphrase =
54
(char *)malloc(ECRYPTFS_MAX_PASSWORD_LENGTH+1)) == NULL) {
58
if (fgets(wrapping_passphrase,
59
ECRYPTFS_MAX_PASSWORD_LENGTH, stdin) == NULL) {
63
p = strrchr(wrapping_passphrase, '\n');
66
wrapping_passphrase = argv[2];
47
wrapping_passphrase = argv[2];
48
70
rc = ecryptfs_read_salt_hex_from_rc(salt_hex);
50
printf("Unable to read salt value from user's "
51
".ecryptfsrc file; using default\n");
72
fprintf(stderr, "%s\n", ECRYPTFS_WARN_DEFAULT_SALT);
52
73
from_hex(salt, ECRYPTFS_DEFAULT_SALT_HEX, ECRYPTFS_SALT_SIZE);
54
75
from_hex(salt, salt_hex, ECRYPTFS_SALT_SIZE);
55
76
if ((rc = ecryptfs_unwrap_passphrase(passphrase, file,
56
77
wrapping_passphrase, salt))) {
57
printf("Error attempting to unwrap passphrase; rc = [%d]. "
58
"Check the system log for more information from "
59
"libecryptfs.\n", rc);
78
fprintf(stderr, "%s [%d]\n", ECRYPTFS_ERROR_UNWRAP, rc);
79
fprintf(stderr, "%s\n", ECRYPTFS_INFO_CHECK_LOG);