Opaque structures - Cant access buf_len variable from evp_cipher_ctx_st

Pedro Lopes pedroterrosolopes at gmail.com
Thu May 23 10:58:49 UTC 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20190523/0be7cad7/attachment-0001.html>


More information about the openssl-users mailing list