1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Free the Ed448 curve in ec_cleanup

ec_cleanup frees every curve ecc-ssh.c sets up except Ed448: ec_ed448 lacks
the WINSCP_CURVE_CLEANUP its siblings have and ec_cleanup does not call it,
so its points and bignums leak at shutdown once an Ed448 key was used.
This commit is contained in:
Eduardo Correia
2026-10-12 23:51:46 -03:00
committed by Martin Prikryl
parent be053db0a6
commit d6dd4c7ec8

View File

@@ -327,6 +327,8 @@ static struct ec_curve *ec_ed448(void)
static struct ec_curve curve = { 0 };
static bool initialised = false;
WINSCP_CURVE_CLEANUP(e);
if (!initialised) {
mp_int *p = MP_LITERAL(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
mp_int *d = MP_LITERAL(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffff6756); /* = p - 39081 */
@@ -1866,6 +1868,7 @@ void ec_cleanup(void)
ec_p521();
ec_curve25519();
ec_ed25519();
ec_ed448();
ec_curve448();
// in case we want to restart (unlikely)
ec_curve_cleanup = 0;