aboutsummaryrefslogtreecommitdiff
path: root/src/openvpn/crypto_openssl.c
diff options
context:
space:
mode:
authorArne Schwabe2021-12-01 19:07:24 +0100
committerGert Doering2021-12-06 10:20:00 +0100
commit459d9669d1b5ca110107306762625a4fb5650c58 (patch)
treea4cab7b630b684f42153dbb6059930e43005bea0 /src/openvpn/crypto_openssl.c
parent9cc7fdcf851f87cb4fd5f9f249f790565f7b8e33 (diff)
downloadopenvpn-459d9669d1b5ca110107306762625a4fb5650c58.zip
openvpn-459d9669d1b5ca110107306762625a4fb5650c58.tar.gz
Remove key_type->hmac_length
This field is only set once with md_kt_size and then only read. Remove this field and replace the read accesses with md_kt_size. Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20211201180727.2496903-6-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23274.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/crypto_openssl.c')
-rw-r--r--src/openvpn/crypto_openssl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index 8b53b2c..e28e2f4 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -1079,11 +1079,11 @@ hmac_ctx_free(HMAC_CTX *ctx)
}
void
-hmac_ctx_init(HMAC_CTX *ctx, const uint8_t *key, int key_len,
- const EVP_MD *kt)
+hmac_ctx_init(HMAC_CTX *ctx, const uint8_t *key, const EVP_MD *kt)
{
ASSERT(NULL != kt && NULL != ctx);
+ int key_len = EVP_MD_size(kt);
HMAC_CTX_reset(ctx);
if (!HMAC_Init_ex(ctx, key, key_len, kt, NULL))
{
@@ -1152,10 +1152,10 @@ hmac_ctx_free(hmac_ctx_t *ctx)
}
void
-hmac_ctx_init(hmac_ctx_t *ctx, const uint8_t *key, int key_len,
- const EVP_MD *kt)
+hmac_ctx_init(hmac_ctx_t *ctx, const uint8_t *key, const EVP_MD *kt)
{
ASSERT(NULL != kt && NULL != ctx && ctx->ctx != NULL);
+ int key_len = EVP_MD_size(kt);
ASSERT(key_len <= EVP_MAX_KEY_LENGTH);
/* We need to make a copy of the key since the OSSL parameters