summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-08-03 12:50:29 +0200
committerSander Vrijders <sander@ouroboros.rocks>2019-08-09 19:43:07 +0200
commit3339a629b41c50cca4232517b8249d55f462464d (patch)
tree3acfbaf91bf11deb1b10ff32b31332f593b17ea7
parent9e8d603d14561095fb8d08871319a315d3bf6763 (diff)
downloadouroboros-3339a629b41c50cca4232517b8249d55f462464d.tar.gz
ouroboros-3339a629b41c50cca4232517b8249d55f462464d.zip
ipcpd: Fix length mismatch of encryption cypher
The cypher_s field in QoS was sometimes 32 and sometimes 16 bits. This is now corrected to be 16 bits. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--include/ouroboros/qos.h2
-rw-r--r--src/ipcpd/eth/eth.c2
-rw-r--r--src/ipcpd/udp/main.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h
index f5becaa6..c34cb9f8 100644
--- a/include/ouroboros/qos.h
+++ b/include/ouroboros/qos.h
@@ -34,7 +34,7 @@ typedef struct qos_spec {
uint32_t ber; /* Bit error rate, errors per billion bits */
uint8_t in_order; /* In-order delivery, enables FRCT */
uint32_t max_gap; /* In ms */
- uint32_t cypher_s; /* Cypher strength, 0 = no encryption */
+ uint16_t cypher_s; /* Cypher strength, 0 = no encryption */
} qosspec_t;
static const qosspec_t qos_raw = {
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index dccfd190..a268b564 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -733,7 +733,7 @@ static int eth_ipcp_mgmt_frame(const uint8_t * buf,
qs.ber = ntoh32(msg->ber);
qs.in_order = msg->in_order;
qs.max_gap = ntoh32(msg->max_gap);
- qs.cypher_s = hton32(msg->cypher_s);
+ qs.cypher_s = ntoh16(msg->cypher_s);
if (shim_data_reg_has(eth_data.shim_data,
buf + sizeof(*msg))) {
diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c
index f6aa57d1..08d44c8e 100644
--- a/src/ipcpd/udp/main.c
+++ b/src/ipcpd/udp/main.c
@@ -91,7 +91,7 @@ struct mgmt_msg {
uint32_t loss;
uint32_t ber;
uint32_t max_gap;
- uint32_t cypher_s;
+ uint16_t cypher_s;
} __attribute__((packed));
struct mgmt_frame {
@@ -210,7 +210,7 @@ static int ipcp_udp_port_alloc(int skfd,
msg->ber = hton32(qs.ber);
msg->in_order = qs.in_order;
msg->max_gap = hton32(qs.max_gap);
- msg->cypher_s = hton32(qs.cypher_s);
+ msg->cypher_s = hton16(qs.cypher_s);
memcpy(msg + 1, dst, ipcp_dir_hash_len());