Mercurial > hg > quicktun
comparison src/proto.salty.c @ 46:3f04a72ce035
Salty protocol: move local sending timestamp forward if remote has a newer timestamp
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Fri, 24 May 2013 17:06:42 +0200 |
parents | 671d640390f2 |
children | 3115f8af98bb |
comparison
equal
deleted
inserted
replaced
45:671d640390f2 | 46:3f04a72ce035 |
---|---|
413 int lkeyid = (cflags >> 5) & 0x01; | 413 int lkeyid = (cflags >> 5) & 0x01; |
414 if ((cflags & (1 << 4)) == 0) dosendkeyupdate |= 1; | 414 if ((cflags & (1 << 4)) == 0) dosendkeyupdate |= 1; |
415 memcpy(d->dataremotekey, raw + 32 + 1, 32); | 415 memcpy(d->dataremotekey, raw + 32 + 1, 32); |
416 memcpy(d->dataremotenonce, raw + 32 + 1 + 32, 24); | 416 memcpy(d->dataremotenonce, raw + 32 + 1 + 32, 24); |
417 uint64 lexpectts = decodeuint64(raw + 32 + 1 + 32 + 24 + 32 + 24); | 417 uint64 lexpectts = decodeuint64(raw + 32 + 1 + 32 + 24 + 32 + 24); |
418 if (lexpectts > d->controlencodetime) { | |
419 fprintf(stderr, "Remote expects newer control timestamp (%llu > %llu), moving forward.\n", lexpectts, d->controlencodetime); | |
420 d->controlencodetime = lexpectts; | |
421 } | |
418 struct qt_proto_data_salty_keyset* enckey = &d->datalocalkeys[lkeyid]; | 422 struct qt_proto_data_salty_keyset* enckey = &d->datalocalkeys[lkeyid]; |
419 if (memcmp(enckey->publickey, raw + 32 + 1 + 32 + 24, 32) || memcmp(enckey->nonce, raw + 32 + 1 + 32 + 24 + 32, 20)) { | 423 if (memcmp(enckey->publickey, raw + 32 + 1 + 32 + 24, 32) || memcmp(enckey->nonce, raw + 32 + 1 + 32 + 24 + 32, 20)) { |
420 dosendkeyupdate |= 2; | 424 dosendkeyupdate |= 2; |
421 lkeyid = -1; | 425 lkeyid = -1; |
422 } | 426 } |