14 #define DISABLE_DEBUGLOG
17 #include "crypthead_p.h"
19 #include <gwenhywfar/misc.h>
20 #include <gwenhywfar/debug.h>
21 #include <gwenhywfar/tag16.h>
40 if (ch->pKey &&ch->lKey)
64 const char *subtagPtr;
76 if (subtagLen && subtagPtr) {
79 case GWEN_CRYPTHEAD_TLV_KEYNAME:
80 ch->keyName=(
char*)malloc(subtagLen+1);
81 memmove(ch->keyName, subtagPtr, subtagLen);
82 ch->keyName[subtagLen]=0;
85 case GWEN_CRYPTHEAD_TLV_KEYNUM:
86 if (sscanf(subtagPtr,
"%d", &i)==1)
90 case GWEN_CRYPTHEAD_TLV_KEYVER:
91 if (sscanf(subtagPtr,
"%d", &i)==1)
95 case GWEN_CRYPTHEAD_TLV_KEY:
96 ch->pKey=(uint8_t*)malloc(subtagLen);
98 memmove(ch->pKey, subtagPtr, subtagLen);
102 case GWEN_CRYPTHEAD_TLV_CRYPTPROFILE:
103 if (sscanf(subtagPtr,
"%d", &i)==1)
138 snprintf(numbuf,
sizeof(numbuf),
"%d", ch->keyNumber);
141 snprintf(numbuf,
sizeof(numbuf),
"%d", ch->keyVersion);
143 if (ch->pKey && ch->lKey)
145 (
const char*)ch->pKey,
149 snprintf(numbuf,
sizeof(numbuf),
"%d", ch->cryptProfile);
173 if (s) ch->keyName=strdup(s);
174 else ch->keyName=
NULL;
181 return ch->keyNumber;
195 return ch->keyVersion;
209 return ch->cryptProfile;
237 if (ch->pKey && ch->lKey)
240 ch->pKey=(uint8_t*)malloc(l);
242 memmove(ch->pKey, p, l);