tried to run my decryption func with test vectors and got not proper result

---------- CODE ----------
void aes256cbc_encrypt()
{
    int i, outlen;
    unsigned char *outbuf = (unsigned char*)malloc(1024);

    unsigned char key[] =
"0000000000000000000000000000000000000000000000000000000000000000";
    unsigned char iv[] = "00000000000000000000000000000000";
    unsigned char inbuf[] = "014730f80ac625fe84f026c60bfd547d";
    int inlen = sizeof(inbuf) - 1;

    EVP_CIPHER_CTX ctx;
    const EVP_CIPHER *cipher;

    EVP_CIPHER_CTX_init(&ctx);
    cipher = EVP_aes_256_cbc();
    EVP_EncryptInit(&ctx, cipher, key, iv);

    EVP_EncryptUpdate(&ctx, outbuf, &outlen, inbuf, inlen);
    EVP_EncryptFinal(&ctx, outbuf + outlen, &outlen);

    for(i = 0; i < outlen; i++) printf("%02x", outbuf[i]);

    EVP_CIPHER_CTX_cleanup(&ctx);
    free(outbuf);
}
---------- CODE ----------

Result for this test vector should be "5c9d844ed46f9885085e5d6a4f94c7d7"

What am I doing wrong?
-- 
View this message in context: 
http://www.nabble.com/aes256cbc_encrypt-tp26090506p26090506.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to