gwenhywfar
4.6.0beta
|
#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>
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) |
#define BLOWFISH_KEYSIZE 32 |
Definition at line 29 of file smalltresor.c.
Referenced by _decode(), _decodeData(), _encode(), _encodeData(), GWEN_SmallTresor_Decrypt(), and GWEN_SmallTresor_Encrypt().
#define DISABLE_DEBUGLOG |
Definition at line 14 of file smalltresor.c.
|
static |
Definition at line 134 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().
|
static |
Definition at line 179 of file smalltresor.c.
References _decodeData(), BLOWFISH_KEYSIZE, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_AppendBytes(), GWEN_Buffer_free(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Buffer_new(), and GWEN_Buffer_Reset().
Referenced by GWEN_SmallTresor_Decrypt().
|
static |
Definition at line 155 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().
|
static |
Definition at line 66 of file smalltresor.c.
References BLOWFISH_KEYSIZE, DBG_ERROR, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_AppendBytes(), GWEN_Buffer_free(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Buffer_new(), GWEN_Buffer_Reset(), GWEN_Crypt_CryptMode_Cbc, GWEN_Crypt_Key_Encipher(), GWEN_Crypt_Key_free(), GWEN_Crypt_KeyBlowFish_Generate(), GWEN_Crypt_KeyBlowFish_GetKeyDataPtr(), GWEN_ERROR_INTERNAL, GWEN_LOGDOMAIN, and NULL.
Referenced by GWEN_SmallTresor_Encrypt().
|
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().
int GWEN_SmallTresor_Decrypt | ( | const uint8_t * | p, |
uint32_t | len, | ||
const char * | password, | ||
GWEN_BUFFER * | dst, | ||
int | passwordIterations, | ||
int | cryptIterations | ||
) |
Definition at line 340 of file smalltresor.c.
References _decode(), _decodeData(), BLOWFISH_KEYSIZE, DBG_ERROR, DBG_INFO, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_AppendBytes(), GWEN_Buffer_free(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Buffer_new(), GWEN_ERROR_BAD_DATA, GWEN_ERROR_INVALID, GWEN_LOGDOMAIN, GWEN_MDigest_free(), GWEN_MDigest_PBKDF2(), GWEN_MDigest_Sha256_new(), and GWEN_Padd_UnpaddWithIso9796_2().
Referenced by GWEN_PasswordStore_ReadDecryptFile().
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 234 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_PasswordStore_EncryptWriteFile().