MCPcopy Create free account
hub / github.com/ElementsProject/elements / ECRYPT_keysetup

Function ECRYPT_keysetup

src/test/fuzz/crypto_diff_fuzz_chacha20.cpp:95–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93static const char tau[] = "expand 16-byte k";
94
95void ECRYPT_keysetup(ECRYPT_ctx* x, const u8* k, u32 kbits, u32 ivbits)
96{
97 const char* constants;
98
99 x->input[4] = U8TO32_LITTLE(k + 0);
100 x->input[5] = U8TO32_LITTLE(k + 4);
101 x->input[6] = U8TO32_LITTLE(k + 8);
102 x->input[7] = U8TO32_LITTLE(k + 12);
103 if (kbits == 256) { /* recommended */
104 k += 16;
105 constants = sigma;
106 } else { /* kbits == 128 */
107 constants = tau;
108 }
109 x->input[8] = U8TO32_LITTLE(k + 0);
110 x->input[9] = U8TO32_LITTLE(k + 4);
111 x->input[10] = U8TO32_LITTLE(k + 8);
112 x->input[11] = U8TO32_LITTLE(k + 12);
113 x->input[0] = U8TO32_LITTLE(constants + 0);
114 x->input[1] = U8TO32_LITTLE(constants + 4);
115 x->input[2] = U8TO32_LITTLE(constants + 8);
116 x->input[3] = U8TO32_LITTLE(constants + 12);
117}
118
119void ECRYPT_ivsetup(ECRYPT_ctx* x, const u8* iv)
120{

Callers 1

FUZZ_TARGETFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected