Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge fcd5d5a into 971757c
Browse files Browse the repository at this point in the history
  • Loading branch information
kealan committed Sep 2, 2019
2 parents 971757c + fcd5d5a commit 90e8d64
Show file tree
Hide file tree
Showing 18 changed files with 465 additions and 469 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -724,7 +724,7 @@ endif()

if(BUILD_PYTHON)
message(STATUS "Build Python wrappers")
add_subdirectory(wrappers/python)
add_subdirectory(python)
endif()

if(BUILD_TESTING)
Expand Down
40 changes: 16 additions & 24 deletions Dockerfile
@@ -1,32 +1,24 @@
FROM ubuntu:latest
FROM ubuntu:bionic

RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get install -y --no-install-recommends \
astyle \
ca-certificates \
RUN dpkg --add-architecture i386

# add repositories cache
RUN apt-get update -y

# install packages
RUN apt-get install -y \
build-essential \
cmake \
doxygen \
doxygen-latex \
g++ \
g++-multilib \
gcc \
git \
lcov \
make \
mingw-w64 \
parallel \
python-pip \
python-setuptools\
python3-pip \
python3-setuptools\
wine-stable \
mingw-w64 \
wine64 \
wine32 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& pip install \
autopep8 \
cffi \
wheel
lcov \
python3-dev \
python3-pip \
gcc-multilib

RUN pip3 install cffi autopep8

CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -243,7 +243,7 @@ format:
astyle --style=allman --recursive --suffix=none 'examples/*.c'
astyle --style=allman --recursive --suffix=none 'examples/*.c.in'
astyle --style=allman --recursive --suffix=none 'benchmark/*.c.in'
autopep8 --in-place --aggressive --aggressive ./wrappers/python/*.py.in
autopep8 --in-place --aggressive --aggressive ./python/*.py.in

# Remove any build artifact
clean:
Expand Down
32 changes: 22 additions & 10 deletions README.md
Expand Up @@ -57,17 +57,29 @@ The above packages can be installed in different ways, depending on the Operatin

```
sudo dpkg --add-architecture i386
sudo apt-get install -y astyle ca-certificates cmake doxygen doxygen-latex g++ \
g++-multilib gcc git lcov make mingw-w64 parallel python-pip python-setuptools\
python3-pip python3-setuptools wine-stable wine64
sudo pip install cffi autopep8
sudo pip3 install cffi
echo "add repositories cache"
sudo apt-get update -y
echo "install packages"
sudo apt-get install -y \
build-essential \
cmake \
doxygen \
parallel \
mingw-w64 \
wine64 \
wine32 \
lcov \
python3-dev \
python3-pip \
gcc-multilib
sudo pip3 install cffi autopep8
```

* **Fedora 30 Linux**

Python is not supported for this operating systems.

```
sudo dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/30/winehq.repo
sudo dnf install -y @development-tools cmake libffi-devel libasan parallel mingw64-gcc \
Expand Down Expand Up @@ -123,8 +135,8 @@ program. To build and run the example use this script;
NOTE: The default build is for 64 bit machines

```
git clone https://github.com/milagro-crypto/milagro-crypto-c
cd milagro-crypto-c
git clone https://github.com/apache/incubator-milagro-crypto-c.git
cd incubator-milagro-crypto-c
mkdir -p target/build
cd target/build
cmake ../..
Expand Down Expand Up @@ -182,7 +194,7 @@ make package
Start a command prompt as an administrator

```
git clone https://github.com/milagro-crypto/milagro-crypto-c
git clone https://github.com/apache/incubator-milagro-crypto-c.git
cd milagro-crypto-c
mkdir target\build
cd target\build
Expand Down
11 changes: 0 additions & 11 deletions cmake/PythonSiteDirs.cmake
Expand Up @@ -17,17 +17,6 @@

cmake_minimum_required(VERSION 3.1)

execute_process(COMMAND
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)

execute_process(COMMAND
python -c "from distutils.sysconfig import get_python_lib; from os.path import dirname; print dirname(get_python_lib())"
OUTPUT_VARIABLE PYTHON_SITE_LIB
)

execute_process(COMMAND
python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
OUTPUT_VARIABLE PYTHON3_SITE_PACKAGES
Expand Down
8 changes: 4 additions & 4 deletions examples/example_bls_ZZZ.c.in
Expand Up @@ -16,13 +16,13 @@ specific language governing permissions and limitations
under the License.
*/

/*
BLS example code.
/*
BLS example code.

Build executable after installation:

1. Change headers;

#include "bls_ZZZ.h" -> #include <amcl/bls_ZZZ.h>

2. Build code
Expand Down
40 changes: 20 additions & 20 deletions examples/example_bls_sss_ZZZ.c.in
Expand Up @@ -16,13 +16,13 @@ specific language governing permissions and limitations
under the License.
*/

/*
BLS Shamir Secret Sharing example code.
/*
BLS Shamir Secret Sharing example code.

Build executable after installation:

1. Change headers;

#include "bls_ZZZ.h" -> #include <amcl/bls_ZZZ.h>

2. Build code
Expand Down Expand Up @@ -82,7 +82,7 @@ int bls_sss(csprng *RNG)
octet X[n];
char y[n][BGS_ZZZ];
octet Y[n];

for(int i=0; i<n; i++)
{
memset(&y[i], 0, sizeof(y[i]));
Expand All @@ -94,7 +94,7 @@ int bls_sss(csprng *RNG)
X[i].len = BGS_ZZZ;
X[i].val = x[i];
}

// Generate key pair
BLS_ZZZ_KEY_PAIR_GENERATE(RNG,&SKI,&PKI);

Expand All @@ -115,7 +115,7 @@ int bls_sss(csprng *RNG)
if (rc!=BLS_OK)
{
printf("Error: Invalid Signature\n");
return 1;
return 1;
}
printf("Success: Signature is valid\n");

Expand All @@ -124,8 +124,8 @@ int bls_sss(csprng *RNG)
if (rc!=BLS_OK)
{
printf("Error: BLS_ZZZ_MAKE_SHARES\n");
return 1;
}
return 1;
}

for(int i=0; i<n; i++)
{
Expand All @@ -134,32 +134,32 @@ int bls_sss(csprng *RNG)
printf("Y[%d] ", i);
OCT_output(&Y[i]);
}

printf("SKO: ");
OCT_output(&SKO);

if (!OCT_comp(&SKI,&SKO))
{
printf("FAILURE SKI != SKO");
return 1;
}

// Recover BLS secret key
rc = BLS_ZZZ_RECOVER_SECRET(k, X, Y, &SKR);
if (rc!=BLS_OK)
{
printf("Error: BLS_ZZZ_RECOVER_SECRET\n");
return 1;
}
return 1;
}
printf("SKR: ");
OCT_output(&SKR);

if (!OCT_comp(&SKR,&SKO))
{
printf("FAILURE SKR != SKO");
return 1;
}

// Generate public keys and signatures using shares
char pks[n][G2LEN];
octet PKS[n];
Expand Down Expand Up @@ -197,17 +197,17 @@ int bls_sss(csprng *RNG)
if (rc!=BLS_OK)
{
printf("Error: BLS_ZZZ_RECOVER_SIGNATURE\n");
return 1;
}
return 1;
}
printf("SIGR: ");
OCT_output(&SIGR);

if (!OCT_comp(&SIGR,&SIGI))
{
printf("FAILURE SIGR != SIGI");
return 1;
}

return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions wrappers/python/CMakeLists.txt → python/CMakeLists.txt
Expand Up @@ -28,9 +28,9 @@ foreach(curve ${AMCL_CURVE})
amcl_configure_file_curve(TimeMPIN_ZZZ.py.in TimeMPIN_${TC}.py ${curve} __no_install)
amcl_configure_file_curve(TestMPINInstall_ZZZ.py.in TestMPINInstall_${TC}.py ${curve} __no_install)

install(FILES "${amcl_mpin_${TC}_GEN_PYS}" DESTINATION ${PYTHON_SITE_PACKAGES})
install(FILES "${amcl_mpin_${TC}_GEN_PYS}" DESTINATION ${PYTHON3_SITE_PACKAGES})

add_test(test_python_mpin_install_${TC} python TestMPINInstall_${TC}.py)
add_test(test_python_mpin_install_${TC} python3 TestMPINInstall_${TC}.py)

# Set the LD_LIBRARY_PATH or equivalent to the libraries can be
# loaded when running the test.
Expand All @@ -48,7 +48,7 @@ foreach(curve ${AMCL_CURVE})

if(TARGET amcl_wcc_${TC})
amcl_configure_file_curve(wcc_ZZZ.py.in wcc_${TC}.py ${curve} amcl_wcc_${TC}_GEN_PYS)
install(FILES "${amcl_wcc_${TC}_GEN_PYS}" DESTINATION ${PYTHON_SITE_PACKAGES})
install(FILES "${amcl_wcc_${TC}_GEN_PYS}" DESTINATION ${PYTHON3_SITE_PACKAGES})
endif()

if(TARGET amcl_bls_${TC})
Expand Down
File renamed without changes.

0 comments on commit 90e8d64

Please sign in to comment.