CTR-mode would need to call the appropriate ECB mode function. That could be done without going through the EVP interface. Also, you could probably implement counter mode purely with macros if the right data items are in the cipher context, meaning that it wouldn't be any slower than calling any other encryption mode through the EVP interface.

I need to write something like this anyway. I'll work on it tonight, and send it to you tomorrow.

John

On Thursday, October 17, 2002, at 04:30 PM, Richard Levitte - VMS Whacker wrote:

In message <[EMAIL PROTECTED]> on Thu, 17 Oct 2002 16:19:23 -0400, John Viega <[EMAIL PROTECTED]> said:

viega> > viega> Also, why isn't counter mode implemented in a generic fashion?
viega> > It's
viega> > viega> so simple, it should be usable with any block cipher without
viega> > having to
viega> > viega> write additional code.
viega> >
viega> > Ask yourself why OFB, CFB, CBC and ECB modes aren't implemented
viega> > generically. A hint: speed. Someone made a test having a generic CBC
viega> > that would take a pointer to the cipher function to use. The speed
viega> > apparently decreased enough for it to be an issue.
viega>
viega> I mean have a generic implementation, not necessarily a generic
viega> interface. I was more thinking a counter mode macro that could be used
viega> to create counter mode instances for all block ciphers quickly.

That's something I've thought of just a few days ago. I'll add that
to my TODO.

viega> Additionally, if you were to create a COUNTER wrapper along the lines
viega> of the HMAC wrapper (clearly it'd need to be a bit different), you
viega> wouldn't need the indirection of a function pointer whatsoever, and
viega> would not need to explicitly instantiate macros.

All the HMAC stuff I see (quick look) call EVP functions. If the mode
functions did that, we'd see dramatic slowdown. Not a good thought.

--
Richard Levitte \ Spannvägen 38, II \ [EMAIL PROTECTED]
Redakteur@Stacken \ S-168 35 BROMMA \ T: +46-8-26 52 47
\ SWEDEN \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.

Attachment: PGP.sig
Description: PGP signature

Reply via email to