hmac(3) OpenSSL hmac(3) NNAAMMEE HMAC, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - HMAC message authentication code SSYYNNOOPPSSIISS #include 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); DDEESSCCRRIIPPTTIIOONN HMAC is a MAC (message authentication code), i.e. a keyed hash function used for message authentication, which is based on a hash function. _H_M_A_C_(_) computes the message authentication code of the nn bytes at dd using the hash function eevvpp__mmdd and the key kkeeyy which is kkeeyy__lleenn bytes long. It places the result in mmdd (which must have space for the output of the hash function, which is no more than EEVVPP__MMAAXX__MMDD__SSIIZZEE bytes). If mmdd is NULL, the digest is placed in a static array. The size of the output is placed in mmdd__lleenn, unless it is NNUULLLL. eevvpp__mmdd can be _E_V_P___s_h_a_1_(_), _E_V_P___r_i_p_e_m_d_1_6_0_(_) etc. _H_M_A_C___C_T_X___i_n_i_t_(_) initialises a HHMMAACC__CCTTXX before first use. It must be called. _H_M_A_C___C_T_X___c_l_e_a_n_u_p_(_) erases the key and other data from the HHMMAACC__CCTTXX and releases any associated resources. It must be called when an HHMMAACC__CCTTXX is no longer required. _H_M_A_C___c_l_e_a_n_u_p_(_) is an alias for _H_M_A_C___C_T_X___c_l_e_a_n_u_p_(_) 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: _H_M_A_C___I_n_i_t_(_) initializes a HHMMAACC__CCTTXX structure to use the hash function eevvpp__mmdd and the key kkeeyy which is kkeeyy__lleenn bytes long. It is deprecated and only included for backward compatibility with OpenSSL 0.9.6b. _H_M_A_C___I_n_i_t___e_x_(_) initializes or reuses a HHMMAACC__CCTTXX structure to use the function eevvpp__mmdd and key kkeeyy. Either can be NULL, in which case the existing one will be reused. _H_M_A_C___C_T_X___i_n_i_t_(_) must have been called before the first use of an HHMMAACC__CCTTXX in this function. NN..BB.. _HH_MM_AA_CC____II_nn_ii_tt_((_)) hhaadd tthhiiss uunnddooccuummeenntteedd bbeehhaavviioouurr iinn pprreevviioouuss vveerrssiioonnss ooff OOppeennSSSSLL -- ffaaiill-- uurree ttoo sswwiittcchh ttoo _HH_MM_AA_CC____II_nn_ii_tt____ee_xx_((_)) iinn pprrooggrraammss tthhaatt eexxppeecctt iitt wwiillll ccaauussee tthheemm ttoo ssttoopp wwoorrkkiinngg. _H_M_A_C___U_p_d_a_t_e_(_) can be called repeatedly with chunks of the message to be authenticated (lleenn bytes at ddaattaa). _H_M_A_C___F_i_n_a_l_(_) places the message authentication code in mmdd, which must have space for the hash function output. RREETTUURRNN VVAALLUUEESS _H_M_A_C_(_) returns a pointer to the message authentication code or NULL if an error occurred. _H_M_A_C___I_n_i_t___e_x_(_), _H_M_A_C___U_p_d_a_t_e_(_) and _H_M_A_C___F_i_n_a_l_(_) return 1 for success or 0 if an error occurred. _H_M_A_C___C_T_X___i_n_i_t_(_) and _H_M_A_C___C_T_X___c_l_e_a_n_u_p_(_) do not return values. CCOONNFFOORRMMIINNGG TTOO RFC 2104 SSEEEE AALLSSOO _s_h_a(3), _e_v_p(3) HHIISSTTOORRYY _H_M_A_C_(_), _H_M_A_C___I_n_i_t_(_), _H_M_A_C___U_p_d_a_t_e_(_), _H_M_A_C___F_i_n_a_l_(_) and _H_M_A_C___c_l_e_a_n_u_p_(_) are available since SSLeay 0.9.0. _H_M_A_C___C_T_X___i_n_i_t_(_), _H_M_A_C___I_n_i_t___e_x_(_) and _H_M_A_C___C_T_X___c_l_e_a_n_u_p_(_) are available since OpenSSL 0.9.7. _H_M_A_C___I_n_i_t___e_x_(_), _H_M_A_C___U_p_d_a_t_e_(_) and _H_M_A_C___F_i_n_a_l_(_) did not return values in versions of OpenSSL before 1.0.0. 1.0.1u 2016-09-22 hmac(3)