$NetBSD: openssl_HMAC.3,v 1.1.1.1 2023/04/18 14:19:15 christos Exp $ Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) 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 >0, 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'...
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
.\}
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 "2018-01-15" "1.1.0g" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes way too many mistakes in technical documents..nh
"NAME"
HMAC,
HMAC_CTX_new,
HMAC_CTX_reset,
HMAC_CTX_free,
HMAC_Init,
HMAC_Init_ex,
HMAC_Update,
HMAC_Final,
HMAC_CTX_copy,
HMAC_CTX_set_flags,
HMAC_CTX_get_md
\- HMAC message authentication code
"LIBRARY"
libcrypto, -lcrypto
"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);
\&
HMAC_CTX *HMAC_CTX_new(void);
int HMAC_CTX_reset(HMAC_CTX *ctx);
\&
int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,
const EVP_MD *md, ENGINE *impl);
int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
\&
void HMAC_CTX_free(HMAC_CTX *ctx);
\&
int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx);
.Ve
Deprecated:
.Vb 4
#if OPENSSL_API_COMPAT < 0x10100000L
int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,
const EVP_MD *md);
#endif
.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. Note: passing a \s-1NULL\s0
value for md to use the static array is not thread safe.
\fBevp_md can be EVP_sha1(), EVP_ripemd160() etc.
\fIHMAC_CTX_new() creates a new \s-1HMAC_CTX\s0 in heap memory.
\fIHMAC_CTX_reset() zeroes an existing \s-1HMAC_CTX\s0 and associated
resources, making it suitable for new computations as if it was newly
created with HMAC_CTX_new().
\fIHMAC_CTX_free() erases the key and other data from the \s-1HMAC_CTX\s0,
releases any associated resources and finally frees the \s-1HMAC_CTX\s0
itself.
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 hash
function evp_md and key key. If both are \s-1NULL \s0(or evp_md is the same
as the previous digest used by ctx and key is \s-1NULL\s0) the existing key is
reused. ctx must have been created with HMAC_CTX_new() 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.
\fB\s-1NOTE:\s0 If HMAC_Init_ex() is called with key \s-1NULL\s0 and evp_md is not the
same as the previous digest used by ctx then an error is returned
because reuse of an existing key with a different digest is not supported.
\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.
\fIHMAC_CTX_copy() copies all of the internal state from sctx into dctx.
\fIHMAC_CTX_set_flags() applies the specified flags to the internal EVP_MD_CTXs.
These flags have the same meaning as for EVP_MD_CTX_set_flags\|(3).
\fIHMAC_CTX_get_md() returns the \s-1EVP_MD\s0 that has previously been set for the
supplied \s-1HMAC_CTX.\s0
"RETURN VALUES"
Header "RETURN VALUES" \s-1
HMAC\s0() returns a pointer to the message authentication code or \s-1NULL\s0 if
an error occurred.
\fIHMAC_CTX_new() returns a pointer to a new \s-1HMAC_CTX\s0 on success or
\fB\s-1NULL\s0 if an error occurred.
\fIHMAC_CTX_reset(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and
\fIHMAC_CTX_copy() return 1 for success or 0 if an error occurred.
\fIHMAC_CTX_get_md() return the \s-1EVP_MD\s0 previously set for the supplied \s-1HMAC_CTX\s0 or
\s-1NULL\s0 if no \s-1EVP_MD\s0 has been set.
"CONFORMING TO"
Header "CONFORMING TO" \s-1RFC 2104\s0
"SEE ALSO"
Header "SEE ALSO" \fIopenssl_sha\|(3),
openssl_evp\|(3)
"HISTORY"
Header "HISTORY" \fIHMAC_CTX_init() was replaced with
HMAC_CTX_reset() in OpenSSL versions 1.1.0.
\fIHMAC_CTX_cleanup() existed in OpenSSL versions before 1.1.0.
\fIHMAC_CTX_new(), HMAC_CTX_free() and HMAC_CTX_get_md() are new in OpenSSL version
1.1.0.
\fIHMAC_Init_ex(), HMAC_Update() and HMAC_Final() did not return values in
versions of OpenSSL before 1.0.0.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the OpenSSL license (the \*(L"License\*(R"). 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
<https://www.openssl.org/source/license.html>.