Commit a4e70960 authored by Niels Möller's avatar Niels Möller
Browse files

Handle sequence numbers.

Rev: src/encrypt.c:1.8
Rev: src/encrypt.h:1.6
parent 4167debe
......@@ -19,9 +19,14 @@ static int do_encrypt(struct abstract_write **w,
if (closure->mac->mac_size)
{
/* FIXME: Sequence number */
UPDATE(closure->mac, packet->length, packet->data);
DIGEST(closure->mac, new->data + packet->length);
UINT8 s[4];
WRITE_UINT32(s, closure->sequence_number);
closure->sequence_number++;
HASH_UPDATE(closure->mac, 4, s);
HASH_UPDATE(closure->mac, packet->length, packet->data);
HASH_DIGEST(closure->mac, new->data + packet->length);
}
lsh_string_free(packet);
......@@ -37,6 +42,7 @@ make_packet_encrypt(struct abstract_write *continuation,
closure->super.super.write = do_encrypt;
closure->super.next = continuation;
closure->sequence_number = 0;
closure->mac = mac;
closure->crypto = crypto;
......
......@@ -13,6 +13,7 @@ struct packet_encrypt
{
struct abstract_write_pipe super;
UINT32 sequence_number;
struct mac_instance *mac;
struct crypto_instance *crypto;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment