bother sending the IV - it's the same each time. (If we wanted to send
it we've have to add 16 bytes to each message, not 4, so that the
message stays a multiple of 16 bytes long.) */
- memset(iv,0,16);
+ FILLZERO(iv);
put_uint32(iv, ti->maciv);
serpentbe_encrypt(&ti->mackey,iv,macacc);
serpentbe_encrypt(&ti->mackey,macplain,macacc);
}
serpentbe_encrypt(&ti->mackey,macacc,macacc);
- memcpy(buf_append(buf,16),macacc,16);
+ BUF_ADD_BYTES(append,buf,macacc,16);
/* Serpent-CBC. We expand the ID as for CBCMAC, do the encryption,
and prepend the IV before increasing it. */
- memset(iv,0,16);
+ FILLZERO(iv);
put_uint32(iv, ti->cryptiv);
serpentbe_encrypt(&ti->cryptkey,iv,iv);
}
/* CBC */
- memset(iv,0,16);
+ FILLZERO(iv);
{
uint32_t ivword = buf_unprepend_uint32(buf);
put_uint32(iv, ivword);
serpentbe_decrypt(&ti->cryptkey,n,n);
for (i = 0; i < 16; i++)
n[i] ^= iv[i];
- memcpy(iv, pct, 16);
+ COPY_OBJ(iv, pct);
}
/* CBCMAC */
macexpected=buf_unappend(buf,16);
- memset(iv,0,16);
+ FILLZERO(iv);
put_uint32(iv, ti->maciv);
serpentbe_encrypt(&ti->mackey,iv,macacc);
st->cl.apply=NULL;
st->cl.interface=&st->ops;
st->ops.st=st;
- st->ops.max_start_pad=28; /* 4byte seqnum, 16byte pad, 4byte MACIV,
- 4byte IV */
+ update_max_start_pad(&transform_max_start_pad, 28);
+ /* 4byte seqnum, 16byte pad, 4byte MACIV, 4byte IV */
/* We need 256*2 bits for serpent keys, 32 bits for CBC-IV and 32 bits
for CBCMAC-IV, and 32 bits for init sequence number */
st->max_seq_skew=dict_read_number(dict, "max-sequence-skew",
False, "serpent-cbc256", loc, 10);
+ SET_CAPAB_TRANSFORMNUM(CAPAB_TRANSFORMNUM_SERPENT256CBC);
+
return new_closure(&st->cl);
}
buf.base = malloc(4096);
buffer_init(&buf, 2048);
- memcpy(buf_append(&buf, sizeof(text)), text, sizeof(text));
+ BUF_ADD_OBJ(append, buf, text, sizeof(text));
if (transform_forward(ti, &buf, &errmsg)) {
fatal("transform_forward test: %s", errmsg);
}