#ifndef HEADER_HMAC_H
#define HEADER_HMAC_H
-#ifdef __cplusplus
-extern "C" {
+#include <openssl/opensslconf.h>
+
+#ifdef OPENSSL_NO_HMAC
+#error HMAC is disabled.
#endif
-#include "evp.h"
+#include <openssl/evp.h>
-#define HMAC_MAX_MD_CBLOCK 64
+#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef struct hmac_ctx_st
{
- EVP_MD *md;
+ const EVP_MD *md;
EVP_MD_CTX md_ctx;
EVP_MD_CTX i_ctx;
EVP_MD_CTX o_ctx;
#define HMAC_size(e) (EVP_MD_size((e)->md))
-#ifndef NOPROTO
-
-void HMAC_Init(HMAC_CTX *ctx, unsigned char *key, int len,
- EVP_MD *md);
-void HMAC_Update(HMAC_CTX *ctx,unsigned char *key, int len);
-void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
-void HMAC_cleanup(HMAC_CTX *ctx);
-unsigned char *HMAC(EVP_MD *evp_md, unsigned char *key, int key_len,
- unsigned char *d, int n, unsigned char *md, unsigned int *md_len);
+void HMAC_CTX_init(HMAC_CTX *ctx);
+void HMAC_CTX_cleanup(HMAC_CTX *ctx);
-#else
+#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
-void HMAC_Init();
-void HMAC_Update();
-void HMAC_Final();
-void HMAC_cleanup();
-unsigned char *HMAC();
+void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
+ const EVP_MD *md); /* deprecated */
+void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
+ const EVP_MD *md, ENGINE *impl);
+void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
+void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
+unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
+ const unsigned char *d, size_t n, unsigned char *md,
+ unsigned int *md_len);
-#endif
#ifdef __cplusplus
}