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.10 by pcg, Sat Mar 22 02:35:57 2003 UTC vs.
Revision 1.12 by pcg, Sat Mar 22 22:28:34 2003 UTC

451 struct { 451 struct {
452 u8 rnd[RAND_SIZE]; 452 u8 rnd[RAND_SIZE];
453 u32 seqno; 453 u32 seqno;
454 } datahdr; 454 } datahdr;
455 455
456 datahdr.seqno = seqno; 456 datahdr.seqno = ntohl (seqno);
457 RAND_pseudo_bytes ((unsigned char *) datahdr.rnd, RAND_SIZE); 457 RAND_pseudo_bytes ((unsigned char *) datahdr.rnd, RAND_SIZE);
458 458
459 EVP_EncryptUpdate (cctx, 459 EVP_EncryptUpdate (cctx,
460 (unsigned char *) data + outl, &outl2, 460 (unsigned char *) data + outl, &outl2,
461 (unsigned char *) &datahdr, DATAHDR); 461 (unsigned char *) &datahdr, DATAHDR);
509 outl += outl2; 509 outl += outl2;
510 510
511 EVP_DecryptFinal_ex (cctx, (unsigned char *)d + outl, &outl2); 511 EVP_DecryptFinal_ex (cctx, (unsigned char *)d + outl, &outl2);
512 outl += outl2; 512 outl += outl2;
513 513
514 seqno = *(u32 *)(d + RAND_SIZE); 514 seqno = ntohl (*(u32 *)(d + RAND_SIZE));
515 515
516 id2mac (dst () ? dst() : THISNODE->id, p->dst); 516 id2mac (dst () ? dst() : THISNODE->id, p->dst);
517 id2mac (src (), p->src); 517 id2mac (src (), p->src);
518 518
519#if ENABLE_COMPRESSION 519#if ENABLE_COMPRESSION
911 ictx = 0; 911 ictx = 0;
912 912
913 delete octx; 913 delete octx;
914 914
915 octx = new crypto_ctx (*k, 1); 915 octx = new crypto_ctx (*k, 1);
916 oseqno = *(u32 *)&k[CHG_SEQNO] & 0x7fffffff; 916 oseqno = ntohl (*(u32 *)&k[CHG_SEQNO] & 0x7fffffff);
917 917
918 send_auth (AUTH_REPLY, ssa, k); 918 send_auth (AUTH_REPLY, ssa, k);
919 break; 919 break;
920 920
921 case AUTH_REPLY: 921 case AUTH_REPLY:
923 if (!memcmp ((u8 *)gen_challenge (seqrand, ssa), (u8 *)k, sizeof (rsachallenge))) 923 if (!memcmp ((u8 *)gen_challenge (seqrand, ssa), (u8 *)k, sizeof (rsachallenge)))
924 { 924 {
925 delete ictx; 925 delete ictx;
926 926
927 ictx = new crypto_ctx (*k, 0); 927 ictx = new crypto_ctx (*k, 0);
928 iseqno.reset (*(u32 *)&k[CHG_SEQNO] & 0x7fffffff); // at least 2**31 sequence numbers are valid 928 iseqno.reset (ntohl (*(u32 *)&k[CHG_SEQNO] & 0x7fffffff)); // at least 2**31 sequence numbers are valid
929 929
930 sa = *ssa; 930 sa = *ssa;
931 931
932 rekey.set (NOW + ::conf.rekey); 932 rekey.set (NOW + ::conf.rekey);
933 keepalive.set (NOW + ::conf.keepalive); 933 keepalive.set (NOW + ::conf.keepalive);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines