Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp fix for - 'Undefined symbols for architecture x86_64' when compiling #144 #146

Merged
merged 1 commit into from Nov 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
90 changes: 90 additions & 0 deletions tsschecker/tss.c
Expand Up @@ -131,6 +131,96 @@ plist_t tss_request_new(plist_t overrides) {
return request;
}

uint64_t _plist_dict_get_uint(plist_t dict, const char *key)
{
uint64_t uintval = 0;
char *strval = NULL;
uint64_t strsz = 0;
plist_t node = plist_dict_get_item(dict, key);
if (!node) {
return (uint64_t)-1LL;
}
switch (plist_get_node_type(node)) {
case PLIST_UINT:
plist_get_uint_val(node, &uintval);
break;
case PLIST_STRING:
plist_get_string_val(node, &strval);
if (strval) {
uintval = strtoull(strval, NULL, 0);
free(strval);
}
break;
case PLIST_DATA:
plist_get_data_val(node, &strval, &strsz);
if (strval) {
if (strsz == 8) {
uintval = le64toh(*(uint64_t*)strval);
} else if (strsz == 4) {
uintval = le32toh(*(uint32_t*)strval);
} else if (strsz == 2) {
uintval = le16toh(*(uint16_t*)strval);
} else if (strsz == 1) {
uintval = strval[0];
} else {
error("%s: ERROR: invalid size %d for data to integer conversion\n", __func__, strsz);
}
free(strval);
}
break;
default:
break;
}
return uintval;
}

uint8_t _plist_dict_get_bool(plist_t dict, const char *key)
{
uint8_t bval = 0;
uint64_t uintval = 0;
char *strval = NULL;
uint64_t strsz = 0;
plist_t node = plist_dict_get_item(dict, key);
if (!node) {
return 0;
}
switch (plist_get_node_type(node)) {
case PLIST_BOOLEAN:
plist_get_bool_val(node, &bval);
break;
case PLIST_UINT:
plist_get_uint_val(node, &uintval);
bval = (uint8_t)uintval;
break;
case PLIST_STRING:
plist_get_string_val(node, &strval);
if (strval) {
if (strcmp(strval, "true")) {
bval = 1;
} else if (strcmp(strval, "false")) {
bval = 0;
}
free(strval);
}
break;
case PLIST_DATA:
plist_get_data_val(node, &strval, &strsz);
if (strval) {
if (strsz == 1) {
bval = strval[0];
} else {
error("%s: ERROR: invalid size %d for data to boolean conversion\n", __func__, strsz);
}
free(strval);
}
break;
default:
break;
}
return bval;
}


int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity)
{
plist_t node = NULL;
Expand Down