15#define DISABLE_DEBUGLOG
18#include "cryptmgrkeys_p.h"
20#include <gwenhywfar/misc.h>
21#include <gwenhywfar/debug.h>
22#include <gwenhywfar/mdigest.h>
23#include <gwenhywfar/padd.h>
24#include <gwenhywfar/crypthead.h>
25#include <gwenhywfar/text.h>
40 GWEN_CRYPTMGR_KEYS *xcm;
48 xcm->localKey=localKey;
51 xcm->ownLocalKey=ownKeys;
60 xcm->ownPeerKey=ownKeys;
84 GWEN_CRYPTMGR_KEYS *xcm;
86 xcm=(GWEN_CRYPTMGR_KEYS *) p;
100 GWEN_CRYPTMGR_KEYS *xcm;
108 xcm->peerKey=peerKey;
109 xcm->ownPeerKey=ownKey;
116 const uint8_t *pData, uint32_t lData,
119 GWEN_CRYPTMGR_KEYS *xcm;
124 uint32_t signatureLen;
130 if (xcm->localKey==
NULL) {
190 const uint8_t *pData, uint32_t lData,
191 const uint8_t *pSignature, uint32_t lSignature)
193 GWEN_CRYPTMGR_KEYS *xcm;
204 if (xcm->peerKey==
NULL) {
217 pSignature, lSignature,
287 const uint8_t *pData, uint32_t lData,
290 GWEN_CRYPTMGR_KEYS *xcm;
300 if (xcm->peerKey==
NULL) {
340 const uint8_t *pData, uint32_t lData,
343 GWEN_CRYPTMGR_KEYS *xcm;
353 if (xcm->localKey==
NULL) {
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
int GWEN_Buffer_IncrementPos(GWEN_BUFFER *bf, uint32_t i)
uint32_t GWEN_Buffer_GetMaxUnsegmentedWrite(GWEN_BUFFER *bf)
int GWEN_Buffer_AdjustUsedBytes(GWEN_BUFFER *bf)
char * GWEN_Buffer_GetPosPointer(const GWEN_BUFFER *bf)
int GWEN_Buffer_AppendBytes(GWEN_BUFFER *bf, const char *buffer, uint32_t size)
int GWEN_Buffer_AppendBuffer(GWEN_BUFFER *bf, GWEN_BUFFER *sf)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
int GWEN_Buffer_AllocRoom(GWEN_BUFFER *bf, uint32_t size)
int GWEN_Crypt_Key_Decipher(GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, uint8_t *pOutData, uint32_t *pOutLen)
void GWEN_Crypt_Key_free(GWEN_CRYPT_KEY *k)
int GWEN_Crypt_Key_Sign(GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, uint8_t *pSignatureData, uint32_t *pSignatureLen)
int GWEN_Crypt_Key_GetKeyVersion(const GWEN_CRYPT_KEY *k)
int GWEN_Crypt_Key_GetKeySize(const GWEN_CRYPT_KEY *k)
int GWEN_Crypt_Key_GetKeyNumber(const GWEN_CRYPT_KEY *k)
int GWEN_Crypt_Key_Encipher(GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, uint8_t *pOutData, uint32_t *pOutLen)
struct GWEN_CRYPT_KEY GWEN_CRYPT_KEY
void GWEN_CryptMgr_SetLocalKeyName(GWEN_CRYPTMGR *cm, const char *s)
void GWEN_CryptMgr_SetLocalKeyNumber(GWEN_CRYPTMGR *cm, int i)
GWEN_CRYPTMGR_SIGNDATA_FN GWEN_CryptMgr_SetSignDataFn(GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_SIGNDATA_FN f)
GWEN_CRYPTMGR_DECRYPTKEY_FN GWEN_CryptMgr_SetDecryptKeyFn(GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_DECRYPTKEY_FN f)
GWEN_CRYPTMGR * GWEN_CryptMgr_new(void)
void GWEN_CryptMgr_SetPeerKeyVersion(GWEN_CRYPTMGR *cm, int i)
void GWEN_CryptMgr_SetPeerKeyName(GWEN_CRYPTMGR *cm, const char *s)
GWEN_CRYPTMGR_VERIFYDATA_FN GWEN_CryptMgr_SetVerifyDataFn(GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_VERIFYDATA_FN f)
void GWEN_CryptMgr_SetPeerKeyNumber(GWEN_CRYPTMGR *cm, int i)
GWEN_CRYPTMGR_ENCRYPTKEY_FN GWEN_CryptMgr_SetEncryptKeyFn(GWEN_CRYPTMGR *cm, GWEN_CRYPTMGR_ENCRYPTKEY_FN f)
void GWEN_CryptMgr_SetLocalKeyVersion(GWEN_CRYPTMGR *cm, int i)
struct GWEN_CRYPTMGR GWEN_CRYPTMGR
GWENHYWFAR_CB int GWEN_CryptMgrKeys_EncryptKey(GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
GWENHYWFAR_CB int GWEN_CryptMgrKeys_SignData(GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
GWENHYWFAR_CB int GWEN_CryptMgrKeys_VerifyData(GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, const uint8_t *pSignature, uint32_t lSignature)
GWENHYWFAR_CB int GWEN_CryptMgrKeys_DecryptKey(GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf)
void GWEN_CryptMgrKeys_SetPeerKey(GWEN_CRYPTMGR *cm, GWEN_CRYPT_KEY *peerKey, int ownKey)
GWENHYWFAR_CB void GWEN_CryptMgrKeys_FreeData(GWEN_UNUSED void *bp, void *p)
GWEN_CRYPTMGR * GWEN_CryptMgrKeys_new(const char *localName, GWEN_CRYPT_KEY *localKey, const char *peerName, GWEN_CRYPT_KEY *peerKey, int ownKeys)
#define DBG_INFO(dbg_logger, format,...)
#define DBG_ERROR(dbg_logger, format,...)
#define GWEN_ERROR_VERIFY
#define GWEN_ERROR_GENERIC
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
#define GWEN_INHERIT(bt, t)
#define GWEN_INHERIT_GETDATA(bt, t, element)
int GWEN_MDigest_Begin(GWEN_MDIGEST *md)
int GWEN_MDigest_End(GWEN_MDIGEST *md)
unsigned int GWEN_MDigest_GetDigestSize(GWEN_MDIGEST *md)
uint8_t * GWEN_MDigest_GetDigestPtr(GWEN_MDIGEST *md)
void GWEN_MDigest_free(GWEN_MDIGEST *md)
int GWEN_MDigest_Update(GWEN_MDIGEST *md, const uint8_t *buf, unsigned int l)
GWENHYWFAR_API GWEN_MDIGEST * GWEN_MDigest_Rmd160_new(void)
struct GWEN_MDIGEST GWEN_MDIGEST
#define GWEN_NEW_OBJECT(typ, varname)
int GWEN_Padd_PaddWithIso9796_2(GWEN_BUFFER *buf, int dstSize)
int GWEN_Padd_UnpaddWithIso9796_2(GWEN_BUFFER *buf)