aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/crypto_openssl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
index 457da56..8506fff 100644
--- a/src/crypto/crypto_openssl.c
+++ b/src/crypto/crypto_openssl.c
@@ -572,10 +572,14 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
if (ctx == NULL)
return NULL;
+#if OPENSSL_VERSION_NUMBER < 0x00909000
+ HMAC_Init_ex(&ctx->ctx, key, key_len, md, NULL);
+#else /* openssl < 0.9.9 */
if (HMAC_Init_ex(&ctx->ctx, key, key_len, md, NULL) != 1) {
os_free(ctx);
return NULL;
}
+#endif /* openssl < 0.9.9 */
return ctx;
}
@@ -603,7 +607,12 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
}
mdlen = *len;
+#if OPENSSL_VERSION_NUMBER < 0x00909000
+ HMAC_Final(&ctx->ctx, mac, &mdlen);
+ res = 1;
+#else /* openssl < 0.9.9 */
res = HMAC_Final(&ctx->ctx, mac, &mdlen);
+#endif /* openssl < 0.9.9 */
HMAC_CTX_cleanup(&ctx->ctx);
os_free(ctx);