views:

141

answers:

2

Hi, i encrypt a file using ideas from tldp.org/LDP/LG/issue87/vinayak.html. I downloaded and compiled this source code for encrypting/decrypting a simple text file. Once compiled I do:

./blowfish input_file.txt output_enc.txt output_dec.txt

I use the options:

  1. G for generating a key
  2. E for encrypting the file, so output_enc.txt is generated
  3. D for decrypting output_enc.txt so output_dec.txt is generated

In the third step I obtain a segmentation fault. A decrypted file is generated but it differs in some characters from the original one. Any ideas?

A: 

tried it on my machine, same result, I can only assume this was written to an older Crypto lib, which the new one is incompatible with. If it's of interest, the Segmentation fault is on line

 if (EVP_DecryptFinal (&ctx, outbuf + olen, &tlen) != 1)

Process terminating with default action of signal 11 (SIGSEGV) Access not within mapped region at address 0x808080C

Liran Orevi
+1  A: 

This question is very similar to the one I've answered previously. Did you search before posting the question? Anyway here is the link. The page you are using as source is wrong. Beware that the code I provided is only a corrected version of the original supplied code, and can be optimized.

rsarro
The x-ref looks good!
Jonathan Leffler