Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wasm_test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bartek Wrona
wasm_test
Commits
6c66f81f
Commit
6c66f81f
authored
1 year ago
by
Mariusz Trela
Browse files
Options
Downloads
Patches
Plain Diff
secp256k1 library is compiled into WASM
parent
6cc8805c
No related branches found
No related tags found
1 merge request
!2
OpenSSL library is compiled into WASM
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+5
-2
5 additions, 2 deletions
CMakeLists.txt
README.md
+12
-3
12 additions, 3 deletions
README.md
src/wasm_test.cpp
+14
-1
14 additions, 1 deletion
src/wasm_test.cpp
with
31 additions
and
6 deletions
CMakeLists.txt
+
5
−
2
View file @
6c66f81f
...
...
@@ -24,6 +24,9 @@ set_target_properties( crypto PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURC
add_library
(
ssl STATIC IMPORTED
)
set_target_properties
(
ssl PROPERTIES IMPORTED_LOCATION
${
CMAKE_CURRENT_SOURCE_DIR
}
/openssl/libssl.a
)
target_include_directories
(
wasm_test PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/openssl/include"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
${
Boost_INCLUDE_DIR
}
)
target_link_libraries
(
wasm_test PRIVATE ssl crypto mfc embind idbfs.js
${
Boost_LIBRARIES
}
)
add_library
(
secp256k1 STATIC IMPORTED
)
set_target_properties
(
secp256k1 PROPERTIES IMPORTED_LOCATION
${
CMAKE_CURRENT_SOURCE_DIR
}
/secp256k1-zkp/.libs/libsecp256k1.a
)
target_include_directories
(
wasm_test PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/openssl/include"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/secp256k1-zkp/include"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
${
Boost_INCLUDE_DIR
}
)
target_link_libraries
(
wasm_test PRIVATE secp256k1 ssl crypto mfc embind idbfs.js
${
Boost_LIBRARIES
}
)
target_link_options
(
wasm_test PRIVATE
"--emrun"
)
This diff is collapsed.
Click to expand it.
README.md
+
12
−
3
View file @
6c66f81f
...
...
@@ -12,11 +12,20 @@
10.
git submodule update --init --recursive
11.
emconfigure ./Configure linux-generic64
12.
sed -i 's|^CROSS_COMPILE.
*
$|CROSS_COMPILE=|g' Makefile
13.
emmake make
-j 12
build_generated libssl.a libcrypto.a
13.
emmake make build_generated libssl.a libcrypto.a
14.
./build.sh && ./run.sh
14.
git clone https://github.com/ElementsProject/secp256k1-zkp.git
15.
./autogen.sh
#if above script fails, then try to install:
sudo apt-get install autoconf
and/or
sudo apt-get install libtool
16.
emconfigure ./configure
17.
emmake make
15.
Start a browser and open url: http://
<ip>
:6931/test/wasm_test.html
18.
./build.sh && ./run.sh
19.
Start a browser and open url: http://
<ip>
:6931/test/wasm_test.html
This diff is collapsed.
Click to expand it.
src/wasm_test.cpp
+
14
−
1
View file @
6c66f81f
...
...
@@ -8,6 +8,8 @@
#include
<openssl/sha.h>
#include
<secp256k1.h>
#include
<emscripten/bind.h>
using
namespace
emscripten
;
...
...
@@ -23,7 +25,17 @@ public:
++
x
;
}
std
::
string
test_sec256k1
()
{
secp256k1_context
*
_ctx
=
secp256k1_context_create
(
SECP256K1_CONTEXT_VERIFY
|
SECP256K1_CONTEXT_SIGN
);
std
::
string
_result
=
_ctx
?
"OK"
:
"FAIL"
;
free
(
_ctx
);
return
_result
;
}
void
dump
(
std
::
string
path
)
{
auto
_context_status
=
test_sec256k1
();
SHA_CTX
ctx
;
ctx
.
num
=
12
;
...
...
@@ -52,7 +64,8 @@ public:
sd
.
doWork
(
path
,
std
::
string
(
"specified path: "
)
+
path
+
path_description
+
std
::
string
(
";X has value: "
)
+
std
::
to_string
(
x
)
+
" use SHA_CTX structure: "
+
std
::
to_string
(
ctx
.
num
)
+
" generate SHA512: "
+
__sha512
);
+
" generate SHA512: "
+
__sha512
+
" sec256k1 context status: "
+
_context_status
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment