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_EncryptUpdate(&ctx, out, outl, in, inl); 
    if(!ret) abort();
    len += *outl;
    ret = EVP_EncryptFinal_ex(&ctx, out+len, outl);
    if(!ret) abort();
   len += *outl;

Or if I call like this, the result is error (return 16 byte, but not equal to 
Ciphertext in the test case)

   ret = EVP_EncryptUpdate(&ctx, out, outl, in, inl); 
    if(!ret) abort();

    ret = EVP_EncryptFinal_ex(&ctx, out, outl);
    if(!ret) abort();
    
   len += *outl;

Bian


>     char Plaintext[]="Single block msg";

This is a 17-byte string.


>     out = EncryptTest((unsigned char*)Plaintext,
> sizeof(Plaintext), key,iv, &outl);

sizeof(Plaintext) == 17

DS


      ___________________________________________________________ 
天生购物狂,狂抢购物券,你还等什么! 
http://cn.mail.yahoo.com/promo/taobao20/index.php

Reply via email to