OpenSL hmac(3openssl)
NAME
HMAC, HMACInit, HMACUpdate, HMACFinal, HMACcleanup -
HMAC message authentication code
SYNOPSIS
#include
unsigned char *HMAC(const EVPMD *evpmd, const void *key,
int keylen, const unsigned char *d, int n,
unsigned char *md, unsigned int *mdlen);
void HMACTXinit(HMACTX *ctx);
void HMACInit(HMACTX *ctx, const void *key, int keylen,
const EVPMD *md);
void HMACInitex(HMACTX *ctx, const void *key, int keylen,
const EVPMD *md);
void HMACUpdate(HMACTX *ctx, const unsigned char *data, int len);
void HMACFinal(HMACTX *ctx, unsigned char *md, unsigned int *len);
void HMACTXcleanup(HMACTX *ctx);
void HMACcleanup(HMACTX *ctx);
DESCRIPTION
HMAC is a MAC (message authentication code), i.e. a keyed
hash function used for message authentication, which is
based on a hash function.
HMAC() computes the message authentication code of the n
bytes at d using the hash function evpmd and the key key
which is keylen bytes long.
It places the result in md (which must have space for the
output of the hash function, which is no more than
EVPMAXMDSIZE bytes). If md is NUL, the digest is placed
in a static array. The size of the output is placed in
mdlen, unless it is NUL.
evpmd can be EVPsha1(), EVPripemd160() etc. key and
evpmd may be NUL if a key and hash function have been set
in a previous call to HMACInit() for that HMACTX.
HMACTXinit() initialises a HMACTX before first use. It
must be called.
HMACTXcleanup() erases the key and other data from the
HMACTX and releases any associated resources. It must be
called when an HMACTX is no longer required.
HMACcleanup() is an alias for HMACTXcleanup() included
for back compatibility with 0.9.6b, it is deprecated.
OpenSL-0.9.8 Last change: Oct 11 2005 1
OpenSL hmac(3openssl)
The following functions may be used if the message is not
completely stored in memory:
HMACInit() initializes a HMACTX structure to use the hash
function evpmd and the key key which is keylen bytes long.
It is deprecated and only included for backward
compatibility with OpenSL 0.9.6b.
HMACInitex() initializes or reuses a HMACTX structure to
use the function evpmd and key key. Either can be NUL, in
which case the existing one will be reused. HMACTXinit()
must have been called before the first use of an HMACTX in
this function. N.B. HMACInit() had this undocumented
behaviour in previous versions of OpenSL - failure to
switch to HMACInitex() in programs that expect it will
cause them to stop working.
HMACUpdate() can be called repeatedly with chunks of the
message to be authenticated (len bytes at data).
HMACFinal() places the message authentication code in md,
which must have space for the hash function output.
RETURN VALUES
HMAC() returns a pointer to the message authentication code.
HMACTXinit(), HMACInitex(), HMACUpdate(), HMACFinal()
and HMACTXcleanup() do not return values.
CONFORMING TO
RFC 2104
SEE ALSO
sha(3), evp(3)
HISTORY
HMAC(), HMACInit(), HMACUpdate(), HMACFinal() and
HMACcleanup() are available since SLeay 0.9.0.
HMACTXinit(), HMACInitex() and HMACTXcleanup() are
available since OpenSL 0.9.7.
OpenSL-0.9.8 Last change: Oct 11 2005 2
|