… | |
… | |
479 | } |
479 | } |
480 | |
480 | |
481 | bool config_packet::chk_config () const |
481 | bool config_packet::chk_config () const |
482 | { |
482 | { |
483 | if (prot_major != PROTOCOL_MAJOR) |
483 | if (prot_major != PROTOCOL_MAJOR) |
484 | slog (L_WARN, _("major version mismatch (%d <=> %d)"), prot_major, PROTOCOL_MAJOR); |
484 | slog (L_WARN, _("major version mismatch (remote %d <=> local %d)"), prot_major, PROTOCOL_MAJOR); |
485 | else if (randsize != RAND_SIZE) |
485 | else if (randsize != RAND_SIZE) |
486 | slog (L_WARN, _("rand size mismatch (%d <=> %d)"), randsize, RAND_SIZE); |
486 | slog (L_WARN, _("rand size mismatch (remote %d <=> local %d)"), randsize, RAND_SIZE); |
487 | else if (hmaclen != HMACLENGTH) |
487 | else if (hmaclen != HMACLENGTH) |
488 | slog (L_WARN, _("hmac length mismatch (%d <=> %d)"), hmaclen, HMACLENGTH); |
488 | slog (L_WARN, _("hmac length mismatch (remote %d <=> local %d)"), hmaclen, HMACLENGTH); |
489 | else if (flags != curflags ()) |
489 | else if (flags != curflags ()) |
490 | slog (L_WARN, _("flag mismatch (%x <=> %x)"), flags, curflags ()); |
490 | slog (L_WARN, _("flag mismatch (remote %x <=> local %x)"), flags, curflags ()); |
491 | else if (challengelen != sizeof (rsachallenge)) |
491 | else if (challengelen != sizeof (rsachallenge)) |
492 | slog (L_WARN, _("challenge length mismatch (%d <=> %d)"), challengelen, sizeof (rsachallenge)); |
492 | slog (L_WARN, _("challenge length mismatch (remote %d <=> local %d)"), challengelen, sizeof (rsachallenge)); |
493 | else if (cipher_nid != htonl (EVP_CIPHER_nid (CIPHER))) |
493 | else if (cipher_nid != htonl (EVP_CIPHER_nid (CIPHER))) |
494 | slog (L_WARN, _("cipher mismatch (%x <=> %x)"), ntohl (cipher_nid), EVP_CIPHER_nid (CIPHER)); |
494 | slog (L_WARN, _("cipher mismatch (remote %x <=> local %x)"), ntohl (cipher_nid), EVP_CIPHER_nid (CIPHER)); |
495 | else if (digest_nid != htonl (EVP_MD_type (RSA_HASH))) |
495 | else if (digest_nid != htonl (EVP_MD_type (RSA_HASH))) |
496 | slog (L_WARN, _("digest mismatch (%x <=> %x)"), ntohl (digest_nid), EVP_MD_type (RSA_HASH)); |
496 | slog (L_WARN, _("digest mismatch (remote %x <=> local %x)"), ntohl (digest_nid), EVP_MD_type (RSA_HASH)); |
497 | else if (hmac_nid != htonl (EVP_MD_type (DIGEST))) |
497 | else if (hmac_nid != htonl (EVP_MD_type (DIGEST))) |
498 | slog (L_WARN, _("hmac mismatch (%x <=> %x)"), ntohl (hmac_nid), EVP_MD_type (DIGEST)); |
498 | slog (L_WARN, _("hmac mismatch (remote %x <=> local %x)"), ntohl (hmac_nid), EVP_MD_type (DIGEST)); |
499 | else |
499 | else |
500 | return true; |
500 | return true; |
501 | |
501 | |
502 | return false; |
502 | return false; |
503 | } |
503 | } |
… | |
… | |
911 | rsachallenge k; |
911 | rsachallenge k; |
912 | |
912 | |
913 | if (0 > RSA_private_decrypt (sizeof (p->encr), |
913 | if (0 > RSA_private_decrypt (sizeof (p->encr), |
914 | (unsigned char *)&p->encr, (unsigned char *)&k, |
914 | (unsigned char *)&p->encr, (unsigned char *)&k, |
915 | ::conf.rsa_key, RSA_PKCS1_OAEP_PADDING)) |
915 | ::conf.rsa_key, RSA_PKCS1_OAEP_PADDING)) |
|
|
916 | { |
916 | slog (L_ERR, _("%s(%s): challenge illegal or corrupted (%s). mismatched key or config file?"), |
917 | slog (L_ERR, _("%s(%s): challenge illegal or corrupted (%s). mismatched key or config file?"), |
917 | conf->nodename, (const char *)rsi, ERR_error_string (ERR_get_error (), 0)); |
918 | conf->nodename, (const char *)rsi, ERR_error_string (ERR_get_error (), 0)); |
|
|
919 | break; |
|
|
920 | } |
918 | else |
921 | else |
919 | { |
922 | { |
920 | delete octx; |
923 | delete octx; |
921 | |
924 | |
922 | octx = new crypto_ctx (k, 1); |
925 | octx = new crypto_ctx (k, 1); |