1 | /* |
1 | /* |
2 | conf.C -- configuration code |
2 | conf.C -- configuration code |
3 | Copyright (C) 2003-2008,2011 Marc Lehmann <gvpe@schmorp.de> |
3 | Copyright (C) 2003-2008,2011,2018 Marc Lehmann <gvpe@schmorp.de> |
4 | |
4 | |
5 | This file is part of GVPE. |
5 | This file is part of GVPE. |
6 | |
6 | |
7 | GVPE is free software; you can redistribute it and/or modify it |
7 | GVPE is free software; you can redistribute it and/or modify it |
8 | under the terms of the GNU General Public License as published by the |
8 | under the terms of the GNU General Public License as published by the |
… | |
… | |
648 | slog (L_NOTICE, _("local node ('%s') not found in config file, aborting."), ::thisnode); |
648 | slog (L_NOTICE, _("local node ('%s') not found in config file, aborting."), ::thisnode); |
649 | exit (EXIT_FAILURE); |
649 | exit (EXIT_FAILURE); |
650 | } |
650 | } |
651 | |
651 | |
652 | if (conf.rsa_key && conf.thisnode->rsa_key) |
652 | if (conf.rsa_key && conf.thisnode->rsa_key) |
653 | if (BN_cmp (conf.rsa_key->n, conf.thisnode->rsa_key->n) != 0 |
653 | { |
654 | || BN_cmp (conf.rsa_key->e, conf.thisnode->rsa_key->e) != 0) |
654 | const BIGNUM *conf_n, *conf_e, *thisnode_n, *thisnode_e; |
|
|
655 | |
|
|
656 | #if OPENSSL_VERSION_NUMBER >= 0x10100000 && !LIBRESSL_VERSION_NUMBER |
|
|
657 | RSA_get0_key (conf.rsa_key, &conf_n, &conf_e, 0); |
|
|
658 | RSA_get0_key (conf.thisnode->rsa_key, &thisnode_n, &thisnode_e, 0); |
|
|
659 | #else |
|
|
660 | conf_n = conf.thisnode->rsa_key->n; |
|
|
661 | conf_e = conf.thisnode->rsa_key->e; |
|
|
662 | thisnode_n = conf.rsa_key->n; |
|
|
663 | thisnode_e = conf.rsa_key->e; |
|
|
664 | #endif |
|
|
665 | if (BN_cmp (conf_n, thisnode_n) != 0 || BN_cmp (conf_e, thisnode_e) != 0) |
655 | { |
666 | { |
656 | slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); |
667 | slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); |
657 | exit (EXIT_FAILURE); |
668 | exit (EXIT_FAILURE); |
658 | } |
669 | } |
|
|
670 | } |
659 | } |
671 | } |
660 | } |
672 | } |
661 | |
673 | |
662 | parse_argv (); |
674 | parse_argv (); |
663 | } |
675 | } |