Hi,
I test AES CBC mode with below test case(from RFC 3602 section 4). I meet some
questions which are strange for me.
(I use openssl-0.9.8g, under WidowsXP, VC6++),
1 EVP_EncryptFinal_ex() shall be called after calling EVP_EncryptUpdate(), or
not if the block is just 16 bytes long
2 when I d
> The decrypt program:
>
> unsigned char *DecryptTest(unsigned char *in, int inl, unsigned
> char *key, unsigned char *iv, int * outl)
> {
> int ret;
> EVP_CIPHER_CTX ctx;
> EVP_CIPHER_CTX_init(&ctx);
>
> ret = EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), 0, key, iv);
> if(!ret)
I modified the code with using strlen(Plaintext) which is 16-byte long, but
still not understand if need to call EVP_EncryptFinal_ex() after called
EVP_EncryptUpdate().
If I call like this, I get 32-byte return(The first 16 byte string equal to
Ciphertext in the test case)
ret = EVP_Encrypt
> If I call like this, I get 32-byte return(The first 16 byte string equal to
> Ciphertext in the test case)
> ret = EVP_EncryptUpdate(&ctx, out, outl, in, inl);
>if(!ret) abort();
>len += *outl;
>ret = EVP_EncryptFinal_ex(&ctx, out+len, outl);
>if(!ret) abort();
> len += *out