Subject: Using all zeros for IV means that..

From: Mauricio Junqueira <[email-masked]>
Date: Sat, 14 Jun 2003 11:32:27 -0300

.. a cipher text encoded in CFB mode could be decrypted in CBC ?

That question may be a silly one, but here's the point:

I am a Brazilian engineer who are in charge of a
system development that needs to send critical data over
the internet and other means.

Being new to cryptography but with some past experience
coding the DES algorithm for TEF I decided to do a little
research for new encryption methods. Then I decided for
twofish 128bits and implemented the server side of the
system using C and mcrypt in the CFB.
So I decided a very special convection for the IV bytes and
also had hash the IV prior his use.
To test the server, we have coded some clients in PHP and
everything works just fine.

Well, now we are developing for the real client: a 16mhz Hitachi H300
that has its own c libraries.
I found the implement mcrypt then twofish was not an option and
went to code twofish only.

When Looking for some examples showing how to implement twofish, I found
a Twofish source for PGP and used that as the basis for
the H300 implementation. Aside from differences in what a
unsigned char means, I now have it working.

But it only operates on 16bytes each time, what makes it
a CBC mode ( I guess ).

My solution was to complete with spaces the remain bytes to have
an entire block, but what about the IV?

I will lose some quality if I drop the IV and CFB mode in the
server or is there a way to use the IV in CBC mode like pre-pending
the IV or using all zeros IV in CFB...

I hope I have found the right place to post this and I was encouraged
in doing so after reading some messages from this mail list.

Thank you for your time in reading this and
who knows if some one could enlightenment me
in the right direction.

Mauricio Junqueira
[email-masked]

AMERICA - SOUTH AMERICA - BRASIL - GOIAS - GOIANIA

---

From: Derek Atkins <[email-masked]>
Date: 15 Jun 2003 11:29:31 -0400

Hi,

first, this is probably not the apprpriate forum for
general cryptographic help (unless of course you
are looking for a security consulting to come help
you, in which case you can look at my personal website
and retain my services ;)

Having said that....

> .. a cipher text encoded in CFB mode could be decrypted in CBC ?

No.  CFB and CBC are completely different crypto modes.

[snip]

> But it only operates on 16bytes each time, what makes it

No.  It has a 16-byte block size, but that does not make it CBC.

> an entire block, but what about the IV?

You should read Applied Cryptography.  This is "not the way".  There
are a number of standard padding techniques, but you do not need
them if you use CFB mode.  CFB mode always gives you the "exact"
amount of ciphertext that you need.

> the IV or using all zeros IV in CFB...

This question does not make sense.

> in doing so after reading some messages from this mail list.

Not really, as this list is for discussion of the OpenPGP
specification, not about cryptography in general.

> who knows if some one could enlightenment me

As I said, I recommend you read Applied Cryptograhy, or
engage the services of a Security Consultant to help you
understand all the issues...

Good Luck,

> [email-masked]

-derek

-- 
       Derek Atkins                 617-623-3745
       [email-masked]             www.ihtfp.com
       Computer and Internet Security Consultant