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

Comparing gvpe/src/protocol.C (file contents):
Revision 1.12 by pcg, Sat Mar 22 22:28:34 2003 UTC vs.
Revision 1.13 by pcg, Sat Mar 22 22:34:36 2003 UTC

445 } 445 }
446#endif 446#endif
447 447
448 EVP_EncryptInit_ex (cctx, 0, 0, 0, 0); 448 EVP_EncryptInit_ex (cctx, 0, 0, 0, 0);
449 449
450 struct {
450#if RAND_SIZE 451#if RAND_SIZE
451 struct {
452 u8 rnd[RAND_SIZE]; 452 u8 rnd[RAND_SIZE];
453#endif
453 u32 seqno; 454 u32 seqno;
454 } datahdr; 455 } datahdr;
455 456
456 datahdr.seqno = ntohl (seqno); 457 datahdr.seqno = ntohl (seqno);
458#if RAND_SIZE
457 RAND_pseudo_bytes ((unsigned char *) datahdr.rnd, RAND_SIZE); 459 RAND_pseudo_bytes ((unsigned char *) datahdr.rnd, RAND_SIZE);
460#endif
458 461
459 EVP_EncryptUpdate (cctx, 462 EVP_EncryptUpdate (cctx,
460 (unsigned char *) data + outl, &outl2, 463 (unsigned char *) data + outl, &outl2,
461 (unsigned char *) &datahdr, DATAHDR); 464 (unsigned char *) &datahdr, DATAHDR);
462 outl += outl2; 465 outl += outl2;
463#else
464 EVP_EncryptUpdate (cctx,
465 (unsigned char *) data + outl, &outl2,
466 (unsigned char *) &seqno, DATAHDR);
467 outl += outl2;
468#endif
469 466
470 EVP_EncryptUpdate (cctx, 467 EVP_EncryptUpdate (cctx,
471 (unsigned char *) data + outl, &outl2, 468 (unsigned char *) data + outl, &outl2,
472 (unsigned char *) d, l); 469 (unsigned char *) d, l);
473 outl += outl2; 470 outl += outl2;
911 ictx = 0; 908 ictx = 0;
912 909
913 delete octx; 910 delete octx;
914 911
915 octx = new crypto_ctx (*k, 1); 912 octx = new crypto_ctx (*k, 1);
916 oseqno = ntohl (*(u32 *)&k[CHG_SEQNO] & 0x7fffffff); 913 oseqno = ntohl (*(u32 *)&k[CHG_SEQNO]) & 0x7fffffff;
917 914
918 send_auth (AUTH_REPLY, ssa, k); 915 send_auth (AUTH_REPLY, ssa, k);
919 break; 916 break;
920 917
921 case AUTH_REPLY: 918 case AUTH_REPLY:
923 if (!memcmp ((u8 *)gen_challenge (seqrand, ssa), (u8 *)k, sizeof (rsachallenge))) 920 if (!memcmp ((u8 *)gen_challenge (seqrand, ssa), (u8 *)k, sizeof (rsachallenge)))
924 { 921 {
925 delete ictx; 922 delete ictx;
926 923
927 ictx = new crypto_ctx (*k, 0); 924 ictx = new crypto_ctx (*k, 0);
928 iseqno.reset (ntohl (*(u32 *)&k[CHG_SEQNO] & 0x7fffffff)); // at least 2**31 sequence numbers are valid 925 iseqno.reset (ntohl (*(u32 *)&k[CHG_SEQNO]) & 0x7fffffff); // at least 2**31 sequence numbers are valid
929 926
930 sa = *ssa; 927 sa = *ssa;
931 928
932 rekey.set (NOW + ::conf.rekey); 929 rekey.set (NOW + ::conf.rekey);
933 keepalive.set (NOW + ::conf.keepalive); 930 keepalive.set (NOW + ::conf.keepalive);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines