)
AC_CHECK_FUNCS([BN_GENCB_new ERR_remove_state RSA_set0_key], , , [#include <openssl/rsa.h>])
+ AC_CHECK_FUNCS([HMAC_CTX_new], , , [#include <openssl/hmac.h>])
])
}
bool digest_set_key(digest_t *digest, const void *key, size_t len) {
+#ifdef HAVE_HMAC_CTX_NEW
digest->hmac_ctx = HMAC_CTX_new();
HMAC_Init_ex(digest->hmac_ctx, key, len, digest->digest, NULL);
+#else
+ digest->hmac_ctx = xzalloc(sizeof(*digest->hmac_ctx));
+ HMAC_Init(digest->hmac_ctx, key, len, digest->digest);
+#endif
if(!digest->hmac_ctx) {
abort();
EVP_MD_CTX_destroy(digest->md_ctx);
}
+#ifdef HAVE_HMAC_CTX_NEW
+
if(digest->hmac_ctx) {
HMAC_CTX_free(digest->hmac_ctx);
}
+#else
+ free(digest->hmac_ctx);
+#endif
+
free(digest);
}