refactoring
This commit is contained in:
@@ -453,3 +453,13 @@ CborError CborGetStringValueBuf(CborValue *elm) {
|
|||||||
|
|
||||||
return CborGetStringValue(elm, stringBuf, sizeof(stringBuf), NULL);
|
return CborGetStringValue(elm, stringBuf, sizeof(stringBuf), NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder) {
|
||||||
|
json_t *elm = json_object_get(root, rootElmId);
|
||||||
|
if (!elm)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
int res = JsonToCbor(elm, encoder);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,4 +32,6 @@ extern CborError CborGetArrayStringValue(CborValue *elm, char *data, size_t maxd
|
|||||||
extern CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen);
|
extern CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen);
|
||||||
extern CborError CborGetStringValueBuf(CborValue *elm);
|
extern CborError CborGetStringValueBuf(CborValue *elm);
|
||||||
|
|
||||||
|
extern int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder);
|
||||||
|
|
||||||
#endif /* __CBORTOOLS_H__ */
|
#endif /* __CBORTOOLS_H__ */
|
||||||
|
|||||||
@@ -298,16 +298,6 @@ int CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder) {
|
|
||||||
json_t *elm = json_object_get(root, rootElmId);
|
|
||||||
if (!elm)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
int res = JsonToCbor(elm, encoder);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user