Opaque structures - Cant access buf_len variable from evp_cipher_ctx_st

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Opaque structures - Cant access buf_len variable from evp_cipher_ctx_st

Pedro Lopes
Good morning,

I'd like to know how to get buffer length from cipher structures since 1.1 version.

I'm using that variable member to know what should be the required length if something gets wrong and return to the caller. Snippet of my source code:

DecryptUpdate(unsigned char* pEncryptedPart, unsigned long int ulEncryptedPartLen,
unsigned char* pPart, unsigned long int *pulPartLen){

unsigned long required_rest = (ctx.buf_len + ulEncryptedPartLen) % EVP_CIPHER_block_size(mCipher);
unsigned long required_len = ctx.buf_len + ulEncryptedPartLen - required_rest;

if (pPart == NULL_PTR || *pulPartLen < required_len)
{
*pulPartLen = required_len;
return pPart == NULL_PTR  ? CKR_OK : CKR_BUFFER_TOO_SMALL;
}
...
}

--
Kind Regards,
Pedro Lopes