diff options
author | Jouni Malinen <j@w1.fi> | 2012-07-07 10:58:32 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-07-07 10:58:32 +0300 |
commit | 895cb1683d56d6def966ca5bd0b77c43cad823b1 (patch) | |
tree | 0107845f5c4521eaf8817db574184a2ae796a6c8 /src | |
parent | 990933fb1dfb7f28524e695ea4ec5c1f5250d2b2 (diff) | |
download | external_wpa_supplicant_8_ti-895cb1683d56d6def966ca5bd0b77c43cad823b1.zip external_wpa_supplicant_8_ti-895cb1683d56d6def966ca5bd0b77c43cad823b1.tar.gz external_wpa_supplicant_8_ti-895cb1683d56d6def966ca5bd0b77c43cad823b1.tar.bz2 |
OpenSSL: Add support for HMAC functions with 0.9.8 and older
Commit d9cc4646eb0255be31f11d8a8edad857431fdf49 added
crypto_hash_{init,update,finish}() wrappers for OpenSSL, but it
assumed the current HMAC API in OpenSSL. This was changed in 0.9.9
to return error codes from the functions while older versions used
void functions. Add support for the older versions, too.
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/crypto_openssl.c | 9 |
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); |