--- gvpe/src/conf.C 2013/10/11 07:56:07 1.65 +++ gvpe/src/conf.C 2018/10/25 04:32:27 1.67 @@ -1,6 +1,6 @@ /* conf.C -- configuration code - Copyright (C) 2003-2008,2011 Marc Lehmann + Copyright (C) 2003-2008,2011,2018 Marc Lehmann This file is part of GVPE. @@ -238,7 +238,7 @@ { char *end = line + strlen (line); - while (*end < ' ' && end >= line) + while (end >= line && *end < ' ') end--; *++end = 0; @@ -650,12 +650,24 @@ } if (conf.rsa_key && conf.thisnode->rsa_key) - if (BN_cmp (conf.rsa_key->n, conf.thisnode->rsa_key->n) != 0 - || BN_cmp (conf.rsa_key->e, conf.thisnode->rsa_key->e) != 0) - { - slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); - exit (EXIT_FAILURE); - } + { + const BIGNUM *conf_n, *conf_e, *thisnode_n, *thisnode_e; + +#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !LIBRESSL_VERSION_NUMBER + RSA_get0_key (conf.rsa_key, &conf_n, &conf_e, 0); + RSA_get0_key (conf.thisnode->rsa_key, &thisnode_n, &thisnode_e, 0); +#else + conf_n = conf.thisnode->rsa_key->n; + conf_e = conf.thisnode->rsa_key->e; + thisnode_n = conf.rsa_key->n; + thisnode_e = conf.rsa_key->e; +#endif + if (BN_cmp (conf_n, thisnode_n) != 0 || BN_cmp (conf_e, thisnode_e) != 0) + { + slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); + exit (EXIT_FAILURE); + } + } } }