tillitis-key1
tillitis-key1 copied to clipboard
Idea: multiple inputs to `blake2s` in firmware
Note that I did have to investigate how blake2s
in firmware works: I was looking for a way to hash multiple byte-arrays, which isn't possible now. The thing I run into is when I have several byte-arrays, so I want to pass those on, instead of concatenating them first. That blake2s
in firmware is a one-shot function: init
+ update
+ finalize
is not so much the problem, but being limited to a single byte-array of input sometimes is. Obviously I can use the monocypher mechanisms, obviously I can concatenate, also vararg
isn't an option given that input is arbitrary-length therefore needs length separately specified.
One option to consider would be to simply provide parameters for 2nd, 3rd, 4th input and accept 0 length to ignore. I don't think one often needs tens of inputs, but more than one is quite common. For example: monocypher
recommends performing a keyed hash with the X25519 shared secret as key, and both X25519 public keys as input. This step is a necessary follow-up step, in some cases such as this, to produce uniformly random bytes as secret (for example when used as a symmetric key).
I would suggest the extra inputs as something to consider. Especially if use is as simple as passing in 0
values for unwanted additional arguments/parameters, i.e. with conditional to skip 0-length input, a pointer address 0
is no problem. Which is straight-forward, relatively cheap and simple to use. (If I read the firmware function blake2s_update
correctly, then you can even pass on 0
(value) arguments and they will be processed in same way as conditionally calling additional blake2s_update
.)
update I just realized this might not be the appropriate place for this report.