Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab6406fb92e0a31af85255174599e6b6@smtp.hushmail.com>
Date: Mon, 05 Mar 2012 21:00:26 +0100
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: AES decrypt portions to buffer (for RAR format)

Could anyone help me with this trivial OpenSSL question. I can't find
the docs (wtf?) nor any google example. Maybe I'm just too exhausted. I
want to decrypt 32KB or so at a time from a larger buffer of encrypted data.

This works fine (all at once):

 AES_KEY key;
 AES_set_decrypt_key(aes_key, 16 * 8, &key);
 AES_cbc_encrypt(input, output, len, &key, aes_iv, AES_DECRYPT);


This is what I think I'm doing and it produces garbage from 2nd read on
(actually that is a presumtion, I only know the end result is bad):

 AES_KEY key;
 AES_set_decrypt_key(aes_key, 16 * 8, &key);
 while(data to read) {
   AES_cbc_encrypt(input, output, BUF_SIZE, &key, aes_iv, AES_DECRYPT);
   ...process buffer and increment input pointer...
  }

Are not &key and/or aes_iv supposed to keep state? Or should I call
set_key each time, or what?

magnum

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.