mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-16 16:52:52 -04:00
Test whether the crypto library supports the HMAC algorithm
When initialising HMAC support check that the crypto library supports the algorithm rather than just assuming it is supported.
This commit is contained in:
parent
ffebd217f5
commit
97627c554b
2 changed files with 8 additions and 4 deletions
|
|
@ -199,9 +199,7 @@ dst_lib_init(isc_mem_t *mctx, const char *engine) {
|
|||
|
||||
memset(dst_t_func, 0, sizeof(dst_t_func));
|
||||
RETERR(dst__openssl_init(engine)); /* Sets FIPS mode. */
|
||||
if (!isc_fips_mode()) {
|
||||
RETERR(dst__hmacmd5_init(&dst_t_func[DST_ALG_HMACMD5]));
|
||||
}
|
||||
RETERR(dst__hmacmd5_init(&dst_t_func[DST_ALG_HMACMD5]));
|
||||
RETERR(dst__hmacsha1_init(&dst_t_func[DST_ALG_HMACSHA1]));
|
||||
RETERR(dst__hmacsha224_init(&dst_t_func[DST_ALG_HMACSHA224]));
|
||||
RETERR(dst__hmacsha256_init(&dst_t_func[DST_ALG_HMACSHA256]));
|
||||
|
|
|
|||
|
|
@ -127,7 +127,13 @@
|
|||
isc_result_t dst__hmac##alg##_init(dst_func_t **funcp) { \
|
||||
REQUIRE(funcp != NULL); \
|
||||
if (*funcp == NULL) { \
|
||||
*funcp = &hmac##alg##_functions; \
|
||||
isc_hmac_t *ctx = isc_hmac_new(); \
|
||||
if (isc_hmac_init(ctx, "test", 4, ISC_MD_##alg) == \
|
||||
ISC_R_SUCCESS) \
|
||||
{ \
|
||||
*funcp = &hmac##alg##_functions; \
|
||||
} \
|
||||
isc_hmac_free(ctx); \
|
||||
} \
|
||||
return (ISC_R_SUCCESS); \
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue