Changeset View
Changeset View
Standalone View
Standalone View
head/sys/boot/uboot/lib/glue.c
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | valid_sig(struct api_signature *sig) | ||||
if (checksum != sig->checksum) | if (checksum != sig->checksum) | ||||
return (0); | return (0); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* | /* | ||||
* Checks to see if API signature's address was given to us as a command line | |||||
* argument by U-Boot. | |||||
* | |||||
* returns 1/0 depending on found/not found result | |||||
*/ | |||||
int | |||||
api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig) | |||||
{ | |||||
unsigned long api_address; | |||||
int c; | |||||
api_address = 0; | |||||
opterr = 0; | |||||
optreset = 1; | |||||
optind = 1; | |||||
while ((c = getopt (argc, argv, "a:")) != -1) | |||||
switch (c) { | |||||
case 'a': | |||||
api_address = strtoul(optarg, NULL, 16); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (api_address != 0) { | |||||
*sig = (struct api_signature *)api_address; | |||||
if (valid_sig(*sig)) | |||||
return (1); | |||||
} | |||||
return (0); | |||||
} | |||||
/* | |||||
* Searches for the U-Boot API signature | * Searches for the U-Boot API signature | ||||
* | * | ||||
* returns 1/0 depending on found/not found result | * returns 1/0 depending on found/not found result | ||||
*/ | */ | ||||
int | int | ||||
api_search_sig(struct api_signature **sig) | api_search_sig(struct api_signature **sig) | ||||
{ | { | ||||
unsigned char *sp, *spend; | unsigned char *sp, *spend; | ||||
▲ Show 20 Lines • Show All 451 Lines • Show Last 20 Lines |