Advertisement
Guest User

Untitled

a guest
Oct 29th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. diff --git a/utils/sbtools/sbtoelf.c b/utils/sbtools/sbtoelf.c
  2. index 87017ab..023964f 100644
  3. --- a/utils/sbtools/sbtoelf.c
  4. +++ b/utils/sbtools/sbtoelf.c
  5. @@ -89,6 +89,18 @@ static uint8_t instruction_checksum(struct sb_instruction_header_t *hdr)
  6. static void elf_write(void *user, uint32_t addr, const void *buf, size_t count)
  7. {
  8. FILE *f = user;
  9. + /* if seeking paste end of file, write constant 0xff otherwise the system
  10. + * might write random bytes and it's not good to reproduce problems */
  11. + #if 1
  12. + fseek(f, 0, SEEK_END);
  13. + size_t pos = ftell(f);
  14. + if(pos < addr)
  15. + {
  16. + uint8_t zero = 0xff;
  17. + while(pos++ < addr)
  18. + fwrite(&zero, 1, 1, f);
  19. + }
  20. + #endif
  21. fseek(f, addr, SEEK_SET);
  22. fwrite(buf, count, 1, f);
  23. }
  24. @@ -481,6 +493,15 @@ static void extract(unsigned long filesize)
  25. }
  26. }
  27.  
  28. + if(getenv("SB_REAL_KEY") != 0)
  29. + {
  30. + struct crypto_key_t k;
  31. + char *env = getenv("SB_REAL_KEY");
  32. + if(!parse_key(&env, &k) || *env)
  33. + bug("Invalid SB_REAL_KEY");
  34. + memcpy(real_key, k.u.key, 16);
  35. + }
  36. +
  37. color(RED);
  38. printf(" Summary:\n");
  39. color(GREEN);
  40. @@ -751,6 +772,9 @@ int main(int argc, char **argv)
  41. add_keys(&g_zero_key, 1);
  42. break;
  43. }
  44. + case 'r':
  45. + g_raw_mode = true;
  46. + break;
  47. case 'a':
  48. {
  49. struct crypto_key_t key;
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement