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:

committed by
Jeffrey Altman

parent
ae62cc2341
commit
c1eb9828f4
@@ -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
|
size_t
|
||||||
HMAC_size(const HMAC_CTX *ctx)
|
HMAC_size(const HMAC_CTX *ctx)
|
||||||
{
|
{
|
||||||
|
@@ -39,6 +39,8 @@
|
|||||||
#include <hcrypto/evp.h>
|
#include <hcrypto/evp.h>
|
||||||
|
|
||||||
/* symbol renaming */
|
/* symbol renaming */
|
||||||
|
#define HMAC_CTX_new hc_HMAC_CTX_new
|
||||||
|
#define HMAC_CTX_free hc_HMAC_CTX_free
|
||||||
#define HMAC_CTX_init hc_HMAC_CTX_init
|
#define HMAC_CTX_init hc_HMAC_CTX_init
|
||||||
#define HMAC_CTX_cleanup hc_HMAC_CTX_cleanup
|
#define HMAC_CTX_cleanup hc_HMAC_CTX_cleanup
|
||||||
#define HMAC_size hc_HMAC_size
|
#define HMAC_size hc_HMAC_size
|
||||||
@@ -68,6 +70,8 @@ struct hc_HMAC_CTX {
|
|||||||
|
|
||||||
void HMAC_CTX_init(HMAC_CTX *);
|
void HMAC_CTX_init(HMAC_CTX *);
|
||||||
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
|
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
|
||||||
|
HMAC_CTX *HMAC_CTX_new(void);
|
||||||
|
void HMAC_CTX_free(HMAC_CTX *ctx);
|
||||||
|
|
||||||
size_t HMAC_size(const HMAC_CTX *ctx);
|
size_t HMAC_size(const HMAC_CTX *ctx);
|
||||||
|
|
||||||
|
@@ -259,6 +259,8 @@ EXPORTS
|
|||||||
hc_HMAC
|
hc_HMAC
|
||||||
hc_HMAC_CTX_cleanup
|
hc_HMAC_CTX_cleanup
|
||||||
hc_HMAC_CTX_init
|
hc_HMAC_CTX_init
|
||||||
|
hc_HMAC_CTX_free
|
||||||
|
hc_HMAC_CTX_new
|
||||||
hc_HMAC_Final
|
hc_HMAC_Final
|
||||||
hc_HMAC_Init_ex
|
hc_HMAC_Init_ex
|
||||||
hc_HMAC_Update
|
hc_HMAC_Update
|
||||||
|
@@ -243,7 +243,9 @@ HEIMDAL_CRYPTO_1.0 {
|
|||||||
hc_EVP_hcrypto_aes_256_cts;
|
hc_EVP_hcrypto_aes_256_cts;
|
||||||
hc_HMAC;
|
hc_HMAC;
|
||||||
hc_HMAC_CTX_cleanup;
|
hc_HMAC_CTX_cleanup;
|
||||||
|
hc_HMAC_CTX_free;
|
||||||
hc_HMAC_CTX_init;
|
hc_HMAC_CTX_init;
|
||||||
|
hc_HMAC_CTX_new;
|
||||||
hc_HMAC_Final;
|
hc_HMAC_Final;
|
||||||
hc_HMAC_Init_ex;
|
hc_HMAC_Init_ex;
|
||||||
hc_HMAC_Update;
|
hc_HMAC_Update;
|
||||||
|
Reference in New Issue
Block a user