- cipher_set_counter(s->outcipher, &seqno, sizeof seqno);
- if(!cipher_counter_xor(s->outcipher, buffer + 6, len + 1UL, buffer + 6))
- return false;
+ if(!cipher_set_counter(s->outcipher, &seqno, sizeof seqno))
+ return error(s, EINVAL, "Failed to set counter");
+
+ if(!cipher_gcm_encrypt_start(s->outcipher, buffer + 4, 1, buffer + 4, NULL))
+ return error(s, EINVAL, "Error encrypting record");