comparison src/proto.nacltai.c @ 27:5ba185ca7102

Fixed error checking during initialization, restructured code a bit to make it even simpler
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 09 Apr 2011 17:36:48 +0200
parents 68c67c6d2080
children 6f0e6b7dc088
comparison
equal deleted inserted replaced
26:68c67c6d2080 27:5ba185ca7102
187 } 187 }
188 d->cdnonce[nonceoffset-1] = d->cenonce[nonceoffset-1] ? 0 : 1; 188 d->cdnonce[nonceoffset-1] = d->cenonce[nonceoffset-1] ? 0 : 1;
189 return 0; 189 return 0;
190 } 190 }
191 191
192 #ifdef COMBINED_BINARY 192 struct qtproto qtproto_nacltai = {
193 int tunmain_nacltai() { 193 1,
194 #else 194 MAX_PACKET_LEN + crypto_box_curve25519xsalsa20poly1305_ZEROBYTES,
195 int tunmain() { 195 MAX_PACKET_LEN + crypto_box_curve25519xsalsa20poly1305_ZEROBYTES,
196 #endif 196 crypto_box_curve25519xsalsa20poly1305_ZEROBYTES,
197 struct qtproto p = { 197 crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES - noncelength,
198 1, 198 encode,
199 MAX_PACKET_LEN + crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, 199 decode,
200 MAX_PACKET_LEN + crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, 200 init,
201 crypto_box_curve25519xsalsa20poly1305_ZEROBYTES, 201 sizeof(struct qt_proto_data_nacltai),
202 crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES - noncelength, 202 };
203 encode,
204 decode,
205 init,
206 sizeof(struct qt_proto_data_nacltai),
207 };
208 return qtrun(&p);
209 }
210 203
211 #ifndef COMBINED_BINARY 204 #ifndef COMBINED_BINARY
212 int main() { 205 int main() {
213 print_header(); 206 print_header();
214 return tunmain(); 207 return qtrun(&qtproto_nacltai);
215 } 208 }
216 #endif 209 #endif