Skip to content

Commit

Permalink
Integrate ed25519 library; update Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Lebedev <[email protected]>
  • Loading branch information
lebdron authored and kamilsa committed Dec 27, 2017
1 parent 8b706d8 commit 9fa611b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
41 changes: 41 additions & 0 deletions cmake/Modules/Finded25519.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
add_library(ed25519 UNKNOWN IMPORTED)

find_path(ed25519_INCLUDE_DIR ed25519/ed25519.h)
mark_as_advanced(ed25519_INCLUDE_DIR)

find_library(ed25519_LIBRARY ed25519)
mark_as_advanced(ed25519_LIBRARY)

find_package_handle_standard_args(ed25519 DEFAULT_MSG
ed25519_INCLUDE_DIR
ed25519_LIBRARY
)

set(URL https://github.com/warchant/ed25519.git)
set(VERSION 0d31b082e0f0d4144fe598fb0f2a120e36de2a8f)
set_target_description(ed25519 "Digital signature algorithm" ${URL} ${VERSION})

if (NOT ed25519_FOUND)
externalproject_add(warchant_ed25519
GIT_REPOSITORY ${URL}
GIT_TAG ${VERSION}
CMAKE_ARGS
-DTESTING=OFF
INSTALL_COMMAND "" # remove install step
TEST_COMMAND "" # remove test step
UPDATE_COMMAND "" # remove update step
)
externalproject_get_property(warchant_ed25519 binary_dir)
externalproject_get_property(warchant_ed25519 source_dir)
set(ed25519_INCLUDE_DIR ${source_dir}/include)
set(ed25519_LIBRARY ${binary_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}ed25519${CMAKE_SHARED_LIBRARY_SUFFIX})
message(STATUS ${ed25519_LIBRARY})
file(MAKE_DIRECTORY ${ed25519_INCLUDE_DIR})

add_dependencies(ed25519 warchant_ed25519)
endif ()

set_target_properties(ed25519 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ed25519_INCLUDE_DIR}
IMPORTED_LOCATION ${ed25519_LIBRARY}
)
5 changes: 4 additions & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,7 @@ if(BENCHMARKING)
find_package(benchmark)
endif()


###################################
# ed25519/sha3 #
###################################
find_package(ed25519)
8 changes: 8 additions & 0 deletions docker/develop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,13 @@ RUN git clone git://sourceware.org/git/valgrind.git /tmp/valgrind; \
make -C /tmp/valgrind install; \
rm -rf /tmp/valgrind

# install ed25519
RUN git clone git://github.com/warchant/ed25519.git /tmp/ed25519; \
(cd /tmp/ed25519 ; git checkout 0d31b082e0f0d4144fe598fb0f2a120e36de2a8f); \
cmake -DCMAKE_BUILD_TYPE=Debug -DTESTING=OFF -H/tmp/ed25519 -B/tmp/ed25519/build; \
cmake --build /tmp/ed25519/build --target install -- -j${PARALLELISM}; \
ldconfig; \
rm -rf /tmp/ed25519

WORKDIR /opt/iroha
CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion libs/common/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ namespace iroha {

using sig_t = blob_t<64>; // ed25519 sig is 64 bytes length
using pubkey_t = blob_t<32>;
using privkey_t = blob_t<64>;
using privkey_t = blob_t<32>;

struct keypair_t {
keypair_t() = default;
Expand Down

0 comments on commit 9fa611b

Please sign in to comment.