hmac.3 revision 279265
Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)

Standard preamble:
========================================================================
..
..
.. 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 -- \(*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\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . 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 . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . 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 .\} ========================================================================

Title "hmac 3"
hmac 3 "2015-01-08" "0.9.8zd" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
HMAC, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - HMAC message authentication code
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/hmac.h> \& unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d, int n, unsigned char *md, unsigned int *md_len); \& void HMAC_CTX_init(HMAC_CTX *ctx); \& void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md); void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md, ENGINE *impl); void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); \& void HMAC_CTX_cleanup(HMAC_CTX *ctx); void HMAC_cleanup(HMAC_CTX *ctx); .Ve
"DESCRIPTION"
Header "DESCRIPTION" \s-1HMAC\s0 is a \s-1MAC \s0(message authentication code), i.e. a keyed hash function used for message authentication, which is based on a hash function.

\s-1HMAC\s0() computes the message authentication code of the n bytes at \fBd using the hash function evp_md and the key key which is \fBkey_len bytes long.

It places the result in md (which must have space for the output of the hash function, which is no more than \s-1EVP_MAX_MD_SIZE\s0 bytes). If md is \s-1NULL,\s0 the digest is placed in a static array. The size of the output is placed in md_len, unless it is \s-1NULL\s0.

\fBevp_md can be EVP_sha1(), EVP_ripemd160() etc.

\fIHMAC_CTX_init() initialises a \s-1HMAC_CTX\s0 before first use. It must be called.

\fIHMAC_CTX_cleanup() erases the key and other data from the \s-1HMAC_CTX\s0 and releases any associated resources. It must be called when an \fB\s-1HMAC_CTX\s0 is no longer required.

\fIHMAC_cleanup() is an alias for HMAC_CTX_cleanup() included for back compatibility with 0.9.6b, it is deprecated.

The following functions may be used if the message is not completely stored in memory:

\fIHMAC_Init() initializes a \s-1HMAC_CTX\s0 structure to use the hash function evp_md and the key key which is key_len bytes long. It is deprecated and only included for backward compatibility with OpenSSL 0.9.6b.

\fIHMAC_Init_ex() initializes or reuses a \s-1HMAC_CTX\s0 structure to use the function evp_md and key key. Either can be \s-1NULL,\s0 in which case the existing one will be reused. HMAC_CTX_init() must have been called before the first use of an \s-1HMAC_CTX\s0 in this function. N.B. \f(BIHMAC_Init() had this undocumented behaviour in previous versions of OpenSSL - failure to switch to \f(BIHMAC_Init_ex() in programs that expect it will cause them to stop working.

\fIHMAC_Update() can be called repeatedly with chunks of the message to be authenticated (len bytes at data).

\fIHMAC_Final() places the message authentication code in md, which must have space for the hash function output.

"RETURN VALUES"
Header "RETURN VALUES" \s-1HMAC\s0() returns a pointer to the message authentication code.

\fIHMAC_CTX_init(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and \fIHMAC_CTX_cleanup() do not return values.

"CONFORMING TO"
Header "CONFORMING TO" \s-1RFC 2104\s0
"SEE ALSO"
Header "SEE ALSO" \fIsha\|(3), evp\|(3)
"HISTORY"
Header "HISTORY" \s-1HMAC\s0(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() are available since SSLeay 0.9.0.

\fIHMAC_CTX_init(), HMAC_Init_ex() and HMAC_CTX_cleanup() are available since OpenSSL 0.9.7.