Check-in [44cc61b6df]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix typo
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 44cc61b6df38103451559ac411c9b0b1f5fc8bcc
User & Date: bernd 2019-06-06 16:10:42
Context
2019-06-06
16:14
Bump version number check-in: ac07ab3731 user: bernd tags: trunk, 0.9.0-20190606
16:10
Fix typo check-in: 44cc61b6df user: bernd tags: trunk
2019-06-05
22:15
Add new method for vault key exchange check-in: 211b96e714 user: bernd tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to classes.fs.

    26     26   object class
    27     27       field: token-table
    28     28       value: parent
    29     29       value: my-key        \ key used for this context
    30     30       field: req?
    31     31       field: c-state \ state for checks whether everything is there
    32     32       method start-req
    33         -    method nest-sig \ check sig first and then nest
           33  +    method nest-sig     \ check sig first and then nest
    34     34   end-class cmd-class \ command interpreter
    35     35   ' noop cmd-class to start-req
    36     36   :noname ( addr u -- flag ) 2drop -1 ; cmd-class to nest-sig
    37     37   
    38     38   Variable cmd-table
    39     39   Variable reply-table
    40     40   Variable log-table
................................................................................
   126    126       64field: max-slack
   127    127       64field: time-offset  \ make timestamps smaller
   128    128       64field: lastdeltat
   129    129   end-class ack-class
   130    130   
   131    131   cmd-class class
   132    132       field: peers[]
          133  +    field: msg-keys[]
   133    134       field: silent-last#
          135  +    method dec-nest-sig \ check sig, decrypt and then nest
   134    136   end-class msging-class
   135    137   
   136    138   cmd-class class{ msg
   137    139       $value: id$
   138    140       method start
   139    141       method tag
   140    142       method chain

Changes to crypt.fs.

    43     43       keysize   uvar stskc
    44     44       keypack-all# uvar keypack-d
    45     45       $100      uvar vaultkey \ buffers for vault
    46     46       $100      uvar keydump-buf  \ buffer for dumping keys
    47     47       state2#   uvar vkey \ maximum size for session key
    48     48       state2#   uvar voutkey \ for keydump
    49     49       keysize   uvar keygendh
    50         -    keysize   uvar vpk
    51         -    keysize   uvar vsk
    52     50       tf_ctx_256 uvar tf-key
    53     51       keysize   uvar tf-out
    54     52       $10       uvar tf-hashout
    55     53       1 64s     uvar last-mykey
    56     54       cell      uvar keytmp-up
    57     55   end-class keytmp-c
    58     56   
................................................................................
   646    644   	4 to mode
   647    645       keysize +LOOP  0 0 ;
   648    646   : v-dec$ ( addr u -- session-key u / 0 0 )
   649    647       over >vdhe keysize /string
   650    648       over >viv  $10 /string
   651    649       v-dec-loop ;
   652    650   
   653         -: vdhe ( -- )  vsk vpk ed-keypair  vpk keysize type ;
          651  +: vdhe ( -- )  stskc stpkc ed-keypair  stpkc keysize type ;
   654    652   : viv  ( -- )  $10 rng$ 2dup type  tf-key tf_ctx_256-tweak swap move ;
   655    653   : vsessionkey ( -- )
   656    654       keysize rng$ vkey state# move-rep
   657    655       c:0key vkey keysize c:hash tf-hashout $10 2dup c:hash@ type ;
   658    656   : v-enc-loop ( keylist -- )
   659         -    [:  drop vsk swap tf-key tf_ctx_256-key ed-dh 2drop
          657  +    [:  drop stskc swap tf-key tf_ctx_256-key ed-dh 2drop
   660    658   	tf-key vkey tf-out $C tf_encrypt_256
   661    659   	tf-out keysize type
   662    660   	tf-key tf_tweak256++
   663    661       ;] $[]map ;
   664    662   : v-enc-gen ( keylist -- )
   665    663       vdhe viv vsessionkey v-enc-loop ;
   666    664   : v-enc$ ( keylist -- addr u )

Changes to do.

     1      1   #!/bin/bash
     2      2   
     3      3   echo "This script builds net2o from scratch"
     4      4   
     5         -GFORTH=gforth-0.7.9_20190530
            5  +GFORTH=gforth-0.7.9_20190606
     6      6   
     7      7   if [ "$(uname -o)" = "Cygwin" ]
     8      8   then
     9      9       CONFOPT="--prefix=/usr $*"
    10     10   else
    11     11       CONFOPT="$*"
    12     12   fi

Changes to msg.fs.

   604    604   \    ." admin " groups:admin[] [: '@' emit .simple-id space ;] $[]map
   605    605       ." +" groups:perms# x64.
   606    606       o> cr ;
   607    607   : .chatgroups ( -- )
   608    608       groups>sort[]
   609    609       group-list[] $@ bounds ?DO  I @ .chatgroup  cell +LOOP ;
   610    610   
          611  +: ?pkgroup ( addr u -- addr u )
          612  +    \ if no group has been selected, use the pubkey as group
          613  +    last# 0= IF  2dup + sigpksize# - keysize >group  THEN ;
          614  +
          615  +: handle-msg ( addr u -- )
          616  +    ?pkgroup >msg-log
          617  +    2dup d0<> \ do something if it is new
          618  +    IF  replay-mode @ 0= IF
          619  +	    2dup show-msg
          620  +	    2dup parent .push-msg
          621  +	THEN
          622  +    THEN  2drop ;
          623  +
   611    624   \g 
   612    625   \g ### messaging commands ###
   613    626   \g 
   614    627   
   615    628   scope{ net2o-base
   616    629   
   617    630   $34 net2o: message ( -- o:msg ) \g push a message object
................................................................................
   634    647   	parent last# cell+ del$cell  THEN ;
   635    648   +net2o: msg-reconnect ( $:pubkey+addr -- ) \g rewire distribution tree
   636    649       $> $make
   637    650       <event last-msg 2@ e$, elit, o elit, last# elit, :>chat-reconnect
   638    651       parent .wait-task @ ?query-task over select event> ;
   639    652   +net2o: msg-last? ( start end n -- ) 64>n msg:last? ;
   640    653   +net2o: msg-last ( $:[tick0,msgs,..tickn] n -- ) 64>n msg:last ;
   641         -
   642         -: ?pkgroup ( addr u -- addr u )
   643         -    \ if no group has been selected, use the pubkey as group
   644         -    last# 0= IF  2dup + sigpksize# - keysize >group  THEN ;
          654  ++net2o: msg-key ( $:key -- )
          655  +    $> v-dec$ dup IF  msg-keys[] $+[]!  ELSE  2drop  THEN ;
   645    656   
   646    657   net2o' nestsig net2o: msg-nestsig ( $:cmd+sig -- ) \g check sig+nest
   647    658       $> nest-sig ?dup-0=-IF
   648         -	?pkgroup >msg-log
   649         -	2dup d0<> \ do something if it is new
   650         -	IF  replay-mode @ 0= IF
   651         -		2dup show-msg
   652         -		2dup parent .push-msg
   653         -	    THEN
   654         -	THEN  2drop
   655         -    ELSE  replay-mode @ IF  drop 2drop
          659  +	handle-msg
          660  +   ELSE  replay-mode @ IF  drop 2drop
          661  +	ELSE  !!sig!!  THEN \ balk on all wrong signatures
          662  +    THEN ;
          663  ++net2o: msg-nestencsig ( $:enc[cmd]+sig -- ) \g decrypt, chech sig+nest
          664  +    $> dec-nest-sig ?dup-0=-IF
          665  +	handle-msg
          666  +   ELSE  replay-mode @ IF  drop 2drop
   656    667   	ELSE  !!sig!!  THEN \ balk on all wrong signatures
   657    668       THEN ;
   658    669   
   659         -:noname skip-sig? @ IF   quicksig( pk-quick-sig? )else( pk-date? )
   660         -    ELSE  pk-sig?  THEN ;  ' message  2dup
          670  +: msg-sig? ( addr u -- addr u' flag )
          671  +    skip-sig? @ IF   quicksig( pk-quick-sig? )else( pk-date? )
          672  +    ELSE  pk-sig?  THEN ;
          673  +' msg-sig? ' message  2dup
   661    674   msging-class to start-req
   662    675   msging-class to nest-sig
   663    676   msg-class to start-req
   664    677   msg-class to nest-sig
          678  +
          679  +: msg-dec-sig? ( addr u -- addr' u' flag )
          680  +    msg-sig? dup  IF  drop
          681  +	2dup + pktmp keysize move \ move the pk to pktmp
          682  +	get0 pktmp ge25519-unpack- 0= !!no-ed-key!!
          683  +	msg-keys[] $@ bounds U+DO
          684  +	    2dup I $@ crypt-key-init $>align
          685  +	    2dup 0 c:decrypt+auth IF
          686  +		voutkey keysize c:hash@
          687  +		sct0 voutkey 32b>sc25519
          688  +		get1 get0 sct0 ge25519*
          689  +		tf-out get1 ge25519-pack
          690  +		$80 tf-out $1F + xorc!
          691  +		2nip true unloop  EXIT  THEN
          692  +	    2drop
          693  +	cell +LOOP
          694  +	false
          695  +    THEN ;
   665    696   
   666    697   ' context-table is gen-table
   667    698   
   668    699   also }scope
   669    700   
   670    701   msging-table $save
   671    702   

Changes to vault.fs.

   116    116   : enc>crypt2 ( -- )
   117    117       enc-mode @ $10 rshift $FF and >crypt ;
   118    118   
   119    119   enc-keccak
   120    120   
   121    121   : pk-off ( -- ) key-list $[]off ;
   122    122   
   123         -: vdhe, ( -- )   vsk vpk ed-keypair vpk keysize $, dhe ;
          123  +: vdhe, ( -- )   stskc stpkc ed-keypair stpkc keysize $, dhe ;
   124    124   : vkeys, ( key-list -- )
   125    125       vaultkey $100 erase
   126    126       enc-mode @ $FF and $20 - rng$ vkey state# move-rep
   127    127       vkey( ." vkey key: " vkey state# 85type forth:cr )
   128    128       enc-mode @ dup ulit, vault-crypt 8 rshift $FF and >crypt
   129         -    [: [: drop vsk swap keygendh ed-dh 2>r
          129  +    [: [: drop stskc swap keygendh ed-dh 2>r
   130    130   	    vkey vaultkey $10 + enc-mode @ $FF and $20 - move
   131    131   	    vaultkey enc-mode @ $FF and 2r> encrypt$
   132    132   	    vaultkey enc-mode @ $FF and forth:type ;] $[]map ;] $tmp
   133    133       $, vault-keys 0 >crypt ;
   134    134   : vdhe-keys, ( key-list -- )
   135    135       v-enc$ $, vault-dhe-keys  0 >crypt ;
   136    136   : vfile-in ( -- )

Changes to wiki/commands.md.

   353    353     if blockwise, there may be multiple parts
   354    354   * $23 vault-sig ( $:sig -- )
   355    355     the signature of the vault, using the keyed hash over the file
   356    356   * $24 vault-crypt ( n -- )
   357    357     set encryption mode and key wrap size
   358    358   * $25 vault-auth ( $:auth -- )
   359    359     block authentication, 64 byte block
          360  +* $26 vault-dhe-keys ( $:dhe+keys -- )
   360    361   
   361    362   ### message commands ###
   362    363   
   363    364   * $20 msg-start ( $:pksig -- )
   364    365     start message
   365    366   * $21 msg-tag ( $:tag -- )
   366    367     tagging (can be anywhere)
................................................................................
   410    411     join a chat group
   411    412   * $23 msg-leave ( $:group -- )
   412    413     leave a chat group
   413    414   * $24 msg-reconnect ( $:pubkey+addr -- )
   414    415     rewire distribution tree
   415    416   * $25 msg-last? ( start end n -- )
   416    417   * $26 msg-last ( $:[tick0,msgs,..tickn] n -- )
          418  +* $27 msg-key ( $:key -- )
   417    419   * $A msg-nestsig ( $:cmd+sig -- )
   418    420     check sig+nest
          421  +* $28 msg-nestencsig ( $:enc[cmd]+sig -- )
          422  +  decrypt, chech sig+nest
   419    423   
   420    424   ### DVCS patch commands ###
   421    425   
   422    426   DVCS metadata is stored in messages, containing message text, refs
   423    427   and patchset objects. Patchset objects are constructed in a way
   424    428   that makes identical transactions have the same hash.
   425    429