- return send_record_priv(s, SPTPS_HANDSHAKE, s->mykex, 1 + 32 + keylen);
+ return send_record_priv(s, SPTPS_HANDSHAKE, s->mykex, sizeof(sptps_kex_t));
+}
+
+static size_t sigmsg_len(size_t labellen) {
+ return 1 + 2 * sizeof(sptps_kex_t) + labellen;
+}
+
+static void fill_msg(uint8_t *msg, bool initiator, const sptps_kex_t *kex0, const sptps_kex_t *kex1, const sptps_t *s) {
+ *msg = initiator, msg++;
+ memcpy(msg, kex0, sizeof(*kex0)), msg += sizeof(*kex0);
+ memcpy(msg, kex1, sizeof(*kex1)), msg += sizeof(*kex1);
+ memcpy(msg, s->label, s->labellen);