changeset 4:a989ecbd5f53

Fixed nacltai implementation
author ivo <ivo@UFO-Net.nl>
date Fri, 08 Oct 2010 18:18:05 +0200
parents 27632fe319bd
children 9d449e899402
files src/common.c src/proto.nacltai.c
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/common.c	Thu Oct 07 16:04:53 2010 +0200
+++ b/src/common.c	Fri Oct 08 18:18:05 2010 +0200
@@ -219,8 +219,7 @@
 			} else {
 				len = p->decode(&session, buffer_enc, buffer_raw, len);
 				if (len != 0 && session.remote_float != 0 && (session.remote_addr.sin_addr.s_addr != recvaddr.sin_addr.s_addr || session.remote_addr.sin_port != recvaddr.sin_port)) {
-					//fprintf(stderr, "Remote endpoint has changed to %s:%d", inet_ntoa(recvaddr.sin_addr), ntohs(recvaddr.sin_port));
-					fprintf(stderr, "Remote endpoint has changed to %s:%d", 0, 0);
+					fprintf(stderr, "Remote endpoint has changed to %08X:%d\n", recvaddr.sin_addr, ntohs(recvaddr.sin_port));
 					session.remote_addr = recvaddr;
 					session.remote_float = 2;
 				}
--- a/src/proto.nacltai.c	Thu Oct 07 16:04:53 2010 +0200
+++ b/src/proto.nacltai.c	Fri Oct 08 18:18:05 2010 +0200
@@ -168,13 +168,14 @@
 	memset(d->cenonce, 0, crypto_box_NONCEBYTES);
 	memset(d->cdnonce, 0, crypto_box_NONCEBYTES);
 
-	crypto_scalarmult(cownpublickey, csecretkey);
+	const unsigned char base[32] = {9};
+	crypto_scalarmult(cownpublickey, csecretkey, base);
 
 	if (envval = getenv("TIME_WINDOW")) {
 		taia_now(&d->cdtaip);
 		d->cdtaip.sec.x -= atol(envval);
 	} else {
-		printf("Warning: TIME_WINDOW not set, risking an initial replay attack\n");
+		fprintf(stderr, "Warning: TIME_WINDOW not set, risking an initial replay attack\n");
 	}
 	if (envval = getenv("ROLE")) {
 		d->cenonce[nonceoffset-1] = atoi(envval) ? 1 : 0;