- cipher_set_counter(&s->outcipher, &seqno, sizeof seqno);
- if(!cipher_counter_xor(&s->outcipher, buffer + 6, len + 1UL, buffer + 6))
- return false;
-
- if(!digest_create(&s->outdigest, buffer, len + 7UL, buffer + 7UL + len))
- return false;
-
- return s->send_data(s->handle, type, buffer + 2, len + 21UL);
+ chacha_poly1305_encrypt(s->outcipher, seqno, buffer + 4, len + 1, buffer + 4, NULL);
+ return s->send_data(s->handle, type, buffer, len + 21UL);