Skip to content

Instantly share code, notes, and snippets.

@nahueldsanchez
Last active May 17, 2021 22:27
Show Gist options
  • Save nahueldsanchez/7101197b7018760d7a478c70ab62e007 to your computer and use it in GitHub Desktop.
Save nahueldsanchez/7101197b7018760d7a478c70ab62e007 to your computer and use it in GitHub Desktop.
decompiled function rsl_sys_updateFirmware for TPLink blopost
undefined4 rsl_sys_updateFirmware(int param_1,uint param_2)
{
...
if (some_checks() {
uVar4 = rsl_dev_getProductVer();
if (more_checks() == uVar4)
{
uVar2 = oal_sys_getAddHverFlash();
...
printf("flash hver is %d\n",uVar6);
...
printf("image hver is %d\n",
uVar4 << 0x18 | uVar4 >> 0x18 | (uVar4 & 0xff0000) >> 8 | (uVar4 & 0xff00) << 8);
...
if (other_additional_checks() != O)
{
cdbg_printf(8,"rsl_sys_updateFirmware",0xbe3,
"Firmware Additional HardwareVersion check failed\n");
return 0x119a;
}
...
cdbg_printf(8,"rsl_sys_updateFirmware",0xbf4,
"NEW: swRevision-0x%x, platformVer-0x%x, swSignature-0x%x\n",
rev, ver, sig);
iVar3 = rsl_getCurrSwSignature();
if (iVar3 != local_38) {
rsl_sys_restoreDefaultCfg();
}
if ((*(int *)(iVar1 + 0x84) == 0) && (*(int *)(iVar1 + 0x88) == 0)) {
pcVar7 = oal_sys_writeAppFlash;
}
else {
pcVar7 = oal_sys_writeAppBootFlash;
param_1 = param_1 + 0x200;
param_2 = param_2 - 0x200;
}
iVar1 = (*pcVar7)(param_1,param_2);
if (iVar1 == 0) {
return 0;
}
cdbg_printf(8,"rsl_sys_updateFirmware",0xc11,"Update firmware error!\n");
return 1;
}
}
cdbg_printf(8,"rsl_sys_updateFirmware",0xbd7,"Firmware version check failed\n");
return 0x1197;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment