Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
f3fe85cf
Unverified
Commit
f3fe85cf
authored
Aug 27, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added gmp
parent
627c3255
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
BLSUtils.cpp
secure_enclave/BLSUtils.cpp
+13
-14
No files found.
secure_enclave/BLSUtils.cpp
View file @
f3fe85cf
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#define GMP_WITH_SGX
#define GMP_WITH_SGX
#include "libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp"
#include "libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp"
#include "libff/algebra/curves/alt_bn128/alt_bn128_init.hpp"
#include "BLSUtils.h"
#include "BLSUtils.h"
...
@@ -35,6 +36,8 @@ libff::alt_bn128_Fr* keyFromString(std::string& _keyString) {
...
@@ -35,6 +36,8 @@ libff::alt_bn128_Fr* keyFromString(std::string& _keyString) {
void
import_key
(
const
char
*
_keyString
,
char
*
encryptedKey
,
uint64_t
bufLen
)
{
void
import_key
(
const
char
*
_keyString
,
char
*
encryptedKey
,
uint64_t
bufLen
)
{
libff
::
init_alt_bn128_params
();
if
(
encryptedKey
==
nullptr
&&
bufLen
<
100
)
if
(
encryptedKey
==
nullptr
&&
bufLen
<
100
)
throw
std
::
exception
();
throw
std
::
exception
();
...
@@ -43,26 +46,22 @@ void import_key(const char* _keyString, char* encryptedKey, uint64_t bufLen) {
...
@@ -43,26 +46,22 @@ void import_key(const char* _keyString, char* encryptedKey, uint64_t bufLen) {
std
::
string
ks
(
_keyString
);
std
::
string
ks
(
_keyString
);
//std::string keyString = "4160780231445160889237664391382223604184857153814275770598791864649971919844";
// std::string keyString = "4160780231445160889237664391382223604184857153814275770598791864649971919844";
auto
key1
=
keyFromString
(
ks
);
auto
s1
=
stringFromKey
(
key1
);
auto
key
=
keyFromString
(
ks
);
auto
key2
=
keyFromString
(
*
s1
);
auto
s1
=
stringFromKey
(
key
);
auto
s2
=
stringFromKey
(
key2
);
if
(
s1
->
compare
(
ks
)
!=
0
)
throw
std
::
exception
();
if
(
s1
->
compare
(
*
s2
)
!=
0
)
throw
std
::
exception
();
if
(
s1
->
size
()
<
10
)
throw
std
::
exception
();
if
(
s2
->
size
()
==
0
)
throw
std
::
exception
();
if
(
s2
->
size
()
>=
100
)
if
(
s1
->
size
()
>=
100
)
throw
std
::
exception
();
throw
std
::
exception
();
strncpy
(
encryptedKey
,
s2
->
c_str
(),
100
);
strncpy
(
encryptedKey
,
s1
->
c_str
(),
100
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment