提交 00a5a74b 编写于 作者: M Matt Caswell

HMAC_cleanup, and HMAC_Init are stated as deprecated in the docs and source.

Mark them as such with OPENSSL_USE_DEPRECATED
Reviewed-by: NTim Hudson <tjh@openssl.org>
上级 a8b4e057
...@@ -118,12 +118,14 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, ...@@ -118,12 +118,14 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
return 0; return 0;
} }
#ifndef OPENSSL_NO_DEPRECATED
int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md)
{ {
if (key && md) if (key && md)
HMAC_CTX_init(ctx); HMAC_CTX_init(ctx);
return HMAC_Init_ex(ctx, key, len, md, NULL); return HMAC_Init_ex(ctx, key, len, md, NULL);
} }
#endif
int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
{ {
...@@ -190,7 +192,7 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, ...@@ -190,7 +192,7 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
if (md == NULL) if (md == NULL)
md = m; md = m;
HMAC_CTX_init(&c); HMAC_CTX_init(&c);
if (!HMAC_Init(&c, key, key_len, evp_md)) if (!HMAC_Init_ex(&c, key, key_len, evp_md, NULL))
goto err; goto err;
if (!HMAC_Update(&c, d, n)) if (!HMAC_Update(&c, d, n))
goto err; goto err;
......
...@@ -82,12 +82,15 @@ typedef struct hmac_ctx_st { ...@@ -82,12 +82,15 @@ typedef struct hmac_ctx_st {
void HMAC_CTX_init(HMAC_CTX *ctx); void HMAC_CTX_init(HMAC_CTX *ctx);
void HMAC_CTX_cleanup(HMAC_CTX *ctx); void HMAC_CTX_cleanup(HMAC_CTX *ctx);
#ifdef OPENSSL_USE_DEPRECATED
/* deprecated */ /* deprecated */
# define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) # define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx)
/* deprecated */ /* deprecated */
__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, DECLARE_DEPRECATED(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md); const EVP_MD *md));
#endif
/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, /*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl); const EVP_MD *md, ENGINE *impl);
/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, /*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册