[#EVP_CipherInit_ex2]
= EVP&lowbar;CipherInit&lowbar;ex2
:mrdocs:

Initialise a cipher context with optional OSSL&lowbar;PARAM settings&period;

== Synopsis

Declared in `&lt;openssl&sol;evp&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
EVP&lowbar;CipherInit&lowbar;ex2(
    xref:EVP_CIPHER_CTX.adoc[EVP&lowbar;CIPHER&lowbar;CTX]* ctx,
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* cipher,
    unsigned char const* key,
    unsigned char const* iv,
    int enc,
    xref:OSSL_PARAM.adoc[OSSL&lowbar;PARAM] const params[]);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Cipher context to initialise&period;
| *cipher*
| Cipher algorithm, or NULL to reuse the one already in `ctx&period;`
| *key*
| Key bytes, or NULL to set later&period;
| *iv*
| IV&sol;nonce bytes, or NULL when not yet available &sol; not required&period;
| *enc*
| 1 to encrypt, 0 to decrypt, or &hyphen;1 to leave the prior direction&period;
| *params*
| Optional parameter array terminated by OSSL&lowbar;PARAM&lowbar;END, or NULL&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
