-#define SALSA20_INIT(r, ctx, k, ksz, n) salsa20_init(ctx, k, ksz, n)
-#define SALSA20_SEEKU64(r, ctx, i) salsa20_seeku64(ctx, i)
+
+#define SALSA20_TESTSETUP(r, ctx, k, ksz, n, nsz, p, psz) do { \
+ kludge64 pos64; \
+ salsa20_init(ctx, k, ksz, 0); \
+ if (nsz == 8) salsa20_setnonce(ctx, n); \
+ else if (nsz == 12) salsa20_setnonce_ietf(ctx, n); \
+ if (psz == 8) { LOAD64_(pos64, p); salsa20_seeku64(ctx, pos64); } \
+ else if (psz == 4) salsa20_seek_ietf(ctx, LOAD32(p)); \
+} while (0)
+
+#define XSALSA20_TESTSETUP(r, ctx, k, ksz, n, nsz, p, psz) do { \
+ kludge64 pos64; \
+ XSALSA20_INIT(r, ctx, k, ksz, 0); \
+ if (nsz == 24) XSALSA20_SETNONCE(r, ctx, n); \
+ if (psz == 8) { LOAD64_(pos64, p); XSALSA20_SEEKU64(r, ctx, pos64); } \
+} while (0)