MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

common/test/run-sphinx-xor_cipher_stream.c:149–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147#define PARTIAL_SIZE 128
148
149int main(int argc, char **argv)
150{
151 const u8 nonce[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
152 struct secret k;
153 u8 normal[1024];
154
155 common_setup(argv[0]);
156 memset(&k, 1, sizeof(k));
157 crypto_stream_chacha20(normal, sizeof(normal), nonce, k.data);
158
159 for (size_t i = 0; i < sizeof(normal) - PARTIAL_SIZE; i++) {
160 for (size_t len = 0; len < PARTIAL_SIZE; len++) {
161 u8 *partial = tal_arrz(tmpctx, u8, len);
162 xor_cipher_stream_off(&k, i, partial, len);
163 assert(memcmp(partial, normal + i, len) == 0);
164 }
165 }
166
167 common_shutdown();
168 return 0;
169}

Callers

nothing calls this directly

Calls 3

common_setupFunction · 0.85
xor_cipher_stream_offFunction · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected