hmac.3 revision 100947
Automatically generated by Pod::Man version 1.15
Tue Jul 30 09:22:06 2002

Standard preamble:
======================================================================

\\$1

.. ..

"\\$1" \\$2
..
..

.. 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. | will give a
real vertical bar. \*(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-|\(bv\*(Tr . 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" '' 'br\}
If the F register is turned on, we'll generate index entries on stderr
for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
index entries marked with X<> in POD. Of course, you'll have to process
the output yourself in some meaningful fashion.
. de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\}
For nroff, turn off justification. Always turn off hyphenation; it
makes way too many mistakes in technical documents.

Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
.bd B 3 . \" 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 "0.9.6e" "2000-11-12" "OpenSSL"
C
"NAME"
\s-1HMAC\s0, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - \s-1HMAC\s0 message authentication code
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/hmac.h> .Ve .Vb 3 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); .Ve .Vb 4 void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md); void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); .Ve .Vb 1 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.

\fIHMAC() 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. \fBkey and evp_md may be \s-1NULL\s0 if a key and hash function have been set in a previous call to HMAC_Init() for that \s-1HMAC_CTX\s0.

\fIHMAC_cleanup() erases the key and other data from the \s-1HMAC_CTX\s0.

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.

\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" \fIHMAC() returns a pointer to the message authentication code.

\fIHMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() do not return values.

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