MCPcopy Create free account
hub / github.com/F-Stack/f-stack / chacha_ivsetup

Function chacha_ivsetup

freebsd/crypto/chacha20/chacha.c:84–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84LOCAL void
85chacha_ivsetup(chacha_ctx *x, const u8 *iv, const u8 *counter)
86{
87#ifndef CHACHA_NONCE0_CTR128
88 x->input[12] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 0);
89 x->input[13] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 4);
90 x->input[14] = U8TO32_LITTLE(iv + 0);
91 x->input[15] = U8TO32_LITTLE(iv + 4);
92#else
93 // CHACHA_STATELEN
94 (void)iv;
95 x->input[12] = U8TO32_LITTLE(counter + 0);
96 x->input[13] = U8TO32_LITTLE(counter + 4);
97 x->input[14] = U8TO32_LITTLE(counter + 8);
98 x->input[15] = U8TO32_LITTLE(counter + 12);
99#endif
100}
101
102#ifdef CHACHA_NONCE0_CTR128
103LOCAL void

Callers 3

chacha20_xform_reinitFunction · 0.70
arc4random.cFile · 0.50
kerneldumpcrypto_initFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected