From 304d4ca57a4189b8cd21aec53da1abe4ee2e8a59 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 10 Aug 2018 17:04:09 +0200 Subject: [PATCH] botan: Adhere to configured DH exponent length --- src/libstrongswan/plugins/botan/botan_diffie_hellman.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libstrongswan/plugins/botan/botan_diffie_hellman.c b/src/libstrongswan/plugins/botan/botan_diffie_hellman.c index 422b4aea14..008e15fbde 100644 --- a/src/libstrongswan/plugins/botan/botan_diffie_hellman.c +++ b/src/libstrongswan/plugins/botan/botan_diffie_hellman.c @@ -223,7 +223,7 @@ static botan_diffie_hellman_t *create_generic(diffie_hellman_group_t group, } rng = lib->crypto->create_rng(lib->crypto, RNG_STRONG); - if (!rng || !rng->allocate_bytes(rng, p.len, &random)) + if (!rng || !rng->allocate_bytes(rng, exp_len, &random)) { DESTROY_IF(rng); destroy(this); @@ -253,7 +253,7 @@ botan_diffie_hellman_t *botan_diffie_hellman_create( if (group == MODP_CUSTOM) { VA_ARGS_GET(group, g, p); - return create_generic(group, g, p); + return create_generic(group, g, p, p.len); } params = diffie_hellman_get_params(group); @@ -261,7 +261,8 @@ botan_diffie_hellman_t *botan_diffie_hellman_create( { return NULL; } - return create_generic(group, params->generator, params->prime); + return create_generic(group, params->generator, params->prime, + params->exp_len); } #endif -- 2.47.2