ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/connection.C
(Generate patch)

Comparing gvpe/src/connection.C (file contents):
Revision 1.23 by pcg, Wed Oct 22 00:42:53 2003 UTC vs.
Revision 1.24 by pcg, Wed Oct 22 01:05:23 2003 UTC

675connection::send_auth_request (const sockinfo &si, bool initiate) 675connection::send_auth_request (const sockinfo &si, bool initiate)
676{ 676{
677 auth_req_packet *pkt = new auth_req_packet (conf->id, initiate, THISNODE->protocols); 677 auth_req_packet *pkt = new auth_req_packet (conf->id, initiate, THISNODE->protocols);
678 678
679 rsachallenge chg; 679 rsachallenge chg;
680
681 rsa_cache.gen (pkt->id, chg); 680 rsa_cache.gen (pkt->id, chg);
682 681 rsa_encrypt (conf->rsa_key, chg, pkt->encr);
683 if (0 > RSA_public_encrypt (sizeof chg,
684 (unsigned char *)&chg, (unsigned char *)&pkt->encr,
685 conf->rsa_key, RSA_PKCS1_OAEP_PADDING))
686 fatal ("RSA_public_encrypt error");
687 682
688 slog (L_TRACE, ">>%d PT_AUTH_REQ [%s]", conf->id, (const char *)si); 683 slog (L_TRACE, ">>%d PT_AUTH_REQ [%s]", conf->id, (const char *)si);
689 684
690 send_vpn_packet (pkt, si, IPTOS_RELIABILITY | IPTOS_LOWDELAY); // rsa is very very costly 685 send_vpn_packet (pkt, si, IPTOS_RELIABILITY | IPTOS_LOWDELAY); // rsa is very very costly
691 686
908 if (p->initiate) 903 if (p->initiate)
909 send_auth_request (rsi, false); 904 send_auth_request (rsi, false);
910 905
911 rsachallenge k; 906 rsachallenge k;
912 907
913 if (0 > RSA_private_decrypt (sizeof (p->encr), 908 if (!rsa_decrypt (::conf.rsa_key, p->encr, k))
914 (unsigned char *)&p->encr, (unsigned char *)&k,
915 ::conf.rsa_key, RSA_PKCS1_OAEP_PADDING))
916 { 909 {
917 slog (L_ERR, _("%s(%s): challenge illegal or corrupted (%s). mismatched key or config file?"), 910 slog (L_ERR, _("%s(%s): challenge illegal or corrupted (%s). mismatched key or config file?"),
918 conf->nodename, (const char *)rsi, ERR_error_string (ERR_get_error (), 0)); 911 conf->nodename, (const char *)rsi, ERR_error_string (ERR_get_error (), 0));
919 break; 912 break;
920 } 913 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines