Simon Josefsson simon@josefsson.org writes:
I quickly discovered that I needed the round-reduced variants of Salsa20. Here they are. I didn't update the assembler part, so I would need help finishing that part.
Nice. Key setup is the same, just the number of iterations in the main loop is different?
+static void +salsa20r_crypt(struct salsa20_ctx *ctx,
int rounds,
unsigned length,
uint8_t *c,
const uint8_t *m)
This is the function which should be implemented in assembly. Do you think this should be a public, documented function (in which case salsa20r_crypt sounds like a reasonable name), or internal, in which case nettle convention would be something like _salsa20_crypt?
--- a/testsuite/salsa20-test.c +++ b/testsuite/salsa20-test.c @@ -13,13 +13,18 @@ memzero_p (const uint8_t *p, size_t n) return 1; }
+typedef void (*salsa20_func) (struct salsa20_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
A very minor point... I've decided to try to stick to non-pointer typedefs for function types. I.e.,
typedef void salsa20_func (struct salsa20_ctx *ctx, unsigned length, uint8_t *dst, const uint8_t *src);
That way, it is possible (although maybe not useful very often) to use the typedef for declaring functions, like
salsa20_func salsa20_crypt; salsa20_func salsa20r8_crypt; salsa20_func salsa20r12_crypt;
Regards, /Niels