AES and EVP_CIPHER question
Philip Prindeville
philipp_subx at redfish-solutions.com
Tue May 17 15:25:39 UTC 2022
> On May 17, 2022, at 4:32 AM, Matt Caswell <matt at openssl.org> wrote:
>
>
>
> On 16/05/2022 23:48, Philip Prindeville wrote:
>> Sorry, I shouldn't have phrased that inartfully.
>> There is no EVP_CIPHER_CTX_get_padding(), so how does one achieve something analogous?
>
>
> From 3.0, assuming you are using provided ciphers (i.e. not engine ones), then OSSL_CIPHER_PARAM_PADDING is a "gettable" parameter. See the section "Gettable and Settable EVP_CIPHER_CTX parameters" on this page:
>
> https://www.openssl.org/docs/man3.0/man3/EVP_EncryptInit_ex2.html
>
> So you can use EVP_CIPHER_CTX_get_params() to obtain that value (documented on the same man page as above). E.g. something like:
>
> OSSL_PARAM params[2], *p = params;
> unsigned int pad;
>
> *p++ = OSSL_PARAM_construct_uint(OSSL_CIPHER_PARAM_PADDING,
> &pad);
> *p = OSSL_PARAM_construct_end();
>
> if (!EVP_CIPHER_CTX_get_params(ctx, params)) {
> /* Error */
> }
>
> Matt
Thanks, and for 1.1.x?
More information about the openssl-users
mailing list