gwenhywfar 5.14.1
smalltresor.c File Reference
#include "smalltresor.h"
#include <gwenhywfar/mdigest.h>
#include <gwenhywfar/cryptkey.h>
#include <gwenhywfar/cryptdefs.h>
#include <gwenhywfar/cryptkeysym.h>
#include <gwenhywfar/padd.h>
#include <gwenhywfar/text.h>
#include <gwenhywfar/debug.h>
Include dependency graph for smalltresor.c:

Go to the source code of this file.

Macros

#define BLOWFISH_KEYSIZE   32
#define DISABLE_DEBUGLOG

Functions

static int _addRandomBytes (GWEN_BUFFER *dst, int withLength)
static int _decode (const uint8_t *p, uint32_t len, GWEN_BUFFER *dst, int iterations)
static int _decodeData (const uint8_t *ptr, uint32_t len, uint8_t *pOutData, uint32_t *pOutLen, const uint8_t *pKey)
static int _encode (const uint8_t *p, uint32_t len, GWEN_BUFFER *buf, int iterations)
static int _encodeData (const uint8_t *ptr, uint32_t len, uint8_t *pOutData, uint32_t *pOutLen, const uint8_t *pKey)
int GWEN_SmallTresor_Decrypt (const uint8_t *p, uint32_t len, const char *password, GWEN_BUFFER *dst, int passwordIterations, int cryptIterations)
int GWEN_SmallTresor_Encrypt (const uint8_t *src, uint32_t slen, const char *password, GWEN_BUFFER *dst, int passwordIterations, int cryptIterations)

Macro Definition Documentation

◆ BLOWFISH_KEYSIZE

#define BLOWFISH_KEYSIZE   32

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 14 of file smalltresor.c.

Function Documentation

◆ _addRandomBytes()

int _addRandomBytes ( GWEN_BUFFER * dst,
int withLength )
static

Definition at line 136 of file smalltresor.c.

References GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_AppendByte(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_IncrementPos(), and GWEN_Crypt_Random().

Referenced by GWEN_SmallTresor_Encrypt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _decode()

int _decode ( const uint8_t * p,
uint32_t len,
GWEN_BUFFER * dst,
int iterations )
static

◆ _decodeData()

int _decodeData ( const uint8_t * ptr,
uint32_t len,
uint8_t * pOutData,
uint32_t * pOutLen,
const uint8_t * pKey )
static

Definition at line 158 of file smalltresor.c.

References BLOWFISH_KEYSIZE, GWEN_Crypt_CryptMode_Cbc, GWEN_Crypt_Key_Decipher(), GWEN_Crypt_Key_free(), GWEN_Crypt_KeyBlowFish_fromData(), and GWEN_ERROR_DECRYPT.

Referenced by _decode(), and GWEN_SmallTresor_Decrypt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _encode()

◆ _encodeData()

int _encodeData ( const uint8_t * ptr,
uint32_t len,
uint8_t * pOutData,
uint32_t * pOutLen,
const uint8_t * pKey )
static

Definition at line 34 of file smalltresor.c.

References BLOWFISH_KEYSIZE, DBG_ERROR, GWEN_Crypt_CryptMode_Cbc, GWEN_Crypt_Key_Encipher(), GWEN_Crypt_Key_free(), GWEN_Crypt_KeyBlowFish_fromData(), GWEN_ERROR_ENCRYPT, and GWEN_LOGDOMAIN.

Referenced by GWEN_SmallTresor_Encrypt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_SmallTresor_Decrypt()

◆ GWEN_SmallTresor_Encrypt()

int GWEN_SmallTresor_Encrypt ( const uint8_t * src,
uint32_t slen,
const char * password,
GWEN_BUFFER * dst,
int passwordIterations,
int cryptIterations )

This function encrypts the given data using the given password. The key for encryption is derived from the given password using the function GWEN_MDigest_PKPDF2.

Definition at line 239 of file smalltresor.c.

References _addRandomBytes(), _encode(), _encodeData(), BLOWFISH_KEYSIZE, DBG_ERROR, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_AppendByte(), GWEN_Buffer_AppendBytes(), GWEN_Buffer_free(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Buffer_new(), GWEN_Crypt_Random(), GWEN_LOGDOMAIN, GWEN_MDigest_free(), GWEN_MDigest_PBKDF2(), GWEN_MDigest_Sha256_new(), and GWEN_Padd_PaddWithIso9796_2().

Referenced by GWEN_Crypt_TokenOHBCI_Write(), and GWEN_PasswordStore_EncryptWriteFile().

Here is the call graph for this function:
Here is the caller graph for this function: