Mercurial > hg > quicktun
comparison src/proto.nacltai.c @ 32:51c6d2fc712f V2.1.8
Fixes contributed by Daniel Dickinson <daniel@cshore.neomailbox.net>
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Wed, 12 Oct 2011 01:34:46 +0200 |
parents | 6f0e6b7dc088 |
children | bb4bbf380938 |
comparison
equal
deleted
inserted
replaced
31:a51d07ac3f1b | 32:51c6d2fc712f |
---|---|
172 memset(d->cenonce, 0, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES); | 172 memset(d->cenonce, 0, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES); |
173 memset(d->cdnonce, 0, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES); | 173 memset(d->cdnonce, 0, crypto_box_curve25519xsalsa20poly1305_NONCEBYTES); |
174 | 174 |
175 crypto_scalarmult_curve25519_base(cownpublickey, csecretkey); | 175 crypto_scalarmult_curve25519_base(cownpublickey, csecretkey); |
176 | 176 |
177 if (envval = getenv("TIME_WINDOW")) { | 177 if (envval = getconf("TIME_WINDOW")) { |
178 taia_now(&d->cdtaip); | 178 taia_now(&d->cdtaip); |
179 d->cdtaip.sec.x -= atol(envval); | 179 d->cdtaip.sec.x -= atol(envval); |
180 } else { | 180 } else { |
181 fprintf(stderr, "Warning: TIME_WINDOW not set, risking an initial replay attack\n"); | 181 fprintf(stderr, "Warning: TIME_WINDOW not set, risking an initial replay attack\n"); |
182 } | 182 } |
183 if (envval = getenv("ROLE")) { | 183 if (envval = getconf("ROLE")) { |
184 d->cenonce[nonceoffset-1] = atoi(envval) ? 1 : 0; | 184 d->cenonce[nonceoffset-1] = atoi(envval) ? 1 : 0; |
185 } else { | 185 } else { |
186 d->cenonce[nonceoffset-1] = memcmp(cownpublickey, cpublickey, crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES) > 0 ? 1 : 0; | 186 d->cenonce[nonceoffset-1] = memcmp(cownpublickey, cpublickey, crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES) > 0 ? 1 : 0; |
187 } | 187 } |
188 d->cdnonce[nonceoffset-1] = d->cenonce[nonceoffset-1] ? 0 : 1; | 188 d->cdnonce[nonceoffset-1] = d->cenonce[nonceoffset-1] ? 0 : 1; |