From: Guus Sliepen Date: Thu, 10 Sep 2020 21:18:26 +0000 (+0200) Subject: Allow sptps_force_kex() in all situations. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=cef54614e60952e50f98b810838e9a0872b9ab0d;p=meshlink Allow sptps_force_kex() in all situations. Also allow sptps_force_kex() during the initial key exchange. --- diff --git a/src/sptps.c b/src/sptps.c index 267a47f1..fab2e9d9 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -374,12 +374,12 @@ static bool receive_sig(sptps_t *s, const char *data, uint16_t len) { // Force another Key EXchange (for testing purposes). bool sptps_force_kex(sptps_t *s) { - if(!s->outstate || s->state < SPTPS_SECONDARY_KEX) { + if(!s->outstate) { return error(s, EINVAL, "Cannot force KEX in current state"); } - if(s->state > SPTPS_SECONDARY_KEX) { - // We are already in the middle of a secondary key exchange + if(s->state != SPTPS_SECONDARY_KEX) { + // We are already in the middle of a key exchange return true; }