Changeset 47185


Ignore:
Timestamp:
2015-10-12T15:11:03+02:00 (2 years ago)
Author:
nbd
Message:

firmware-utils/buffalo-enc: add support for decrypting data with an offset

Signed-off-by: Felix Fietkau <nbd@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/firmware-utils/src/buffalo-enc.c

    r43756 r47185  
    3535static char *version; 
    3636static int do_decrypt; 
     37static int offset; 
    3738 
    3839void usage(int status) 
     
    5354"  -v <version>    set version to <version>\n" 
    5455"  -h              show this screen\n" 
     56"  -O              Offset of encrypted data in file (decryption)\n" 
    5557        ); 
    5658 
     
    8890        ep.longstate = longstate; 
    8991 
    90         err = decrypt_buf(&ep, buf, src_len); 
     92        err = decrypt_buf(&ep, buf + offset, src_len - offset); 
    9193        if (err) { 
    9294                ERR("unable to decrypt '%s'", ifname); 
     
    101103        printf("Checksum\t: 0x%08x\n", ep.csum); 
    102104 
    103         err = write_buf_to_file(ofname, buf, ep.datalen); 
     105        err = write_buf_to_file(ofname, buf + offset, ep.datalen); 
    104106        if (err) { 
    105107                ERR("unable to write to file '%s'", ofname); 
     
    240242                int c; 
    241243 
    242                 c = getopt(argc, argv, "adi:m:o:hlp:v:k:r:s:"); 
     244                c = getopt(argc, argv, "adi:m:o:hlp:v:k:O:r:s:"); 
    243245                if (c == -1) 
    244246                        break; 
     
    271273                case 's': 
    272274                        seed = strtoul(optarg, NULL, 16); 
     275                        break; 
     276                case 'O': 
     277                        offset = strtoul(optarg, NULL, 0); 
    273278                        break; 
    274279                case 'h': 
Note: See TracChangeset for help on using the changeset viewer.