comparison src/proto.nacltai.c @ 4:a989ecbd5f53

Fixed nacltai implementation
author ivo <ivo@UFO-Net.nl>
date Fri, 08 Oct 2010 18:18:05 +0200
parents 65c01f57bdce
children cf9b44b46be5
comparison
equal deleted inserted replaced
3:27632fe319bd 4:a989ecbd5f53
166 crypto_box_beforenm(d->cbefore, cpublickey, csecretkey); 166 crypto_box_beforenm(d->cbefore, cpublickey, csecretkey);
167 167
168 memset(d->cenonce, 0, crypto_box_NONCEBYTES); 168 memset(d->cenonce, 0, crypto_box_NONCEBYTES);
169 memset(d->cdnonce, 0, crypto_box_NONCEBYTES); 169 memset(d->cdnonce, 0, crypto_box_NONCEBYTES);
170 170
171 crypto_scalarmult(cownpublickey, csecretkey); 171 const unsigned char base[32] = {9};
172 crypto_scalarmult(cownpublickey, csecretkey, base);
172 173
173 if (envval = getenv("TIME_WINDOW")) { 174 if (envval = getenv("TIME_WINDOW")) {
174 taia_now(&d->cdtaip); 175 taia_now(&d->cdtaip);
175 d->cdtaip.sec.x -= atol(envval); 176 d->cdtaip.sec.x -= atol(envval);
176 } else { 177 } else {
177 printf("Warning: TIME_WINDOW not set, risking an initial replay attack\n"); 178 fprintf(stderr, "Warning: TIME_WINDOW not set, risking an initial replay attack\n");
178 } 179 }
179 if (envval = getenv("ROLE")) { 180 if (envval = getenv("ROLE")) {
180 d->cenonce[nonceoffset-1] = atoi(envval) ? 1 : 0; 181 d->cenonce[nonceoffset-1] = atoi(envval) ? 1 : 0;
181 } else { 182 } else {
182 d->cenonce[nonceoffset-1] = memcmp(cpublickey, cownpublickey, crypto_box_PUBLICKEYBYTES) ? 1 : 0; 183 d->cenonce[nonceoffset-1] = memcmp(cpublickey, cownpublickey, crypto_box_PUBLICKEYBYTES) ? 1 : 0;