symm/{chacha.c,salsa20.c}: Fix random generator allocation sizes.
[catacomb] / symm / salsa20.c
index 0afad2c..92631b1 100644 (file)
@@ -42,11 +42,9 @@ const octet salsa20_keysz[] = { KSZ_SET, 32, 16, 10, 0 };
  *             the feedforward step.
  */
 
-CPU_DISPATCH(static, (void),
-            void, core, (unsigned r, const salsa20_matrix src,
-                         salsa20_matrix dest),
-            (r, src, dest),
-            pick_core, simple_core);
+CPU_DISPATCH(static, (void), void, core,
+            (unsigned r, const salsa20_matrix src, salsa20_matrix dest),
+            (r, src, dest), pick_core, simple_core);
 
 static void simple_core(unsigned r, const salsa20_matrix src,
                        salsa20_matrix dest)
@@ -709,7 +707,7 @@ static void grdestroy(grand *r)
   grand *SALSA20_DECOR(salsa20, rr, _rand)                             \
     (const void *k, size_t ksz, const void *n)                         \
   {                                                                    \
-    grctx *g = S_CREATE(g);                                            \
+    grctx *g = S_CREATE(grctx);                                                \
     g->r.r.ops = &grops_rand_##rr;                                     \
     g->r.ops = &grops_##rr;                                            \
     salsa20_init(&g->ctx, k, ksz, n);                                  \
@@ -752,7 +750,7 @@ SALSA20_VARS(DEFGRAND)
   grand *SALSA20_DECOR(xsalsa20, rr, _rand)                            \
     (const void *k, size_t ksz, const void *n)                         \
   {                                                                    \
-    grxctx_##rr *g = S_CREATE(g);                                      \
+    grxctx_##rr *g = S_CREATE(grxctx_##rr);                            \
     g->r.r.ops = &grxops_rand_##rr;                                    \
     g->r.ops = &grxops_##rr;                                           \
     XSALSA20_INIT(rr, &g->ctx, k, ksz, n);                             \