Hey, EVP_DecryptFinal returns 0 for me, but no data is returned to supplied output buffer, and returned data length is set to 0. What could be the issue? bdec  receives some correct data tho.

        u32 szbdec = 0;
        u8* bdec = new u8[resp.rSize + halfKey];    // half rSize = half of chyper key + chypered bytes

        EVP_CIPHER_CTX ctx;
        EVP_DecryptInit(&ctx, EVP_aes_256_ecb(), key, NULL);
        EVP_CIPHER_CTX_set_padding(&ctx, 0);
        EVP_DecryptUpdate(&ctx, bdec, (int*)&szbdec, resp.rBuff + halfKey, resp.rSize - halfKey);
        //ZeroMemory(resp.rBuff, resp.rSize);
        if(!EVP_DecryptFinal(&ctx, bdec, (int*)&szbdec))
        {
            u32 err = ERR_get_error();
        }
        EVP_CIPHER_CTX_cleanup(&ctx);

-- roxaz

Reply via email to