Skip to content

Commit

Permalink
Fixed a problem in handling large number of 3des blobs that was causi…
Browse files Browse the repository at this point in the history
…ng failure on 4.0
  • Loading branch information
posixninja committed Jun 21, 2010
1 parent fbc51fa commit f1593c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/genpass.c
Expand Up @@ -184,12 +184,14 @@ uint8* decrypt_key(const char* filesystem, uint8* passphrase) {
uint8* out = malloc(0x30);
free(buffer);

for (i = 0; i < 0x10; i++) {
for (i = 0; i < 0x20; i++) {
if (fread(data, 1, 0x30, fd) <= 0) {
fprintf(stderr, "Error reading filesystem image");
free(out);
return NULL;
}

if(data[0] == 0) break;

EVP_CIPHER_CTX_init(&ctx);
EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, passphrase,
Expand Down Expand Up @@ -226,8 +228,8 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "unable to generate asr passphrase\n");
return -1;
}
printf("asr passphrase: ");
print_hex(pass, 0x20);
//printf("asr passphrase: ");
//print_hex(pass, 0x20);

key = decrypt_key(filesystem, pass);
if (key == NULL) {
Expand Down

0 comments on commit f1593c6

Please sign in to comment.