EVP_CipherInit_ex2

Initialise a cipher context with optional OSSL_PARAM settings.

Synopsis

Declared in <openssl/evp.h>

int
EVP_CipherInit_ex2(
    EVP_CIPHER_CTX* ctx,
    EVP_CIPHER const* cipher,
    unsigned char const* key,
    unsigned char const* iv,
    int enc,
    OSSL_PARAM const params[]);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
ctxCipher context to initialise.
cipherCipher algorithm, or NULL to reuse the one already in ctx.
keyKey bytes, or NULL to set later.
ivIV/nonce bytes, or NULL when not yet available / not required.
enc1 to encrypt, 0 to decrypt, or -1 to leave the prior direction.
paramsOptional parameter array terminated by OSSL_PARAM_END, or NULL.