|
gwenhywfar 5.14.1
|
#include "tag16_p.h"#include <gwenhywfar/debug.h>#include <gwenhywfar/inherit.h>#include <gwenhywfar/misc.h>#include <gwenhywfar/text.h>#include <gwenhywfar/portable_endian.h>#include <stdlib.h>#include <assert.h>#include <string.h>#include "tag16-t.c"
Go to the source code of this file.
Macros | |
| #define | DISABLE_DEBUGLOG |
Functions | |
| static void | _writeTagToBuffer (unsigned int tagType, const uint8_t *p, int size, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_DirectlyToBuffer (unsigned int tagType, const char *p, int size, GWEN_BUFFER *buf) |
| int | GWEN_Tag16_EndTagInBuffer (int startPos, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_free (GWEN_TAG16 *tag) |
| GWEN_TAG16 * | GWEN_Tag16_fromBuffer (GWEN_BUFFER *mbuf, GWEN_UNUSED int isBerTlv) |
| GWEN_TAG16 * | GWEN_Tag16_fromBuffer2 (const uint8_t *bufferPtr, uint32_t bufferLen, int doCopy) |
| const void * | GWEN_Tag16_GetTagData (const GWEN_TAG16 *tag) |
| double | GWEN_Tag16_GetTagDataAsDouble (const GWEN_TAG16 *tag, double defaultValue) |
| char * | GWEN_Tag16_GetTagDataAsNewString (const GWEN_TAG16 *tag, const char *defaultValue) |
| uint16_t | GWEN_Tag16_GetTagDataAsUint16 (const GWEN_TAG16 *tag, uint16_t defaultValue) |
| uint32_t | GWEN_Tag16_GetTagDataAsUint32 (const GWEN_TAG16 *tag, uint32_t defaultValue) |
| uint64_t | GWEN_Tag16_GetTagDataAsUint64 (const GWEN_TAG16 *tag, uint64_t defaultValue) |
| uint8_t | GWEN_Tag16_GetTagDataAsUint8 (const GWEN_TAG16 *tag, uint8_t defaultValue) |
| unsigned int | GWEN_Tag16_GetTagLength (const GWEN_TAG16 *tag) |
| unsigned int | GWEN_Tag16_GetTagSize (const GWEN_TAG16 *tag) |
| unsigned int | GWEN_Tag16_GetTagType (const GWEN_TAG16 *tag) |
| const GWEN_TAG16 * | GWEN_Tag16_List_FindFirstByTagType (const GWEN_TAG16_LIST *tagList, unsigned int tagType) |
| const GWEN_TAG16 * | GWEN_Tag16_List_FindNextByTagType (const GWEN_TAG16 *tag, unsigned int tagType) |
| GWEN_TAG16_LIST * | GWEN_Tag16_List_fromBuffer (const uint8_t *p, uint32_t l, int doCopy) |
| GWEN_TAG16 * | GWEN_Tag16_new (void) |
| GWEN_TAG16 * | GWEN_Tag16_newCopy (unsigned int tagType, unsigned int tagLength, const uint8_t *tagData) |
| GWEN_TAG16 * | GWEN_Tag16_newNoCopy (unsigned int tagType, unsigned int tagLength, const uint8_t *tagData) |
| int | GWEN_Tag16_StartTagInBuffer (unsigned int tagType, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteDoubleTagToBuffer (unsigned int tagType, double data, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteStringTagToBuffer (unsigned int tagType, const char *s, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteTagToBuffer (unsigned int tagType, const uint8_t *s, int size, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteUint16TagToBuffer (unsigned int tagType, uint16_t data, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteUint32TagToBuffer (unsigned int tagType, uint32_t data, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteUint64TagToBuffer (unsigned int tagType, uint64_t data, GWEN_BUFFER *buf) |
| void | GWEN_Tag16_WriteUint8TagToBuffer (unsigned int tagType, uint8_t data, GWEN_BUFFER *buf) |
|
static |
Definition at line 384 of file tag16.c.
References DBG_INFO, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_IncrementPos(), and GWEN_LOGDOMAIN.
Referenced by GWEN_Tag16_DirectlyToBuffer(), GWEN_Tag16_WriteDoubleTagToBuffer(), GWEN_Tag16_WriteStringTagToBuffer(), GWEN_Tag16_WriteTagToBuffer(), GWEN_Tag16_WriteUint16TagToBuffer(), GWEN_Tag16_WriteUint32TagToBuffer(), GWEN_Tag16_WriteUint64TagToBuffer(), and GWEN_Tag16_WriteUint8TagToBuffer().


| void GWEN_Tag16_DirectlyToBuffer | ( | unsigned int | tagType, |
| const char * | p, | ||
| int | size, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 240 of file tag16.c.
References _writeTagToBuffer().
Referenced by GWEN_Crypt_TokenOHBCI__EncodeKey(), GWEN_Crypt_TokenOHBCI_Encode(), GWEN_Crypt_TokenOHBCI_Write(), GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_SigHead_toBuffer(), and GWEN_SigTail_toBuffer().


| int GWEN_Tag16_EndTagInBuffer | ( | int | startPos, |
| GWEN_BUFFER * | buf ) |
Use this to finish a tag16 structure in buffer you started with GWEN_Tag16_StartTagInBuffer.
Internally this function adjusts the size element of the tag16 object in the buffer.
| startPos | value returned by GWEN_Tag16_StartTagInBuffer (i.e. start of the tag in buffer) |
| buf | buffer to write into |
Definition at line 437 of file tag16.c.
References DBG_ERROR, GWEN_Buffer_GetPos(), GWEN_Buffer_GetStart(), GWEN_ERROR_GENERIC, and GWEN_LOGDOMAIN.

| void GWEN_Tag16_free | ( | GWEN_TAG16 * | tag | ) |
Definition at line 103 of file tag16.c.
References GWEN_FREE_OBJECT, and GWEN_LIST_FINI.
Referenced by GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_Crypt_TokenOHBCI__DecryptFile16(), GWEN_Crypt_TokenOHBCI_Read(), GWEN_CryptHead_fromBuffer(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), GWEN_SigHead_fromBuffer(), and GWEN_SigTail_fromBuffer().

| GWEN_TAG16 * GWEN_Tag16_fromBuffer | ( | GWEN_BUFFER * | mbuf, |
| GWEN_UNUSED int | isBerTlv ) |
Definition at line 143 of file tag16.c.
References GWEN_Buffer_GetPosPointer(), GWEN_Buffer_GetUsedBytes(), GWEN_Buffer_IncrementPos(), GWEN_Tag16_fromBuffer2(), and GWEN_UNUSED.
Referenced by GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_Crypt_TokenOHBCI__DecryptFile16(), and GWEN_Crypt_TokenOHBCI_Read().


| GWEN_TAG16 * GWEN_Tag16_fromBuffer2 | ( | const uint8_t * | bufferPtr, |
| uint32_t | bufferLen, | ||
| int | doCopy ) |
Definition at line 156 of file tag16.c.
References DBG_ERROR, GWEN_LOGDOMAIN, GWEN_Tag16_newCopy(), GWEN_Tag16_newNoCopy(), and NULL.
Referenced by GWEN_CryptHead_fromBuffer(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), GWEN_SigHead_fromBuffer(), GWEN_SigTail_fromBuffer(), GWEN_Tag16_fromBuffer(), and GWEN_Tag16_List_fromBuffer().


| const void * GWEN_Tag16_GetTagData | ( | const GWEN_TAG16 * | tag | ) |
Definition at line 136 of file tag16.c.
References NULL.
Referenced by GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_Crypt_TokenOHBCI__DecryptFile16(), GWEN_Crypt_TokenOHBCI_Read(), GWEN_CryptHead_fromBuffer(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), GWEN_SigHead_fromBuffer(), and GWEN_SigTail_fromBuffer().

| double GWEN_Tag16_GetTagDataAsDouble | ( | const GWEN_TAG16 * | tag, |
| double | defaultValue ) |
| char * GWEN_Tag16_GetTagDataAsNewString | ( | const GWEN_TAG16 * | tag, |
| const char * | defaultValue ) |
Definition at line 302 of file tag16.c.
References GWEN_Text_strndup(), and NULL.

| uint16_t GWEN_Tag16_GetTagDataAsUint16 | ( | const GWEN_TAG16 * | tag, |
| uint16_t | defaultValue ) |
| uint32_t GWEN_Tag16_GetTagDataAsUint32 | ( | const GWEN_TAG16 * | tag, |
| uint32_t | defaultValue ) |
| uint64_t GWEN_Tag16_GetTagDataAsUint64 | ( | const GWEN_TAG16 * | tag, |
| uint64_t | defaultValue ) |
| uint8_t GWEN_Tag16_GetTagDataAsUint8 | ( | const GWEN_TAG16 * | tag, |
| uint8_t | defaultValue ) |
| unsigned int GWEN_Tag16_GetTagLength | ( | const GWEN_TAG16 * | tag | ) |
Definition at line 122 of file tag16.c.
Referenced by GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_Crypt_TokenOHBCI__DecryptFile16(), GWEN_Crypt_TokenOHBCI_Read(), GWEN_CryptHead_fromBuffer(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), GWEN_SigHead_fromBuffer(), and GWEN_SigTail_fromBuffer().

| unsigned int GWEN_Tag16_GetTagSize | ( | const GWEN_TAG16 * | tag | ) |
Return the full size of the complete tag including type, length and data fields.
Definition at line 129 of file tag16.c.
Referenced by GWEN_CryptHead_fromBuffer(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), GWEN_SigHead_fromBuffer(), and GWEN_SigTail_fromBuffer().

| unsigned int GWEN_Tag16_GetTagType | ( | const GWEN_TAG16 * | tag | ) |
Definition at line 115 of file tag16.c.
Referenced by GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_Crypt_TokenOHBCI__DecryptFile16(), GWEN_CryptHead_fromBuffer(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Verify(), GWEN_SigHead_fromBuffer(), and GWEN_SigTail_fromBuffer().

| const GWEN_TAG16 * GWEN_Tag16_List_FindFirstByTagType | ( | const GWEN_TAG16_LIST * | tagList, |
| unsigned int | tagType ) |
Definition at line 311 of file tag16.c.
References GWEN_Tag16_List_First(), GWEN_Tag16_List_Next(), and NULL.

| const GWEN_TAG16 * GWEN_Tag16_List_FindNextByTagType | ( | const GWEN_TAG16 * | tag, |
| unsigned int | tagType ) |
Definition at line 327 of file tag16.c.
References GWEN_Tag16_List_Next(), and NULL.

| GWEN_TAG16_LIST * GWEN_Tag16_List_fromBuffer | ( | const uint8_t * | p, |
| uint32_t | l, | ||
| int | doCopy ) |
Definition at line 343 of file tag16.c.
References DBG_ERROR, DBG_INFO, GWEN_LOGDOMAIN, GWEN_Tag16_fromBuffer2(), GWEN_Tag16_List_Add(), GWEN_Tag16_List_free(), GWEN_Tag16_List_GetCount(), GWEN_Tag16_List_new(), and NULL.

| GWEN_TAG16 * GWEN_Tag16_new | ( | void | ) |
Definition at line 48 of file tag16.c.
References GWEN_LIST_INIT, and GWEN_NEW_OBJECT.
Referenced by GWEN_Tag16_newCopy(), and GWEN_Tag16_newNoCopy().

| GWEN_TAG16 * GWEN_Tag16_newCopy | ( | unsigned int | tagType, |
| unsigned int | tagLength, | ||
| const uint8_t * | tagData ) |
Definition at line 78 of file tag16.c.
References GWEN_Tag16_new().
Referenced by GWEN_Tag16_fromBuffer2().


| GWEN_TAG16 * GWEN_Tag16_newNoCopy | ( | unsigned int | tagType, |
| unsigned int | tagLength, | ||
| const uint8_t * | tagData ) |
Definition at line 60 of file tag16.c.
References GWEN_Tag16_new().
Referenced by GWEN_Tag16_fromBuffer2().


| int GWEN_Tag16_StartTagInBuffer | ( | unsigned int | tagType, |
| GWEN_BUFFER * | buf ) |
Use this function together with GWEN_Tag16_EndTagInBuffer to create complex tags in a buffer. This can be used to cascade tags into a buffer.
Internally this function writes the begin of a TAG16 structure into buffer. After that you can add as many bytes as you like. Finally call GWEN_Tag16_EndTagInBuffer to finish the tag by correcting the size element of the tag16 in the buffer.
| tagType | 8-bit type code/name/id of the tag (meaning of this code is up to the caller) |
| buf | buffer to write into |
Definition at line 405 of file tag16.c.
References DBG_INFO, GWEN_Buffer_AdjustUsedBytes(), GWEN_Buffer_AllocRoom(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetPosPointer(), GWEN_Buffer_IncrementPos(), GWEN_ERROR_INVALID, and GWEN_LOGDOMAIN.

| void GWEN_Tag16_WriteDoubleTagToBuffer | ( | unsigned int | tagType, |
| double | data, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 225 of file tag16.c.
References _writeTagToBuffer().

| void GWEN_Tag16_WriteStringTagToBuffer | ( | unsigned int | tagType, |
| const char * | s, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 181 of file tag16.c.
References _writeTagToBuffer().

| void GWEN_Tag16_WriteTagToBuffer | ( | unsigned int | tagType, |
| const uint8_t * | s, | ||
| int | size, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 377 of file tag16.c.
References _writeTagToBuffer().

| void GWEN_Tag16_WriteUint16TagToBuffer | ( | unsigned int | tagType, |
| uint16_t | data, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 195 of file tag16.c.
References _writeTagToBuffer().

| void GWEN_Tag16_WriteUint32TagToBuffer | ( | unsigned int | tagType, |
| uint32_t | data, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 205 of file tag16.c.
References _writeTagToBuffer().

| void GWEN_Tag16_WriteUint64TagToBuffer | ( | unsigned int | tagType, |
| uint64_t | data, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 215 of file tag16.c.
References _writeTagToBuffer().

| void GWEN_Tag16_WriteUint8TagToBuffer | ( | unsigned int | tagType, |
| uint8_t | data, | ||
| GWEN_BUFFER * | buf ) |
Definition at line 188 of file tag16.c.
References _writeTagToBuffer().
