mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
refactoring
This commit is contained in:
parent
a9be05dbf7
commit
26cf350713
3 changed files with 17 additions and 16 deletions
|
@ -463,3 +463,19 @@ int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder) {
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CborError CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder) {
|
||||||
|
uint8_t buf[100] = {0};
|
||||||
|
size_t jlen;
|
||||||
|
|
||||||
|
JsonLoadBufAsHex(root, "$.ClientDataHash", buf, sizeof(buf), &jlen);
|
||||||
|
|
||||||
|
// fill with 0x00 if not found
|
||||||
|
if (!jlen)
|
||||||
|
jlen = 32;
|
||||||
|
|
||||||
|
int res = cbor_encode_byte_string(encoder, buf, jlen);
|
||||||
|
cbor_check(res);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -33,5 +33,6 @@ extern CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatale
|
||||||
extern CborError CborGetStringValueBuf(CborValue *elm);
|
extern CborError CborGetStringValueBuf(CborValue *elm);
|
||||||
|
|
||||||
extern int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder);
|
extern int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder);
|
||||||
|
extern CborError CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder);
|
||||||
|
|
||||||
#endif /* __CBORTOOLS_H__ */
|
#endif /* __CBORTOOLS_H__ */
|
||||||
|
|
|
@ -282,22 +282,6 @@ int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *pu
|
||||||
#define fido_check_if(r) if ((r) != CborNoError) {return r;} else
|
#define fido_check_if(r) if ((r) != CborNoError) {return r;} else
|
||||||
#define fido_check(r) if ((r) != CborNoError) return r;
|
#define fido_check(r) if ((r) != CborNoError) return r;
|
||||||
|
|
||||||
int CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder) {
|
|
||||||
uint8_t buf[100] = {0};
|
|
||||||
size_t jlen;
|
|
||||||
|
|
||||||
JsonLoadBufAsHex(root, "$.ClientDataHash", buf, sizeof(buf), &jlen);
|
|
||||||
|
|
||||||
// fill with 0x00 if not found
|
|
||||||
if (!jlen)
|
|
||||||
jlen = 32;
|
|
||||||
|
|
||||||
int res = cbor_encode_byte_string(encoder, buf, jlen);
|
|
||||||
fido_check(res);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen) {
|
int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen) {
|
||||||
if (datalen)
|
if (datalen)
|
||||||
*datalen = 0;
|
*datalen = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue