gwenhywfar 5.14.1
cryptmgr.c File Reference
#include "cryptmgr_p.h"
#include "i18n_l.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/gwentime.h>
#include <gwenhywfar/crypthead.h>
#include <gwenhywfar/sighead.h>
#include <gwenhywfar/sigtail.h>
#include <gwenhywfar/tag16.h>
#include <gwenhywfar/cryptkeysym.h>
#include <gwenhywfar/padd.h>
Include dependency graph for cryptmgr.c:

Go to the source code of this file.

Macros

#define DISABLE_DEBUGLOG

Functions

int GWEN_CryptMgr_Decode (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_Decrypt (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_DecryptKey (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_Encode (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_Encrypt (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_EncryptKey (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
void GWEN_CryptMgr_free (GWEN_CRYPTMGR *cm)
int GWEN_CryptMgr_GetCryptProfile (const GWEN_CRYPTMGR *cm)
const char * GWEN_CryptMgr_GetLocalKeyName (const GWEN_CRYPTMGR *cm)
int GWEN_CryptMgr_GetLocalKeyNumber (const GWEN_CRYPTMGR *cm)
int GWEN_CryptMgr_GetLocalKeyVersion (const GWEN_CRYPTMGR *cm)
const char * GWEN_CryptMgr_GetPeerKeyName (const GWEN_CRYPTMGR *cm)
int GWEN_CryptMgr_GetPeerKeyNumber (const GWEN_CRYPTMGR *cm)
int GWEN_CryptMgr_GetPeerKeyVersion (const GWEN_CRYPTMGR *cm)
int GWEN_CryptMgr_GetSignatureProfile (const GWEN_CRYPTMGR *cm)
GWEN_CRYPTMGRGWEN_CryptMgr_new (void)
void GWEN_CryptMgr_SetCryptProfile (GWEN_CRYPTMGR *cm, int i)
GWEN_CRYPTMGR_DECRYPTKEY_FN GWEN_CryptMgr_SetDecryptKeyFn (GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_DECRYPTKEY_FN f)
GWEN_CRYPTMGR_ENCRYPTKEY_FN GWEN_CryptMgr_SetEncryptKeyFn (GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_ENCRYPTKEY_FN f)
void GWEN_CryptMgr_SetLocalKeyName (GWEN_CRYPTMGR *cm, const char *s)
void GWEN_CryptMgr_SetLocalKeyNumber (GWEN_CRYPTMGR *cm, int i)
void GWEN_CryptMgr_SetLocalKeyVersion (GWEN_CRYPTMGR *cm, int i)
void GWEN_CryptMgr_SetPeerKeyName (GWEN_CRYPTMGR *cm, const char *s)
void GWEN_CryptMgr_SetPeerKeyNumber (GWEN_CRYPTMGR *cm, int i)
void GWEN_CryptMgr_SetPeerKeyVersion (GWEN_CRYPTMGR *cm, int i)
void GWEN_CryptMgr_SetSignatureProfile (GWEN_CRYPTMGR *cm, int i)
GWEN_CRYPTMGR_SIGNDATA_FN GWEN_CryptMgr_SetSignDataFn (GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_SIGNDATA_FN f)
GWEN_CRYPTMGR_VERIFYDATA_FN GWEN_CryptMgr_SetVerifyDataFn (GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_VERIFYDATA_FN f)
int GWEN_CryptMgr_Sign (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_SignData (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_Verify (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
int GWEN_CryptMgr_VerifyData (GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, const uint8_t *pSignature, uint32_t lSignature)

Macro Definition Documentation

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 14 of file cryptmgr.c.

Function Documentation

◆ GWEN_CryptMgr_Decode()

int GWEN_CryptMgr_Decode ( GWEN_CRYPTMGR * cm,
const uint8_t * pData,
uint32_t lData,
GWEN_BUFFER * dbuf )

Decrypt the given data which is expected to be an encrypted object containing a signed object which actually contains the data. The signature of the contained signed object is verified.

Definition at line 826 of file cryptmgr.c.

References DBG_INFO, GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_new(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), and GWEN_LOGDOMAIN.

Here is the call graph for this function:

◆ GWEN_CryptMgr_Decrypt()

◆ GWEN_CryptMgr_DecryptKey()

int GWEN_CryptMgr_DecryptKey ( GWEN_CRYPTMGR * cm,
const uint8_t * pData,
uint32_t lData,
GWEN_BUFFER * dbuf )

Definition at line 235 of file cryptmgr.c.

References GWEN_ERROR_NOT_IMPLEMENTED.

Referenced by GWEN_CryptMgr_Decrypt().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_Encode()

int GWEN_CryptMgr_Encode ( GWEN_CRYPTMGR * cm,
const uint8_t * pData,
uint32_t lData,
GWEN_BUFFER * dbuf )

Sign the given data (thus creating a signed object) and encrypt the result of that operation (i.e. creating an encrypted object containing a signed object which actually contains the data).

Definition at line 793 of file cryptmgr.c.

References DBG_INFO, GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_new(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), and GWEN_LOGDOMAIN.

Here is the call graph for this function:

◆ GWEN_CryptMgr_Encrypt()

◆ GWEN_CryptMgr_EncryptKey()

int GWEN_CryptMgr_EncryptKey ( GWEN_CRYPTMGR * cm,
const uint8_t * pData,
uint32_t lData,
GWEN_BUFFER * dbuf )

Definition at line 211 of file cryptmgr.c.

References GWEN_ERROR_NOT_IMPLEMENTED.

Referenced by GWEN_CryptMgr_Encrypt().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_free()

void GWEN_CryptMgr_free ( GWEN_CRYPTMGR * cm)

Definition at line 49 of file cryptmgr.c.

References GWEN_FREE_OBJECT, and GWEN_INHERIT_FINI.

Referenced by GWEN_Sar_SignArchive(), GWEN_Sar_VerifyArchive(), signArchive(), and verifyArchive().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_GetCryptProfile()

int GWEN_CryptMgr_GetCryptProfile ( const GWEN_CRYPTMGR * cm)

Definition at line 166 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetLocalKeyName()

const char * GWEN_CryptMgr_GetLocalKeyName ( const GWEN_CRYPTMGR * cm)

Definition at line 62 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetLocalKeyNumber()

int GWEN_CryptMgr_GetLocalKeyNumber ( const GWEN_CRYPTMGR * cm)

Definition at line 82 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetLocalKeyVersion()

int GWEN_CryptMgr_GetLocalKeyVersion ( const GWEN_CRYPTMGR * cm)

Definition at line 98 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetPeerKeyName()

const char * GWEN_CryptMgr_GetPeerKeyName ( const GWEN_CRYPTMGR * cm)

Definition at line 114 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetPeerKeyNumber()

int GWEN_CryptMgr_GetPeerKeyNumber ( const GWEN_CRYPTMGR * cm)

Definition at line 134 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetPeerKeyVersion()

int GWEN_CryptMgr_GetPeerKeyVersion ( const GWEN_CRYPTMGR * cm)

Definition at line 150 of file cryptmgr.c.

◆ GWEN_CryptMgr_GetSignatureProfile()

int GWEN_CryptMgr_GetSignatureProfile ( const GWEN_CRYPTMGR * cm)

Definition at line 182 of file cryptmgr.c.

◆ GWEN_CryptMgr_new()

GWEN_CRYPTMGR * GWEN_CryptMgr_new ( void )

Definition at line 37 of file cryptmgr.c.

References GWEN_CryptMgr_new(), GWEN_INHERIT_INIT, and GWEN_NEW_OBJECT.

Referenced by GWEN_CryptMgr_new(), and GWEN_CryptMgrKeys_new().

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

◆ GWEN_CryptMgr_SetCryptProfile()

void GWEN_CryptMgr_SetCryptProfile ( GWEN_CRYPTMGR * cm,
int i )

Definition at line 174 of file cryptmgr.c.

◆ GWEN_CryptMgr_SetDecryptKeyFn()

GWEN_CRYPTMGR_DECRYPTKEY_FN GWEN_CryptMgr_SetDecryptKeyFn ( GWEN_CRYPTMGR * cm,
GWEN_CRYPTMGR_DECRYPTKEY_FN f )

Definition at line 285 of file cryptmgr.c.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetEncryptKeyFn()

GWEN_CRYPTMGR_ENCRYPTKEY_FN GWEN_CryptMgr_SetEncryptKeyFn ( GWEN_CRYPTMGR * cm,
GWEN_CRYPTMGR_ENCRYPTKEY_FN f )

Definition at line 272 of file cryptmgr.c.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetLocalKeyName()

void GWEN_CryptMgr_SetLocalKeyName ( GWEN_CRYPTMGR * cm,
const char * s )

Definition at line 70 of file cryptmgr.c.

References NULL.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetLocalKeyNumber()

void GWEN_CryptMgr_SetLocalKeyNumber ( GWEN_CRYPTMGR * cm,
int i )

Definition at line 90 of file cryptmgr.c.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetLocalKeyVersion()

void GWEN_CryptMgr_SetLocalKeyVersion ( GWEN_CRYPTMGR * cm,
int i )

Definition at line 106 of file cryptmgr.c.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetPeerKeyName()

void GWEN_CryptMgr_SetPeerKeyName ( GWEN_CRYPTMGR * cm,
const char * s )

Definition at line 122 of file cryptmgr.c.

References NULL.

Referenced by GWEN_CryptMgr_Verify(), and GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetPeerKeyNumber()

void GWEN_CryptMgr_SetPeerKeyNumber ( GWEN_CRYPTMGR * cm,
int i )

Definition at line 142 of file cryptmgr.c.

Referenced by GWEN_CryptMgr_Verify(), and GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetPeerKeyVersion()

void GWEN_CryptMgr_SetPeerKeyVersion ( GWEN_CRYPTMGR * cm,
int i )

Definition at line 158 of file cryptmgr.c.

Referenced by GWEN_CryptMgr_Verify(), and GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetSignatureProfile()

void GWEN_CryptMgr_SetSignatureProfile ( GWEN_CRYPTMGR * cm,
int i )

Definition at line 190 of file cryptmgr.c.

◆ GWEN_CryptMgr_SetSignDataFn()

GWEN_CRYPTMGR_SIGNDATA_FN GWEN_CryptMgr_SetSignDataFn ( GWEN_CRYPTMGR * cm,
GWEN_CRYPTMGR_SIGNDATA_FN f )

Definition at line 246 of file cryptmgr.c.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_SetVerifyDataFn()

GWEN_CRYPTMGR_VERIFYDATA_FN GWEN_CryptMgr_SetVerifyDataFn ( GWEN_CRYPTMGR * cm,
GWEN_CRYPTMGR_VERIFYDATA_FN f )

Definition at line 259 of file cryptmgr.c.

Referenced by GWEN_CryptMgrKeys_new().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_Sign()

◆ GWEN_CryptMgr_SignData()

int GWEN_CryptMgr_SignData ( GWEN_CRYPTMGR * cm,
const uint8_t * pData,
uint32_t lData,
GWEN_BUFFER * dbuf )

Definition at line 200 of file cryptmgr.c.

References GWEN_ERROR_NOT_IMPLEMENTED.

Referenced by GWEN_CryptMgr_Sign().

Here is the caller graph for this function:

◆ GWEN_CryptMgr_Verify()

◆ GWEN_CryptMgr_VerifyData()

int GWEN_CryptMgr_VerifyData ( GWEN_CRYPTMGR * cm,
const uint8_t * pData,
uint32_t lData,
const uint8_t * pSignature,
uint32_t lSignature )

Definition at line 222 of file cryptmgr.c.

References GWEN_ERROR_NOT_IMPLEMENTED.

Referenced by GWEN_CryptMgr_Verify().

Here is the caller graph for this function: