Skip to content
Browse files

make compilable when in lib/api mode

  • Loading branch information...
1 parent bc488b4 commit a6e7a9d2fb8146215e0ac0b2d03adaa3f535aadb @bwalex committed Jul 3, 2011
Showing with 15 additions and 10 deletions.
  1. +4 −1 Makefile
  2. +8 −6 tc-play-api.c
  3. +3 −3 tc-play-api.h
View
5 Makefile
@@ -1,6 +1,9 @@
all:
gcc -O0 -Wall -g tc-play.c crc32.c safe_mem.c io.c crypto.c hdr.c openssl/openssl/libcrypto.a -o tc-play -ldevmapper -lprop -lutil
experimental:
- gcc -O0 -Wall -g tc-play.c crc32.c safe_mem.c io.c crypto-dev.c hdr.c openssl/openssl/libcrypto.a -o tc-play -ldevmapper -lprop -lutil
+ gcc -O0 -Wall -g main.c tc-play.c crc32.c safe_mem.c io.c crypto-dev.c hdr.c openssl/openssl/libcrypto.a -o tc-play -ldevmapper -lprop -lutil
+lib:
+ gcc -c -fPIC -O0 -Wall -g tc-play-api.c tc-play.c crc32.c safe_mem.c io.c crypto-dev.c hdr.c
+ gcc -shared -Wl -o libtcplay.so tc-play-api.o tc-play.o crc32.o safe_mem.o io.o crypto-dev.o hdr.o
clean:
rm -f tc-play tc-play.core *.o ktrace.out
View
14 tc-play-api.c
@@ -27,6 +27,8 @@
* SUCH DAMAGE.
*/
+#include <stdlib.h>
+#include <unistd.h>
#include <errno.h>
#include "tc-play.h"
@@ -79,7 +81,7 @@ tc_api_create_volume(tc_api_op *api_opts)
create_hidden = 0;
- if (tc_size_hidden_in_blocks > 0) {
+ if (api_opts->tc_size_hidden_in_blocks > 0) {
create_hidden = 1;
for (n_hkeyfiles = 0; (n_hkeyfiles < MAX_KEYFILES) &&
(api_opts->tc_keyfiles_hidden[n_hkeyfiles] != NULL);
@@ -93,7 +95,7 @@ tc_api_create_volume(tc_api_op *api_opts)
check_prf_algo(api_opts->tc_prf_hash, 1),
check_cipher_chain(api_opts->tc_cipher, 1),
api_opts->tc_passphrase, api_opts->tc_passphrase_hidden,
- tc_size_hidden_in_blocks, 0 /* non-interactive */);
+ api_opts->tc_size_hidden_in_blocks, 0 /* non-interactive */);
return (err) ? TC_ERR : TC_OK;
}
@@ -114,11 +116,11 @@ tc_api_map_volume(tc_api_op *api_opts)
(api_opts->tc_keyfiles[nkeyfiles] != NULL); nkeyfiles++)
;
- err = map_volume(api_opts->tc_map_name, api_opts->device,
+ err = map_volume(api_opts->tc_map_name, api_opts->tc_device,
/* sflag */ 0, /* sys_dev */ NULL,
/* protect_hidden */ 0, api_opts->tc_keyfiles, nkeyfiles,
/* h_keyfiles[] */ NULL, /* n_hkeyfiles */ 0,
- api_opts->passphrase, /* passphrase_hidden */ NULL,
+ api_opts->tc_passphrase, /* passphrase_hidden */ NULL,
api_opts->tc_interactive_prompt, api_opts->tc_password_retries);
return (err) ? TC_ERR : TC_OK;
@@ -129,7 +131,7 @@ tc_api_check_cipher(tc_api_op *api_opts)
{
struct tc_cipher_chain *chain;
- if (api_opts == NULL || api_opts->tc_cipher == NULL)
+ if (api_opts == NULL || api_opts->tc_cipher == NULL) {
errno = EFAULT;
return TC_ERR;
}
@@ -146,7 +148,7 @@ tc_api_check_prf_hash(tc_api_op *api_opts)
{
struct pbkdf_prf_algo *prf_hash;
- if (api_opts == NULL || api_opts->tc_prf_hash == NULL)
+ if (api_opts == NULL || api_opts->tc_prf_hash == NULL) {
errno = EFAULT;
return TC_ERR;
}
View
6 tc-play-api.h
@@ -36,7 +36,7 @@ typedef struct tc_api_op {
char *tc_cipher;
char *tc_prf_hash;
char *tc_passphrase;
- char *tc_keyfiles[];
+ char **tc_keyfiles;
/* Fields for mapping */
char *tc_map_name;
@@ -46,10 +46,10 @@ typedef struct tc_api_op {
/* Fields for creation */
size_t tc_size_hidden_in_blocks;
char *tc_passphrase_hidden;
- char *tc_keyfiles_hidden[];
+ char **tc_keyfiles_hidden;
} tc_api_op;
-int tc_api_init(void);
+int tc_api_init(int verbose);
int tc_api_uninit(void);
int tc_api_create_volume(tc_api_op *api_opts);
int tc_api_map_volume(tc_api_op *api_opts);

0 comments on commit a6e7a9d

Please sign in to comment.
Something went wrong with that request. Please try again.