hyperledger / iroha-ed25519 Goto Github PK
View Code? Open in Web Editor NEWRFC8032 compatible Ed25519 implementation with pluggable hash (sha2-512, sha3-512)
Home Page: https://wiki.hyperledger.org/display/iroha
License: Apache License 2.0
RFC8032 compatible Ed25519 implementation with pluggable hash (sha2-512, sha3-512)
Home Page: https://wiki.hyperledger.org/display/iroha
License: Apache License 2.0
Project consists of 3 subprojects: EDIMPL, HASH, RANDOM. Each of subprojects can have many implementations. The task is to produce single SHARED
library, which is a result of merging of 3 subprojects.
We consider two clients of this repository:
libed25519.so
, which consists of selected implementations. Nothing else should be built.We can't just define all targets and add them to all
target (usual make
), because it is likely that some combinations will work on client (1) and some will not (example is EDIMPL=amd64-64-24k-pic
on MAC, it will not work). make install
for such client will fail.
From the other side, client (2) can typically build all targets or almost all targets -- it has all dependencies (such as openssl) and it has proper architecture (amd64).
Define every implementation as OBJECT library and include OBJECT library in every dependent target. Client specifies EDIMPL, HASH, RANDOM and combination of these libraries is built together in single SHARED ed25519.
Problems:
Define every implementation as STATIC library.
Problems:
resulting SHARED library will not contain symbols of STATIC libraries.
above problem can be solved with flag -Wl,--whole-archive ${lib1} ${lib2} ${lib3} -Wl,--no-whole-archive
. But in this case this error appears:
/usr/bin/ld: lib/ed25519/amd64-64-24k/CMakeFiles/amd64-64-24k.dir/fe25519_mul.s.o: relocation R_X86_64_32S against `crypto_sign_ed25519_amd64_64_38' can not be used when making a shared object; recompile with -fPIC
lib/ed25519/amd64-64-24k/CMakeFiles/amd64-64-24k.dir/fe25519_mul.s.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/ed25519.dir/build.make:211: recipe for target 'libed25519.so.1.2.2' failed
even when everything is built with -fPIC
.
And above problem again can be solved with something like linker exportmap:
https://github.com/hyperledger/iroha-ed25519/blob/master/src/CMakeLists.txt#L14-L16
https://github.com/hyperledger/iroha-ed25519/blob/master/exportmap
But, exactly this solution is not portable -- only Linux ld
can use exportmap.
Append all sources to a variable and use them in single ed25519 target as it is done here:
https://github.com/hyperledger/iroha-ed25519/blob/master/src/CMakeLists.txt#L8-L32
Problems:
--whole-archive
.set -e
git clone git://github.com/hyperledger/iroha-ed25519.git /tmp/ed25519
cd /tmp/ed25519
cmake -DCMAKE_BUILD_TYPE=Release -DTESTING=OFF -H/tmp/ed25519 -B/tmp/ed25519/build
cmake --build /tmp/ed25519/build --target install
Log
Cloning into 'C:/Users/ADMINI~1/AppData/Local/Temp/2/ed25519'...
remote: Counting objects: 817, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 817 (delta 0), reused 3 (delta 0), pack-reused 810
Receiving objects: 100% (817/817), 1.19 MiB | 2.22 MiB/s, done.
Resolving deltas: 100% (357/357), done.
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.14393.
-- The C compiler identification is MSVC 19.13.26132.0
-- The CXX compiler identification is MSVC 19.13.26132.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x86/cl.exe
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
-- EDIMPL=ref10 is selected (Ed25519 implementation)
-- HASH=sha3_brainhub is selected (SHA implementation)
-- RANDOM=dev_urandom is selected (RNG implementation)
-- BUILD=SHARED is selected (library build type)
-- CMAKE_BUILD_TYPE=Release is selected (cmake build type)
-- [ed25519] Target EDIMPL=amd64-64-24k is not supported on your platform
-- [ed25519] Target EDIMPL=amd64-64-24k-pic is not supported on your platform
-- [ed25519] Target RANDOM=dev_random is not supported on your platform
-- [ed25519] Target RANDOM=dev_urandom is not supported on your platform
-- [ed25519] Target HASH=sha2_openssl is not supported on your platform
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Administrator/AppData/Local/Temp/2/ed25519/build
Microsoft (R) Build Engine version 15.6.85.37198 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 6/13/2018 2:38:59 PM.
Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\install.vcxpr oj" on node 1 (default targets).
Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\install.vcxpr oj" (1) is building "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\Z ERO_CHECK.vcxproj" (2) on node 1 (default targets).
InitializeBuildStatus:
Creating "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "A lwaysCreate" was specified.
CustomBuild:
All outputs are up-to-date.
FinalizeBuildStatus:
Deleting file "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
Touching "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \ZERO_CHECK.vcxproj" (default targets).
Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\install.vcxpr oj" (1) is building "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\A LL_BUILD.vcxproj" (3) on node 1 (default targets).
Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ALL_BUILD.vcx proj" (3) is building "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \ed25519.vcxproj" (4) on node 1 (default targets).
Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ed25519.vcxpr oj" (4) is building "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\l ib\ed25519\ref10\ref10.vcxproj" (5) on node 1 (default targets).
InitializeBuildStatus:
Touching "ref10.dir\Debug\ref10.tlog\unsuccessfulbuild".
CustomBuild:
All outputs are up-to-date.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\1 4.13.26128\bin\HostX86\x86\CL.exe /c /IC:\Users\Administrator\AppData\Local\Temp \2\ed25519\build /IC:\Users\Administrator\AppData\Local\Temp\2\ed25519\include / IC:\Users\Administrator\AppData\Local\Temp\2\ed25519\lib\ed25519\ref10 /IC:\User s\Administrator\AppData\Local\Temp\2\ed25519\lib\ed25519\ref10\C:\Users\Administ rator\AppData\Local\Temp\2\ed25519\build /Zi /nologo /W3 /WX- /diagnostics:class ic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D ed25519_EXPORTS /D "CMAKE_INTDIR=\"Debu g\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inlin e /Fo"ref10.dir\Debug\\" /Fd"ref10.dir\Debug\ref10.pdb" /Gd /TC /analyze- /FC /e rrorReport:queue C:\Users\Administrator\AppData\Local\Temp\2\ed25519\lib\ed25519 \ref10\ed25519.c
ed25519.c
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519.c( 30): error C2057: expected constant expression [C:\Users\Administrator\AppData\L ocal\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519.c( 30): error C2466: cannot allocate an array of constant size 0 [C:\Users\Administ rator\AppData\Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519.c( 30): error C2133: 'context': unknown size [C:\Users\Administrator\AppData\Local\ Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519.c( 71): error C2057: expected constant expression [C:\Users\Administrator\AppData\L ocal\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519.c( 71): error C2466: cannot allocate an array of constant size 0 [C:\Users\Administ rator\AppData\Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519.c( 71): error C2133: 'context': unknown size [C:\Users\Administrator\AppData\Local\ Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
Done Building Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \lib\ed25519\ref10\ref10.vcxproj" (default targets) -- FAILED.
Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ed25519.vcxpr oj" (4) is building "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\l ib\hash\sha3_brainhub\sha3_brainhub.vcxproj" (6) on node 1 (default targets).
InitializeBuildStatus:
Touching "sha3_brainhub.dir\Debug\sha3_brainhub.tlog\unsuccessfulbuild".
CustomBuild:
All outputs are up-to-date.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\1 4.13.26128\bin\HostX86\x86\CL.exe /c /IC:\Users\Administrator\AppData\Local\Temp \2\ed25519\build /IC:\Users\Administrator\AppData\Local\Temp\2\ed25519\include / IC:\Users\Administrator\AppData\Local\Temp\2\ed25519\lib\hash\sha3_brainhub\C:\U sers\Administrator\AppData\Local\Temp\2\ed25519\build /Zi /nologo /W3 /WX- /diag nostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D ed25519_EXPORTS /D "CMAKE_ INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forSc ope /Zc:inline /Fo"sha3_brainhub.dir\Debug\\" /Fd"sha3_brainhub.dir\Debug\sha3_b rainhub.pdb" /Gd /TC /analyze- /FC /errorReport:queue C:\Users\Administrator\App Data\Local\Temp\2\ed25519\lib\hash\sha3_brainhub\sha3_256.c C:\Users\Administrat or\AppData\Local\Temp\2\ed25519\lib\hash\sha3_brainhub\sha3_512.c
sha3_256.c
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 256.c(12): warning C4244: 'function': conversion from 'unsigned __int64' to '::s ize_t', possible loss of data [C:\Users\Administrator\AppData\Local\Temp\2\ed255 19\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 256.c(23): error C2057: expected constant expression [C:\Users\Administrator\App Data\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 256.c(23): error C2466: cannot allocate an array of constant size 0 [C:\Users\Ad ministrator\AppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brain hub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 256.c(23): error C2133: 'ctx': unknown size [C:\Users\Administrator\AppData\Loca l\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
sha3_512.c
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 512.c(12): warning C4244: 'function': conversion from 'unsigned __int64' to '::s ize_t', possible loss of data [C:\Users\Administrator\AppData\Local\Temp\2\ed255 19\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 512.c(23): error C2057: expected constant expression [C:\Users\Administrator\App Data\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 512.c(23): error C2466: cannot allocate an array of constant size 0 [C:\Users\Ad ministrator\AppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brain hub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha3_ 512.c(23): error C2133: 'ctx': unknown size [C:\Users\Administrator\AppData\Loca l\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
Generating Code...
Done Building Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \lib\hash\sha3_brainhub\sha3_brainhub.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \ed25519.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \ALL_BUILD.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build \install.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\install.vcxproj" (def ault target) (1) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ALL_BUILD.vcxproj" (d efault target) (3) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ed25519.vcxproj" (def ault target) (4) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhu b\sha3_brainhub.vcxproj" (default target) (6) ->
(ClCompile target) ->
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_256.c(12): warning C4244: 'function': conversion from 'unsigned __int64' to ': :size_t', possible loss of data [C:\Users\Administrator\AppData\Local\Temp\2\ed2 5519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_512.c(12): warning C4244: 'function': conversion from 'unsigned __int64' to ': :size_t', possible loss of data [C:\Users\Administrator\AppData\Local\Temp\2\ed2 5519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\install.vcxproj" (def ault target) (1) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ALL_BUILD.vcxproj" (d efault target) (3) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ed25519.vcxproj" (def ault target) (4) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref 10.vcxproj" (default target) (5) ->
(ClCompile target) ->
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519. c(30): error C2057: expected constant expression [C:\Users\Administrator\AppData \Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519. c(30): error C2466: cannot allocate an array of constant size 0 [C:\Users\Admini strator\AppData\Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519. c(30): error C2133: 'context': unknown size [C:\Users\Administrator\AppData\Loca l\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519. c(71): error C2057: expected constant expression [C:\Users\Administrator\AppData \Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519. c(71): error C2466: cannot allocate an array of constant size 0 [C:\Users\Admini strator\AppData\Local\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\ed25519\ref10\ed25519. c(71): error C2133: 'context': unknown size [C:\Users\Administrator\AppData\Loca l\Temp\2\ed25519\build\lib\ed25519\ref10\ref10.vcxproj]
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\install.vcxproj" (def ault target) (1) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ALL_BUILD.vcxproj" (d efault target) (3) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\ed25519.vcxproj" (def ault target) (4) ->
"C:\Users\Administrator\AppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhu b\sha3_brainhub.vcxproj" (default target) (6) ->
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_256.c(23): error C2057: expected constant expression [C:\Users\Administrator\A ppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_256.c(23): error C2466: cannot allocate an array of constant size 0 [C:\Users\ Administrator\AppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_bra inhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_256.c(23): error C2133: 'ctx': unknown size [C:\Users\Administrator\AppData\Lo cal\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_512.c(23): error C2057: expected constant expression [C:\Users\Administrator\A ppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_512.c(23): error C2466: cannot allocate an array of constant size 0 [C:\Users\ Administrator\AppData\Local\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_bra inhub.vcxproj]
c:\users\administrator\appdata\local\temp\2\ed25519\lib\hash\sha3_brainhub\sha 3_512.c(23): error C2133: 'ctx': unknown size [C:\Users\Administrator\AppData\Lo cal\Temp\2\ed25519\build\lib\hash\sha3_brainhub\sha3_brainhub.vcxproj]
2 Warning(s)
12 Error(s)
Time Elapsed 00:00:01.91
For now cmake overrides the system-defined compiler, would be nice to fix that
[ 89%] Linking C shared library libed25519.so
/usr/bin/ld: lib/ed25519/amd64-64-24k-pic/CMakeFiles/amd64-64-24k-pic.dir/fe25519_mul.s.o: relocation R_X86_64_PC32 against symbol `crypto_sign_ed25519_amd64_64_38' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
I followed the instructions on the page except that I used the amd64-64-24k-pic implementation so that I'd get the PIC fixes. It looks like there's an instance that was missed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.