| 82 | } |
| 83 | |
| 84 | LOCAL void |
| 85 | chacha_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 |
| 103 | LOCAL void |
no outgoing calls
no test coverage detected