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
d0fd73da
Unverified
Commit
d0fd73da
authored
Sep 03, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing SGX
parent
67c016b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
BLSPrivateKeyShareSGX.cpp
BLSPrivateKeyShareSGX.cpp
+5
-2
BLSUtils.cpp
secure_enclave/BLSUtils.cpp
+1
-0
sgxd_common.h
sgxd_common.h
+7
-4
No files found.
BLSPrivateKeyShareSGX.cpp
View file @
d0fd73da
...
@@ -147,9 +147,12 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX(
...
@@ -147,9 +147,12 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX(
size_t
sz
=
0
;
size_t
sz
=
0
;
auto
encryptedKey
=
hex2carray
(
encryptedKeyHex
->
c_str
(),
&
sz
);
if
(
encryptedKey
==
nullptr
)
{
uint8_t
encryptedKey
[
BUF_LEN
];
bool
result
=
hex2carray
(
encryptedKeyHex
->
c_str
(),
&
sz
,
encryptedKey
);
if
(
!
result
)
{
BOOST_THROW_EXCEPTION
(
std
::
invalid_argument
(
"Invalid hex encrypted key"
));
BOOST_THROW_EXCEPTION
(
std
::
invalid_argument
(
"Invalid hex encrypted key"
));
}
}
...
...
secure_enclave/BLSUtils.cpp
View file @
d0fd73da
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#define GMP_WITH_SGX
#define GMP_WITH_SGX
#include <string.h>
#include <string.h>
#include <cstdint>
#include "../sgxd_common.h"
#include "../sgxd_common.h"
...
...
sgxd_common.h
View file @
d0fd73da
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#ifndef SGXD_SGXD_COMMON_H
#ifndef SGXD_SGXD_COMMON_H
#define SGXD_SGXD_COMMON_H
#define SGXD_SGXD_COMMON_H
#include <stdbool.h>
#define BUF_LEN 1024
#define BUF_LEN 1024
#define MAX_KEY_LENGTH 128
#define MAX_KEY_LENGTH 128
...
@@ -42,14 +44,14 @@ void carray2Hex(const unsigned char *d, int _len, char* _hexArray) {
...
@@ -42,14 +44,14 @@ void carray2Hex(const unsigned char *d, int _len, char* _hexArray) {
}
}
int
hex2carray
(
const
char
*
_hex
,
unsigned
long
long
*
_bin_len
,
bool
hex2carray
(
const
char
*
_hex
,
uint64_t
*
_bin_len
,
u
nsigned
char
*
_bin
)
{
u
int8_t
*
_bin
)
{
int
len
=
strnlen
(
_hex
,
BUF_LEN
);
int
len
=
strnlen
(
_hex
,
BUF_LEN
);
if
(
len
==
0
&&
len
%
2
==
1
)
if
(
len
==
0
&&
len
%
2
==
1
)
return
-
1
;
return
false
;
*
_bin_len
=
len
/
2
;
*
_bin_len
=
len
/
2
;
...
@@ -58,12 +60,13 @@ int hex2carray(const char * _hex, unsigned long long *_bin_len,
...
@@ -58,12 +60,13 @@ int hex2carray(const char * _hex, unsigned long long *_bin_len,
int
low
=
char2int
((
char
)
_hex
[
i
*
2
+
1
]);
int
low
=
char2int
((
char
)
_hex
[
i
*
2
+
1
]);
if
(
high
<
0
||
low
<
0
)
{
if
(
high
<
0
||
low
<
0
)
{
return
-
1
;
return
false
;
}
}
_bin
[
i
]
=
(
unsigned
char
)
(
high
*
16
+
low
);
_bin
[
i
]
=
(
unsigned
char
)
(
high
*
16
+
low
);
}
}
return
true
;
}
}
...
...
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