/
tcplay.3
265 lines (262 loc) · 6.92 KB
/
tcplay.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
.\"
.\" Copyright (c) 2011 The DragonFly Project. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. Neither the name of The DragonFly Project nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific, prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd July 5, 2011
.Dt TCPLAY 3
.Os
.Sh NAME
.Nm tc_api_init ,
.Nm tc_api_uninit ,
.Nm tc_api_create_volume ,
.Nm tc_api_map_volume ,
.Nm tc_api_unmap_volume ,
.Nm tc_api_check_cipher ,
.Nm tc_api_check_prf_hash ,
.Nm tc_api_get_error_msg ,
.Nm tc_api_get_summary
.Nd TrueCrypt volume management
.Sh LIBRARY
.Lb libtcplay
.Sh SYNOPSIS
.In tcplay_api.h
.Ft int
.Fn tc_api_init "int verbose"
.Ft int
.Fn tc_api_uninit "void"
.Ft int
.Fn tc_api_create_volume "tc_api_opts *api_opts"
.Ft int
.Fn tc_api_map_volume "tc_api_opts *api_opts"
.Ft int
.Fn tc_api_unmap_volume "tc_api_opts *api_opts"
.Ft int
.Fn tc_api_check_cipher "tc_api_opts *api_opts"
.Ft int
.Fn tc_api_check_prf_hash "tc_api_opts *api_opts"
.Ft const char *
.Fn tc_api_get_error_msg "void"
.Ft const char *
.Fn tc_api_get_summary "void"
.Sh DESCRIPTION
The
.Nm tcplay
library provides an interface to create, query and map
TrueCrypt-compatible
volumes.
.Pp
The
.Fn tc_api_create_volume ,
.Fn tc_api_map_volume ,
.Fn tc_api_unmap_volume ,
.Fn tc_api_check_cipher
and
.Fn tc_api_check_prf_hash
functions take a
.Vt tc_api_opts
data structure as only argument, which is defined as follows:
.Bd -literal
typedef struct tc_api_opts {
/* Common fields */
char *tc_device;
char *tc_passphrase;
const char **tc_keyfiles;
/* Fields for mapping */
char *tc_map_name;
int tc_password_retries;
int tc_interactive_prompt;
unsigned long tc_prompt_timeout;
/* Fields for creation */
char *tc_cipher;
char *tc_prf_hash;
char *tc_cipher_hidden;
char *tc_prf_hash_hidden;
size_t tc_size_hidden_in_bytes;
char *tc_passphrase_hidden;
const char **tc_keyfiles_hidden;
} tc_api_opts;
.Ed
.Pp
where the keyfile fields,
.Fa tc_keyfiles
and
.Fa tc_keyfiles_hidden ,
are
.Dv NULL
terminated arrays of key file strings.
.Pp
The
.Fn tc_api_init
function initializes the library internals and prepares it for use via
the API.
This function has to be called before using any other API function.
If the
.Fa verbose
argument is non-zero, then the library will output information such as
errors via stdout and stderr.
.Pp
The
.Fn tc_api_uninit
function clears up all internal secure memory, such as memory used for
decrypted headers, passphrases, keyfiles, etc.
.Pp
The
.Fn tc_api_create_volume
function creates a new volume using the parameters specified in the
.Fa api_opts
argument.
The new volume will be created on the device specified by
.Fa tc_device
using the cipher specified by
.Fa tc_cipher
and the pbkdf2 prf hash algorithm specified by
.Fa tc_prf_hash
and using the passphrase and keyfiles specified by
.Fa tc_passphrase
and
.Fa tc_keyfiles
respectively.
If
.Fa tc_size_hidden_in_bytes
is not zero, a hidden volume of the given size will be created, using
the cipher specified by
.Fa tc_cipher_hidden
and the pbkdf2 prf hash algorithm specified by
.Fa tc_prf_hash_hidden .
If
.Fa tc_cipher_hidden
or
.Fa tc_prf_hash_hidden
are
.Dv NULL ,
the same algorithm as for the outer volume will be used.
The passphrase and keyfiles used are specified by
.Fa tc_passphrase_hidden
and
.Fa tc_keyfiles_hidden
respectively.
.Pp
The
.Fn tc_api_map_volume
function maps a volume using the parameters specified in the
.Fa api_opts
argument.
The volume, which will be mapped as
.Fa tc_map_name ,
is specified in
.Fa tc_device .
The
.Fa tc_interactive_prompt
field determines whether the user will be prompted to enter a passphrase
interactively or whether the passphrase in
.Fa tc_passphrase
will be used.
If an interactive prompt is used, the prompt will time out after
.Fa tc_prompt_timeout
seconds.
A value of 0 indicates that no timeout will occur.
The number of passphrase entry retries is defined by
.Fa tc_password_retries .
Note that the
.Fn tc_api_map_volume
function does not support accessing an outer volume while
protecting the hidden volume.
Depending on the passphrase/keyfiles used
either the outer or the hidden volume will be mapped.
.Pp
The
.Fn tc_api_unmap_volume
unmaps / closes the volume specified in
.Fa tc_map_name .
.Pp
The
.Fn tc_api_check_cipher
function checks whether the cipher specified in the
.Fa api_opts
argument field
.Fa tc_cipher
is valid.
.Pp
The
.Fn tc_api_check_prf_hash
function checks whether the prf hash algorithm specified in the
.Fa api_opts
argument field
.Fa tc_prf_hash
is valid.
.Pp
The
.Fn tc_api_get_error_msg
function should be called whenver another API function returns
.Dv TC_ERR .
It returns a string containing a description of the error that
occured.
.Pp
The
.Fn tc_api_get_summary
function returns a string containing a summary of the current
progress of a certain operation.
Currently only the volume erasing
part of creating a new volume can provide a summary.
When no summary is available, an empty string is returned.
The output otherwise is equivalent to that of a
.Dv SIGINFO
signal when using
.Xr tcplay 8 .
.Sh RETURN VALUES
All functions except
.Fn tc_api_get_error_msg
and
.Fn tc_api_get_summary
return either
.Dv TC_OK
to signal that the operation completed successfully, or
.Dv TC_ERR
to signal that an error occured.
.Pp
The
.Fn tc_api_get_error_msg
and
.Fn tc_api_get_summary
always return a valid, but possibly empty, string.
.Sh COMPATIBILITY
The
.Nm tcplay
library offers full compatibility with TrueCrypt volumes including
hidden
volumes, system encryption (map-only), keyfiles and cipher cascading.
.Sh SEE ALSO
.Xr tcplay 8
.Sh HISTORY
The
.Nm tcplay
library appeared in
.Dx 2.11 .
.Sh AUTHORS
.An Alex Hornung