Commit 7c3fc063 authored by bernd's avatar bernd

Made stateless connections symmetric

parent 9d841afa
......@@ -395,7 +395,6 @@ Variable throwcount
string-stack $off
object-stack $off
nest-stack $off
tmp-0key sec-off
o to connection
o IF
maxdata code+
......
......@@ -144,8 +144,6 @@ net2o-base
reply-key, gen-punchload gen-punch time-offset! context ]tmpnest
push-cmd ;] IS expect-reply? ;
+net2o: knock ( $:key -- ) $> tmp-0key sec! ;
gen-table $freeze
0 [IF]
......
......@@ -47,7 +47,6 @@ object class
keysize uvar keypad
1 64s uvar last-mykey
cell uvar my-0key
cell uvar tmp-0key
end-class keybuf-c
: init-keybuf ( -- )
......@@ -174,17 +173,17 @@ User last-ivskey
inbuf 1+ c@ c:decrypt+auth +enc ;
: set-0key ( keyaddr -- )
dup @ IF
sec@ state# min
sec@ dup IF
state# min
ivs-assembly state# bounds ?DO
2dup I swap move
dup +LOOP 2drop
ELSE
ivs-assembly state# erase
2drop ivs-assembly state# erase
THEN
ivs-assembly >c:key ;
: try-0decrypt ( key -- flag ) set-0key
: try-0decrypt ( addr -- flag ) set-0key
inbuf packet-data +cryptsu
inbuf 1+ c@ c:decrypt+auth +enc ;
......@@ -197,7 +196,7 @@ User last-ivskey
: outbuf0-encrypt ( -- ) +calc
outbuf addr 64@ outbuf flags w@ addr>assembly
o IF dest-0key ELSE tmp-0key THEN set-0key
o IF dest-0key ELSE my-0key THEN set-0key
outbuf packet-data +cryptsu
outbuf 1+ c@ c:encrypt+auth +enc ;
......
......@@ -967,6 +967,7 @@ cmd-class class
KEYBYTES +field tpkc
KEYBYTES +field tskc
field: dest-pubkey \ if not 0, connect only to this key
field: src-0key \ key for stateless connections
field: dest-0key \ key for stateless connections
end-class context-class
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment