提交 a87a0a6e 编写于 作者: R Richard Levitte

Cleanup: fix all sources that used HMAC_CTX_init

Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 dc0099e1
......@@ -134,7 +134,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
HMAC_CTX_free(hctx_tpl);
return 0;
}
HMAC_CTX_init(hctx);
HMAC_CTX_reset(hctx);
memcpy(p, digtmp, cplen);
for (j = 1; j < iter; j++) {
if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
......@@ -148,7 +148,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
HMAC_CTX_free(hctx_tpl);
return 0;
}
HMAC_CTX_init(hctx);
HMAC_CTX_reset(hctx);
for (k = 0; k < cplen; k++)
p[k] ^= digtmp[k];
}
......
......@@ -131,7 +131,7 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md)
{
if (key && md)
HMAC_CTX_init(ctx);
HMAC_CTX_reset(ctx);
return HMAC_Init_ex(ctx, key, len, md, NULL);
}
#endif
......@@ -225,7 +225,7 @@ int HMAC_CTX_reset(HMAC_CTX *ctx)
int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx)
{
if (!HMAC_CTX_init(dctx))
if (!HMAC_CTX_reset(dctx))
goto err;
if (!EVP_MD_CTX_copy_ex(dctx->i_ctx, sctx->i_ctx))
goto err;
......
......@@ -193,7 +193,7 @@ int main(int argc, char *argv[])
}
printf("test 4 ok\n");
test5:
HMAC_CTX_init(ctx);
HMAC_CTX_reset(ctx);
if (HMAC_Init_ex(ctx, test[4].key, test[4].key_len, NULL, NULL)) {
printf("Should fail to initialise HMAC with empty MD (test 5)\n");
err++;
......@@ -282,7 +282,7 @@ test5:
printf("test 5 ok\n");
}
test6:
HMAC_CTX_init(ctx);
HMAC_CTX_reset(ctx);
ctx2 = HMAC_CTX_new();
if (ctx2 == NULL) {
printf("HMAC malloc failure (test 6)\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册