Browse Source

Forget yesterday's hack; just add an arch_config.h to each arch which says

how many bits it is.

Add batarch.map for eBATS architecture renaming.
master
Michael Hamburg 10 years ago
parent
commit
4433591cfc
11 changed files with 48 additions and 18 deletions
  1. +17
    -0
      HISTORY.txt
  2. +5
    -4
      Makefile
  3. +12
    -1
      TODO.txt
  4. +1
    -0
      src/arch_32/arch_config.h
  5. +1
    -0
      src/arch_arm_32/arch_config.h
  6. +1
    -0
      src/arch_neon/arch_config.h
  7. +1
    -0
      src/arch_neon_experimental/arch_config.h
  8. +1
    -0
      src/arch_ref64/arch_config.h
  9. +1
    -0
      src/arch_x86_64/arch_config.h
  10. +3
    -13
      src/include/word.h
  11. +5
    -0
      test/batarch.map

+ 17
- 0
HISTORY.txt View File

@@ -1,3 +1,20 @@
September 29, 2014:
Yesterday I put in some more architecture detection, but it should
really be based on the arch directory, because what's in there really
is a terrible hack.
I've tweaked the eBAT construction code to rename the architectures
using test/batarch.map. Maybe I should also rename them internally,
but not yet.
I added some new TODO.txt items. Some folks have been asking for a
more factored library, instead of this combined arithmetic, curve code,
encodings and protocol all-in-one jumble. Likewise the hash and RNG
should be flexible.
I've also been meaning to put more work in on SPAKE2EE, which would
also mean finalizing the Elligator code.

September 18, 2014:
Begin work on a "ref" implementation. Currently this is just the
arch_ref64 architecture. The ref implementation always weak_reduces


+ 5
- 4
Makefile View File

@@ -122,14 +122,15 @@ doc: Doxyfile doc/timestamp src/*.c src/include/*.h src/$(ARCH)/*.c src/$(ARCH)/

bat: $(BATNAME)

$(BATNAME): include/* src/* src/*/*
$(BATNAME): include/* src/* src/*/* test/batarch.map
rm -fr $@
for arch in src/arch*; do \
(while read arch where; do \
mkdir -p $@/`basename $$arch`; \
cp include/* src/*.c src/include/* $$arch/* $@/`basename $$arch`; \
cp include/*.h src/*.c src/include/*.h src/$$where/*.c src/$$where/*.h $@/`basename $$arch`; \
perl -p -i -e 's/.*endif.*GOLDILOCKS_CONFIG_H/#define SUPERCOP_WONT_LET_ME_OPEN_FILES 1\n\n$$&/' $@/`basename $$arch`/config.h; \
perl -p -i -e 's/SYSNAME/'`basename $(BATNAME)`_`basename $$arch`'/g' $@/`basename $$arch`/api.h; \
done
done \
) < test/batarch.map
echo 'Mike Hamburg' > $@/designers
echo 'Ed448-Goldilocks sign and dh' > $@/description


+ 12
- 1
TODO.txt View File

@@ -1,5 +1,16 @@
Important work items for Ed448-Goldilocks:

* Better architecture detection / factoring of arch-related headers.
[PROGRESS]

* Better factoring of high-level vs low-level library.

* Factor out hash, crandom from core library?

* Signed 32-bit NEON implementation to avoid bias/reduce after subtract



* Documentation: write high-level API docs, and internal docs to help
other implementors.
* Partial progress on Doxygenating the code.
@@ -59,7 +70,7 @@ Important work items for Ed448-Goldilocks:
* Scalarmul with other cofactor modes.

* High-level API:
* SPAKE2 Elligator Edition? Maybe write a paper first.
* SHA512 Elligator Edition? Maybe write a paper first.
* Elligator.
* Need to write Elligator inverse. Might not be Elligator-2S.


+ 1
- 0
src/arch_32/arch_config.h View File

@@ -0,0 +1 @@
#define WORD_BITS 32

+ 1
- 0
src/arch_arm_32/arch_config.h View File

@@ -0,0 +1 @@
#define WORD_BITS 32

+ 1
- 0
src/arch_neon/arch_config.h View File

@@ -0,0 +1 @@
#define WORD_BITS 32

+ 1
- 0
src/arch_neon_experimental/arch_config.h View File

@@ -0,0 +1 @@
#define WORD_BITS 32

+ 1
- 0
src/arch_ref64/arch_config.h View File

@@ -0,0 +1 @@
#define WORD_BITS 64

+ 1
- 0
src/arch_x86_64/arch_config.h View File

@@ -0,0 +1 @@
#define WORD_BITS 64

+ 3
- 13
src/include/word.h View File

@@ -5,6 +5,8 @@
#ifndef __WORD_H__
#define __WORD_H__

#include "arch_config.h"

/* for posix_memalign */
#define _XOPEN_SOURCE 600

@@ -26,18 +28,7 @@
#include <immintrin.h>
#endif

#if ((__SIZEOF_INT128__ == 16 \
|| 10*__clang_major__ + __clang_minor__ <= 32) \
&& __SIZEOF_SIZE_T__ == 8 \
&& (__SIZEOF_LONG__==8 || __POINTER_WIDTH__==64) \
&& !defined(GOLDI_FORCE_32_BIT))
/* It's a 64-bit machine if:
* __uint128_t exists
* size_t is 64 bits
* Either longs are 64-bits (doesn't happen on Windows)
* or pointers are 64-bits (doesn't happen on 32/64 arches)
* FUTURE: validate this hack on more architectures.
*/
#if (WORD_BITS == 64)
typedef uint32_t hword_t;
typedef uint64_t word_t;
typedef __uint128_t dword_t;
@@ -67,7 +58,6 @@ typedef int64_t dsword_t;
#define GOLDI_BITS 32
#endif

#define WORD_BITS (sizeof(word_t) * 8)
#define DIV_CEIL(_x,_y) (((_x) + (_y) - 1)/(_y))
#define ROUND_UP(_x,_y) (DIV_CEIL((_x),(_y))*(_y))
#define WORDS_FOR_BITS(_x) (DIV_CEIL((_x),WORD_BITS))


+ 5
- 0
test/batarch.map View File

@@ -0,0 +1,5 @@
neon arch_neon_experimental
arm32 arch_arm_32
64 arch_ref64
32 arch_32
amd64 arch_x86_64

Loading…
Cancel
Save