X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fopenssl%2Fecdh.c;fp=src%2Fopenssl%2Fecdh.c;h=fde8e8a49c75a8ba58d1c36257a5c87a3f652df0;hp=d997007f0c6d65634805751a934e1bfa55b1decf;hb=a7458f6dfd86dd345b43690ef977dc034f550e68;hpb=22d804d4467cfe9f3926ab6d37b69c3760395b6c diff --git a/src/openssl/ecdh.c b/src/openssl/ecdh.c index d997007f..fde8e8a4 100644 --- a/src/openssl/ecdh.c +++ b/src/openssl/ecdh.c @@ -32,14 +32,16 @@ typedef EC_KEY ecdh_t; #include "../utils.h" #include "../xalloc.h" +#include "brainpool.h" + ecdh_t *ecdh_generate_public(void *pubkey) { - ecdh_t *ecdh = EC_KEY_new_by_curve_name(NID_secp521r1); + ecdh_t *ecdh = EC_KEY_new(); if(!ecdh) { - logger(DEBUG_ALWAYS, LOG_ERR, "Generating EC key_by_curve_name failed: %s", ERR_error_string(ERR_get_error(), NULL)); + logger(DEBUG_ALWAYS, LOG_ERR, "Allocating EC key failed: %s", ERR_error_string(ERR_get_error(), NULL)); return false; } - if(!EC_KEY_generate_key(ecdh)) { + if(!EC_KEY_set_group(ecdh, brainpoolp512r1) || !EC_KEY_generate_key(ecdh)) { EC_KEY_free(ecdh); logger(DEBUG_ALWAYS, LOG_ERR, "Generating EC key failed: %s", ERR_error_string(ERR_get_error(), NULL)); return NULL;