gcry_cipher_decrypt not functioning

D. Hazelton dhazelton at enter.net
Wed Apr 5 22:15:56 CEST 2006


On Wednesday 05 April 2006 05:48, Brad Hards wrote:
> On Wednesday 05 April 2006 12:04 pm, D. Hazelton wrote:
> > >From watching the process in gdb it is certain that the decryption never
> >
> > happens. I have tried a version where I was creating a temporary buffer
> > for the output, and even with that step the input stream matched the
> > output stream from the function.
>
> It would help if you could tell us what is each gcry_* function returning.

Everything returns fine. Each call returns "No Error"...

When gcry_cipher_decrypt returns it returns with no decryption.

> >   rval = gcry_cipher_open( &hand, algo, 0, 0 );
>
> This looks wrong. What mode are you trying to use? 0 =>
> GCRY_CIPHER_MODE_NONE, which isn't good...
>
> You aren't setting an IV either. That is OK, as long as you are using ECB.
> However it looks like you are doing a lot of data, and ECB is a bad choice
> in this case. I like CFB (to avoid padding), but it obviously has to match
> whatever you are using to encrypt.

Okay. So I should set an IV (and store it in the output) and use 
GCRY_CIPHER_MODE_CFB? Sound pretty simple to me. Thank you!

DRH



More information about the Gcrypt-devel mailing list