hcrypto: Add HMAC_CTX_new and HMAC_CTX_free

Add a pair of functions which can be used to allocate and free
an HMAC_CTX structure on the heap. This means that the caller doesn't
need to know the size of the underlying structure.
This commit is contained in:
Simon Wilkinson
2018-05-14 13:18:33 +01:00
committed by Jeffrey Altman
parent ae62cc2341
commit c1eb9828f4
4 changed files with 21 additions and 0 deletions

View File

@@ -66,6 +66,19 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx)
}
}
HMAC_CTX *
HMAC_CTX_new(void)
{
return calloc(1, sizeof(HMAC_CTX));
}
void
HMAC_CTX_free(HMAC_CTX *ctx)
{
HMAC_CTX_cleanup(ctx);
free(ctx);
}
size_t
HMAC_size(const HMAC_CTX *ctx)
{