It’s perhaps useful to add one test case with some arbitrary input and position, to make sure an implementation isn’t swapping some of the first 31 bytes of the input seed for example.
0+ unsigned char input4[32] = {
1+ 0x32, 0x56, 0x56, 0xf4, 0x29, 0x02, 0xc2, 0xf8,
2+ 0xa3, 0x4b, 0x96, 0xf5, 0xa7, 0xf7, 0xe3, 0x6c,
3+ 0x92, 0xad, 0xa5, 0x18, 0x1c, 0xe3, 0x41, 0xae,
4+ 0xc3, 0xf3, 0x18, 0xd0, 0xfa, 0x5b, 0x72, 0x53
5+ };
6+ unsigned char expected4[64] = {
7+ 0x28, 0xd3, 0x56, 0xe7, 0x5c, 0x19, 0xc6, 0xe9,
8+ 0x21, 0x8e, 0x17, 0x6f, 0x11, 0x72, 0x1e, 0x8c,
9+ 0x0d, 0x17, 0xbd, 0xe7, 0xe9, 0xad, 0x14, 0xac,
10+ 0x92, 0xb6, 0x9f, 0x3d, 0xfb, 0x20, 0x09, 0xd6,
11+ 0x6d, 0x3b, 0x8e, 0x43, 0xc7, 0xdc, 0x33, 0xe3,
12+ 0xbb, 0x6f, 0x07, 0x6c, 0xb5, 0xc8, 0xb4, 0x1f,
13+ 0x12, 0xe5, 0x6c, 0xe3, 0x0c, 0x64, 0xd7, 0xd9,
14+ 0xab, 0x0d, 0xa7, 0xf5, 0x81, 0xf1, 0x03, 0x79
15+ };
16+
17+ secp256k1_scalar_chacha20(&r1, &r2, input4, 0x6ff8602a7a78e2f2ULL);
18+ secp256k1_scalar_set_b32(&exp_r1, &expected4[0], NULL);
19+ secp256k1_scalar_set_b32(&exp_r2, &expected4[32], NULL);
20+ CHECK(secp256k1_scalar_eq(&exp_r1, &r1));
21+ CHECK(secp256k1_scalar_eq(&exp_r2, &r2));