Mailing List Archive

newbie needs helps
Hi, everybody. I am interested in developing some
multi-threaded apps that would use the AES in Linux
Fedora FC2 PC. However, I have not been able to use
AES alone just to encrypt some files for testing.
Here is what I do:

After setting the handle I would pick the cipher and
specified CBC mode and CBC_CTS for AES256 using
cipher_open. Then do a get_algo_keylen, and setkey (my
key is of 128/8 bits. Then I would setiv(handle, HDD,
NULL, 0) and then read from file and do encrypting. I
would ask if this is the right sequence because I
studies the tests/basic.c to do this. I think it is
right. However, since I also set CBC_CTS, but I got
error for the last block of the file that is less than
16 bytes and I have to pad it up with something to
have 16 byte block. What is wrong? Did I miss
something or misunderstand anything? For decryption,
I followed the same sequence, except I don't worry
about the last block size since ....

My other question is I plan to use Pthread, however,
after reading the mailing list about
>> > gnunetd: ath.c:181: _gcry_ath_mutex_lock:
Assertion `*lock ==
>> > ((ath_mutex_t) 0)' failed.
I saw that we have this file ath.c (thread-safeness
library). So what this file and the api? Only for
internal use right because no exported apis in the
gcrypt.info and etc...

I would like to see more examples of how to use
symmetric encryption/decryption as well as how to use
Pthread to work with libgcrypt-1.20. Could you please
give me some pointers to what sources with these
information so I can learn more?

Thank you very much.
Steven.




__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
Re: newbie needs helps [ In reply to ]
Steven Truong <steven_n_truong@yahoo.com> writes:

> Hi, everybody. I am interested in developing some
> multi-threaded apps that would use the AES in Linux
> Fedora FC2 PC. However, I have not been able to use
> AES alone just to encrypt some files for testing.
> Here is what I do:
>
> After setting the handle I would pick the cipher and
> specified CBC mode and CBC_CTS for AES256 using
> cipher_open. Then do a get_algo_keylen, and setkey (my
> key is of 128/8 bits. Then I would setiv(handle, HDD,
> NULL, 0) and then read from file and do encrypting. I
> would ask if this is the right sequence because I
> studies the tests/basic.c to do this. I think it is
> right. However, since I also set CBC_CTS, but I got
> error for the last block of the file that is less than
> 16 bytes and I have to pad it up with something to
> have 16 byte block. What is wrong? Did I miss
> something or misunderstand anything? For decryption,
> I followed the same sequence, except I don't worry
> about the last block size since ....

It is not clear if you intend to use CBC with Cipher Text Stealing
(CTS). Not many application use this. If you don't need it, you will
likely get a mismatch on the last bock. So I guess the question is
whether you want CBC or CBC-CTS?

It isn't unlikely that the CTS behaviour is incorrect, the test
vectors used in the self tests is from only one source. If you really
want CBC-CTS, do you have any test vectors for your application?