Check-in [90b0958714]
Not logged in

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

Overview
Comment:Improve haves
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 90b0958714a0cbfd1d3a1598423116c38c807cc1
User & Date: bernd 2020-01-12 21:09:56.541
Context
2020-01-12
21:38
Add ARMv8 neon implementation check-in: 8761eb293a user: bernd tags: trunk
21:09
Improve haves check-in: 90b0958714 user: bernd tags: trunk
2020-01-09
18:52
Fix ihave, problem check-in: 136a37fd0f user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.in.
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
datarootdir = @datarootdir@
datadir   = $(package)@datadir@
srcdir    = @srcdir@
bindir    = $(package)@bindir@
libdir = $(package)@libdir@
LIBCCDEST = $(libdir)/gforth/$(GFVER)/$(machine)/libcc-named
libccdir = $(subst $(package),,$(LIBCCDEST))
LIBS 	 = keccak threefish ed25519-donna bdelta
MKDIR	 = mkdir
RMDIR	 = rm -rf
GCC	 = gcc
LIBTOOL	 = @GNU_LIBTOOL@
CFLAGS	 = -O3 -fomit-frame-pointer
HOST     = 
FAST     = @FAST@







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
datarootdir = @datarootdir@
datadir   = $(package)@datadir@
srcdir    = @srcdir@
bindir    = $(package)@bindir@
libdir = $(package)@libdir@
LIBCCDEST = $(libdir)/gforth/$(GFVER)/$(machine)/libcc-named
libccdir = $(subst $(package),,$(LIBCCDEST))
LIBS 	 = keccakp threefish ed25519-donna bdelta
MKDIR	 = mkdir
RMDIR	 = rm -rf
GCC	 = gcc
LIBTOOL	 = @GNU_LIBTOOL@
CFLAGS	 = -O3 -fomit-frame-pointer
HOST     = 
FAST     = @FAST@
Changes to debian/control.in.
33
34
35
36
37
38
39
40
41
42
43
44
45
 others will follow.
 .
 This package is optional and contains the tests.

Package: @PACKAGE_NAME@-libcc
Version: @PACKAGE_VERSION@
Architecture: any
Depends: gforth (>= @GFDEBVER@), keccak, threefish, ed25519-prim, bdelta
Description: @PACKAGE_NAME@ protocol stack
 net2o reinvents the Internet.  Applications include file copy, chat, DHT;
 others will follow.
 .
 These are the architectural dependent C bindings







|





33
34
35
36
37
38
39
40
41
42
43
44
45
 others will follow.
 .
 This package is optional and contains the tests.

Package: @PACKAGE_NAME@-libcc
Version: @PACKAGE_VERSION@
Architecture: any
Depends: gforth (>= @GFDEBVER@), keccakp, threefish, ed25519-prim, bdelta
Description: @PACKAGE_NAME@ protocol stack
 net2o reinvents the Internet.  Applications include file copy, chat, DHT;
 others will follow.
 .
 These are the architectural dependent C bindings
Changes to keccak.fs.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require rec-scope.fs
require unix/cpu.fs

fast-lib [IF]
    require keccakfast.fs false
[ELSE]
    [IFDEF] android
	s" libkeccak.so" c-lib:open-path-lib drop
    [THEN] true
[THEN]
[IF]
    c-library keccak
	s" keccak" add-lib
	include keccaklib.fs
    end-c-library
[THEN]

[IFUNDEF] crypto bye [THEN] \ stop here if libcompile only

25 8 * Constant keccak#







|




|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require rec-scope.fs
require unix/cpu.fs

fast-lib [IF]
    require keccakfast.fs false
[ELSE]
    [IFDEF] android
	s" libkeccakp.so" c-lib:open-path-lib drop
    [THEN] true
[THEN]
[IF]
    c-library keccak
	s" keccakp" add-lib
	include keccaklib.fs
    end-c-library
[THEN]

[IFUNDEF] crypto bye [THEN] \ stop here if libcompile only

25 8 * Constant keccak#
Changes to keccakfast.fs.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
\ GNU Affero General Public License for more details.

\ You should have received a copy of the GNU Affero General Public License
\ along with this program.  If not, see <http://www.gnu.org/licenses/>.

require rec-scope.fs
[IFDEF] android
    s" libkeccakfast.so" c-lib:open-path-lib drop
[THEN]

c-library keccakfast
    s" keccakfast" add-lib
    include keccaklib.fs
end-c-library







|



|


13
14
15
16
17
18
19
20
21
22
23
24
25
26
\ GNU Affero General Public License for more details.

\ You should have received a copy of the GNU Affero General Public License
\ along with this program.  If not, see <http://www.gnu.org/licenses/>.

require rec-scope.fs
[IFDEF] android
    s" libkeccakpfast.so" c-lib:open-path-lib drop
[THEN]

c-library keccakfast
    s" keccakpfast" add-lib
    include keccaklib.fs
end-c-library
Name change from keccak/AUTHORS to keccakp/AUTHORS.
Name change from keccak/COPYING to keccakp/COPYING.
Name change from keccak/ChangeLog to keccakp/ChangeLog.
Name change from keccak/Keccak-avr8-settings.h to keccakp/Keccak-avr8-settings.h.
Name change from keccak/Keccak-avr8-util.h to keccakp/Keccak-avr8-util.h.
Name change from keccak/Keccak-avr8.h to keccakp/Keccak-avr8.h.
Name change from keccak/Keccak-compact-settings.h to keccakp/Keccak-compact-settings.h.
Name change from keccak/Keccak-compact.h to keccakp/Keccak-compact.h.
Name change from keccak/Keccak-compact8-settings.h to keccakp/Keccak-compact8-settings.h.
Name change from keccak/Keccak-compact8.h to keccakp/Keccak-compact8.h.
Name change from keccak/KeccakF-1600-32-rvk.macros to keccakp/KeccakF-1600-32-rvk.macros.
Name change from keccak/KeccakF-1600-32-s1.macros to keccakp/KeccakF-1600-32-s1.macros.
Name change from keccak/KeccakF-1600-32-s2.macros to keccakp/KeccakF-1600-32-s2.macros.
Name change from keccak/KeccakF-1600-32.macros to keccakp/KeccakF-1600-32.macros.
Name change from keccak/KeccakF-1600-64.macros to keccakp/KeccakF-1600-64.macros.
Name change from keccak/KeccakF-1600-inplace-armgcc-ARMv7A-NEON.s to keccakp/KeccakF-1600-inplace-armgcc-ARMv7A-NEON.s.
Name change from keccak/KeccakF-1600-int-set.h to keccakp/KeccakF-1600-int-set.h.
Name change from keccak/KeccakF-1600-interface.h to keccakp/KeccakF-1600-interface.h.
Name change from keccak/KeccakF-1600-neon.c to keccakp/KeccakF-1600-neon.c.
Name change from keccak/KeccakF-1600-opt32-settings.h to keccakp/KeccakF-1600-opt32-settings.h.
Name change from keccak/KeccakF-1600-opt32.c to keccakp/KeccakF-1600-opt32.c.
Name change from keccak/KeccakF-1600-opt64-settings.h to keccakp/KeccakF-1600-opt64-settings.h.
Name change from keccak/KeccakF-1600-opt64.c to keccakp/KeccakF-1600-opt64.c.
Name change from keccak/KeccakF-1600-reference.h to keccakp/KeccakF-1600-reference.h.
Name change from keccak/KeccakF-1600-simd128.macros to keccakp/KeccakF-1600-simd128.macros.
Name change from keccak/KeccakF-1600-simd64.macros to keccakp/KeccakF-1600-simd64.macros.
Name change from keccak/KeccakF-1600-unrolling.macros to keccakp/KeccakF-1600-unrolling.macros.
Name change from keccak/KeccakF-1600-xop.macros to keccakp/KeccakF-1600-xop.macros.
Name change from keccak/KeccakF-1600.h to keccakp/KeccakF-1600.h.
Name change from keccak/KeccakNISTInterface.h to keccakp/KeccakNISTInterface.h.
Name change from keccak/Makefile.am to keccakp/Makefile.am.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Automake file for keccak

## Place generated object files (.o) into the same directory as their source
## files, in order to avoid collisions when non-recursive make is used.
AUTOMAKE_OPTIONS = subdir-objects

## Additional flags to pass to aclocal when it is invoked automatically at
## make time. The ${ACLOCAL_FLAGS} variable is picked up from the environment
## to provide a way for the user to supply additional arguments.
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

## Set the default command-line flags for the C preprocessor to the value
## obtained from pkg-config via PKG_CHECK_MODULES in configure.ac.  These
## flags are passed to the compiler for both C and C++, in addition to the
## language-specific options.
AM_CPPFLAGS = $(EXAMPLE_CFLAGS)

lib_LTLIBRARIES = libkeccak.la
if FAST
lib_LTLIBRARIES += libkeccakfast.la
if ASM
libkeccakfast_la_SOURCES = KeccakF-1600-@as@.s KeccakF-1600-@plattform@.c
else
libkeccakfast_la_SOURCES = KeccakF-1600-@ws@.c
endif
libkeccak_la_SOURCES = KeccakF-1600-@ws@.c
else
if ASM
libkeccak_la_SOURCES = KeccakF-1600-@as@.s KeccakF-1600-@plattform@.c
else
libkeccak_la_SOURCES = KeccakF-1600-@ws@.c
endif
endif
include_HEADERS = KeccakF-1600.h
libkeccak_la_LIBADD = 
libkeccak_la_LDFLAGS = -version-info ${VERSION} -no-undefined
libkeccak_la_CFLAGS = @flags@
libkeccak_la_CCASFLAGS = @asmflags@
libkeccakfast_la_LIBADD = 
libkeccakfast_la_CFLAGS = @fastflags@
libkeccakfast_la_CCASFLAGS = @fastasmflags@
libkeccakfast_la_LDFLAGS = -version-info ${VERSION} -no-undefined

install-exec-hook:
	-/sbin/ldconfig $(libdir)
|
















|

|

|

|

|


|

|



|
|
|
|
|
|
|
|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Automake file for keccak primitives

## Place generated object files (.o) into the same directory as their source
## files, in order to avoid collisions when non-recursive make is used.
AUTOMAKE_OPTIONS = subdir-objects

## Additional flags to pass to aclocal when it is invoked automatically at
## make time. The ${ACLOCAL_FLAGS} variable is picked up from the environment
## to provide a way for the user to supply additional arguments.
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

## Set the default command-line flags for the C preprocessor to the value
## obtained from pkg-config via PKG_CHECK_MODULES in configure.ac.  These
## flags are passed to the compiler for both C and C++, in addition to the
## language-specific options.
AM_CPPFLAGS = $(EXAMPLE_CFLAGS)

lib_LTLIBRARIES = libkeccakp.la
if FAST
lib_LTLIBRARIES += libkeccakpfast.la
if ASM
libkeccakpfast_la_SOURCES = KeccakF-1600-@as@.s KeccakF-1600-@plattform@.c
else
libkeccakpfast_la_SOURCES = KeccakF-1600-@ws@.c
endif
libkeccakp_la_SOURCES = KeccakF-1600-@ws@.c
else
if ASM
libkeccakp_la_SOURCES = KeccakF-1600-@as@.s KeccakF-1600-@plattform@.c
else
libkeccakp_la_SOURCES = KeccakF-1600-@ws@.c
endif
endif
include_HEADERS = KeccakF-1600.h
libkeccakp_la_LIBADD = 
libkeccakp_la_LDFLAGS = -version-info ${VERSION} -no-undefined
libkeccakp_la_CFLAGS = @flags@
libkeccakp_la_CCASFLAGS = @asmflags@
libkeccakpfast_la_LIBADD = 
libkeccakpfast_la_CFLAGS = @fastflags@
libkeccakpfast_la_CCASFLAGS = @fastasmflags@
libkeccakpfast_la_LDFLAGS = -version-info ${VERSION} -no-undefined

install-exec-hook:
	-/sbin/ldconfig $(libdir)
Name change from keccak/Makefile.android to keccakp/Makefile.android.
Name change from keccak/Makefile.forth to keccakp/Makefile.forth.
Name change from keccak/NEWS to keccakp/NEWS.
Name change from keccak/README to keccakp/README.
Name change from keccak/autogen.sh to keccakp/autogen.sh.
Name change from keccak/brg_endian.h to keccakp/brg_endian.h.
Name change from keccak/configure.ac to keccakp/configure.ac.
1
2
3
4
5
6
7
8
9
10
## keccac Autoconf

AC_INIT([KECCAK], [3:4], [bernd@net2o.de], [keccak for Linux],
        [http://keccak.noekeon.org/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 -Wall no-define])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])

CFLAGS=${CFLAGS--O3}


|







1
2
3
4
5
6
7
8
9
10
## keccac Autoconf

AC_INIT([keccakp], [3:4], [bernd@net2o.de], [keccak primitives],
        [http://keccak.noekeon.org/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 -Wall no-define])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])

CFLAGS=${CFLAGS--O3}
Name change from keccak/crypto_hash.h to keccakp/crypto_hash.h.
Name change from keccak/debian/changelog to keccakp/debian/changelog.
1
2
3
4
5
keccak (3.3) stable; urgency=low

  * Initial Release

 -- Bernd Paysan <bernd@net2o.de>  Fri, 08 Jan 2016 00:15:15 +0100
|




1
2
3
4
5
keccakp (3.4) stable; urgency=low

  * Initial Release

 -- Bernd Paysan <bernd@net2o.de>  Fri, 08 Jan 2016 00:15:15 +0100
Name change from keccak/debian/compat to keccakp/debian/compat.
Name change from keccak/debian/control to keccakp/debian/control.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Source: keccak
Section: programming
Priority: optional
Maintainer: Bernd Paysan <bernd@net2o.de>
Build-Depends: debhelper, build-essential, gcc, autoconf, automake, libtool, libtool-bin, libc

Package: keccak
Version: 3.2
Architecture: any
Depends: ${shlibs:Depends}
Multi-Arch: same
Description: Keccak
 Keccak is the crypto primitive for SHA-3, but also can be used for
 authenticated en- and decryption (AEAD).
|





|




|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
Source: keccakp
Section: programming
Priority: optional
Maintainer: Bernd Paysan <bernd@net2o.de>
Build-Depends: debhelper, build-essential, gcc, autoconf, automake, libtool, libtool-bin, libc

Package: keccakp
Version: 3.2
Architecture: any
Depends: ${shlibs:Depends}
Multi-Arch: same
Description: Keccak Primitives
 Keccak is the crypto primitive for SHA-3, but also can be used for
 authenticated en- and decryption (AEAD).
Name change from keccak/debian/rules to keccakp/debian/rules.
Name change from keccak/displayIntermediateValues.h to keccakp/displayIntermediateValues.h.
Name change from keccak/keccak-fsi.c to keccakp/keccak-fsi.c.
Name change from keccak/keccak.fs to keccakp/keccak.fs.
Name change from keccak/keccak.i to keccakp/keccak.i.
Name change from keccak/libforth to keccakp/libforth.
Name change from keccak/libforth.android to keccakp/libforth.android.
Changes to msg.fs.
566
567
568
569
570
571
572
573
574
575

576
577
578






579
580
581
582



583
584
585
586
587
588

589
590
591
592
593
594
595
596

597
598
599
600
601
602
603
event: :>hash-finished { d: hash -- }
    hash fetch-finish# #@ IF
	@ >r hash r@ execute r> >addr free throw
	last# bucket-off
    ELSE  drop  THEN
    hash >ihave  hash drop free throw ;

: fetch-queue { tsk w^ want# -- }
    want# tsk [{: tsk :}l { item }
	item $@ $8 $E pk-connect? IF  +resend +flow-control

	    item cell+ $@ bounds U+DO
		net2o-code expect+slurp $10 blocksize! $A blockalign!
		I' I keysize $10 * + umin I U+DO






		    I keysize net2o:copy#
		    I keysize save-mem tsk [{: d: hash tsk :}h
			<event hash e$, :>hash-finished tsk event> ;]
		    lastfile@ >o to file-xt o>



		keysize +LOOP
		end-code| net2o:close-all
	    keysize $10 *  +LOOP
	    disconnect-me
	THEN ;] #map
    want# #frees ;


event: :>fetch-queue fetch-queue ;

: transmit-queue ( queue -- )
    { w^ queue[] | w^ want# }
    queue[] want# [{: want# :}l 2dup ihave# #@ dup IF
	    cell/ 1- rng cells + $@
	    want# #+!

	ELSE  2drop 2drop  THEN ;] $[]map
    queue[] $[]free
    <event up@ elit, want# @ elit, :>fetch-queue ?query-task event> ;

Variable queue?
event: :>queued ( queue -- )
    [: 0 fetch-queue[] !@ queue? off ;] resize-sema c-section







|
|

>


|
>
>
>
>
>
>
|
|
|
|
>
>
>


|


|
>






|
|
>







566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
event: :>hash-finished { d: hash -- }
    hash fetch-finish# #@ IF
	@ >r hash r@ execute r> >addr free throw
	last# bucket-off
    ELSE  drop  THEN
    hash >ihave  hash drop free throw ;

: fetch-queue 0 .pk.host $make { tsk w^ want# w^ pk$ -- }
    want# tsk pk$ [{: tsk pk$ :}l { item }
	item $@ $8 $E pk-connect? IF  +resend +flow-control
	    { | hashs }
	    item cell+ $@ bounds U+DO
		net2o-code expect+slurp $10 blocksize! $A blockalign!
		I' I U+DO
		    I keysize ihave# $@ dup IF
			0 -rot bounds U+DO
			    I $@ pk$ $@ str= or
			cell +LOOP
		    ELSE  2drop true  THEN
		    IF
			I keysize net2o:copy#
			I keysize save-mem tsk [{: d: hash tsk :}h
			    <event hash e$, :>hash-finished tsk event> ;]
			lastfile@ >o to file-xt o>
			1 +to hashs
		    THEN
		    hashs $10 u>= ?LEAVE
		keysize +LOOP
		end-code| net2o:close-all
	    keysize hashs *  0 to hashs  +LOOP
	    disconnect-me
	THEN ;] #map
    want# #frees
    pk$ $free ;

event: :>fetch-queue fetch-queue ;

: transmit-queue ( queue -- )
    { w^ queue[] | w^ want# }
    queue[] want# [{: want# :}l 2dup ihave# #@ dup IF
	    bounds U+DO
		2dup I $@ want# #+!
	    cell +LOOP  2drop
	ELSE  2drop 2drop  THEN ;] $[]map
    queue[] $[]free
    <event up@ elit, want# @ elit, :>fetch-queue ?query-task event> ;

Variable queue?
event: :>queued ( queue -- )
    [: 0 fetch-queue[] !@ queue? off ;] resize-sema c-section
894
895
896
897
898
899
900
901
902




903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919

920
921
922
923
924
925
926
' context-table is gen-table

also }scope

\ serialize hashes

: msg-serialize-hash ( -- )
    { | w^ want# }
    ?hashs[] want# [{: want# :}l




	2dup ihave# #@ dup IF
	    bounds U+DO
		2dup I $@ want# #+!
	    cell +LOOP  2drop
	ELSE  2drop
	    2dup need-hashed? IF  2drop   ELSE  
		0 .pk.host
		2over 2over 2swap ihave# #!ins[]
		want# #+!
	    THEN
	THEN
    ;] $[]map
    want# [:
	msg( dup $@ .@host.id ." : " dup cell+ $@ 85type forth:cr )
	dup cell+ $@ $, $@ $, msg-ihave ;] #map
    ?hashs[] $[]free
    want# #frees ;


msging-table $save

: msg-reply ( tag -- )
    ." got reply " hex. pubkey $@ key>nick forth:type forth:cr ;
: expect-msg ( o:connection -- )
    reply( ['] msg-reply )else( ['] drop ) expect-reply-xt +chat-control ;







|
|
>
>
>
>



|
|
|
<
<
<
<
<





|
>







906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924





925
926
927
928
929
930
931
932
933
934
935
936
937
938
' context-table is gen-table

also }scope

\ serialize hashes

: msg-serialize-hash ( -- )
    0 .pk.host $make { w^ pk$ | w^ want# }
    ?hashs[] want# pk$ [{: want# pk$ :}l
	2dup need-hashed? 0= IF
	    pk$ $@ 2over ihave# #!ins[]
	    2dup pk$ $@ want# #+!
	THEN
	2dup ihave# #@ dup IF
	    bounds U+DO
		2dup I $@ want# #+!
	    cell +LOOP
	ELSE  2drop  THEN
	2drop





    ;] $[]map
    want# [:
	msg( dup $@ .@host.id ." : " dup cell+ $@ 85type forth:cr )
	dup cell+ $@ $, $@ $, msg-ihave ;] #map
    ?hashs[] $[]free
    want# #frees
    pk$ $free ;

msging-table $save

: msg-reply ( tag -- )
    ." got reply " hex. pubkey $@ key>nick forth:type forth:cr ;
: expect-msg ( o:connection -- )
    reply( ['] msg-reply )else( ['] drop ) expect-reply-xt +chat-control ;