Style?

```c++
uint16_t cipher_len =
    (data[cipher_offset] << 8) + data[cipher_offset + 1];
```

Is a little more idiomatic.  For that matter, you could write it like this:

```c++
uint16_t cipher_len =
    data[cipher_offset] * 256 + data[cipher_offset + 1];
```

Then you don't have to use parentheses everywhere.  Just food for thought. :-)