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
627c3255
Unverified
Commit
627c3255
authored
Aug 27, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added gmp
parent
d9bbc4b2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
BLSUtils.cpp
secure_enclave/BLSUtils.cpp
+12
-1
BLSUtils.h
secure_enclave/BLSUtils.h
+1
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+1
-6
sgxd.c
sgxd.c
+2
-0
No files found.
secure_enclave/BLSUtils.cpp
View file @
627c3255
...
...
@@ -33,8 +33,10 @@ libff::alt_bn128_Fr* keyFromString(std::string& _keyString) {
void
import_key
(
const
char
*
_keyString
)
{
void
import_key
(
const
char
*
_keyString
,
char
*
encryptedKey
,
uint64_t
bufLen
)
{
if
(
encryptedKey
==
nullptr
&&
bufLen
<
100
)
throw
std
::
exception
();
if
(
_keyString
==
nullptr
)
throw
std
::
exception
();
...
...
@@ -54,4 +56,13 @@ void import_key(const char* _keyString) {
if
(
s1
->
compare
(
*
s2
)
!=
0
)
throw
std
::
exception
();
if
(
s2
->
size
()
==
0
)
throw
std
::
exception
();
if
(
s2
->
size
()
>=
100
)
throw
std
::
exception
();
strncpy
(
encryptedKey
,
s2
->
c_str
(),
100
);
}
secure_enclave/BLSUtils.h
View file @
627c3255
...
...
@@ -13,7 +13,7 @@
#define EXTERNC
#endif
EXTERNC
void
import_key
(
const
char
*
_keyString
);
EXTERNC
void
import_key
(
const
char
*
_keyString
,
char
*
encryptedKey
,
uint64_t
bufLen
);
#endif //SGXD_BLSUTILS_H
secure_enclave/secure_enclave.c
View file @
627c3255
...
...
@@ -109,12 +109,7 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un) {
}
/* Use the Chudnovsky equation to rapidly estimate pi */
#define DIGITS_PER_ITERATION 14.1816
/* Roughly */
mpz_t
c3
,
c4
,
c5
;
int
pi_init
=
0
;
void
encrypt_key
(
int
*
err_status
,
char
*
key
,
char
*
encrypted_key
)
{
...
...
@@ -123,7 +118,7 @@ void encrypt_key(int *err_status, char* key, char* encrypted_key) {
if
(
strnlen
(
key
)
==
100
)
return
;
import_key
(
key
);
import_key
(
key
,
encrypted_key
,
100
);
*
err_status
=
0
;
}
...
...
sgxd.c
View file @
627c3255
...
...
@@ -136,6 +136,8 @@ int main (int argc, char *argv[])
gmp_printf
(
"Encrypt key completed with status: %d
\n
"
,
err_status
);
gmp_printf
(
"Result: %s
\n
"
,
encryptedKey
);
return
0
;
}
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