[noise] rev32b (Release Candidate)

Guanhao Yin sopium at mysterious.site
Sat May 13 20:44:34 PDT 2017


在 2017年05月14日 01:40, Trevor Perrin 写道:

> On Sat, May 13, 2017 at 5:21 PM, Alex <alex at centromere.net> wrote:
>> The `psk` token unlike all other tokens: It is parameterized. There is
>> no way for a Noise library to know ahead of time what the value will
>> be.
> In a general-purpose library I think "psk" tokens should probably be
> handled by a callback (psk0 is perhaps an exception to this, if the
> library wants to provide a different/simpler API for just setting the
> psk0 explicitly).
> That's different from existing tokens, but seems OK to me - callbacks
> are not uncommon if you look at, say, TLS APIs.

Using callbacks is what I first thought of too. But there is a
limitation: it is hard to support async/non-blocking IO in the

I am more inclined to have read_message/write_message returning an
error indicating that a PSK is needed. Something like

  let r = handshake_state.write_message(payload, output);
  if r == Err(NeedPsk) {
    let psk = lookup_psk(handshake_state.get_rs());
    handshake_state.write_message(payload, output);

  (Hypothetical Rust code)

I'll play with this idea in noise-rust and see how it turns out.

Guanhao Yin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://moderncrypto.org/mail-archive/noise/attachments/20170514/cbb5b831/attachment.html>

More information about the Noise mailing list