diff src/proto.nacl0.c @ 41:54d28a81ca99

Small updates in preparation for stateful protocols
author Ivo Smits <Ivo@UCIS.nl>
date Thu, 16 May 2013 01:15:01 +0200
parents d9f5caa13898
children 5685fad38195
line wrap: on
line diff
--- a/src/proto.nacl0.c	Mon May 06 23:58:25 2013 +0200
+++ b/src/proto.nacl0.c	Thu May 16 01:15:01 2013 +0200
@@ -42,13 +42,13 @@
 	int i;
 	if (len < crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES) {
 		fprintf(stderr, "Short packet received: %d\n", len);
-		return 0;
+		return -1;
 	}
 	len -= crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES;
 	memset(enc, 0, crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES);
 	if (i = crypto_box_curve25519xsalsa20poly1305_open_afternm(raw, enc, len+crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, d->cnonce, d->cbefore)) {
 		fprintf(stderr, "Decryption failed len=%d result=%d\n", len, i);
-		return 0;
+		return -1;
 	}
 	return len;
 }