good const, bad const, fixing -Wincompatible-pointer-types-discards-qualifiers
This commit is contained in:
@@ -161,7 +161,7 @@ static CborError dumprecursive(uint8_t cmdCode, bool isResponse, CborValue *it,
|
||||
if (cmdCode > 0 && nestingLevel == 1 && isMapType && !(elmCount % 2)) {
|
||||
int64_t val;
|
||||
cbor_value_get_int64(it, &val);
|
||||
char *desc = fido2GetCmdMemberDescription(cmdCode, isResponse, val);
|
||||
const char *desc = fido2GetCmdMemberDescription(cmdCode, isResponse, val);
|
||||
if (desc)
|
||||
printf(" (%s)", desc);
|
||||
}
|
||||
@@ -459,7 +459,7 @@ CborError CborGetStringValueBuf(CborValue *elm) {
|
||||
return CborGetStringValue(elm, stringBuf, sizeof(stringBuf), NULL);
|
||||
};
|
||||
|
||||
int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder) {
|
||||
int CBOREncodeElm(json_t *root, const char *rootElmId, CborEncoder *encoder) {
|
||||
json_t *elm = NULL;
|
||||
if (rootElmId && strlen(rootElmId) && rootElmId[0] == '$')
|
||||
elm = json_path_get(root, rootElmId);
|
||||
|
||||
@@ -32,7 +32,7 @@ CborError CborGetArrayStringValue(CborValue *elm, char *data, size_t maxdatalen,
|
||||
CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen);
|
||||
CborError CborGetStringValueBuf(CborValue *elm);
|
||||
|
||||
int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder);
|
||||
int CBOREncodeElm(json_t *root, const char *rootElmId, CborEncoder *encoder);
|
||||
CborError CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder);
|
||||
|
||||
#endif /* __CBORTOOLS_H__ */
|
||||
|
||||
@@ -19,15 +19,15 @@ static const char COSEEmptyStr[] = "";
|
||||
|
||||
typedef struct {
|
||||
int Value;
|
||||
char *Name;
|
||||
char *Description;
|
||||
const char *Name;
|
||||
const char *Description;
|
||||
} COSEValueNameDesc_t;
|
||||
|
||||
typedef struct {
|
||||
int Value;
|
||||
char *Type;
|
||||
char *Name;
|
||||
char *Description;
|
||||
const char *Type;
|
||||
const char *Name;
|
||||
const char *Description;
|
||||
} COSEValueTypeNameDesc_t;
|
||||
|
||||
// kty - Key Type Values
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
typedef struct {
|
||||
uint8_t ErrorCode;
|
||||
char *ShortDescription;
|
||||
char *Description;
|
||||
const char *ShortDescription;
|
||||
const char *Description;
|
||||
} fido2Error_t;
|
||||
|
||||
fido2Error_t fido2Errors[] = {
|
||||
@@ -84,7 +84,7 @@ typedef struct {
|
||||
fido2Commands Command;
|
||||
fido2PacketType PckType;
|
||||
int MemberNumber;
|
||||
char *Description;
|
||||
const char *Description;
|
||||
} fido2Desc_t;
|
||||
|
||||
fido2Desc_t fido2CmdGetInfoRespDesc[] = {
|
||||
@@ -149,7 +149,7 @@ fido2Desc_t fido2CmdGetInfoRespDesc[] = {
|
||||
{fido2COSEKey, ptResponse, -4, "d - private key"},
|
||||
};
|
||||
|
||||
char *fido2GetCmdErrorDescription(uint8_t errorCode) {
|
||||
const char *fido2GetCmdErrorDescription(uint8_t errorCode) {
|
||||
for (int i = 0; i < sizeof(fido2Errors) / sizeof(fido2Error_t); i++)
|
||||
if (fido2Errors[i].ErrorCode == errorCode)
|
||||
return fido2Errors[i].Description;
|
||||
@@ -157,7 +157,7 @@ char *fido2GetCmdErrorDescription(uint8_t errorCode) {
|
||||
return fido2Errors[0].Description;
|
||||
}
|
||||
|
||||
char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum) {
|
||||
const char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum) {
|
||||
for (int i = 0; i < sizeof(fido2CmdGetInfoRespDesc) / sizeof(fido2Desc_t); i++)
|
||||
if (fido2CmdGetInfoRespDesc[i].Command == cmdCode &&
|
||||
fido2CmdGetInfoRespDesc[i].PckType == (isResponse ? ptResponse : ptQuery) &&
|
||||
|
||||
@@ -45,8 +45,8 @@ int FIDO2GetAssertion(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_
|
||||
|
||||
int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *publicKey, size_t publicKeyMaxLen);
|
||||
|
||||
char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum);
|
||||
char *fido2GetCmdErrorDescription(uint8_t errorCode);
|
||||
const char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum);
|
||||
const char *fido2GetCmdErrorDescription(uint8_t errorCode);
|
||||
|
||||
bool CheckrpIdHash(json_t *json, uint8_t *hash);
|
||||
int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen);
|
||||
|
||||
Reference in New Issue
Block a user