-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing memory allocation issues ignore workspace Update README.md
- Loading branch information
Showing
21 changed files
with
340 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
mkdir -p ./build | ||
cd ./build | ||
emconfigure cmake -DBUILD_WEBASSEMBLY=ON -DBUILD_PYTHON=OFF .. | ||
emmake make | ||
emcc --bind libjsqrl.so -O3 -o libjsqrl.js | ||
cp ../src/tests_js/test.js . | ||
node test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Add your requirements here like: | ||
scikit-build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#include <emscripten.h> | ||
#include <emscripten/bind.h> | ||
#include <iostream> | ||
#include <xmssFast.h> | ||
#include <misc.h> | ||
#include <xmss.h> | ||
|
||
namespace { | ||
|
||
class XmssWrapper | ||
{ | ||
public: | ||
XmssWrapper(const std::vector<unsigned char> &seed, unsigned char height) : _xmss(seed, height) {} | ||
|
||
TSIGNATURE sign(const TMESSAGE &message) { return _xmss.sign(message); } | ||
|
||
TKEY getSK() { return _xmss.getSK(); } | ||
TKEY getPK() { return _xmss.getPK(); } | ||
TSEED getSeed() { return _xmss.getSeed(); } | ||
int getHeight() { return _xmss.getHeight(); } | ||
|
||
TKEY getRoot() { return _xmss.getRoot(); } | ||
TKEY getPKSeed() { return _xmss.getPKSeed(); } | ||
TKEY getSKSeed() { return _xmss.getSKSeed(); } | ||
TKEY getSKPRF() { return _xmss.getSKPRF(); } | ||
|
||
unsigned int getIndex() { return _xmss.getIndex(); } | ||
unsigned int setIndex(unsigned int new_index) { return _xmss.setIndex(new_index); } | ||
|
||
static bool verify(const TMESSAGE &message, | ||
const TSIGNATURE &signature, | ||
const TKEY &pk, | ||
unsigned char height) | ||
{ | ||
return XmssFast::verify(message, signature, pk, height); | ||
} | ||
|
||
private: | ||
XmssFast _xmss; | ||
}; | ||
|
||
std::string EMSCRIPTEN_KEEPALIVE _bin2hstr(std::vector<unsigned char> input) { | ||
return bin2hstr(input, 0); | ||
} | ||
|
||
std::vector<unsigned char> EMSCRIPTEN_KEEPALIVE _hstr2bin(std::string input) { | ||
return hstr2bin(input); | ||
} | ||
|
||
std::vector<unsigned char> EMSCRIPTEN_KEEPALIVE _str2bin(std::string str) { | ||
return str2bin(str); | ||
} | ||
|
||
using namespace emscripten; | ||
|
||
EMSCRIPTEN_BINDINGS(my_module) { | ||
register_vector<unsigned char>("VectorUChar"); | ||
function("bin2hstr", &_bin2hstr); | ||
function("hstr2bin", &_hstr2bin); | ||
function("str2bin", &_str2bin); | ||
|
||
class_<XmssWrapper>("Xmss") | ||
.constructor<TSEED, unsigned char>() | ||
.function("getPK", &XmssWrapper::getPK) | ||
.function("getSK", &XmssWrapper::getSK) | ||
.function("getSeed", &XmssWrapper::getSeed) | ||
.function("getHeight", &XmssWrapper::getHeight) | ||
|
||
.function("getRoot", &XmssWrapper::getRoot) | ||
.function("getPKSeed", &XmssWrapper::getPKSeed) | ||
.function("getSKSeed", &XmssWrapper::getSKSeed) | ||
.function("getSKPRF", &XmssWrapper::getSKPRF) | ||
|
||
.function("getIndex", &XmssWrapper::getIndex) | ||
.function("sign", &XmssWrapper::sign) | ||
.class_function("verify", &XmssWrapper::verify) | ||
; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.