In message <[EMAIL PROTECTED]> on Fri, 18 Feb 2005 12:37:05 -0800 (PST), Phong 
<[EMAIL PROTECTED]> said:

phong_co> As someone new to openSSL I'm trying to write a simple
phong_co> program to read a text file from disk, encrypt using
phong_co> AES 128 and write to disk and reverse the process. 
phong_co> 
phong_co> I started out with a blowfish example program and am
phong_co> attempting to change it to use AES. It works fine
phong_co> during the encryption phase but am running into either
phong_co> a EVP_DecryptFinal error or segmentation fault.

You've misunderstood how EVP_DecryptFinal should be used.  You have
basically done the following:

  EVP_DecryptInit(...)
  loop
    {
      EVP_DecryptUpdate(...)
      EVP_DecryptFinal(...)
    }

when the correct way is the following:

  EVP_DecryptInit(...)
  loop
    {
      EVP_DecryptUpdate(...)
    }
  EVP_DecryptFinal(...)

Did that make sense to you?

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

-- 
Richard Levitte                         [EMAIL PROTECTED]
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to