X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=src%2Fchacha-poly1305%2Fchacha.c;h=a158de5efafa6266cc46ee2473aba6aca0f7352f;hb=fa05f996c5500c056a36c1d43e33a407f876643c;hp=2d0b9183dde4258dd0d20a4492aa19b7aee72776;hpb=6086a7fc1ecdf197d3937cec5f291b83c5d68454;p=meshlink diff --git a/src/chacha-poly1305/chacha.c b/src/chacha-poly1305/chacha.c index 2d0b9183..a158de5e 100644 --- a/src/chacha-poly1305/chacha.c +++ b/src/chacha-poly1305/chacha.c @@ -79,6 +79,14 @@ void chacha_ivsetup(chacha_ctx *x, const uint8_t *iv, const uint8_t *counter) x->input[15] = U8TO32_LITTLE(iv + 4); } +void chacha_ivsetup_96(chacha_ctx *x, const uint8_t *iv, const uint8_t *counter) +{ + x->input[12] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 0); + x->input[13] = U8TO32_LITTLE(iv + 0); + x->input[14] = U8TO32_LITTLE(iv + 4); + x->input[15] = U8TO32_LITTLE(iv + 8); +} + void chacha_encrypt_bytes(chacha_ctx *x, const uint8_t *m, uint8_t *c, uint32_t bytes) {