|
gwenhywfar 5.14.1
|
#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>
Go to the source code of this file.
Macros | |
| #define | DISABLE_DEBUGLOG |
| #define DISABLE_DEBUGLOG |
Definition at line 14 of file cryptmgr.c.
| 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.

| int GWEN_CryptMgr_Decrypt | ( | GWEN_CRYPTMGR * | cm, |
| const uint8_t * | pData, | ||
| uint32_t | lData, | ||
| GWEN_BUFFER * | dbuf ) |
Extracts the data from an encrypted object and decrypts it.
Definition at line 637 of file cryptmgr.c.
References DBG_ERROR, DBG_INFO, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AppendBuffer(), GWEN_Buffer_free(), GWEN_Buffer_GetMaxUnsegmentedWrite(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Buffer_new(), GWEN_Crypt_CryptMode_Cbc, GWEN_Crypt_Key_Decipher(), GWEN_Crypt_Key_free(), GWEN_Crypt_KeyBlowFish_fromData(), GWEN_CryptHead_free(), GWEN_CryptHead_fromBuffer(), GWEN_CryptHead_GetKeyLen(), GWEN_CryptHead_GetKeyName(), GWEN_CryptHead_GetKeyNumber(), GWEN_CryptHead_GetKeyPtr(), GWEN_CryptHead_GetKeyVersion(), GWEN_CryptMgr_DecryptKey(), GWEN_CRYPTMGR_TLV_ENCRYPTEDOBJECT, GWEN_ERROR_BAD_DATA, GWEN_LOGDOMAIN, GWEN_Padd_UnpaddWithAnsiX9_23(), GWEN_Tag16_free(), GWEN_Tag16_fromBuffer2(), GWEN_Tag16_GetTagData(), GWEN_Tag16_GetTagLength(), GWEN_Tag16_GetTagSize(), GWEN_Tag16_GetTagType(), and NULL.
Referenced by GWEN_CryptMgr_Decode().


| 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().

| 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.

| int GWEN_CryptMgr_Encrypt | ( | GWEN_CRYPTMGR * | cm, |
| const uint8_t * | pData, | ||
| uint32_t | lData, | ||
| GWEN_BUFFER * | dbuf ) |
Encrypt the given data and create an encrypted object containing the encrypted data.
Definition at line 381 of file cryptmgr.c.
References DBG_ERROR, DBG_INFO, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AppendByte(), GWEN_Buffer_AppendBytes(), GWEN_Buffer_free(), GWEN_Buffer_GetMaxUnsegmentedWrite(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Buffer_new(), GWEN_Crypt_CryptMode_Cbc, GWEN_Crypt_Key_Encipher(), GWEN_Crypt_Key_free(), GWEN_Crypt_KeyBlowFish_Generate(), GWEN_Crypt_KeyBlowFish_GetKeyDataLen(), GWEN_Crypt_KeyBlowFish_GetKeyDataPtr(), GWEN_CryptHead_free(), GWEN_CryptHead_new(), GWEN_CryptHead_SetCryptProfile(), GWEN_CryptHead_SetKey(), GWEN_CryptHead_SetKeyName(), GWEN_CryptHead_SetKeyNumber(), GWEN_CryptHead_SetKeyVersion(), GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_EncryptKey(), GWEN_CRYPTMGR_TLV_ENCRYPTEDOBJECT, GWEN_ERROR_GENERIC, GWEN_LOGDOMAIN, GWEN_Padd_PaddWithAnsiX9_23(), GWEN_Tag16_DirectlyToBuffer(), and NULL.
Referenced by GWEN_CryptMgr_Encode().


| 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().

| 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().

| int GWEN_CryptMgr_GetCryptProfile | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 166 of file cryptmgr.c.
| const char * GWEN_CryptMgr_GetLocalKeyName | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 62 of file cryptmgr.c.
| int GWEN_CryptMgr_GetLocalKeyNumber | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 82 of file cryptmgr.c.
| int GWEN_CryptMgr_GetLocalKeyVersion | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 98 of file cryptmgr.c.
| const char * GWEN_CryptMgr_GetPeerKeyName | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 114 of file cryptmgr.c.
| int GWEN_CryptMgr_GetPeerKeyNumber | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 134 of file cryptmgr.c.
| int GWEN_CryptMgr_GetPeerKeyVersion | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 150 of file cryptmgr.c.
| int GWEN_CryptMgr_GetSignatureProfile | ( | const GWEN_CRYPTMGR * | cm | ) |
Definition at line 182 of file cryptmgr.c.
| 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().


| void GWEN_CryptMgr_SetCryptProfile | ( | GWEN_CRYPTMGR * | cm, |
| int | i ) |
Definition at line 174 of file cryptmgr.c.
| 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().

| 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().

| 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().

| void GWEN_CryptMgr_SetLocalKeyNumber | ( | GWEN_CRYPTMGR * | cm, |
| int | i ) |
Definition at line 90 of file cryptmgr.c.
Referenced by GWEN_CryptMgrKeys_new().

| void GWEN_CryptMgr_SetLocalKeyVersion | ( | GWEN_CRYPTMGR * | cm, |
| int | i ) |
Definition at line 106 of file cryptmgr.c.
Referenced by GWEN_CryptMgrKeys_new().

| 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().

| 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().

| 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().

| void GWEN_CryptMgr_SetSignatureProfile | ( | GWEN_CRYPTMGR * | cm, |
| int | i ) |
Definition at line 190 of file cryptmgr.c.
| 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().

| 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().

| int GWEN_CryptMgr_Sign | ( | GWEN_CRYPTMGR * | cm, |
| const uint8_t * | pData, | ||
| uint32_t | lData, | ||
| GWEN_BUFFER * | dbuf ) |
Sign the given data and create a signed object containing the signature and the given data.
Definition at line 298 of file cryptmgr.c.
References DBG_INFO, GWEN_Buffer_AppendByte(), GWEN_Buffer_free(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetStart(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_new(), GWEN_CryptMgr_SignData(), GWEN_CRYPTMGR_TLV_SIGNEDOBJECT, GWEN_CurrentTime(), GWEN_LOGDOMAIN, GWEN_SigHead_free(), GWEN_SigHead_new(), GWEN_SigHead_SetDateTime(), GWEN_SigHead_SetKeyName(), GWEN_SigHead_SetKeyNumber(), GWEN_SigHead_SetKeyVersion(), GWEN_SigHead_SetSignatureNumber(), GWEN_SigHead_SetSignatureProfile(), GWEN_SigHead_toBuffer(), GWEN_SigTail_free(), GWEN_SigTail_new(), GWEN_SigTail_SetSignature(), GWEN_SigTail_SetSignatureNumber(), GWEN_SigTail_toBuffer(), GWEN_Tag16_DirectlyToBuffer(), and GWEN_Time_free().
Referenced by GWEN_CryptMgr_Encode(), and GWEN_Sar_Sign().


| 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().

| int GWEN_CryptMgr_Verify | ( | GWEN_CRYPTMGR * | cm, |
| const uint8_t * | pData, | ||
| uint32_t | lData, | ||
| GWEN_BUFFER * | dbuf ) |
Extract the data from a signed object and verify the signature.
Definition at line 482 of file cryptmgr.c.
References DBG_ERROR, DBG_INFO, GWEN_Buffer_AppendBytes(), GWEN_CryptMgr_SetPeerKeyName(), GWEN_CryptMgr_SetPeerKeyNumber(), GWEN_CryptMgr_SetPeerKeyVersion(), GWEN_CRYPTMGR_TLV_SIGNEDOBJECT, GWEN_CryptMgr_VerifyData(), GWEN_ERROR_BAD_DATA, GWEN_LOGDOMAIN, GWEN_SigHead_free(), GWEN_SigHead_fromBuffer(), GWEN_SigHead_GetKeyName(), GWEN_SigHead_GetKeyNumber(), GWEN_SigHead_GetKeyVersion(), GWEN_SigHead_GetSignatureNumber(), GWEN_SigTail_free(), GWEN_SigTail_fromBuffer(), GWEN_SigTail_GetSignatureLen(), GWEN_SigTail_GetSignatureNumber(), GWEN_SigTail_GetSignaturePtr(), GWEN_Tag16_free(), GWEN_Tag16_fromBuffer2(), GWEN_Tag16_GetTagData(), GWEN_Tag16_GetTagLength(), GWEN_Tag16_GetTagSize(), GWEN_Tag16_GetTagType(), and NULL.
Referenced by GWEN_CryptMgr_Decode(), and GWEN_Sar_Verify().


| 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().
