[openssl-dev] How to define EVP_EncryptUpdate and EVP_EncryptFinal functions for an AES engine? (and a separate question re: padding)

Dr. Stephen Henson steve at openssl.org
Sat Jul 1 19:06:38 UTC 2017


On Mon, Jun 26, 2017, Brett R. Nicholas wrote:

> AFAIK (and please correct me if this is wrong)  my init_key function is invoked by the EVP interface when I call the EVP_[En/De]cryptInit_ex function, and the do_cipher function is called upon EVP_[En/De]cryptUpdate. But how should I handle the EVP_[En/De]cryptFinal functions? Should I not be implementing them in my engine? Or am I missing something here....
> 

The do_cipher function is normally the low level block cipher function: it
gets handed a multiple of the block size to encrypt/decrypt. The higher level
EVP_EncryptUpdate and EVP_EncryptFinal functions perform padding and buffering
internally and call the do_cipher function to encrypt a multiple of the block
size.

I saw "normally" because it is possible to specify the flag
EVP_CIPH_FLAG_CUSTOM_CIPHER in the EVP_CIPHER structure and handle padding
internally.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org


More information about the openssl-dev mailing list