[#EVP_MAC_init]
= EVP&lowbar;MAC&lowbar;init
:mrdocs:

Initialize a MAC context with a key and optional algorithm parameters&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
EVP&lowbar;MAC&lowbar;init(
    xref:EVP_MAC_CTX.adoc[EVP&lowbar;MAC&lowbar;CTX]* ctx,
    unsigned char const* key,
    size&lowbar;t keylen,
    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*
| MAC context created with EVP&lowbar;MAC&lowbar;CTX&lowbar;new()&period;
| *key*
| MAC key octets&period;
| *keylen*
| Length of `key` in bytes&period;
| *params*
| Optional OSSL&lowbar;PARAM array (for example digest selection), or NULL&period;
|===


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