MCPcopy Create free account
hub / github.com/ArduPilot/ArduRemoteID / crypto_hchacha20

Function crypto_hchacha20

RemoteIDModule/monocypher.cpp:207–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void crypto_hchacha20(u8 out[32], const u8 key[32], const u8 in [16])
208{
209 u32 block[16];
210 chacha20_init_key(block, key);
211 // input
212 load32_le_buf(block + 12, in, 4);
213 chacha20_rounds(block, block);
214 // prevent reversal of the rounds by revealing only half of the buffer.
215 store32_le_buf(out , block , 4); // constant
216 store32_le_buf(out+16, block+12, 4); // counter and nonce
217 WIPE_BUFFER(block);
218}
219
220u64 crypto_chacha20_ctr(u8 *cipher_text, const u8 *plain_text,
221 size_t text_size, const u8 key[32], const u8 nonce[8],

Callers 4

crypto_xchacha20_ctrFunction · 0.85
crypto_key_exchangeFunction · 0.85
crypto_lock_aeadFunction · 0.85
crypto_unlock_aeadFunction · 0.85

Calls 4

chacha20_init_keyFunction · 0.85
load32_le_bufFunction · 0.85
chacha20_roundsFunction · 0.85
store32_le_bufFunction · 0.85

Tested by

no test coverage detected