forked from QPQ-AG/enoise
Ditch enacl, support DH448 and Blake2s, and fix types (#14)
* Remove get_stacktrace (deprecated since OTP-24) * Add DH448 support and switch to crypto:generate_key for DH25519 * Switch to crypto:hash/2 for Blake2b and support Blake2s * Switch last enacl calls to crypto - no more enacl * Eqwalizer fixes Ewqalizer fix Eqwalizer fix Eqwalizer fix Eqwalizer fix Eqwalizer support Eqwalizer fix Fix tests to follow types (remote keys) * More error handling on setup * Dialyzer fix * Write CHANGELOG * Note about type-checking in README
This commit is contained in:
@@ -41,10 +41,9 @@ noise_interactive(V = #{ protocol_name := Name }) ->
|
||||
noise_interactive(_Name, Protocol, Init, Resp, Messages, HSHash) ->
|
||||
DH = enoise_protocol:dh(Protocol),
|
||||
SecK = fun(undefined) -> undefined; (Sec) -> enoise_keypair:new(DH, Sec, undefined) end,
|
||||
PubK = fun(undefined) -> undefined; (Pub) -> enoise_keypair:new(DH, Pub) end,
|
||||
|
||||
HSInit = fun(#{ e := E, s := S, rs := RS, prologue := PL }, R) ->
|
||||
Opts = [{noise, Protocol}, {s, SecK(S)}, {e, SecK(E)}, {rs, PubK(RS)}, {prologue, PL}],
|
||||
Opts = [{noise, Protocol}, {s, SecK(S)}, {e, SecK(E)}, {rs, RS}, {prologue, PL}],
|
||||
enoise:handshake(Opts, R)
|
||||
end,
|
||||
{ok, InitHS} = HSInit(Init, initiator),
|
||||
@@ -149,12 +148,12 @@ noise_test_run_(Conf, SKP, CKP) ->
|
||||
Protocol = enoise_protocol:from_name(Conf),
|
||||
Port = 4556,
|
||||
|
||||
SrvOpts = [{echos, 2}, {cpub, CKP}],
|
||||
SrvOpts = [{echos, 2}, {cpub, enoise_keypair:pubkey(CKP)}],
|
||||
EchoSrv = enoise_utils:echo_srv_start(Port, Protocol, SKP, SrvOpts),
|
||||
|
||||
{ok, TcpSock} = gen_tcp:connect("localhost", Port, [{active, once}, binary, {reuseaddr, true}], 100),
|
||||
|
||||
Opts = [{noise, Protocol}, {s, CKP}] ++ [{rs, SKP} || enoise_utils:need_rs(initiator, Conf) ],
|
||||
Opts = [{noise, Protocol}, {s, CKP}] ++ [{rs, enoise_keypair:pubkey(SKP)} || enoise_utils:need_rs(initiator, Conf) ],
|
||||
{ok, EConn, _} = enoise:connect(TcpSock, Opts),
|
||||
|
||||
ok = enoise:send(EConn, <<"Hello World!">>),
|
||||
|
||||
Reference in New Issue
Block a user