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
7c2344ba
Unverified
Commit
7c2344ba
authored
Sep 03, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SGX fixes
parent
ac569b3f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
BLSCrypto.cpp
BLSCrypto.cpp
+17
-5
BLSPrivateKeyShareSGX.cpp
BLSPrivateKeyShareSGX.cpp
+1
-1
sgxd_common.h
sgxd_common.h
+2
-2
No files found.
BLSCrypto.cpp
View file @
7c2344ba
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
//
//
#include <memory>
#include <memory>
#include "BLSCrypto.h"
#include "libff/algebra/curves/alt_bn128/alt_bn128_init.hpp"
#include "libff/algebra/curves/alt_bn128/alt_bn128_init.hpp"
...
@@ -15,6 +13,10 @@
...
@@ -15,6 +13,10 @@
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
#include "BLSPrivateKeyShareSGX.h"
#include "BLSPrivateKeyShareSGX.h"
#include "sgxd_common.h"
#include "BLSCrypto.h"
extern
"C"
void
init_daemon
()
{
extern
"C"
void
init_daemon
()
{
...
@@ -32,13 +34,23 @@ extern "C" void init_daemon() {
...
@@ -32,13 +34,23 @@ extern "C" void init_daemon() {
bool
sign
(
char
*
encryptedKeyHex
,
char
*
hashHex
,
size_t
t
,
size_t
n
,
char
*
_sig
)
{
bool
sign
(
char
*
_encryptedKeyHex
,
char
*
_hashHex
,
size_t
_t
,
size_t
_n
,
size_t
_signerIndex
,
char
*
_sig
)
{
auto
keyStr
=
std
::
make_shared
<
std
::
string
>
(
_encryptedKeyHex
);
auto
hash
=
std
::
make_shared
<
std
::
array
<
uint8_t
,
32
>>
();
uint64_t
binLen
;
hex2carray
(
_hashHex
,
&
binLen
,
hash
->
data
());
auto
keyStr
=
std
::
make_shared
<
std
::
string
>
(
encryptedKeyHex
);
auto
keyShare
=
std
::
make_shared
<
BLSPrivateKeyShareSGX
>
(
keyStr
,
_t
,
_n
);
auto
keyShare
=
std
::
make_shared
<
BLSPrivateKeyShareSGX
>
(
keyStr
,
t
,
n
);
auto
sigShare
=
keyShare
->
signWithHelperSGX
(
hash
,
_signerIndex
);
return
true
;
return
true
;
...
...
BLSPrivateKeyShareSGX.cpp
View file @
7c2344ba
sgxd_common.h
View file @
7c2344ba
...
@@ -31,7 +31,7 @@ inline int char2int(char _input) {
...
@@ -31,7 +31,7 @@ inline int char2int(char _input) {
void
carray2Hex
(
const
unsigned
char
*
d
,
int
_len
,
char
*
_hexArray
)
{
inline
void
carray2Hex
(
const
unsigned
char
*
d
,
int
_len
,
char
*
_hexArray
)
{
static
char
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
static
char
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
...
@@ -46,7 +46,7 @@ void carray2Hex(const unsigned char *d, int _len, char* _hexArray) {
...
@@ -46,7 +46,7 @@ void carray2Hex(const unsigned char *d, int _len, char* _hexArray) {
}
}
bool
hex2carray
(
const
char
*
_hex
,
uint64_t
*
_bin_len
,
inline
bool
hex2carray
(
const
char
*
_hex
,
uint64_t
*
_bin_len
,
uint8_t
*
_bin
)
{
uint8_t
*
_bin
)
{
int
len
=
strnlen
(
_hex
,
2
*
BUF_LEN
);
int
len
=
strnlen
(
_hex
,
2
*
BUF_LEN
);
...
...
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