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

Fixed TRX v1 signature bug #106

Merged
merged 1 commit into from Feb 3, 2015

Conversation

Projects
None yet
2 participants
@bmaia
Copy link
Contributor

bmaia commented Feb 3, 2015

The signature for the TRX header is still incomplete for v1. According to http://wiki.openwrt.org/doc/techref/header, offset[0] = lzma-loader, offset[1] = Linux-Kernel and offset[2] = rootfs.

Before the fix:

bernardomr@splinter ~/openwrt $ binwalk openwrt-wrtsl54gs-squashfs.bin

DECIMAL HEXADECIMAL DESCRIPTION
32 0x20 TRX firmware header, little endian, header size: 32 bytes, image size: 1323008 bytes, CRC32: 0x6CAC483, flags: 0x0, version: 1, kernel offset: 0x1C, rootfs offset: 0x8D8
60 0x3C gzip compressed data, maximum compression, from Unix, NULL date:
2296 0x8F8 LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: -1 bytes
517152 0x7E420 Squashfs filesystem, little endian, version 2.1, size: 805671 bytes, 269 inodes, blocksize: 65536 bytes, created: 2014-10-29 18:53:25

After the fix:

bernardomr@splinter ~/openwrt $ binwalk openwrt-wrtsl54gs-squashfs.bin

DECIMAL HEXADECIMAL DESCRIPTION
32 0x20 TRX firmware header, little endian, header size: 32 bytes, image size: 1323008 bytes, CRC32: 0x6CAC483, flags: 0x0, version: 1, loader offset: 0x1C, linux kernel offset: 0x8D8, rootfs offset: 0x7E400,
60 0x3C gzip compressed data, maximum compression, from Unix, NULL date:
2296 0x8F8 LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: -1 bytes
517152 0x7E420 Squashfs filesystem, little endian, version 2.1, size: 805671 bytes, 269 inodes, blocksize: 65536 bytes, created: 2014-10-29 18:53:25

  • Loader: 0x20 + 0x1C = 0x3C
  • Kernel: 0x20 + 0x8D8 = 0x8F8
  • RootFS: 0x20 + 0x7E400 = 0x7E420
Fixed TRX v1 signature bug
The signature for the TRX header is still incomplete for v1. According to http://wiki.openwrt.org/doc/techref/header, offset[0] = lzma-loader, offset[1] = Linux-Kernel and offset[2] = rootfs.

Before the fix:

bernardomr@splinter ~/openwrt $ binwalk openwrt-wrtsl54gs-squashfs.bin 

DECIMAL       HEXADECIMAL     DESCRIPTION
32            0x20            TRX firmware header, little endian, header size: 32 bytes, image size: 1323008 bytes, CRC32: 0x6CAC483, flags: 0x0, version: 1, kernel offset: 0x1C, rootfs offset: 0x8D8
60            0x3C            gzip compressed data, maximum compression, from Unix, NULL date:
2296          0x8F8           LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: -1 bytes
517152        0x7E420         Squashfs filesystem, little endian, version 2.1, size: 805671 bytes, 269 inodes, blocksize: 65536 bytes, created: 2014-10-29 18:53:25

After the fix:

bernardomr@splinter ~/openwrt $ binwalk openwrt-wrtsl54gs-squashfs.bin 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
32            0x20            TRX firmware header, little endian, header size: 32 bytes, image size: 1323008 bytes, CRC32: 0x6CAC483, flags: 0x0, version: 1, loader offset: 0x1C, linux kernel offset: 0x8D8, rootfs offset: 0x7E400,
60            0x3C            gzip compressed data, maximum compression, from Unix, NULL date:
2296          0x8F8           LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: -1 bytes
517152        0x7E420         Squashfs filesystem, little endian, version 2.1, size: 805671 bytes, 269 inodes, blocksize: 65536 bytes, created: 2014-10-29 18:53:25

- Loader: 0x20 + 0x1C = 0x3C
- Kernel: 0x20 + 0x8D8 = 0x8F8
- RootFS: 0x20 + 0x7E400 = 0x7E420

devttys0 added a commit that referenced this pull request Feb 3, 2015

Merge pull request #106 from bmaia/patch-1
Fixed TRX v1 signature bug

@devttys0 devttys0 merged commit 6cc5f50 into ReFirmLabs:master Feb 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment