This commit is contained in:
Patrick Longa 2017-05-09 10:27:33 -07:00 коммит произвёл GitHub
Родитель 989d28ff87
Коммит caeb99f1e6
1 изменённых файлов: 43 добавлений и 64 удалений

Просмотреть файл

@ -1,102 +1,81 @@
FourQlib v3.0 (C Edition)
=========================
32-bit implementation
===============================
# FourQlib v3.0 (C Edition)
# 32-bit implementation
1. CONTENTS:
--------
## Contents
The "FourQ_32bit" folder contains:
The `FourQ_32bit` folder contains:
Visual Studio/FourQ/ - Folder with Visual Studio 2015 solution and project files for compilation
in Windows.
Visual Studio/fp_tests/ - Folder with Visual Studio project files for testing field arithmetic functions
in Windows.
Visual Studio/ecc_tests/ - Folder with Visual Studio project files for testing ECC functions in Windows.
Visual Studio/crypto_tests/ - Folder with Visual Studio project files for testing cryptographic functions,
specifically key exchange and signatures, in Windows.
makefile - Makefile for compilation using GNU GCC or clang compilers on Linux.
*.c, *.h - Library and header files. Public API for ECC scalar multiplication, key
exchange and signatures is located in FourQ_api.h
generic/ - Folder with library files for 32-bit implementation.
random/ - Folder with pseudo-random generation functions.
sha512/ - Folder with SHA-512 implementation.
tests/ - Test files.
README.txt - This readme file.
* Visual Studio/FourQ/: folder with Visual Studio 2015 solution and project files for compilation in Windows.
* Visual Studio/fp_tests/: folder with Visual Studio project files for testing field arithmetic functions in Windows.
* Visual Studio/ecc_tests/: folder with Visual Studio project files for testing ECC functions in Windows.
* Visual Studio/crypto_tests/: folder with Visual Studio project files for testing cryptographic functions, specifically key exchange and signatures, in Windows.
* makefile: Makefile for compilation using GNU GCC or clang compilers on Linux.
* Main .c and .h files: library and header files. Public API for ECC scalar multiplication, key exchange and signatures is located in FourQ_api.h
* generic/: folder with library files for 32-bit implementation.
* tests/: test files.
* README.md: this readme file.
2. SUPPORTED PLATFORMS:
-------------------
## Supported platforms
This implementation is supported on 32-bit platforms such as x86 and ARM-based processors running Windows or Linux. We have tested the library with Microsoft Visual Studio 2015, GNU GCC v4.9 and clang v3.8.
This implementation is supported on 32-bit platforms such as x86 and ARM-based processors running Windows or
Linux OS. We have tested the library with Microsoft Visual Studio 2015, GNU GCC v4.9 and clang v3.8.
See instructions below to choose an implementation option and compile on one of the supported platforms.
3. COMPLEMENTARY CRYPTO FUNCTIONS:
------------------------------
## Complementary crypto functions
Random values are generated with /dev/urandom in the case of Linux, and with the function BCryptGenRandom()
in the case of Windows.
Random values are generated with `/dev/urandom` in the case of Linux, and with the function `BCryptGenRandom()` in the case of Windows.
The library includes an implementation of SHA-512 which is used by default by SchnorrQ signatures.
Users can experiment with different options by replacing functions in the folders "random" and "sha512" and
applying the corresponding changes to the settings in FourQ.h.
Users can experiment with different options by replacing functions in the [`random`](random/) and [`sha512`](sha512/) folders and
applying the corresponding changes to the settings in [`FourQ_32bit\FourQ.h`](FourQ_32bit\FourQ.h).
4. INSTRUCTIONS FOR WINDOWS OS:
---------------------------
## Instructions for Windows
BUILDING THE LIBRARY WITH VISUAL STUDIO:
---------------------------------------
### Building the library with Visual Studio
Open the solution file (FourQ.sln) in Visual Studio 2015, select the "Generic" configurations from the
Solution Configurations menu (Win32 should appear as Solution Platform).
Open the solution file ([`FourQ.sln`](FourQ_32bit\Visual Studio\FourQ\FourQ.sln)) in Visual Studio 2015, select the "Generic" configurations from the Solution Configurations menu (Win32 should appear as Solution Platform).
By default, USE_ENDO=true is defined. To modify this configuration, go to the property window of the FourQ
project, go to Configuration Properties > C/C++ > Preprocessor. Make any suitable changes, e.g., USE_ENDO=true
or false. Repeat these steps for the fp_tests, ecc_tests and crypto_tests projects.
By default, `USE_ENDO=true` is defined. To modify this configuration, go to the property window of the FourQ project, go to `Configuration Properties > C/C++ > Preprocessor`. Make any suitable changes, e.g., `USE_ENDO=true` or `false`. Repeat these steps for the `fp_tests`, `ecc_tests` and `crypto_tests` projects.
Finally, select "Build Solution" from the "Build" menu.
RUNNING THE TESTS:
-----------------
### Running the tests
After building the solution, run fp_tests.exe, ecc_tests.exe and crypto_tests.exe.
After building the solution, run `fp_tests.exe`, `ecc_tests.exe` and `crypto_tests.exe`.
USING THE LIBRARY:
-----------------
### Using the library
After building the solution, add the FourQ.lib file to the set of References for a project, and add FourQ.h
and FourQ_api.h to the list of Header Files of a project.
After building the solution, add the `FourQ.lib` file to the set of References for a project, and add [`FourQ.h`](FourQ_32bit\FourQ.h) and [`FourQ_api.h`](FourQ_32bit\FourQ_api.h) to the list of header files of a project.
## Instructions for Linux
5. INSTRUCTIONS FOR LINUX OS:
-------------------------
### Building the library and executing the tests with GNU GCC or clang
BUILDING THE LIBRARY AND EXECUTING THE TESTS WITH GNU GCC OR CLANG:
------------------------------------------------------------------
To compile on Linux using the GNU GCC compiler or the clang compiler, execute the following command from the
command prompt:
To compile on Linux using the GNU GCC compiler or the clang compiler, execute the following command from the command prompt:
make ARCH=[x86/ARM] CC=[gcc/clang] USE_ENDO=[TRUE/FALSE] EXTENDED_SET=[TRUE/FALSE] CACHE_MEM=[TRUE/FALSE]
```sh
$ make ARCH=[x86/ARM] CC=[gcc/clang] USE_ENDO=[TRUE/FALSE] EXTENDED_SET=[TRUE/FALSE] CACHE_MEM=[TRUE/FALSE]
```
After compilation, run fp_tests, ecc_tests or crypto_tests.
After compilation, run `fp_tests`, `ecc_tests` or `crypto_tests`.
By default GNU GCC is used, as well as endomorphisms and extended settings. Similarly, CACHE_MEM=TRUE is set
by default indicating that the targeted platform contains a cache memory.
By default GNU GCC is used, as well as endomorphisms and extended settings. Similarly, `CACHE_MEM=TRUE` is set by default indicating that the targeted platform contains a cache memory.
For example, to compile using clang with the efficient endomorphisms on an x86 machine, execute:
make ARCH=x86 CC=clang
```sh
$ make ARCH=x86 CC=clang
```
As another example, to compile using GNU GCC with the efficient endomorphisms on an ARM machine, execute:
make ARCH=ARM
```sh
$ make ARCH=ARM
```
By default EXTENDED_SET is enabled, which sets the following compilation flags: -fwrapv -fomit-frame-pointer
-march=native. To disable this, use EXTENDED_SET=FALSE.
Users are encouraged to experiment with the different flag options.
By default `EXTENDED_SET` is enabled, which sets the following compilation flags: `-fwrapv -fomit-frame-pointer -march=native`. To disable this, use `EXTENDED_SET=FALSE`. Users are encouraged to experiment with the different flag options.