hmac(3ssl)


NAME

   HMAC, HMAC_CTX_init, HMAC_Init, HMAC_Init_ex, HMAC_Update, HMAC_Final,
   HMAC_CTX_cleanup, HMAC_cleanup - HMAC message authentication code

SYNOPSIS

    #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);

    int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,
                  const EVP_MD *md);
    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_cleanup(HMAC_CTX *ctx);
    void HMAC_cleanup(HMAC_CTX *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 evp_md and the key key which is key_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 EVP_MAX_MD_SIZE bytes).  If md is
   NULL, the digest is placed in a static array.  The size of the output
   is placed in md_len, unless it is NULL.

   evp_md can be EVP_sha1(), EVP_ripemd160() etc.

   HMAC_CTX_init() initialises a HMAC_CTX before first use. It must be
   called.

   HMAC_CTX_cleanup() erases the key and other data from the HMAC_CTX and
   releases any associated resources. It must be called when an HMAC_CTX
   is no longer required.

   HMAC_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:

   HMAC_Init() initializes a HMAC_CTX 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.

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

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

   HMAC_Final() 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 or NULL if
   an error occurred.

   HMAC_Init_ex(), HMAC_Update() and HMAC_Final() return 1 for success or
   0 if an error occurred.

   HMAC_CTX_init() and HMAC_CTX_cleanup() do not return values.

CONFORMING TO

   RFC 2104

SEE ALSO

   sha(3), evp(3)

HISTORY

   HMAC(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() are
   available since SSLeay 0.9.0.

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

   HMAC_Init_ex(), HMAC_Update() and HMAC_Final() did not return values in
   versions of OpenSSL before 1.0.0.





Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.