diff options
Diffstat (limited to 'secure/lib/libcrypto/man/man3/EVP_MAC.3')
-rw-r--r-- | secure/lib/libcrypto/man/man3/EVP_MAC.3 | 344 |
1 files changed, 137 insertions, 207 deletions
diff --git a/secure/lib/libcrypto/man/man3/EVP_MAC.3 b/secure/lib/libcrypto/man/man3/EVP_MAC.3 index 1f09c04db2b4..14f7a75f5ef4 100644 --- a/secure/lib/libcrypto/man/man3/EVP_MAC.3 +++ b/secure/lib/libcrypto/man/man3/EVP_MAC.3 @@ -1,4 +1,5 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) +.\" -*- mode: troff; coding: utf-8 -*- +.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== @@ -15,29 +16,12 @@ .ft R .fi .. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. \*(C+ will -.\" give a nicer C++. Capital omega is used to do unbreakable dashes and -.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, -.\" nothing in troff, for use with C<>. -.tr \(*W- -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' . ds C` . ds C' 'br\} @@ -68,86 +52,26 @@ . \} .\} .rr rF -.\" Fear. Run. Save yourself. No user-serviceable parts. -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "EVP_MAC 3ossl" -.TH EVP_MAC 3ossl "2023-09-19" "3.0.11" "OpenSSL" +.TH EVP_MAC 3ossl 2025-07-01 3.5.1 OpenSSL .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh -.SH "NAME" +.SH NAME EVP_MAC, EVP_MAC_fetch, EVP_MAC_up_ref, EVP_MAC_free, EVP_MAC_is_a, EVP_MAC_get0_name, EVP_MAC_names_do_all, EVP_MAC_get0_description, EVP_MAC_get0_provider, EVP_MAC_get_params, EVP_MAC_gettable_params, EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup, EVP_MAC_CTX_get0_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params, EVP_MAC_CTX_get_mac_size, EVP_MAC_CTX_get_block_size, EVP_Q_mac, -EVP_MAC_init, EVP_MAC_update, EVP_MAC_final, EVP_MAC_finalXOF, +EVP_MAC_init, EVP_MAC_init_SKEY, EVP_MAC_update, EVP_MAC_final, EVP_MAC_finalXOF, EVP_MAC_gettable_ctx_params, EVP_MAC_settable_ctx_params, EVP_MAC_CTX_gettable_params, EVP_MAC_CTX_settable_params, EVP_MAC_do_all_provided \- EVP MAC routines -.SH "SYNOPSIS" +.SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/evp.h> @@ -184,6 +108,7 @@ EVP_MAC_do_all_provided \- EVP MAC routines \& unsigned char *out, size_t outsize, size_t *outlen); \& int EVP_MAC_init(EVP_MAC_CTX *ctx, const unsigned char *key, size_t keylen, \& const OSSL_PARAM params[]); +\& int EVP_MAC_init_SKEY(EVP_MAC_CTX *ctx, EVP_SKEY *skey, const OSSL_PARAM params[]); \& int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen); \& int EVP_MAC_final(EVP_MAC_CTX *ctx, \& unsigned char *out, size_t *outl, size_t outsize); @@ -199,99 +124,105 @@ EVP_MAC_do_all_provided \- EVP MAC routines \& void (*fn)(EVP_MAC *mac, void *arg), \& void *arg); .Ve -.SH "DESCRIPTION" +.SH DESCRIPTION .IX Header "DESCRIPTION" These types and functions help the application to calculate MACs of different types and with different underlying algorithms if there are any. .PP MACs are a bit complex insofar that some of them use other algorithms -for actual computation. \s-1HMAC\s0 uses a digest, and \s-1CMAC\s0 uses a cipher. +for actual computation. HMAC uses a digest, and CMAC uses a cipher. Therefore, there are sometimes two contexts to keep track of, one for -the \s-1MAC\s0 algorithm itself and one for the underlying computation +the MAC algorithm itself and one for the underlying computation algorithm if there is one. .PP -To make things less ambiguous, this manual talks about a \*(L"context\*(R" or -\&\*(L"\s-1MAC\s0 context\*(R", which is to denote the \s-1MAC\s0 level context, and about a -\&\*(L"underlying context\*(R", or \*(L"computation context\*(R", which is to denote the +To make things less ambiguous, this manual talks about a "context" or +"MAC context", which is to denote the MAC level context, and about a +"underlying context", or "computation context", which is to denote the context for the underlying computation algorithm if there is one. -.SS "Types" +.SS Types .IX Subsection "Types" -\&\fB\s-1EVP_MAC\s0\fR is a type that holds the implementation of a \s-1MAC.\s0 +\&\fBEVP_MAC\fR is a type that holds the implementation of a MAC. .PP -\&\fB\s-1EVP_MAC_CTX\s0\fR is a context type that holds internal \s-1MAC\s0 information +\&\fBEVP_MAC_CTX\fR is a context type that holds internal MAC information as well as a reference to a computation context, for those MACs that rely on an underlying computation algorithm. .SS "Algorithm implementation fetching" .IX Subsection "Algorithm implementation fetching" -\&\fBEVP_MAC_fetch()\fR fetches an implementation of a \s-1MAC\s0 \fIalgorithm\fR, given +\&\fBEVP_MAC_fetch()\fR fetches an implementation of a MAC \fIalgorithm\fR, given a library context \fIlibctx\fR and a set of \fIproperties\fR. -See \*(L"\s-1ALGORITHM FETCHING\*(R"\s0 in \fBcrypto\fR\|(7) for further information. +See "ALGORITHM FETCHING" in \fBcrypto\fR\|(7) for further information. .PP -See \*(L"Message Authentication Code (\s-1MAC\s0)\*(R" in \fBOSSL_PROVIDER\-default\fR\|(7) for the list +See "Message Authentication Code (MAC)" in \fBOSSL_PROVIDER\-default\fR\|(7) for the list of algorithms supported by the default provider. .PP The returned value must eventually be freed with \&\fBEVP_MAC_free\fR\|(3). .PP \&\fBEVP_MAC_up_ref()\fR increments the reference count of an already fetched -\&\s-1MAC.\s0 +MAC. .PP \&\fBEVP_MAC_free()\fR frees a fetched algorithm. -\&\s-1NULL\s0 is a valid parameter, for which this function is a no-op. +NULL is a valid parameter, for which this function is a no-op. .SS "Context manipulation functions" .IX Subsection "Context manipulation functions" -\&\fBEVP_MAC_CTX_new()\fR creates a new context for the \s-1MAC\s0 type \fImac\fR. +\&\fBEVP_MAC_CTX_new()\fR creates a new context for the MAC type \fImac\fR. The created context can then be used with most other functions described here. .PP \&\fBEVP_MAC_CTX_free()\fR frees the contents of the context, including an underlying context if there is one, as well as the context itself. -\&\s-1NULL\s0 is a valid parameter, for which this function is a no-op. +NULL is a valid parameter, for which this function is a no-op. .PP \&\fBEVP_MAC_CTX_dup()\fR duplicates the \fIsrc\fR context and returns a newly allocated context. .PP -\&\fBEVP_MAC_CTX_get0_mac()\fR returns the \fB\s-1EVP_MAC\s0\fR associated with the context +\&\fBEVP_MAC_CTX_get0_mac()\fR returns the \fBEVP_MAC\fR associated with the context \&\fIctx\fR. .SS "Computing functions" .IX Subsection "Computing functions" \&\fBEVP_Q_mac()\fR computes the message authentication code of \fIdata\fR with length \fIdatalen\fR -using the \s-1MAC\s0 algorithm \fIname\fR and the key \fIkey\fR with length \fIkeylen\fR. -The \s-1MAC\s0 algorithm is fetched using any given \fIlibctx\fR and property query +using the MAC algorithm \fIname\fR and the key \fIkey\fR with length \fIkeylen\fR. +The MAC algorithm is fetched using any given \fIlibctx\fR and property query string \fIpropq\fR. It takes parameters \fIsubalg\fR and further \fIparams\fR, -both of which may be \s-1NULL\s0 if not needed. -If \fIout\fR is not \s-1NULL,\s0 it places the result in the memory pointed at by \fIout\fR, +both of which may be NULL if not needed. +If \fIout\fR is not NULL, it places the result in the memory pointed at by \fIout\fR, but only if \fIoutsize\fR is sufficient (otherwise no computation is made). -If \fIout\fR is \s-1NULL,\s0 it allocates and uses a buffer of suitable length, +If \fIout\fR is NULL, it allocates and uses a buffer of suitable length, which will be returned on success and must be freed by the caller. In either case, also on error, -it assigns the number of bytes written to \fI*outlen\fR unless \fIoutlen\fR is \s-1NULL.\s0 +it assigns the number of bytes written to \fI*outlen\fR unless \fIoutlen\fR is NULL. .PP \&\fBEVP_MAC_init()\fR sets up the underlying context \fIctx\fR with information given -via the \fIkey\fR and \fIparams\fR arguments. The \s-1MAC\s0 \fIkey\fR has a length of +via the \fIkey\fR and \fIparams\fR arguments. The MAC \fIkey\fR has a length of \&\fIkeylen\fR and the parameters in \fIparams\fR are processed before setting -the key. If \fIkey\fR is \s-1NULL,\s0 the key must be set via \fIparams\fR either +the key. If \fIkey\fR is NULL, the key must be set via \fIparams\fR either as part of this call or separately using \fBEVP_MAC_CTX_set_params()\fR. Providing non-NULL \fIparams\fR to this function is equivalent to calling \&\fBEVP_MAC_CTX_set_params()\fR with those \fIparams\fR for the same \fIctx\fR beforehand. +Note: There are additional requirements for some MAC algorithms during +re-initalization (i.e. calling \fBEVP_MAC_init()\fR on an EVP_MAC after \fBEVP_MAC_final()\fR +has been called on the same object). See the NOTES section below. .PP \&\fBEVP_MAC_init()\fR should be called before \fBEVP_MAC_update()\fR and \fBEVP_MAC_final()\fR. .PP -\&\fBEVP_MAC_update()\fR adds \fIdatalen\fR bytes from \fIdata\fR to the \s-1MAC\s0 input. +\&\fBEVP_MAC_init_SKEY()\fR is similar to \fBEVP_MAC_init()\fR but it accepts an opaque +\&\fBEVP_SKEY\fR object as a key. +.PP +\&\fBEVP_MAC_update()\fR adds \fIdatalen\fR bytes from \fIdata\fR to the MAC input. .PP \&\fBEVP_MAC_final()\fR does the final computation and stores the result in the memory pointed at by \fIout\fR of size \fIoutsize\fR, and sets the number of bytes written in \fI*outl\fR at. -If \fIout\fR is \s-1NULL\s0 or \fIoutsize\fR is too small, then no computation +If \fIout\fR is NULL or \fIoutsize\fR is too small, then no computation is made. To figure out what the output length will be and allocate space for it -dynamically, simply call with \fIout\fR being \s-1NULL\s0 and \fIoutl\fR +dynamically, simply call with \fIout\fR being NULL and \fIoutl\fR pointing at a valid location, then allocate space and make a second call with \fIout\fR pointing at the allocated space. .PP -\&\fBEVP_MAC_finalXOF()\fR does the final computation for an \s-1XOF\s0 based \s-1MAC\s0 and stores +\&\fBEVP_MAC_finalXOF()\fR does the final computation for an XOF based MAC and stores the result in the memory pointed at by \fIout\fR of size \fIoutsize\fR. .PP \&\fBEVP_MAC_get_params()\fR retrieves details about the implementation @@ -312,35 +243,35 @@ simply ignored. context, given a context \fIctx\fR. The set of parameters given with \fIparams\fR determine exactly what parameters are passed down. -If \fIparams\fR are \s-1NULL,\s0 the underlying context should do nothing and return 1. +If \fIparams\fR are NULL, the underlying context should do nothing and return 1. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation. .PP -\&\fBEVP_MAC_gettable_params()\fR returns an \s-1\fBOSSL_PARAM\s0\fR\|(3) array that describes +\&\fBEVP_MAC_gettable_params()\fR returns an \fBOSSL_PARAM\fR\|(3) array that describes the retrievable and settable parameters. \fBEVP_MAC_gettable_params()\fR returns parameters that can be used with \fBEVP_MAC_get_params()\fR. .PP \&\fBEVP_MAC_gettable_ctx_params()\fR and \fBEVP_MAC_CTX_gettable_params()\fR -return constant \s-1\fBOSSL_PARAM\s0\fR\|(3) arrays that describe the retrievable +return constant \fBOSSL_PARAM\fR\|(3) arrays that describe the retrievable parameters that can be used with \fBEVP_MAC_CTX_get_params()\fR. \&\fBEVP_MAC_gettable_ctx_params()\fR returns the parameters that can be retrieved from the algorithm, whereas \fBEVP_MAC_CTX_gettable_params()\fR returns the parameters that can be retrieved in the context's current state. .PP \&\fBEVP_MAC_settable_ctx_params()\fR and \fBEVP_MAC_CTX_settable_params()\fR return -constant \s-1\fBOSSL_PARAM\s0\fR\|(3) arrays that describe the settable parameters that +constant \fBOSSL_PARAM\fR\|(3) arrays that describe the settable parameters that can be used with \fBEVP_MAC_CTX_set_params()\fR. \fBEVP_MAC_settable_ctx_params()\fR returns the parameters that can be retrieved from the algorithm, whereas \fBEVP_MAC_CTX_settable_params()\fR returns the parameters that can be retrieved in the context's current state. .SS "Information functions" .IX Subsection "Information functions" -\&\fBEVP_MAC_CTX_get_mac_size()\fR returns the \s-1MAC\s0 output size for the given context. +\&\fBEVP_MAC_CTX_get_mac_size()\fR returns the MAC output size for the given context. .PP -\&\fBEVP_MAC_CTX_get_block_size()\fR returns the \s-1MAC\s0 block size for the given context. -Not all \s-1MAC\s0 algorithms support this. +\&\fBEVP_MAC_CTX_get_block_size()\fR returns the MAC block size for the given context. +Not all MAC algorithms support this. .PP \&\fBEVP_MAC_is_a()\fR checks if the given \fImac\fR is an implementation of an algorithm that's identifiable with \fIname\fR. @@ -348,12 +279,12 @@ algorithm that's identifiable with \fIname\fR. \&\fBEVP_MAC_get0_provider()\fR returns the provider that holds the implementation of the given \fImac\fR. .PP -\&\fBEVP_MAC_do_all_provided()\fR traverses all \s-1MAC\s0 implemented by all activated +\&\fBEVP_MAC_do_all_provided()\fR traverses all MAC implemented by all activated providers in the given library context \fIlibctx\fR, and for each of the implementations, calls the given function \fIfn\fR with the implementation method and the given \fIarg\fR as argument. .PP -\&\fBEVP_MAC_get0_name()\fR return the name of the given \s-1MAC.\s0 For fetched MACs +\&\fBEVP_MAC_get0_name()\fR return the name of the given MAC. For fetched MACs with multiple names, only one of them is returned; it's recommended to use \fBEVP_MAC_names_do_all()\fR instead. .PP @@ -363,116 +294,113 @@ recommended to use \fBEVP_MAC_names_do_all()\fR instead. \&\fBEVP_MAC_get0_description()\fR returns a description of the \fImac\fR, meant for display and human consumption. The description is at the discretion of the mac implementation. -.SH "PARAMETERS" +.SH PARAMETERS .IX Header "PARAMETERS" Parameters are identified by name as strings, and have an expected data type and maximum size. OpenSSL has a set of macros for parameter names it expects to see in -its own \s-1MAC\s0 implementations. +its own MAC implementations. Here, we show all three, the OpenSSL macro for the parameter name, the name in string form, and a type description. .PP The standard parameter names are: -.ie n .IP """key"" (\fB\s-1OSSL_MAC_PARAM_KEY\s0\fR) <octet string>" 4 -.el .IP "``key'' (\fB\s-1OSSL_MAC_PARAM_KEY\s0\fR) <octet string>" 4 -.IX Item "key (OSSL_MAC_PARAM_KEY) <octet string>" -Its value is the \s-1MAC\s0 key as an array of bytes. +.IP """key"" (\fBOSSL_MAC_PARAM_KEY\fR) <octet string>" 4 +.IX Item """key"" (OSSL_MAC_PARAM_KEY) <octet string>" +Its value is the MAC key as an array of bytes. .Sp For MACs that use an underlying computation algorithm, the algorithm -must be set first, see parameter names \*(L"algorithm\*(R" below. -.ie n .IP """iv"" (\fB\s-1OSSL_MAC_PARAM_IV\s0\fR) <octet string>" 4 -.el .IP "``iv'' (\fB\s-1OSSL_MAC_PARAM_IV\s0\fR) <octet string>" 4 -.IX Item "iv (OSSL_MAC_PARAM_IV) <octet string>" -Some \s-1MAC\s0 implementations (\s-1GMAC\s0) require an \s-1IV,\s0 this parameter sets the \s-1IV.\s0 -.ie n .IP """custom"" (\fB\s-1OSSL_MAC_PARAM_CUSTOM\s0\fR) <octet string>" 4 -.el .IP "``custom'' (\fB\s-1OSSL_MAC_PARAM_CUSTOM\s0\fR) <octet string>" 4 -.IX Item "custom (OSSL_MAC_PARAM_CUSTOM) <octet string>" -Some \s-1MAC\s0 implementations (\s-1KMAC, BLAKE2\s0) accept a Customization String, +must be set first, see parameter names "algorithm" below. +.IP """iv"" (\fBOSSL_MAC_PARAM_IV\fR) <octet string>" 4 +.IX Item """iv"" (OSSL_MAC_PARAM_IV) <octet string>" +Some MAC implementations (GMAC) require an IV, this parameter sets the IV. +.IP """custom"" (\fBOSSL_MAC_PARAM_CUSTOM\fR) <octet string>" 4 +.IX Item """custom"" (OSSL_MAC_PARAM_CUSTOM) <octet string>" +Some MAC implementations (KMAC, BLAKE2) accept a Customization String, this parameter sets the Customization String. The default value is the empty string. -.ie n .IP """salt"" (\fB\s-1OSSL_MAC_PARAM_SALT\s0\fR) <octet string>" 4 -.el .IP "``salt'' (\fB\s-1OSSL_MAC_PARAM_SALT\s0\fR) <octet string>" 4 -.IX Item "salt (OSSL_MAC_PARAM_SALT) <octet string>" -This option is used by \s-1BLAKE2 MAC.\s0 -.ie n .IP """xof"" (\fB\s-1OSSL_MAC_PARAM_XOF\s0\fR) <integer>" 4 -.el .IP "``xof'' (\fB\s-1OSSL_MAC_PARAM_XOF\s0\fR) <integer>" 4 -.IX Item "xof (OSSL_MAC_PARAM_XOF) <integer>" +.IP """salt"" (\fBOSSL_MAC_PARAM_SALT\fR) <octet string>" 4 +.IX Item """salt"" (OSSL_MAC_PARAM_SALT) <octet string>" +This option is used by BLAKE2 MAC. +.IP """xof"" (\fBOSSL_MAC_PARAM_XOF\fR) <integer>" 4 +.IX Item """xof"" (OSSL_MAC_PARAM_XOF) <integer>" It's a simple flag, the value 0 or 1 are expected. .Sp -This option is used by \s-1KMAC.\s0 -.ie n .IP """digest-noinit"" (\fB\s-1OSSL_MAC_PARAM_DIGEST_NOINIT\s0\fR) <integer>" 4 -.el .IP "``digest-noinit'' (\fB\s-1OSSL_MAC_PARAM_DIGEST_NOINIT\s0\fR) <integer>" 4 -.IX Item "digest-noinit (OSSL_MAC_PARAM_DIGEST_NOINIT) <integer>" -A simple flag to set the \s-1MAC\s0 digest to not initialise the +This option is used by KMAC. +.IP """digest-noinit"" (\fBOSSL_MAC_PARAM_DIGEST_NOINIT\fR) <integer>" 4 +.IX Item """digest-noinit"" (OSSL_MAC_PARAM_DIGEST_NOINIT) <integer>" +A simple flag to set the MAC digest to not initialise the implementation specific data. The value 0 or 1 is expected. .Sp -This option is used by \s-1HMAC.\s0 -.ie n .IP """digest-oneshot"" (\fB\s-1OSSL_MAC_PARAM_DIGEST_ONESHOT\s0\fR) <integer>" 4 -.el .IP "``digest-oneshot'' (\fB\s-1OSSL_MAC_PARAM_DIGEST_ONESHOT\s0\fR) <integer>" 4 -.IX Item "digest-oneshot (OSSL_MAC_PARAM_DIGEST_ONESHOT) <integer>" -A simple flag to set the \s-1MAC\s0 digest to be a oneshot operation. +This option is deprecated and will be removed in a future release. +The option may be set, but is ignored. +.IP """digest-oneshot"" (\fBOSSL_MAC_PARAM_DIGEST_ONESHOT\fR) <integer>" 4 +.IX Item """digest-oneshot"" (OSSL_MAC_PARAM_DIGEST_ONESHOT) <integer>" +A simple flag to set the MAC digest to be a oneshot operation. The value 0 or 1 is expected. .Sp -This option is used by \s-1HMAC.\s0 -.ie n .IP """properties"" (\fB\s-1OSSL_MAC_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4 -.el .IP "``properties'' (\fB\s-1OSSL_MAC_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4 -.IX Item "properties (OSSL_MAC_PARAM_PROPERTIES) <UTF8 string>" +This option is deprecated and will be removed in a future release. +The option may be set, but is ignored. +.IP """properties"" (\fBOSSL_MAC_PARAM_PROPERTIES\fR) <UTF8 string>" 4 +.IX Item """properties"" (OSSL_MAC_PARAM_PROPERTIES) <UTF8 string>" .PD 0 -.ie n .IP """digest"" (\fB\s-1OSSL_MAC_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4 -.el .IP "``digest'' (\fB\s-1OSSL_MAC_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4 -.IX Item "digest (OSSL_MAC_PARAM_DIGEST) <UTF8 string>" -.ie n .IP """cipher"" (\fB\s-1OSSL_MAC_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4 -.el .IP "``cipher'' (\fB\s-1OSSL_MAC_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4 -.IX Item "cipher (OSSL_MAC_PARAM_CIPHER) <UTF8 string>" +.IP """digest"" (\fBOSSL_MAC_PARAM_DIGEST\fR) <UTF8 string>" 4 +.IX Item """digest"" (OSSL_MAC_PARAM_DIGEST) <UTF8 string>" +.IP """cipher"" (\fBOSSL_MAC_PARAM_CIPHER\fR) <UTF8 string>" 4 +.IX Item """cipher"" (OSSL_MAC_PARAM_CIPHER) <UTF8 string>" .PD -For \s-1MAC\s0 implementations that use an underlying computation cipher or +For MAC implementations that use an underlying computation cipher or digest, these parameters set what the algorithm should be. .Sp The value is always the name of the intended algorithm, or the properties. .Sp Note that not all algorithms may support all digests. -\&\s-1HMAC\s0 does not support variable output length digests such as \s-1SHAKE128\s0 -or \s-1SHAKE256.\s0 -.ie n .IP """size"" (\fB\s-1OSSL_MAC_PARAM_SIZE\s0\fR) <unsigned integer>" 4 -.el .IP "``size'' (\fB\s-1OSSL_MAC_PARAM_SIZE\s0\fR) <unsigned integer>" 4 -.IX Item "size (OSSL_MAC_PARAM_SIZE) <unsigned integer>" -For \s-1MAC\s0 implementations that support it, set the output size that +HMAC does not support variable output length digests such as SHAKE128 +or SHAKE256. +.IP """size"" (\fBOSSL_MAC_PARAM_SIZE\fR) <unsigned integer>" 4 +.IX Item """size"" (OSSL_MAC_PARAM_SIZE) <unsigned integer>" +For MAC implementations that support it, set the output size that \&\fBEVP_MAC_final()\fR should produce. -The allowed sizes vary between \s-1MAC\s0 implementations, but must never exceed +The allowed sizes vary between MAC implementations, but must never exceed what can be given with a \fBsize_t\fR. -.ie n .IP """tls-data-size"" (\fB\s-1OSSL_MAC_PARAM_TLS_DATA_SIZE\s0\fR) <unsigned integer>" 4 -.el .IP "``tls-data-size'' (\fB\s-1OSSL_MAC_PARAM_TLS_DATA_SIZE\s0\fR) <unsigned integer>" 4 -.IX Item "tls-data-size (OSSL_MAC_PARAM_TLS_DATA_SIZE) <unsigned integer>" -This parameter is only supported by \s-1HMAC.\s0 If set then special handling is -activated for calculating the \s-1MAC\s0 of a received mac-then-encrypt \s-1TLS\s0 record -where variable length record padding has been used (as in the case of \s-1CBC\s0 mode +.IP """tls-data-size"" (\fBOSSL_MAC_PARAM_TLS_DATA_SIZE\fR) <unsigned integer>" 4 +.IX Item """tls-data-size"" (OSSL_MAC_PARAM_TLS_DATA_SIZE) <unsigned integer>" +This parameter is only supported by HMAC. If set then special handling is +activated for calculating the MAC of a received mac-then-encrypt TLS record +where variable length record padding has been used (as in the case of CBC mode ciphersuites). The value represents the total length of the record that is -having the \s-1MAC\s0 calculated including the received \s-1MAC\s0 and the record padding. +having the MAC calculated including the received MAC and the record padding. .Sp When used EVP_MAC_update must be called precisely twice. The first time with -the 13 bytes of \s-1TLS\s0 \*(L"header\*(R" data, and the second time with the entire record -including the \s-1MAC\s0 itself and any padding. The entire record length must equal -the value passed in the \*(L"tls-data-size\*(R" parameter. The length passed in the +the 13 bytes of TLS "header" data, and the second time with the entire record +including the MAC itself and any padding. The entire record length must equal +the value passed in the "tls-data-size" parameter. The length passed in the \&\fBdatalen\fR parameter to \fBEVP_MAC_update()\fR should be equal to the length of the -record after the \s-1MAC\s0 and any padding has been removed. +record after the MAC and any padding has been removed. .PP All these parameters should be used before the calls to any of \&\fBEVP_MAC_init()\fR, \fBEVP_MAC_update()\fR and \fBEVP_MAC_final()\fR for a full computation. Anything else may give undefined results. -.SH "NOTES" +.SH NOTES .IX Header "NOTES" -The \s-1MAC\s0 life-cycle is described in \fBlife_cycle\-mac\fR\|(7). In the future, +The MAC life-cycle is described in \fBlife_cycle\-mac\fR\|(7). In the future, the transitions described there will be enforced. When this is done, it will -not be considered a breaking change to the \s-1API.\s0 +not be considered a breaking change to the API. .PP -The usage of the parameter names \*(L"custom\*(R", \*(L"iv\*(R" and \*(L"salt\*(R" correspond to +The usage of the parameter names "custom", "iv" and "salt" correspond to the names used in the standard where the algorithm was defined. +.PP +Some MAC algorithms store internal state that cannot be extracted during +re-initalization. For example GMAC cannot extract an \fBIV\fR from the +underlying CIPHER context, and so calling \fBEVP_MAC_init()\fR on an EVP_MAC object +after \fBEVP_MAC_final()\fR has been called cannot reset its cipher state to what it +was when the \fBIV\fR was initially generated. For such instances, an +\&\fBOSSL_MAC_PARAM_IV\fR parameter must be passed with each call to \fBEVP_MAC_init()\fR. .SH "RETURN VALUES" .IX Header "RETURN VALUES" -\&\fBEVP_MAC_fetch()\fR returns a pointer to a newly fetched \fB\s-1EVP_MAC\s0\fR, or -\&\s-1NULL\s0 if allocation failed. +\&\fBEVP_MAC_fetch()\fR returns a pointer to a newly fetched \fBEVP_MAC\fR, or +NULL if allocation failed. .PP \&\fBEVP_MAC_up_ref()\fR returns 1 on success, 0 on error. .PP @@ -484,23 +412,23 @@ return value of 0 means that the callback was not called for any names. \&\fBEVP_MAC_is_a()\fR returns 1 if the given method can be identified with the given name, otherwise 0. .PP -\&\fBEVP_MAC_get0_name()\fR returns a name of the \s-1MAC,\s0 or \s-1NULL\s0 on error. +\&\fBEVP_MAC_get0_name()\fR returns a name of the MAC, or NULL on error. .PP -\&\fBEVP_MAC_get0_provider()\fR returns a pointer to the provider for the \s-1MAC,\s0 or -\&\s-1NULL\s0 on error. +\&\fBEVP_MAC_get0_provider()\fR returns a pointer to the provider for the MAC, or +NULL on error. .PP \&\fBEVP_MAC_CTX_new()\fR and \fBEVP_MAC_CTX_dup()\fR return a pointer to a newly -created \s-1EVP_MAC_CTX,\s0 or \s-1NULL\s0 if allocation failed. +created EVP_MAC_CTX, or NULL if allocation failed. .PP \&\fBEVP_MAC_CTX_free()\fR returns nothing at all. .PP \&\fBEVP_MAC_CTX_get_params()\fR and \fBEVP_MAC_CTX_set_params()\fR return 1 on success, 0 on error. .PP -\&\fBEVP_Q_mac()\fR returns a pointer to the computed \s-1MAC\s0 value, or \s-1NULL\s0 on error. +\&\fBEVP_Q_mac()\fR returns a pointer to the computed MAC value, or NULL on error. .PP -\&\fBEVP_MAC_init()\fR, \fBEVP_MAC_update()\fR, \fBEVP_MAC_final()\fR, and \fBEVP_MAC_finalXOF()\fR -return 1 on success, 0 on error. +\&\fBEVP_MAC_init()\fR, \fBEVP_MAC_init_SKEY()\fR, \fBEVP_MAC_update()\fR, \fBEVP_MAC_final()\fR, and +\&\fBEVP_MAC_finalXOF()\fR return 1 on success, 0 on error. .PP \&\fBEVP_MAC_CTX_get_mac_size()\fR returns the expected output size, or 0 if it isn't set. If it isn't set, a call to \fBEVP_MAC_init()\fR will set it. @@ -509,7 +437,7 @@ set. If it isn't set, a call to \fBEVP_MAC_init()\fR will set it. If it isn't set, a call to \fBEVP_MAC_init()\fR will set it. .PP \&\fBEVP_MAC_do_all_provided()\fR returns nothing at all. -.SH "EXAMPLES" +.SH EXAMPLES .IX Header "EXAMPLES" .Vb 5 \& #include <stdlib.h> @@ -593,24 +521,26 @@ look like this: .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBproperty\fR\|(7) -\&\s-1\fBOSSL_PARAM\s0\fR\|(3), -\&\s-1\fBEVP_MAC\-BLAKE2\s0\fR\|(7), -\&\s-1\fBEVP_MAC\-CMAC\s0\fR\|(7), -\&\s-1\fBEVP_MAC\-GMAC\s0\fR\|(7), -\&\s-1\fBEVP_MAC\-HMAC\s0\fR\|(7), -\&\s-1\fBEVP_MAC\-KMAC\s0\fR\|(7), +\&\fBOSSL_PARAM\fR\|(3), +\&\fBEVP_MAC\-BLAKE2\fR\|(7), +\&\fBEVP_MAC\-CMAC\fR\|(7), +\&\fBEVP_MAC\-GMAC\fR\|(7), +\&\fBEVP_MAC\-HMAC\fR\|(7), +\&\fBEVP_MAC\-KMAC\fR\|(7), \&\fBEVP_MAC\-Siphash\fR\|(7), \&\fBEVP_MAC\-Poly1305\fR\|(7), \&\fBprovider\-mac\fR\|(7), \&\fBlife_cycle\-mac\fR\|(7) -.SH "HISTORY" +.SH HISTORY .IX Header "HISTORY" These functions were added in OpenSSL 3.0. -.SH "COPYRIGHT" +.PP +The \fBEVP_MAC_init_SKEY()\fR function was added in OpenSSL 3.5. +.SH COPYRIGHT .IX Header "COPYRIGHT" -Copyright 2018\-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2018\-2025 The OpenSSL Project Authors. All Rights Reserved. .PP -Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use +Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy -in the file \s-1LICENSE\s0 in the source distribution or at +in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. |