Hello,
>
> I went through FIPS-197 for AES. Now if I want to test
> void AES_cbc_encrypt(const unsigned char *in, unsigned
> char *out,
> const unsigned long length, const AES_KEY *key,
> unsigned char *ivec, const int enc) function.
> How should I test this function?
For test vectors you may look in test/evptests.txt in OpenSSL source.
For example if you will have test line like:
AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D
then to test this from command line you may run:
$ perl -e 'print pack("H*","6BC1BEE22E409F96E93D7E117393172A")' | \
openssl enc -e -aes-128-cbc \
-K 2B7E151628AED2A6ABF7158809CF4F3C \
-iv 000102030405060708090A0B0C0D0E0F | \
perl -e '$a=<STDIN>; print unpack("H*",$a), "\n"'
to get: 7649abac8119b246cee98e9b12e9197d8964e0b149c10b7b682e6e39aaeb731c
and of course if you run:
$ perl -e 'print
pack("H*","7649abac8119b246cee98e9b12e9197d8964e0b149c10b7b682e6e39aaeb731c")'|\
openssl enc -d -aes-128-cbc \
-K 2B7E151628AED2A6ABF7158809CF4F3C \
-iv 000102030405060708090A0B0C0D0E0F | \
perl -e '$a=<STDIN>; print unpack("H*",$a), "\n"'
you will get: 6bc1bee22e409f96e93d7e117393172a
The same results you should get using AES_cbc_encrypt() but you should
be aware that padding is not removed by this function when you decrypt
data.
Best regards,
--
Marek Marcola <[EMAIL PROTECTED]>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]