zuluCrypt  5.7.1
About: zuluCrypt is a simple but feature rich solution for hard drives encryption. It can manage PLAIN dm-crypt, LUKS, TrueCrypt and VeraCrypt encrypted volumes.
  Fossies Dox: zuluCrypt-5.7.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

file_encryption.c File Reference
#include "includes.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <libcryptsetup.h>
Include dependency graph for file_encryption.c:

Go to the source code of this file.

Macros

#define SIZE   512
 

Functions

static void _write (int x, const void *y, size_t z)
 
static void _read (int x, void *y, size_t z)
 
static string_t crypt_mapper (const char *path, const char *key, u_int64_t key_len)
 
static int zuluExit (int st, int f_in, int f_out, string_t p)
 
int zuluCryptDecryptFile (const char *source, const char *dest, const char *key, u_int64_t key_len)
 
int zuluCryptEncryptFile (const char *source, const char *dest, const char *key, u_int64_t key_len)
 

Macro Definition Documentation

◆ SIZE

#define SIZE   512

Definition at line 36 of file file_encryption.c.

Function Documentation

◆ _read()

static void _read ( int  x,
void *  y,
size_t  z 
)
static

Definition at line 42 of file file_encryption.c.

Referenced by zuluCryptDecryptFile(), and zuluCryptEncryptFile().

◆ _write()

static void _write ( int  x,
const void *  y,
size_t  z 
)
static

Definition at line 38 of file file_encryption.c.

Referenced by zuluCryptDecryptFile(), and zuluCryptEncryptFile().

◆ crypt_mapper()

static string_t crypt_mapper ( const char *  path,
const char *  key,
u_int64_t  key_len 
)
static

◆ zuluCryptDecryptFile()

int zuluCryptDecryptFile ( const char *  source,
const char *  dest,
const char *  key,
u_int64_t  key_len 
)

This function decrypts a file given by argument source to a file given by argument dest using plain mapper opened with key of length key_len

output: 0 - success 1 - decryption failed,could not open mapper 2 - decryption failed,wrong passphrase

Definition at line 126 of file file_encryption.c.

References _read(), _write(), crypt_mapper(), SIZE, StringContent(), StringVoid, and zuluExit().

Referenced by crypt_opt().

◆ zuluCryptEncryptFile()

int zuluCryptEncryptFile ( const char *  source,
const char *  dest,
const char *  key,
u_int64_t  key_len 
)

This function encrypts a file given by argument source to a file given by argument dest using plain mapper opened with key of length key_len

output: 0 - success 1 - encryption failed,could not open mapper

Definition at line 207 of file file_encryption.c.

References _read(), _write(), crypt_mapper(), SIZE, StringContent(), StringIntToString(), StringLength(), StringMultipleDelete(), StringVoid, and zuluCryptCloseMapper().

Referenced by crypt_opt().

◆ zuluExit()

static int zuluExit ( int  st,
int  f_in,
int  f_out,
string_t  p 
)
static

Definition at line 109 of file file_encryption.c.

References StringContent(), StringDelete(), and zuluCryptCloseMapper().

Referenced by zuluCryptDecryptFile().