mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 12:59:44 -07:00
load works. needs some refactoring...
This commit is contained in:
parent
c1a23412ba
commit
167fbc8620
3 changed files with 14 additions and 3 deletions
|
@ -194,7 +194,9 @@ int CmdHFFidoRegister(const char *cmd) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
size_t jlen;
|
||||
JsonLoadBufAsHex(root, "$.ChallengeParam", data, 32, &jlen);
|
||||
JsonLoadBufAsHex(root, "$.ApplicationParam", &data[32], 32, &jlen);
|
||||
} else {
|
||||
root = json_object();
|
||||
}
|
||||
|
|
|
@ -264,7 +264,16 @@ bool HexToBuffer(const char *errormsg, const char *hexvalue, uint8_t * buffer, s
|
|||
return true;
|
||||
}
|
||||
|
||||
int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t *datalen) {
|
||||
int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen) {
|
||||
if (datalen)
|
||||
*datalen = 0;
|
||||
|
||||
json_t *jelm = json_path_get((const json_t *)elm, path);
|
||||
if (!jelm || !json_is_string(jelm))
|
||||
return 1;
|
||||
|
||||
if (!HexToBuffer("ERROR load", json_string_value(jelm), data, maxbufferlen, datalen))
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ extern int JsonSaveTLVTreeElm(json_t *elm, char *path, struct tlvdb *tlvdbelm, b
|
|||
|
||||
extern int JsonSaveTLVTree(json_t *root, json_t *elm, char *path, struct tlvdb *tlvdbelm);
|
||||
|
||||
extern int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t *datalen);
|
||||
extern int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen);
|
||||
|
||||
extern bool ParamLoadFromJson(struct tlvdb *tlv);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue